mercurial/cmdutil.py
changeset 14321 003d63bb4fa5
parent 14320 3438417a6657
child 14322 a90131b85fd8
equal deleted inserted replaced
14320:3438417a6657 14321:003d63bb4fa5
    10 import os, sys, errno, re, tempfile
    10 import os, sys, errno, re, tempfile
    11 import util, scmutil, templater, patch, error, templatekw
    11 import util, scmutil, templater, patch, error, templatekw
    12 import match as matchmod
    12 import match as matchmod
    13 import subrepo
    13 import subrepo
    14 
    14 
    15 expandpats = scmutil.expandpats
       
    16 match = scmutil.match
    15 match = scmutil.match
    17 matchall = scmutil.matchall
    16 matchall = scmutil.matchall
    18 matchfiles = scmutil.matchfiles
    17 matchfiles = scmutil.matchfiles
    19 addremove = scmutil.addremove
       
    20 dirstatecopy = scmutil.dirstatecopy
       
    21 
    18 
    22 def parsealiases(cmd):
    19 def parsealiases(cmd):
    23     return cmd.lstrip("^").split("|")
    20     return cmd.lstrip("^").split("|")
    24 
    21 
    25 def findpossible(cmd, table, strict=False):
    22 def findpossible(cmd, table, strict=False):
   268                 ui.status(_('copying %s to %s\n') % (relsrc, reltarget))
   265                 ui.status(_('copying %s to %s\n') % (relsrc, reltarget))
   269 
   266 
   270         targets[abstarget] = abssrc
   267         targets[abstarget] = abssrc
   271 
   268 
   272         # fix up dirstate
   269         # fix up dirstate
   273         dirstatecopy(ui, repo, wctx, abssrc, abstarget, dryrun=dryrun, cwd=cwd)
   270         scmutil.dirstatecopy(ui, repo, wctx, abssrc, abstarget,
       
   271                              dryrun=dryrun, cwd=cwd)
   274         if rename and not dryrun:
   272         if rename and not dryrun:
   275             wctx.remove([abssrc], not after)
   273             wctx.remove([abssrc], not after)
   276 
   274 
   277     # pat: ossep
   275     # pat: ossep
   278     # dest ossep
   276     # dest ossep
   339                 else:
   337                 else:
   340                     res = lambda p: dest
   338                     res = lambda p: dest
   341         return res
   339         return res
   342 
   340 
   343 
   341 
   344     pats = expandpats(pats)
   342     pats = scmutil.expandpats(pats)
   345     if not pats:
   343     if not pats:
   346         raise util.Abort(_('no source or destination specified'))
   344         raise util.Abort(_('no source or destination specified'))
   347     if len(pats) == 1:
   345     if len(pats) == 1:
   348         raise util.Abort(_('no destination specified'))
   346         raise util.Abort(_('no destination specified'))
   349     dest = pats.pop()
   347     dest = pats.pop()
  1133     message = logmessage(opts)
  1131     message = logmessage(opts)
  1134 
  1132 
  1135     # extract addremove carefully -- this function can be called from a command
  1133     # extract addremove carefully -- this function can be called from a command
  1136     # that doesn't support addremove
  1134     # that doesn't support addremove
  1137     if opts.get('addremove'):
  1135     if opts.get('addremove'):
  1138         addremove(repo, pats, opts)
  1136         scmutil.addremove(repo, pats, opts)
  1139 
  1137 
  1140     return commitfunc(ui, repo, message, match(repo, pats, opts), opts)
  1138     return commitfunc(ui, repo, message, match(repo, pats, opts), opts)
  1141 
  1139 
  1142 def commiteditor(repo, ctx, subs):
  1140 def commiteditor(repo, ctx, subs):
  1143     if ctx.description():
  1141     if ctx.description():