comparison util.py @ 0:f2636cfed115

Initial import of hgsubversion into a public repository.
author Augie Fackler <durin42@gmail.com>
date Tue, 30 Sep 2008 11:42:52 -0500
parents
children 1267b1944cd7
comparison
equal deleted inserted replaced
-1:000000000000 0:f2636cfed115
1 import os
2 import shutil
3
4 svn_subcommands = { }
5
6 def register_subcommand(name):
7 def inner(fn):
8 svn_subcommands[name] = fn
9 return fn
10 return inner
11
12
13 def wipe_all_files(hg_wc_path):
14 files = [f for f in os.listdir(hg_wc_path) if f != '.hg']
15 for f in files:
16 f = os.path.join(hg_wc_path, f)
17 if os.path.isdir(f):
18 shutil.rmtree(f)
19 else:
20 os.remove(f)
21
22
23 def remove_all_files_with_status(path, rev_paths, strip_path, status):
24 for p in rev_paths:
25 if rev_paths[p].action == status:
26 if p.startswith(strip_path):
27 fi = p[len(strip_path)+1:]
28 if len(fi) > 0:
29 fi = os.path.join(path, fi)
30 if os.path.isfile(fi):
31 os.remove(fi)
32 print 'D %s' % fi
33 elif os.path.isdir(fi):
34 shutil.rmtree(fi)
35 print 'D %s' % fi