comparison mercurial/commands.py @ 27176:54ace3372f84

dirstate: change debugrebuilddirstate --minimal to use dirstate.rebuild When debugrebuilddirstate --minimal is called, rebuilding the dirstate was done outside of the appropriate rebuild function. This patch makes debugrebuilddirstate use dirstate.rebuild. This was done to allow our extension to become aware debugrebuilddirstate --minimal
author Christian Delahousse <cdelahousse@fb.com>
date Mon, 30 Nov 2015 11:23:15 -0800
parents 8a8f5d71a49a
children a01d3d32b53a
comparison
equal deleted inserted replaced
27175:25a8a866eb5d 27176:54ace3372f84
2963 """ 2963 """
2964 ctx = scmutil.revsingle(repo, rev) 2964 ctx = scmutil.revsingle(repo, rev)
2965 wlock = repo.wlock() 2965 wlock = repo.wlock()
2966 try: 2966 try:
2967 dirstate = repo.dirstate 2967 dirstate = repo.dirstate
2968 2968 changedfiles = None
2969 # See command doc for what minimal does. 2969 # See command doc for what minimal does.
2970 if opts.get('minimal'): 2970 if opts.get('minimal'):
2971 manifestfiles = set(ctx.manifest().keys())
2971 dirstatefiles = set(dirstate) 2972 dirstatefiles = set(dirstate)
2972 ctxfiles = set(ctx.manifest().keys()) 2973 manifestonly = manifestfiles - dirstatefiles
2973 for file in (dirstatefiles | ctxfiles): 2974 dsonly = dirstatefiles - manifestfiles
2974 indirstate = file in dirstatefiles 2975 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a')
2975 inctx = file in ctxfiles 2976 changedfiles = manifestonly | dsnotadded
2976 2977
2977 if indirstate and not inctx and dirstate[file] != 'a': 2978 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
2978 dirstate.drop(file)
2979 elif inctx and not indirstate:
2980 dirstate.normallookup(file)
2981 else:
2982 dirstate.rebuild(ctx.node(), ctx.manifest())
2983 finally: 2979 finally:
2984 wlock.release() 2980 wlock.release()
2985 2981
2986 @command('debugrebuildfncache', [], '') 2982 @command('debugrebuildfncache', [], '')
2987 def debugrebuildfncache(ui, repo): 2983 def debugrebuildfncache(ui, repo):