Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

stable manifest: improve subrepo view code

This patch contains several improvmenets to the code that is used to identify
the subrepo to which a file belongs to. The improvements are:

- It the name of one subrepo were a substring of another subrepo name, thg could
think that a file belonging to the subrepo with the longer pathname could belong
to the subrepo with the shorter pathname.
- There could be problems with paths with mixed file separators (i.e. '\\' and
'/').
The safest solution for this last problem would be to use os.path.normpath, but
it seems that paths are always stored in "unix" format internaly, so it seems
safe (and faster) to simply use "/" as the path separator when creating and
using the _subinfo dictionary.

Changeset 9bc26a1651c9

Parent 6ab0918e06d8

by Angel Ezquerra

Changes to one file · Browse files at 9bc26a1651c9 Showing diff from parent 6ab0918e06d8 Diff from another changeset...

 
67
68
69
70
71
72
73
74
75
 
76
77
78
 
305
306
307
 
308
309
310
 
67
68
69
 
 
 
 
 
 
70
71
72
73
 
300
301
302
303
304
305
306
@@ -67,12 +67,7 @@
  if not path:   return None, path   for subpath in sorted(self._subinfo.keys())[::-1]: - if path == subpath: - # When we call this method with a subrepo path, we do not want - # to get the subrepo context stored in _subinfo, - # but its _parents_ context - continue - if path.startswith(subpath): + if path.startswith(subpath + '/'):   return self._subinfo[subpath]['ctx'], path[len(subpath)+1:]   return None, path   @@ -305,6 +300,7 @@
  toprelpath = '/'.join([toproot, path])   else:   toprelpath = path + toprelpath = util.pconvert(toprelpath)   self._subinfo[toprelpath] = \   {'substate': substate, 'ctx': None}   srev = substate[1]