changeset 25:295112b3e143

taming that beast that is hg
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 07 Dec 2012 15:28:44 -0800
parents 484858dfbc03
children fa1215cee8c4
files mozillatry.py
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)