Commit 779bcc87 authored by Michal Čihař's avatar Michal Čihař

Save only if there are some changes and push on commit

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent e1036ef8
......@@ -25,17 +25,21 @@ def build_index(storage):
def update_file(template, index, filename):
storage = RESXFile.parsefile(filename)
sindex = build_index(storage)
changed = False
# Add missing units
for unit in template.units:
if unit.getid() not in sindex:
storage.addunit(unit, True)
changed = True
# Remove extra units
for unit in storage.units:
if unit.getid() not in index:
storage.body.remove(unit.xmlelement)
changed = True
if changed:
storage.save()
......@@ -71,6 +75,8 @@ def main():
ret = subprocess.call(
['git', 'commit', '-a', '-m', 'Updated translation files']
)
if ret == 0:
ret = subprocess.call(['git', 'push'])
sys.exit(ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment