| |
@@ -123,7 +123,6 @@
|
| |
repo_dir = os.path.dirname(os.path.abspath(__file__)) + "/l10n/" + repo_name
|
| |
|
| |
if os.path.exists(repo_dir):
|
| |
- subprocess.run(['git', 'reset', "--hard", "origin"], check=True, cwd=repo_dir)
|
| |
subprocess.run(['git', 'pull', "--quiet"], check=True, cwd=repo_dir)
|
| |
else:
|
| |
subprocess.run(["git", "clone", url, repo_dir, "--config",
|
| |
@@ -139,7 +138,6 @@
|
| |
url = "https://pagure.io/fedora-docs/translated-sources.git"
|
| |
|
| |
if os.path.exists(repo_dir):
|
| |
- subprocess.run(['git', 'reset', "--hard", "origin"], check=True, cwd=repo_dir)
|
| |
subprocess.run(['git', 'pull', "--quiet"], check=True, cwd=repo_dir)
|
| |
else:
|
| |
subprocess.run(["git", "clone", url, repo_dir, "--config",
|
| |
@@ -160,10 +158,11 @@
|
| |
out = subprocess.run(['git', 'status', lang, '--porcelain'], check=True, cwd=repo_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
| |
|
| |
if out.stdout.decode("utf-8") :
|
| |
- subprocess.run(["git", "commit", "-m", "["+lang+"]automatic update of translated content", "--quiet"],
|
| |
- check=True, cwd=repo_dir)
|
| |
-
|
| |
- subprocess.run(['git', 'push', "--quiet"], check=True, cwd=repo_dir)
|
| |
+ r_commit = subprocess.run(["git", "commit",
|
| |
+ "-m", "["+lang+"]automatic update of translated content", "--quiet"],
|
| |
+ cwd=repo_dir)
|
| |
+ if r_commit.returncode == 0:
|
| |
+ subprocess.run(['git', 'push', "--quiet"], check=True, cwd=repo_dir)
|
| |
else:
|
| |
print(" ["+lang+"] No changes to commit", flush=True)
|
| |
|
| |
@@ -189,7 +188,7 @@
|
| |
try:
|
| |
# add hooks
|
| |
dir_path = os.path.dirname(os.path.abspath(__file__))
|
| |
- shutil.copytree(os.path.join(dir_path, '.githooks'), os.path.join(repo_dir, '.githooks'))
|
| |
+ shutil.copytree(os.path.join(dir_path, '.githooks'), os.path.join(repo_dir, '.githooks'), dirs_exist_ok=True)
|
| |
|
| |
shutil.copy(os.path.join(dir_path, 'check.sh'), os.path.join(repo_dir, 'check.sh'))
|
| |
subprocess.run(['./check.sh'], check=True, cwd=repo_dir)
|
| |
@@ -200,14 +199,16 @@
|
| |
out = subprocess.run(['git', 'status', '--porcelain'], check=True, cwd=repo_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
| |
|
| |
if out.stdout.decode("utf-8") :
|
| |
- subprocess.run(["git", "commit", "-m", "automatic update of pot/po files", "--quiet"],
|
| |
- check=True, cwd=repo_dir)
|
| |
+ r_commit = subprocess.run(["git", "commit",
|
| |
+ "-m", "automatic update of pot/po files", "--quiet"],
|
| |
+ cwd=repo_dir)
|
| |
|
| |
- subprocess.run(['git', 'push', "--quiet"], check=True, cwd=repo_dir)
|
| |
+ if r_commit.returncode == 0:
|
| |
+ subprocess.run(['git', 'push', "--quiet"], check=True, cwd=repo_dir)
|
| |
else:
|
| |
print(" No changes to commit", flush=True)
|
| |
except subprocess.CalledProcessError as e:
|
| |
- print("** ERROR " + (e.output if e.output else str(e.returncode)))
|
| |
+ print("** ERROR" + e.output)
|
| |
|
| |
def clone_sources():
|
| |
"""List sources repositories from antora yaml file"""
|
| |
This PR is related to fedora-infrastructure#9126
The pre-commit hook doesn't remove pot file from repo, but only unstage it.
I've also added a check to prevent empty commit if all files are unstaged.
And revert the latest commit related to EL7 adaptation since we are moving to fedora.