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