comparison hg_delta_editor.py @ 218:a360ddc97719

branches: change handling again, but this time a little less magic. This change means that files located in the actual branches directory will now be wholly ignored. If we want to handle those correctly, it will take a reasonably large amount of work and probably a configuration flag. Also, any non-related paths outside of branches/trunk will be explicitly ignored, which is similar to the somewhat accidental pre-branch-refactor behavior. Finally, any unrelated files located as children of branches will cause the directory in branches to be used as the branch - not, as recently was the case, the directory immediately containing that file.
author Augie Fackler <durin42@gmail.com>
date Sat, 28 Mar 2009 16:38:57 -0500
parents 6eb691a163cd
children f2c65dd3d5c0
comparison
equal deleted inserted replaced
217:6eb691a163cd 218:a360ddc97719
223 branchpath = self._normalize_path(parentdir) 223 branchpath = self._normalize_path(parentdir)
224 branchname = self._localname(branchpath) 224 branchname = self._localname(branchpath)
225 if branchpath.startswith('trunk/'): 225 if branchpath.startswith('trunk/'):
226 branches[self._localname('trunk')] = 'trunk' 226 branches[self._localname('trunk')] = 'trunk'
227 continue 227 continue
228 if branchname and branchname.startswith('../'):
229 continue
228 branches[branchname] = branchpath 230 branches[branchname] = branchpath
229 231
230 return branches 232 return branches
231 233
232 def _path_and_branch_for_path(self, path, existing=True): 234 def _path_and_branch_for_path(self, path, existing=True):
274 if existing: 276 if existing:
275 return None, None, None 277 return None, None, None
276 if path.startswith('trunk/'): 278 if path.startswith('trunk/'):
277 path = test.split('/')[1:] 279 path = test.split('/')[1:]
278 test = 'trunk' 280 test = 'trunk'
281 elif path.startswith('branches/'):
282 elts = path.split('/')
283 test = '/'.join(elts[:2])
284 path = '/'.join(elts[2:])
279 else: 285 else:
280 path = test.split('/')[-1] 286 path = test.split('/')[-1]
281 test = '/'.join(test.split('/')[:-1]) 287 test = '/'.join(test.split('/')[:-1])
282 return path, self._localname(test), test 288 ln = self._localname(test)
289 if ln and ln.startswith('../'):
290 return None, None, None
291 return path, ln, test
283 292
284 def set_current_rev(self, rev): 293 def set_current_rev(self, rev):
285 """Set the revision we're currently converting. 294 """Set the revision we're currently converting.
286 """ 295 """
287 self.current_rev = rev 296 self.current_rev = rev