Show More
@@ -1832,9 +1832,13 b' def import_(ui, repo, patch1, *patches, ' | |||
|
1832 | 1832 | if not diffs_seen: |
|
1833 | 1833 | raise util.Abort(_('no diffs found')) |
|
1834 | 1834 | |
|
1835 | files = util.patch(strip, tmpname, ui) | |
|
1835 | files = util.patch(strip, tmpname, ui, cwd=repo.root) | |
|
1836 | 1836 | if len(files) > 0: |
|
1837 | addremove_lock(ui, repo, files, {}) | |
|
1837 | cfiles = files | |
|
1838 | cwd = repo.getcwd() | |
|
1839 | if cwd: | |
|
1840 | cfiles = [util.pathto(cwd, f) for f in files] | |
|
1841 | addremove_lock(ui, repo, cfiles, {}) | |
|
1838 | 1842 | repo.commit(files, message, user, date) |
|
1839 | 1843 | finally: |
|
1840 | 1844 | os.unlink(tmpname) |
@@ -93,11 +93,15 b' def find_in_path(name, path, default=Non' | |||
|
93 | 93 | return p_name |
|
94 | 94 | return default |
|
95 | 95 | |
|
96 | def patch(strip, patchname, ui): | |
|
96 | def patch(strip, patchname, ui, cwd=None): | |
|
97 | 97 | """apply the patch <patchname> to the working directory. |
|
98 | 98 | a list of patched files is returned""" |
|
99 | 99 | patcher = find_in_path('gpatch', os.environ.get('PATH', ''), 'patch') |
|
100 | fp = os.popen('%s -p%d < "%s"' % (patcher, strip, patchname)) | |
|
100 | args = [] | |
|
101 | if cwd: | |
|
102 | args.append('-d "%s"' % cwd) | |
|
103 | fp = os.popen('%s %s -p%d < "%s"' % (patcher, ' '.join(args), strip, | |
|
104 | patchname)) | |
|
101 | 105 | files = {} |
|
102 | 106 | for line in fp: |
|
103 | 107 | line = line.rstrip() |
General Comments 0
You need to be logged in to leave comments.
Login now