##// END OF EJS Templates
contrib: fix dirstatenonnormalcheck to work in Python 3...
Augie Fackler -
r35896:6e7fae8f default
parent child Browse files
Show More
@@ -17,7 +17,7 b' def nonnormalentries(dmap):'
17 """Compute nonnormal entries from dirstate's dmap"""
17 """Compute nonnormal entries from dirstate's dmap"""
18 res = set()
18 res = set()
19 for f, e in dmap.iteritems():
19 for f, e in dmap.iteritems():
20 if e[0] != 'n' or e[3] == -1:
20 if e[0] != b'n' or e[3] == -1:
21 res.add(f)
21 res.add(f)
22 return res
22 return res
23
23
@@ -25,24 +25,25 b' def checkconsistency(ui, orig, dmap, _no'
25 """Compute nonnormalset from dmap, check that it matches _nonnormalset"""
25 """Compute nonnormalset from dmap, check that it matches _nonnormalset"""
26 nonnormalcomputedmap = nonnormalentries(dmap)
26 nonnormalcomputedmap = nonnormalentries(dmap)
27 if _nonnormalset != nonnormalcomputedmap:
27 if _nonnormalset != nonnormalcomputedmap:
28 ui.develwarn("%s call to %s\n" % (label, orig), config='dirstate')
28 ui.develwarn(b"%s call to %s\n" % (label, orig), config=b'dirstate')
29 ui.develwarn("inconsistency in nonnormalset\n", config='dirstate')
29 ui.develwarn(b"inconsistency in nonnormalset\n", config=b'dirstate')
30 ui.develwarn("[nonnormalset] %s\n" % _nonnormalset, config='dirstate')
30 ui.develwarn(b"[nonnormalset] %s\n" % _nonnormalset, config=b'dirstate')
31 ui.develwarn("[map] %s\n" % nonnormalcomputedmap, config='dirstate')
31 ui.develwarn(b"[map] %s\n" % nonnormalcomputedmap, config=b'dirstate')
32
32
33 def _checkdirstate(orig, self, arg):
33 def _checkdirstate(orig, self, arg):
34 """Check nonnormal set consistency before and after the call to orig"""
34 """Check nonnormal set consistency before and after the call to orig"""
35 checkconsistency(self._ui, orig, self._map, self._map.nonnormalset,
35 checkconsistency(self._ui, orig, self._map, self._map.nonnormalset,
36 "before")
36 b"before")
37 r = orig(self, arg)
37 r = orig(self, arg)
38 checkconsistency(self._ui, orig, self._map, self._map.nonnormalset, "after")
38 checkconsistency(self._ui, orig, self._map, self._map.nonnormalset,
39 b"after")
39 return r
40 return r
40
41
41 def extsetup(ui):
42 def extsetup(ui):
42 """Wrap functions modifying dirstate to check nonnormalset consistency"""
43 """Wrap functions modifying dirstate to check nonnormalset consistency"""
43 dirstatecl = dirstate.dirstate
44 dirstatecl = dirstate.dirstate
44 devel = ui.configbool('devel', 'all-warnings')
45 devel = ui.configbool(b'devel', b'all-warnings')
45 paranoid = ui.configbool('experimental', 'nonnormalparanoidcheck')
46 paranoid = ui.configbool(b'experimental', b'nonnormalparanoidcheck')
46 if devel:
47 if devel:
47 extensions.wrapfunction(dirstatecl, '_writedirstate', _checkdirstate)
48 extensions.wrapfunction(dirstatecl, '_writedirstate', _checkdirstate)
48 if paranoid:
49 if paranoid:
@@ -1237,9 +1237,12 b' class dirstatemap(object):'
1237 util.clearcachedproperty(self, "nonnormalset")
1237 util.clearcachedproperty(self, "nonnormalset")
1238 util.clearcachedproperty(self, "otherparentset")
1238 util.clearcachedproperty(self, "otherparentset")
1239
1239
1240 def iteritems(self):
1240 def items(self):
1241 return self._map.iteritems()
1241 return self._map.iteritems()
1242
1242
1243 # forward for python2,3 compat
1244 iteritems = items
1245
1243 def __len__(self):
1246 def __len__(self):
1244 return len(self._map)
1247 return len(self._map)
1245
1248
General Comments 0
You need to be logged in to leave comments. Login now