2886 if date: |
2887 if date: |
2887 opts['date'] = util.parsedate(date) |
2888 opts['date'] = util.parsedate(date) |
2888 message = logmessage(ui, opts) |
2889 message = logmessage(ui, opts) |
2889 matcher = scmutil.match(repo[None], pats, opts) |
2890 matcher = scmutil.match(repo[None], pats, opts) |
2890 |
2891 |
|
2892 dsguard = None |
2891 # extract addremove carefully -- this function can be called from a command |
2893 # extract addremove carefully -- this function can be called from a command |
2892 # that doesn't support addremove |
2894 # that doesn't support addremove |
2893 if opts.get('addremove'): |
2895 try: |
2894 if scmutil.addremove(repo, matcher, "", opts) != 0: |
2896 if opts.get('addremove'): |
2895 raise error.Abort( |
2897 dsguard = dirstateguard.dirstateguard(repo, 'commit') |
2896 _("failed to mark all new/missing files as added/removed")) |
2898 if scmutil.addremove(repo, matcher, "", opts) != 0: |
2897 |
2899 raise error.Abort( |
2898 return commitfunc(ui, repo, message, matcher, opts) |
2900 _("failed to mark all new/missing files as added/removed")) |
|
2901 |
|
2902 r = commitfunc(ui, repo, message, matcher, opts) |
|
2903 if dsguard: |
|
2904 dsguard.close() |
|
2905 return r |
|
2906 finally: |
|
2907 if dsguard: |
|
2908 dsguard.release() |
2899 |
2909 |
2900 def samefile(f, ctx1, ctx2): |
2910 def samefile(f, ctx1, ctx2): |
2901 if f in ctx1.manifest(): |
2911 if f in ctx1.manifest(): |
2902 a = ctx1.filectx(f) |
2912 a = ctx1.filectx(f) |
2903 if f in ctx2.manifest(): |
2913 if f in ctx2.manifest(): |