Show More
@@ -57,7 +57,7 b' def _getfsnow(vfs):' | |||
|
57 | 57 | def nonnormalentries(dmap): |
|
58 | 58 | '''Compute the nonnormal dirstate entries from the dmap''' |
|
59 | 59 | try: |
|
60 | return parsers.nonnormalotherparententries(dmap) | |
|
60 | return parsers.nonnormalotherparententries(dmap._map) | |
|
61 | 61 | except AttributeError: |
|
62 | 62 | nonnorm = set() |
|
63 | 63 | otherparent = set() |
@@ -179,7 +179,7 b' class dirstate(object):' | |||
|
179 | 179 | except AttributeError: |
|
180 | 180 | pass |
|
181 | 181 | else: |
|
182 | return makefilefoldmap(self._map, util.normcasespec, | |
|
182 | return makefilefoldmap(self._map._map, util.normcasespec, | |
|
183 | 183 | util.normcasefallback) |
|
184 | 184 | |
|
185 | 185 | f = {} |
@@ -238,7 +238,7 b' class dirstate(object):' | |||
|
238 | 238 | |
|
239 | 239 | @propertycache |
|
240 | 240 | def _dirs(self): |
|
241 | return util.dirs(self._map, 'r') | |
|
241 | return util.dirs(self._map._map, 'r') | |
|
242 | 242 | |
|
243 | 243 | def dirs(self): |
|
244 | 244 | return self._dirs |
@@ -444,7 +444,8 b' class dirstate(object):' | |||
|
444 | 444 | return fp |
|
445 | 445 | |
|
446 | 446 | def _read(self): |
|
447 |
self._map = |
|
|
447 | self._map = dirstatemap() | |
|
448 | ||
|
448 | 449 | self._copymap = {} |
|
449 | 450 | # ignore HG_PENDING because identity is used only for writing |
|
450 | 451 | self._identity = util.filestat.frompath( |
@@ -473,7 +474,7 b' class dirstate(object):' | |||
|
473 | 474 | # This heuristic is imperfect in many ways, so in a future dirstate |
|
474 | 475 | # format update it makes sense to just record the number of entries |
|
475 | 476 | # on write. |
|
476 | self._map = parsers.dict_new_presized(len(st) / 71) | |
|
477 | self._map._map = parsers.dict_new_presized(len(st) / 71) | |
|
477 | 478 | |
|
478 | 479 | # Python's garbage collector triggers a GC each time a certain number |
|
479 | 480 | # of container objects (the number being defined by |
@@ -488,7 +489,7 b' class dirstate(object):' | |||
|
488 | 489 | # |
|
489 | 490 | # (we cannot decorate the function directly since it is in a C module) |
|
490 | 491 | parse_dirstate = util.nogc(parsers.parse_dirstate) |
|
491 | p = parse_dirstate(self._map, self._copymap, st) | |
|
492 | p = parse_dirstate(self._map._map, self._copymap, st) | |
|
492 | 493 | if not self._dirtypl: |
|
493 | 494 | self._pl = p |
|
494 | 495 | |
@@ -731,7 +732,7 b' class dirstate(object):' | |||
|
731 | 732 | return path |
|
732 | 733 | |
|
733 | 734 | def clear(self): |
|
734 |
self._map = |
|
|
735 | self._map = dirstatemap() | |
|
735 | 736 | self._nonnormalset = set() |
|
736 | 737 | self._otherparentset = set() |
|
737 | 738 | if "_dirs" in self.__dict__: |
@@ -840,7 +841,8 b' class dirstate(object):' | |||
|
840 | 841 | now = end # trust our estimate that the end is near now |
|
841 | 842 | break |
|
842 | 843 | |
|
843 |
st.write(parsers.pack_dirstate(self._map, self._copymap, self._pl, |
|
|
844 | st.write(parsers.pack_dirstate(self._map._map, self._copymap, self._pl, | |
|
845 | now)) | |
|
844 | 846 | self._nonnormalset, self._otherparentset = nonnormalentries(self._map) |
|
845 | 847 | st.close() |
|
846 | 848 | self._lastnormaltime = 0 |
@@ -979,7 +981,7 b' class dirstate(object):' | |||
|
979 | 981 | results[nf] = None |
|
980 | 982 | else: # does it match a missing directory? |
|
981 | 983 | if alldirs is None: |
|
982 | alldirs = util.dirs(dmap) | |
|
984 | alldirs = util.dirs(dmap._map) | |
|
983 | 985 | if nf in alldirs: |
|
984 | 986 | if matchedir: |
|
985 | 987 | matchedir(nf) |
@@ -1339,3 +1341,31 b' class dirstate(object):' | |||
|
1339 | 1341 | def clearbackup(self, tr, backupname): |
|
1340 | 1342 | '''Clear backup file''' |
|
1341 | 1343 | self._opener.unlink(backupname) |
|
1344 | ||
|
1345 | class dirstatemap(object): | |
|
1346 | def __init__(self): | |
|
1347 | self._map = {} | |
|
1348 | ||
|
1349 | def iteritems(self): | |
|
1350 | return self._map.iteritems() | |
|
1351 | ||
|
1352 | def __iter__(self): | |
|
1353 | return iter(self._map) | |
|
1354 | ||
|
1355 | def get(self, key, default=None): | |
|
1356 | return self._map.get(key, default) | |
|
1357 | ||
|
1358 | def __contains__(self, key): | |
|
1359 | return key in self._map | |
|
1360 | ||
|
1361 | def __setitem__(self, key, value): | |
|
1362 | self._map[key] = value | |
|
1363 | ||
|
1364 | def __getitem__(self, key): | |
|
1365 | return self._map[key] | |
|
1366 | ||
|
1367 | def __delitem__(self, key): | |
|
1368 | del self._map[key] | |
|
1369 | ||
|
1370 | def keys(self): | |
|
1371 | return self._map.keys() |
General Comments 0
You need to be logged in to leave comments.
Login now