Mercurial > mozilla > hg > MozillaTry
changeset 24:484858dfbc03
add some options so this is more consumable
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 07 Dec 2012 14:53:54 -0800 |
parents | 4016b1d28c79 |
children | 295112b3e143 |
files | mozillatry.py |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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