Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 24259:5ac8ce04baa2
cmdutil.tryimportone: allow importing relative patches into the working dir
This makes hg import --prefix dir/ (without bypass) work.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Mon, 09 Mar 2015 18:22:24 -0700 |
parents | 60c279ab7bd3 |
children | 76225ab5a5da |
comparison
equal
deleted
inserted
replaced
24258:093e8a5e995f | 24259:5ac8ce04baa2 |
---|---|
1531 def patchrepo(ui, repo, ctx, store, patchobj, strip, files=None, | 1531 def patchrepo(ui, repo, ctx, store, patchobj, strip, files=None, |
1532 eolmode='strict'): | 1532 eolmode='strict'): |
1533 backend = repobackend(ui, repo, ctx, store) | 1533 backend = repobackend(ui, repo, ctx, store) |
1534 return patchbackend(ui, backend, patchobj, strip, '', files, eolmode) | 1534 return patchbackend(ui, backend, patchobj, strip, '', files, eolmode) |
1535 | 1535 |
1536 def patch(ui, repo, patchname, strip=1, files=None, eolmode='strict', | 1536 def patch(ui, repo, patchname, strip=1, prefix='', files=None, eolmode='strict', |
1537 similarity=0): | 1537 similarity=0): |
1538 """Apply <patchname> to the working directory. | 1538 """Apply <patchname> to the working directory. |
1539 | 1539 |
1540 'eolmode' specifies how end of lines should be handled. It can be: | 1540 'eolmode' specifies how end of lines should be handled. It can be: |
1541 - 'strict': inputs are read in binary mode, EOLs are preserved | 1541 - 'strict': inputs are read in binary mode, EOLs are preserved |
1550 if files is None: | 1550 if files is None: |
1551 files = set() | 1551 files = set() |
1552 if patcher: | 1552 if patcher: |
1553 return _externalpatch(ui, repo, patcher, patchname, strip, | 1553 return _externalpatch(ui, repo, patcher, patchname, strip, |
1554 files, similarity) | 1554 files, similarity) |
1555 return internalpatch(ui, repo, patchname, strip, '', files, eolmode, | 1555 return internalpatch(ui, repo, patchname, strip, prefix, files, eolmode, |
1556 similarity) | 1556 similarity) |
1557 | 1557 |
1558 def changedfiles(ui, repo, patchpath, strip=1): | 1558 def changedfiles(ui, repo, patchpath, strip=1): |
1559 backend = fsbackend(ui, repo.root) | 1559 backend = fsbackend(ui, repo.root) |
1560 fp = open(patchpath, 'rb') | 1560 fp = open(patchpath, 'rb') |