mercurial/cmdutil.py
changeset 24259 5ac8ce04baa2
parent 24222 02d7b5cd373b
child 24260 76225ab5a5da
equal deleted inserted replaced
24258:093e8a5e995f 24259:5ac8ce04baa2
   613     tmpname, message, user, date, branch, nodeid, p1, p2 = \
   613     tmpname, message, user, date, branch, nodeid, p1, p2 = \
   614         patch.extract(ui, hunk)
   614         patch.extract(ui, hunk)
   615 
   615 
   616     update = not opts.get('bypass')
   616     update = not opts.get('bypass')
   617     strip = opts["strip"]
   617     strip = opts["strip"]
       
   618     prefix = opts["prefix"]
   618     sim = float(opts.get('similarity') or 0)
   619     sim = float(opts.get('similarity') or 0)
   619     if not tmpname:
   620     if not tmpname:
   620         return (None, None, False)
   621         return (None, None, False)
   621     msg = _('applied to working directory')
   622     msg = _('applied to working directory')
   622 
   623 
   672                 repo.dirstate.setbranch(branch or 'default')
   673                 repo.dirstate.setbranch(branch or 'default')
   673 
   674 
   674             partial = opts.get('partial', False)
   675             partial = opts.get('partial', False)
   675             files = set()
   676             files = set()
   676             try:
   677             try:
   677                 patch.patch(ui, repo, tmpname, strip=strip, files=files,
   678                 patch.patch(ui, repo, tmpname, strip=strip, prefix=prefix,
   678                             eolmode=None, similarity=sim / 100.0)
   679                             files=files, eolmode=None, similarity=sim / 100.0)
   679             except patch.PatchError, e:
   680             except patch.PatchError, e:
   680                 if not partial:
   681                 if not partial:
   681                     raise util.Abort(str(e))
   682                     raise util.Abort(str(e))
   682                 if partial:
   683                 if partial:
   683                     rejects = True
   684                     rejects = True