# HG changeset patch # User Jeff Hammel # Date 1354922924 28800 # Node ID 295112b3e143db49300c029f88d1365e36f367d8 # Parent 484858dfbc039b9e020768ea6e55412279d82bd9 taming that beast that is hg diff -r 484858dfbc03 -r 295112b3e143 mozillatry.py --- a/mozillatry.py Fri Dec 07 14:53:54 2012 -0800 +++ b/mozillatry.py Fri Dec 07 15:28:44 2012 -0800 @@ -5,6 +5,7 @@ """ import configuration +import datetime import optparse import os import shutil @@ -43,6 +44,18 @@ update_repo(repo) try: + + # if no patches given and not updating, commit what you have + if not patches and not update: + hg_dir = os.path.join(repo, '.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', 'qinit'], cwd=repo) + # TODO: ensure there's something to commit + call(['hg', 'qnew', datetime.datetime.now().isoformat()], cwd=repo) + # apply patches for patch in patches: call(['hg', 'qimport', patch], cwd=repo)