Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/management/bin/updateExternalFiles.py

Issue 10942098: Make sure subprocess calls don`t ignore result codes indicating errors. Fix JS docs generation whil… (Closed)
Patch Set: Addressed issues Created July 5, 2013, 11:22 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld