comparison svnexternals.py @ 250:79349fd04836

utils: standardizing imported name to hgutil, our_util to util
author Daniel Tang <dytang@cs.purdue.edu>
date Fri, 10 Apr 2009 13:43:44 -0400
parents 2412800b1258
children 552deb1351ce
comparison
equal deleted inserted replaced
249:a065bf61caa1 250:79349fd04836
1 import cStringIO 1 import cStringIO
2 2
3 from mercurial import util as merc_util 3 from mercurial import util as hgutil
4 4
5 class externalsfile(dict): 5 class externalsfile(dict):
6 """Map svn directories to lists of externals entries. 6 """Map svn directories to lists of externals entries.
7 """ 7 """
8 def __init__(self): 8 def __init__(self):
22 else: 22 else:
23 super(externalsfile, self).__setitem__(key, value) 23 super(externalsfile, self).__setitem__(key, value)
24 24
25 def write(self): 25 def write(self):
26 fp = cStringIO.StringIO() 26 fp = cStringIO.StringIO()
27 for target in merc_util.sort(self): 27 for target in hgutil.sort(self):
28 lines = self[target] 28 lines = self[target]
29 if not lines: 29 if not lines:
30 continue 30 continue
31 if not target: 31 if not target:
32 target = '.' 32 target = '.'
45 if not line.strip(): 45 if not line.strip():
46 continue 46 continue
47 if line.startswith('['): 47 if line.startswith('['):
48 line = line.strip() 48 line = line.strip()
49 if line[-1] != ']': 49 if line[-1] != ']':
50 raise merc_util.Abort('invalid externals section name: %s' % line) 50 raise hgutil.Abort('invalid externals section name: %s' % line)
51 target = line[1:-1] 51 target = line[1:-1]
52 if target == '.': 52 if target == '.':
53 target = '' 53 target = ''
54 elif line.startswith(' '): 54 elif line.startswith(' '):
55 line = line.rstrip('\n') 55 line = line.rstrip('\n')