# HG changeset patch # User Jeff Hammel # Date 1354920834 28800 # Node ID 484858dfbc039b9e020768ea6e55412279d82bd9 # Parent 4016b1d28c79e108f55924e191e58b5b2ba30037 add some options so this is more consumable diff -r 4016b1d28c79 -r 484858dfbc03 mozillatry.py --- a/mozillatry.py Fri Dec 07 11:41:27 2012 -0800 +++ b/mozillatry.py Fri Dec 07 14:53:54 2012 -0800 @@ -7,6 +7,7 @@ import configuration import optparse import os +import shutil import sys from subprocess import check_call as call @@ -16,6 +17,9 @@ assert os.path.exists(directory) and os.path.isdir(directory) hg_dir = os.path.join(directory, '.hg') assert os.path.exists(hg_dir) and os.path.isdir(hg_dir) + patches = os.path.join(hg_dir, 'patches') + if os.path.exists(patches): + shutil.rmtree(patches) call(['hg', 'revert', '--no-backup', '--all'], cwd=directory) call(['hg', 'qpop', '--all'], cwd=directory) try: @@ -23,19 +27,20 @@ except: pass -def update(directory): - """update a mozilla-central checkout""" +def update_repo(directory): + """update an hg repository""" assert os.path.exists(directory) and os.path.isdir(directory) reset(directory) call(['hg', 'pull'], cwd=directory) call(['hg', 'update'], cwd=directory) call(['hg', 'qinit'], cwd=directory) -def push_to_try(patches, repo, commit, _try='ssh://hg.mozilla.org/try/'): +def push_to_try(patches, repo, commit, _try='ssh://hg.mozilla.org/try/', update=True): """push a series of patches to try repository""" # ensure the repo is in a good state - update(repo) + if update: + update_repo(repo) try: # apply patches