mercurial/cmdutil.py
changeset 33762 86aca74a063b
parent 33757 2cb442bc1a76
parent 33616 5ac845ca059a
child 33763 02a745c20121
equal deleted inserted replaced
33761:e6d8ee3c9ec3 33762:86aca74a063b
    24 from . import (
    24 from . import (
    25     bookmarks,
    25     bookmarks,
    26     changelog,
    26     changelog,
    27     copies,
    27     copies,
    28     crecord as crecordmod,
    28     crecord as crecordmod,
       
    29     dirstateguard,
    29     encoding,
    30     encoding,
    30     error,
    31     error,
    31     formatter,
    32     formatter,
    32     graphmod,
    33     graphmod,
    33     match as matchmod,
    34     match as matchmod,
  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():