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

Unified Diff: sitescripts/extensions/bin/updateRecommendations.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/extensions/bin/updateRecommendations.py
===================================================================
--- a/sitescripts/extensions/bin/updateRecommendations.py
+++ b/sitescripts/extensions/bin/updateRecommendations.py
@@ -23,18 +23,17 @@ from shutil import rmtree
def updateRecommendations():
repository = get_config().get('extensions', 'abp_repository')
tempdir = mkdtemp(prefix='adblockplus')
try:
subprocess.check_call(['hg', 'clone', '-q', '-U', repository, tempdir])
subprocess.check_call(['hg', 'up', '-q', '-R', tempdir, '-r', 'default'])
writeSubscriptions('recommendations', os.path.join(tempdir, 'chrome', 'content', 'ui', 'subscriptions.xml'))
- subprocess.check_call(['hg', 'commit', '-q', '-R', tempdir, '-u', 'hgbot', '-m', 'Updated list of recommended subscriptions'])
-
- # 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]) != '':
+ subprocess.check_call(['hg', 'commit', '-q', '-R', tempdir, '-u', 'hgbot', '-m', 'Updated list of recommended subscriptions'])
+ subprocess.check_call(['hg', 'push', '-q', '-R', tempdir])
finally:
rmtree(tempdir)
if __name__ == '__main__':
setupStderr()
updateRecommendations()

Powered by Google App Engine
This is Rietveld