##// END OF EJS Templates
dirstate: change debugrebuilddirstate --minimal to use dirstate.rebuild...
Christian Delahousse -
r27176:54ace337 default
parent child Browse files
Show More
@@ -2965,21 +2965,17 b' def debugrebuilddirstate(ui, repo, rev, '
2965 2965 wlock = repo.wlock()
2966 2966 try:
2967 2967 dirstate = repo.dirstate
2968
2968 changedfiles = None
2969 2969 # See command doc for what minimal does.
2970 2970 if opts.get('minimal'):
2971 manifestfiles = set(ctx.manifest().keys())
2971 2972 dirstatefiles = set(dirstate)
2972 ctxfiles = set(ctx.manifest().keys())
2973 for file in (dirstatefiles | ctxfiles):
2974 indirstate = file in dirstatefiles
2975 inctx = file in ctxfiles
2976
2977 if indirstate and not inctx and dirstate[file] != 'a':
2978 dirstate.drop(file)
2979 elif inctx and not indirstate:
2980 dirstate.normallookup(file)
2981 else:
2982 dirstate.rebuild(ctx.node(), ctx.manifest())
2973 manifestonly = manifestfiles - dirstatefiles
2974 dsonly = dirstatefiles - manifestfiles
2975 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a')
2976 changedfiles = manifestonly | dsnotadded
2977
2978 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
2983 2979 finally:
2984 2980 wlock.release()
2985 2981
@@ -639,17 +639,22 b' class dirstate(object):'
639 639
640 640 def rebuild(self, parent, allfiles, changedfiles=None):
641 641 if changedfiles is None:
642 # Rebuild entire dirstate
642 643 changedfiles = allfiles
643 oldmap = self._map
644 self.clear()
645 for f in allfiles:
646 if f not in changedfiles:
647 self._map[f] = oldmap[f]
644 lastnormaltime = self._lastnormaltime
645 self.clear()
646 self._lastnormaltime = lastnormaltime
647
648 for f in changedfiles:
649 mode = 0o666
650 if f in allfiles and 'x' in allfiles.flags(f):
651 mode = 0o777
652
653 if f in allfiles:
654 self._map[f] = dirstatetuple('n', mode, -1, 0)
648 655 else:
649 if 'x' in allfiles.flags(f):
650 self._map[f] = dirstatetuple('n', 0o777, -1, 0)
651 else:
652 self._map[f] = dirstatetuple('n', 0o666, -1, 0)
656 self._map.pop(f, None)
657
653 658 self._pl = (parent, nullid)
654 659 self._dirty = True
655 660
@@ -115,7 +115,7 b' dirstate'
115 115 $ hg debugrebuilddirstate --minimal
116 116 $ hg debugdirstate --nodates
117 117 r 0 0 * bar (glob)
118 n 0 -1 * foo (glob)
118 n 644 -1 * foo (glob)
119 119 a 0 -1 * qux (glob)
120 120 $ hg status -A
121 121 A qux
General Comments 0
You need to be logged in to leave comments. Login now