comparison mozillatry.py @ 31:864172062af7

become religious
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 10 Dec 2012 12:56:12 -0800
parents 1a6125362640
children daf7c333e01c
comparison
equal deleted inserted replaced
30:1a6125362640 31:864172062af7
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 call(['hg', 'revert', '--no-backup', '--all'], cwd=directory) 22
23 try: 23 try:
24 # XXX stupid; see 24 call(['hg', 'revert', '--no-backup', '--all'], cwd=directory)
25 # https://wiki.mozilla.org/Build:TryServer#hg_phases 25 try:
26 call(['hg', 'phase', '-f', '--draft', 'qbase:tip'], cwd=directory) 26 # XXX stupid; see
27 except subprocess.CalledProcessError: 27 # https://wiki.mozilla.org/Build:TryServer#hg_phases
28 pass 28 call(['hg', 'phase', '-f', '--draft', 'qbase:tip'], cwd=directory)
29 call(['hg', 'qpop', '--all'], cwd=directory) 29 except subprocess.CalledProcessError:
30 patches = os.path.join(hg_dir, 'patches') 30 pass
31 if os.path.exists(patches): 31 call(['hg', 'qpop', '--all'], cwd=directory)
32 # remove patches 32 patches = os.path.join(hg_dir, 'patches')
33 shutil.rmtree(patches) 33 if os.path.exists(patches):
34 # remove patches
35 shutil.rmtree(patches)
36 except:
37 sys.stderr.write("Directory: %s\n" % directory)
38 raise
34 39
35 def update_repo(directory): 40 def update_repo(directory):
36 """update an hg repository""" 41 """update an hg repository"""
37 assert os.path.exists(directory) and os.path.isdir(directory) 42 assert os.path.exists(directory) and os.path.isdir(directory)
38 reset(directory) 43 reset(directory)