##// END OF EJS Templates
commit: move the addremove logic around to make the next changeset clearer...
marmoute -
r50923:a46dfc2b default
parent child Browse files
Show More
@@ -2794,8 +2794,6 b' def commit(ui, repo, commitfunc, pats, o'
2794 date = opts.get(b'date')
2794 date = opts.get(b'date')
2795 if date:
2795 if date:
2796 opts[b'date'] = dateutil.parsedate(date)
2796 opts[b'date'] = dateutil.parsedate(date)
2797 message = logmessage(ui, opts)
2798 matcher = scmutil.match(repo[None], pats, opts)
2799
2797
2800 dsguard = None
2798 dsguard = None
2801 # extract addremove carefully -- this function can be called from a command
2799 # extract addremove carefully -- this function can be called from a command
@@ -2803,15 +2801,29 b' def commit(ui, repo, commitfunc, pats, o'
2803 if opts.get(b'addremove'):
2801 if opts.get(b'addremove'):
2804 dsguard = dirstateguard.dirstateguard(repo, b'commit')
2802 dsguard = dirstateguard.dirstateguard(repo, b'commit')
2805 with dsguard or util.nullcontextmanager():
2803 with dsguard or util.nullcontextmanager():
2806 if dsguard:
2804 message = logmessage(ui, opts)
2807 relative = scmutil.anypats(pats, opts)
2805 matcher = scmutil.match(repo[None], pats, opts)
2808 uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=relative)
2806 if True:
2809 if scmutil.addremove(repo, matcher, b"", uipathfn, opts) != 0:
2807 # extract addremove carefully -- this function can be called from a
2810 raise error.Abort(
2808 # command that doesn't support addremove
2811 _(b"failed to mark all new/missing files as added/removed")
2809 if opts.get(b'addremove'):
2810 relative = scmutil.anypats(pats, opts)
2811 uipathfn = scmutil.getuipathfn(
2812 repo,
2813 legacyrelativevalue=relative,
2812 )
2814 )
2813
2815 r = scmutil.addremove(
2814 return commitfunc(ui, repo, message, matcher, opts)
2816 repo,
2817 matcher,
2818 b"",
2819 uipathfn,
2820 opts,
2821 )
2822 m = _(b"failed to mark all new/missing files as added/removed")
2823 if r != 0:
2824 raise error.Abort(m)
2825
2826 return commitfunc(ui, repo, message, matcher, opts)
2815
2827
2816
2828
2817 def samefile(f, ctx1, ctx2):
2829 def samefile(f, ctx1, ctx2):
General Comments 0
You need to be logged in to leave comments. Login now