Show More
@@ -57,7 +57,7 b' def _getfsnow(vfs):' | |||||
57 | def nonnormalentries(dmap): |
|
57 | def nonnormalentries(dmap): | |
58 | '''Compute the nonnormal dirstate entries from the dmap''' |
|
58 | '''Compute the nonnormal dirstate entries from the dmap''' | |
59 | try: |
|
59 | try: | |
60 | return parsers.nonnormalotherparententries(dmap) |
|
60 | return parsers.nonnormalotherparententries(dmap._map) | |
61 | except AttributeError: |
|
61 | except AttributeError: | |
62 | nonnorm = set() |
|
62 | nonnorm = set() | |
63 | otherparent = set() |
|
63 | otherparent = set() | |
@@ -179,7 +179,7 b' class dirstate(object):' | |||||
179 | except AttributeError: |
|
179 | except AttributeError: | |
180 | pass |
|
180 | pass | |
181 | else: |
|
181 | else: | |
182 | return makefilefoldmap(self._map, util.normcasespec, |
|
182 | return makefilefoldmap(self._map._map, util.normcasespec, | |
183 | util.normcasefallback) |
|
183 | util.normcasefallback) | |
184 |
|
184 | |||
185 | f = {} |
|
185 | f = {} | |
@@ -238,7 +238,7 b' class dirstate(object):' | |||||
238 |
|
238 | |||
239 | @propertycache |
|
239 | @propertycache | |
240 | def _dirs(self): |
|
240 | def _dirs(self): | |
241 | return util.dirs(self._map, 'r') |
|
241 | return util.dirs(self._map._map, 'r') | |
242 |
|
242 | |||
243 | def dirs(self): |
|
243 | def dirs(self): | |
244 | return self._dirs |
|
244 | return self._dirs | |
@@ -444,7 +444,8 b' class dirstate(object):' | |||||
444 | return fp |
|
444 | return fp | |
445 |
|
445 | |||
446 | def _read(self): |
|
446 | def _read(self): | |
447 |
self._map = |
|
447 | self._map = dirstatemap() | |
|
448 | ||||
448 | self._copymap = {} |
|
449 | self._copymap = {} | |
449 | # ignore HG_PENDING because identity is used only for writing |
|
450 | # ignore HG_PENDING because identity is used only for writing | |
450 | self._identity = util.filestat.frompath( |
|
451 | self._identity = util.filestat.frompath( | |
@@ -473,7 +474,7 b' class dirstate(object):' | |||||
473 | # This heuristic is imperfect in many ways, so in a future dirstate |
|
474 | # This heuristic is imperfect in many ways, so in a future dirstate | |
474 | # format update it makes sense to just record the number of entries |
|
475 | # format update it makes sense to just record the number of entries | |
475 | # on write. |
|
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 | # Python's garbage collector triggers a GC each time a certain number |
|
479 | # Python's garbage collector triggers a GC each time a certain number | |
479 | # of container objects (the number being defined by |
|
480 | # of container objects (the number being defined by | |
@@ -488,7 +489,7 b' class dirstate(object):' | |||||
488 | # |
|
489 | # | |
489 | # (we cannot decorate the function directly since it is in a C module) |
|
490 | # (we cannot decorate the function directly since it is in a C module) | |
490 | parse_dirstate = util.nogc(parsers.parse_dirstate) |
|
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 | if not self._dirtypl: |
|
493 | if not self._dirtypl: | |
493 | self._pl = p |
|
494 | self._pl = p | |
494 |
|
495 | |||
@@ -731,7 +732,7 b' class dirstate(object):' | |||||
731 | return path |
|
732 | return path | |
732 |
|
733 | |||
733 | def clear(self): |
|
734 | def clear(self): | |
734 |
self._map = |
|
735 | self._map = dirstatemap() | |
735 | self._nonnormalset = set() |
|
736 | self._nonnormalset = set() | |
736 | self._otherparentset = set() |
|
737 | self._otherparentset = set() | |
737 | if "_dirs" in self.__dict__: |
|
738 | if "_dirs" in self.__dict__: | |
@@ -840,7 +841,8 b' class dirstate(object):' | |||||
840 | now = end # trust our estimate that the end is near now |
|
841 | now = end # trust our estimate that the end is near now | |
841 | break |
|
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 | self._nonnormalset, self._otherparentset = nonnormalentries(self._map) |
|
846 | self._nonnormalset, self._otherparentset = nonnormalentries(self._map) | |
845 | st.close() |
|
847 | st.close() | |
846 | self._lastnormaltime = 0 |
|
848 | self._lastnormaltime = 0 | |
@@ -979,7 +981,7 b' class dirstate(object):' | |||||
979 | results[nf] = None |
|
981 | results[nf] = None | |
980 | else: # does it match a missing directory? |
|
982 | else: # does it match a missing directory? | |
981 | if alldirs is None: |
|
983 | if alldirs is None: | |
982 | alldirs = util.dirs(dmap) |
|
984 | alldirs = util.dirs(dmap._map) | |
983 | if nf in alldirs: |
|
985 | if nf in alldirs: | |
984 | if matchedir: |
|
986 | if matchedir: | |
985 | matchedir(nf) |
|
987 | matchedir(nf) | |
@@ -1339,3 +1341,31 b' class dirstate(object):' | |||||
1339 | def clearbackup(self, tr, backupname): |
|
1341 | def clearbackup(self, tr, backupname): | |
1340 | '''Clear backup file''' |
|
1342 | '''Clear backup file''' | |
1341 | self._opener.unlink(backupname) |
|
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