2998 dsguard = None |
2998 dsguard = None |
2999 # extract addremove carefully -- this function can be called from a command |
2999 # extract addremove carefully -- this function can be called from a command |
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(): |
3019 a = ctx1.filectx(f) |
3013 a = ctx1.filectx(f) |
3020 if f in ctx2.manifest(): |
3014 if f in ctx2.manifest(): |