comparison mercurial/cmdutil.py @ 27803:a8e8950ebd4d

with: use context manager for wlock in revert
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:46 -0800
parents ed44a66fd7ae
children d1a55366d825
comparison
equal deleted inserted replaced
27802:ed44a66fd7ae 27803:a8e8950ebd4d
2866 # `names` is a mapping for all elements in working copy and target revision 2866 # `names` is a mapping for all elements in working copy and target revision
2867 # The mapping is in the form: 2867 # The mapping is in the form:
2868 # <asb path in repo> -> (<path from CWD>, <exactly specified by matcher?>) 2868 # <asb path in repo> -> (<path from CWD>, <exactly specified by matcher?>)
2869 names = {} 2869 names = {}
2870 2870
2871 wlock = repo.wlock() 2871 with repo.wlock():
2872 try:
2873 ## filling of the `names` mapping 2872 ## filling of the `names` mapping
2874 # walk dirstate to fill `names` 2873 # walk dirstate to fill `names`
2875 2874
2876 interactive = opts.get('interactive', False) 2875 interactive = opts.get('interactive', False)
2877 wctx = repo[None] 2876 wctx = repo[None]
3120 try: 3119 try:
3121 wctx.sub(sub).revert(ctx.substate[sub], *pats, **opts) 3120 wctx.sub(sub).revert(ctx.substate[sub], *pats, **opts)
3122 except KeyError: 3121 except KeyError:
3123 raise error.Abort("subrepository '%s' does not exist in %s!" 3122 raise error.Abort("subrepository '%s' does not exist in %s!"
3124 % (sub, short(ctx.node()))) 3123 % (sub, short(ctx.node())))
3125 finally:
3126 wlock.release()
3127 3124
3128 def _revertprefetch(repo, ctx, *files): 3125 def _revertprefetch(repo, ctx, *files):
3129 """Let extension changing the storage layer prefetch content""" 3126 """Let extension changing the storage layer prefetch content"""
3130 pass 3127 pass
3131 3128