mercurial/patch.py
changeset 24390 72d7d390ef5d
parent 24385 885a573fa619
child 24416 f07047a506d1
equal deleted inserted replaced
24389:93d3e1a8bfb0 24390:72d7d390ef5d
    15 
    15 
    16 from i18n import _
    16 from i18n import _
    17 from node import hex, short
    17 from node import hex, short
    18 import cStringIO
    18 import cStringIO
    19 import base85, mdiff, scmutil, util, diffhelpers, copies, encoding, error
    19 import base85, mdiff, scmutil, util, diffhelpers, copies, encoding, error
       
    20 import pathutil
    20 
    21 
    21 gitre = re.compile('diff --git a/(.*) b/(.*)')
    22 gitre = re.compile('diff --git a/(.*) b/(.*)')
    22 tabsplitter = re.compile(r'(\t+|[^\t]+)')
    23 tabsplitter = re.compile(r'(\t+|[^\t]+)')
    23 
    24 
    24 class PatchError(Exception):
    25 class PatchError(Exception):
  1793 
  1794 
  1794 def _applydiff(ui, fp, patcher, backend, store, strip=1, prefix='',
  1795 def _applydiff(ui, fp, patcher, backend, store, strip=1, prefix='',
  1795                eolmode='strict'):
  1796                eolmode='strict'):
  1796 
  1797 
  1797     if prefix:
  1798     if prefix:
  1798         # clean up double slashes, lack of trailing slashes, etc
  1799         prefix = pathutil.canonpath(backend.repo.root, backend.repo.getcwd(),
  1799         prefix = util.normpath(prefix) + '/'
  1800                                     prefix)
       
  1801         if prefix != '':
       
  1802             prefix += '/'
  1800     def pstrip(p):
  1803     def pstrip(p):
  1801         return pathtransform(p, strip - 1, prefix)[1]
  1804         return pathtransform(p, strip - 1, prefix)[1]
  1802 
  1805 
  1803     rejects = 0
  1806     rejects = 0
  1804     err = 0
  1807     err = 0