Index: sitescripts/management/bin/updateExternalFiles.py |
=================================================================== |
--- a/sitescripts/management/bin/updateExternalFiles.py |
+++ b/sitescripts/management/bin/updateExternalFiles.py |
@@ -38,23 +38,22 @@ def updateExternalFiles(): |
path = os.path.join(path, filename) |
exists = os.path.exists(path) |
file = codecs.open(path, 'wb', encoding='utf-8') |
data = urllib.urlopen(setting['source']).read().decode('utf-8') |
file.write(data) |
file.close() |
- message = 'Updated copy of external file %s' |
- if not exists: |
- message = 'Added copy of external file %s' |
- subprocess.check_call(['hg', 'commit', '-q', '-A', '-R', tempdir, '-u', 'hgbot', '-m', message % filename]) |
- |
- # Don't check the result of this call, it will be 1 if nothing needs pushing |
- subprocess.call(['hg', 'push', '-q', '-R', tempdir]) |
+ if subprocess.check_output(['hg', 'stat', '-R', tempdir]) != '': |
+ message = 'Updated copy of external file %s' |
+ if not exists: |
+ message = 'Added copy of external file %s' |
+ subprocess.check_call(['hg', 'commit', '-q', '-A', '-R', tempdir, '-u', 'hgbot', '-m', message % filename]) |
+ subprocess.call(['hg', 'push', '-q', '-R', tempdir]) |
finally: |
rmtree(tempdir) |
def readSettings(): |
result = {} |
for option, value in get_config().items('externalFiles'): |
if option.find('_') < 0: |
continue |