comparison hg_delta_editor.py @ 207:b20a6c149021

fetch: Fix a bogus case where no files in the root level of trunk caused breakage in the branch detection.
author Augie Fackler <durin42@gmail.com>
date Mon, 09 Mar 2009 12:01:40 -0500
parents 907c160c6289
children 05243ec295e1
comparison
equal deleted inserted replaced
206:c2e51d6a2d7b 207:b20a6c149021
218 path = filepaths.pop(0) 218 path = filepaths.pop(0)
219 parentdir = '/'.join(path[:-1]) 219 parentdir = '/'.join(path[:-1])
220 filepaths = [p for p in filepaths if not '/'.join(p).startswith(parentdir)] 220 filepaths = [p for p in filepaths if not '/'.join(p).startswith(parentdir)]
221 branchpath = self._normalize_path(parentdir) 221 branchpath = self._normalize_path(parentdir)
222 branchname = self._localname(branchpath) 222 branchname = self._localname(branchpath)
223 if branchpath.startswith('trunk/'):
224 branches[self._localname('trunk')] = 'trunk'
225 continue
223 branches[branchname] = branchpath 226 branches[branchname] = branchpath
224 227
225 return branches 228 return branches
226 229
227 def _path_and_branch_for_path(self, path, existing=True): 230 def _path_and_branch_for_path(self, path, existing=True):
266 test += '/%s' % path_comps.pop(0) 269 test += '/%s' % path_comps.pop(0)
267 if self._localname(test) in self.branches: 270 if self._localname(test) in self.branches:
268 return path[len(test)+1:], self._localname(test), test 271 return path[len(test)+1:], self._localname(test), test
269 if existing: 272 if existing:
270 return None, None, None 273 return None, None, None
271 path = test.split('/')[-1] 274 if path.startswith('trunk/'):
272 test = '/'.join(test.split('/')[:-1]) 275 path = test.split('/')[1:]
276 test = 'trunk'
277 else:
278 path = test.split('/')[-1]
279 test = '/'.join(test.split('/')[:-1])
273 return path, self._localname(test), test 280 return path, self._localname(test), test
274 281
275 def set_current_rev(self, rev): 282 def set_current_rev(self, rev):
276 """Set the revision we're currently converting. 283 """Set the revision we're currently converting.
277 """ 284 """