mercurial/cmdutil.py
changeset 37084 f0b6fbea00cf
parent 36988 317382151ac3
child 37088 08890706366e
equal deleted inserted replaced
37083:f99d64e8a4e4 37084:f0b6fbea00cf
    46     templatekw,
    46     templatekw,
    47     templater,
    47     templater,
    48     util,
    48     util,
    49     vfs as vfsmod,
    49     vfs as vfsmod,
    50 )
    50 )
    51 from .utils import dateutil
    51 
       
    52 from .utils import (
       
    53     dateutil,
       
    54     stringutil,
       
    55 )
       
    56 
    52 stringio = util.stringio
    57 stringio = util.stringio
    53 
    58 
    54 # templates of common command options
    59 # templates of common command options
    55 
    60 
    56 dryrunopts = [
    61 dryrunopts = [
   960             continue
   965             continue
   961         i = start
   966         i = start
   962         while i < end:
   967         while i < end:
   963             n = pat.find(b'%', i, end)
   968             n = pat.find(b'%', i, end)
   964             if n < 0:
   969             if n < 0:
   965                 newname.append(util.escapestr(pat[i:end]))
   970                 newname.append(stringutil.escapestr(pat[i:end]))
   966                 break
   971                 break
   967             newname.append(util.escapestr(pat[i:n]))
   972             newname.append(stringutil.escapestr(pat[i:n]))
   968             if n + 2 > end:
   973             if n + 2 > end:
   969                 raise error.Abort(_("incomplete format spec in output "
   974                 raise error.Abort(_("incomplete format spec in output "
   970                                     "filename"))
   975                                     "filename"))
   971             c = pat[n + 1:n + 2]
   976             c = pat[n + 1:n + 2]
   972             i = n + 2
   977             i = n + 2
  1477                 files = set()
  1482                 files = set()
  1478                 try:
  1483                 try:
  1479                     patch.patchrepo(ui, repo, p1, store, tmpname, strip, prefix,
  1484                     patch.patchrepo(ui, repo, p1, store, tmpname, strip, prefix,
  1480                                     files, eolmode=None)
  1485                                     files, eolmode=None)
  1481                 except error.PatchError as e:
  1486                 except error.PatchError as e:
  1482                     raise error.Abort(util.forcebytestr(e))
  1487                     raise error.Abort(stringutil.forcebytestr(e))
  1483                 if opts.get('exact'):
  1488                 if opts.get('exact'):
  1484                     editor = None
  1489                     editor = None
  1485                 else:
  1490                 else:
  1486                     editor = getcommiteditor(editform='import.bypass')
  1491                     editor = getcommiteditor(editform='import.bypass')
  1487                 memctx = context.memctx(repo, (p1.node(), p2.node()),
  1492                 memctx = context.memctx(repo, (p1.node(), p2.node()),