##// END OF EJS Templates
commit: use context manager with dirstateguard...
Martin von Zweigbergk -
r33823:158dddc6 default
parent child Browse files
Show More
@@ -3000,19 +3000,13 b' def commit(ui, repo, commitfunc, pats, o'
3000 # that doesn't support addremove
3000 # that doesn't support addremove
3001 if opts.get('addremove'):
3001 if opts.get('addremove'):
3002 dsguard = dirstateguard.dirstateguard(repo, 'commit')
3002 dsguard = dirstateguard.dirstateguard(repo, 'commit')
3003 try:
3003 with dsguard or util.nullcontextmanager():
3004 if dsguard:
3004 if dsguard:
3005 if scmutil.addremove(repo, matcher, "", opts) != 0:
3005 if scmutil.addremove(repo, matcher, "", opts) != 0:
3006 raise error.Abort(
3006 raise error.Abort(
3007 _("failed to mark all new/missing files as added/removed"))
3007 _("failed to mark all new/missing files as added/removed"))
3008
3008
3009 r = commitfunc(ui, repo, message, matcher, opts)
3009 return commitfunc(ui, repo, message, matcher, opts)
3010 if dsguard:
3011 dsguard.close()
3012 return r
3013 finally:
3014 if dsguard:
3015 dsguard.release()
3016
3010
3017 def samefile(f, ctx1, ctx2):
3011 def samefile(f, ctx1, ctx2):
3018 if f in ctx1.manifest():
3012 if f in ctx1.manifest():
General Comments 0
You need to be logged in to leave comments. Login now