Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 27806:a5eae47aa1f8
with: use context manager for wlock in debugrebuilddirstate
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Fri, 15 Jan 2016 13:14:46 -0800 |
parents | bdaf433192f0 |
children | 6ad5e134ef2e |
comparison
equal
deleted
inserted
replaced
27805:bdaf433192f0 | 27806:a5eae47aa1f8 |
---|---|
3122 | 3122 |
3123 One use of this command is to make the next :hg:`status` invocation | 3123 One use of this command is to make the next :hg:`status` invocation |
3124 check the actual file content. | 3124 check the actual file content. |
3125 """ | 3125 """ |
3126 ctx = scmutil.revsingle(repo, rev) | 3126 ctx = scmutil.revsingle(repo, rev) |
3127 wlock = repo.wlock() | 3127 with repo.wlock(): |
3128 try: | |
3129 dirstate = repo.dirstate | 3128 dirstate = repo.dirstate |
3130 changedfiles = None | 3129 changedfiles = None |
3131 # See command doc for what minimal does. | 3130 # See command doc for what minimal does. |
3132 if opts.get('minimal'): | 3131 if opts.get('minimal'): |
3133 manifestfiles = set(ctx.manifest().keys()) | 3132 manifestfiles = set(ctx.manifest().keys()) |
3136 dsonly = dirstatefiles - manifestfiles | 3135 dsonly = dirstatefiles - manifestfiles |
3137 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a') | 3136 dsnotadded = set(f for f in dsonly if dirstate[f] != 'a') |
3138 changedfiles = manifestonly | dsnotadded | 3137 changedfiles = manifestonly | dsnotadded |
3139 | 3138 |
3140 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles) | 3139 dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles) |
3141 finally: | |
3142 wlock.release() | |
3143 | 3140 |
3144 @command('debugrebuildfncache', [], '') | 3141 @command('debugrebuildfncache', [], '') |
3145 def debugrebuildfncache(ui, repo): | 3142 def debugrebuildfncache(ui, repo): |
3146 """rebuild the fncache file""" | 3143 """rebuild the fncache file""" |
3147 repair.rebuildfncache(ui, repo) | 3144 repair.rebuildfncache(ui, repo) |