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() |