Mercurial > mozilla > hg > MozillaTry
comparison mozillatry.py @ 30:1a6125362640
make this slightly less stupid
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 10 Dec 2012 12:53:32 -0800 |
parents | ade4262c1c6d |
children | 864172062af7 |
comparison
equal
deleted
inserted
replaced
29:ade4262c1c6d | 30:1a6125362640 |
---|---|
17 def reset(directory): | 17 def reset(directory): |
18 """reset an hg directory to a good state""" | 18 """reset an hg directory to a good state""" |
19 assert os.path.exists(directory) and os.path.isdir(directory) | 19 assert os.path.exists(directory) and os.path.isdir(directory) |
20 hg_dir = os.path.join(directory, '.hg') | 20 hg_dir = os.path.join(directory, '.hg') |
21 assert os.path.exists(hg_dir) and os.path.isdir(hg_dir) | 21 assert os.path.exists(hg_dir) and os.path.isdir(hg_dir) |
22 patches = os.path.join(hg_dir, 'patches') | |
23 if os.path.exists(patches): | |
24 shutil.rmtree(patches) | |
25 call(['hg', 'revert', '--no-backup', '--all'], cwd=directory) | 22 call(['hg', 'revert', '--no-backup', '--all'], cwd=directory) |
26 try: | 23 try: |
27 # XXX stupid; see | 24 # XXX stupid; see |
28 # https://wiki.mozilla.org/Build:TryServer#hg_phases | 25 # https://wiki.mozilla.org/Build:TryServer#hg_phases |
29 call(['hg', 'phase', '-f', '--draft', 'qbase:tip'], cwd=directory) | 26 call(['hg', 'phase', '-f', '--draft', 'qbase:tip'], cwd=directory) |
30 except subprocess.CalledProcessError: | 27 except subprocess.CalledProcessError: |
31 pass | 28 pass |
32 call(['hg', 'qpop', '--all'], cwd=directory) | 29 call(['hg', 'qpop', '--all'], cwd=directory) |
33 try: | 30 patches = os.path.join(hg_dir, 'patches') |
34 shutil.rmtree(os.path.join(hg_dir, 'patches')) # remove patches | 31 if os.path.exists(patches): |
35 except: | 32 # remove patches |
36 pass | 33 shutil.rmtree(patches) |
37 | 34 |
38 def update_repo(directory): | 35 def update_repo(directory): |
39 """update an hg repository""" | 36 """update an hg repository""" |
40 assert os.path.exists(directory) and os.path.isdir(directory) | 37 assert os.path.exists(directory) and os.path.isdir(directory) |
41 reset(directory) | 38 reset(directory) |