Mercurial > mozilla > hg > MozillaTry
comparison mozillatry.py @ 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 |
comparison
equal
deleted
inserted
replaced
24:484858dfbc03 | 25:295112b3e143 |
---|---|
3 """ | 3 """ |
4 push patches to try | 4 push patches to try |
5 """ | 5 """ |
6 | 6 |
7 import configuration | 7 import configuration |
8 import datetime | |
8 import optparse | 9 import optparse |
9 import os | 10 import os |
10 import shutil | 11 import shutil |
11 import sys | 12 import sys |
12 | 13 |
41 # ensure the repo is in a good state | 42 # ensure the repo is in a good state |
42 if update: | 43 if update: |
43 update_repo(repo) | 44 update_repo(repo) |
44 | 45 |
45 try: | 46 try: |
47 | |
48 # if no patches given and not updating, commit what you have | |
49 if not patches and not update: | |
50 hg_dir = os.path.join(repo, '.hg') | |
51 assert os.path.exists(hg_dir) and os.path.isdir(hg_dir) | |
52 patches = os.path.join(hg_dir, 'patches') | |
53 if os.path.exists(patches): | |
54 shutil.rmtree(patches) | |
55 call(['hg', 'qinit'], cwd=repo) | |
56 # TODO: ensure there's something to commit | |
57 call(['hg', 'qnew', datetime.datetime.now().isoformat()], cwd=repo) | |
58 | |
46 # apply patches | 59 # apply patches |
47 for patch in patches: | 60 for patch in patches: |
48 call(['hg', 'qimport', patch], cwd=repo) | 61 call(['hg', 'qimport', patch], cwd=repo) |
49 call(['hg', 'qpush', '--all'], cwd=repo) | 62 call(['hg', 'qpush', '--all'], cwd=repo) |
50 call(['hg', 'qseries', '-v'], cwd=repo) | 63 call(['hg', 'qseries', '-v'], cwd=repo) |