Show More
@@ -1990,14 +1990,16 b' def applydiff(ui, fp, backend, store, st' | |||
|
1990 | 1990 | return _applydiff(ui, fp, patchfile, backend, store, strip=strip, |
|
1991 | 1991 | prefix=prefix, eolmode=eolmode) |
|
1992 | 1992 | |
|
1993 | def _canonprefix(repo, prefix): | |
|
1994 | if prefix: | |
|
1995 | prefix = pathutil.canonpath(repo.root, repo.getcwd(), prefix) | |
|
1996 | if prefix != '': | |
|
1997 | prefix += '/' | |
|
1998 | return prefix | |
|
1999 | ||
|
1993 | 2000 | def _applydiff(ui, fp, patcher, backend, store, strip=1, prefix='', |
|
1994 | 2001 | eolmode='strict'): |
|
1995 | ||
|
1996 | if prefix: | |
|
1997 | prefix = pathutil.canonpath(backend.repo.root, backend.repo.getcwd(), | |
|
1998 | prefix) | |
|
1999 | if prefix != '': | |
|
2000 | prefix += '/' | |
|
2002 | prefix = _canonprefix(backend.repo, prefix) | |
|
2001 | 2003 | def pstrip(p): |
|
2002 | 2004 | return pathtransform(p, strip - 1, prefix)[1] |
|
2003 | 2005 | |
@@ -2183,20 +2185,22 b' def patch(ui, repo, patchname, strip=1, ' | |||
|
2183 | 2185 | return internalpatch(ui, repo, patchname, strip, prefix, files, eolmode, |
|
2184 | 2186 | similarity) |
|
2185 | 2187 | |
|
2186 | def changedfiles(ui, repo, patchpath, strip=1): | |
|
2188 | def changedfiles(ui, repo, patchpath, strip=1, prefix=''): | |
|
2187 | 2189 | backend = fsbackend(ui, repo.root) |
|
2190 | prefix = _canonprefix(repo, prefix) | |
|
2188 | 2191 | with open(patchpath, 'rb') as fp: |
|
2189 | 2192 | changed = set() |
|
2190 | 2193 | for state, values in iterhunks(fp): |
|
2191 | 2194 | if state == 'file': |
|
2192 | 2195 | afile, bfile, first_hunk, gp = values |
|
2193 | 2196 | if gp: |
|
2194 |
gp.path = pathtransform(gp.path, strip - 1, |
|
|
2197 | gp.path = pathtransform(gp.path, strip - 1, prefix)[1] | |
|
2195 | 2198 | if gp.oldpath: |
|
2196 |
gp.oldpath = pathtransform(gp.oldpath, strip - 1, |
|
|
2199 | gp.oldpath = pathtransform(gp.oldpath, strip - 1, | |
|
2200 | prefix)[1] | |
|
2197 | 2201 | else: |
|
2198 | 2202 | gp = makepatchmeta(backend, afile, bfile, first_hunk, strip, |
|
2199 |
|
|
|
2203 | prefix) | |
|
2200 | 2204 | changed.add(gp.path) |
|
2201 | 2205 | if gp.op == 'RENAME': |
|
2202 | 2206 | changed.add(gp.oldpath) |
General Comments 0
You need to be logged in to leave comments.
Login now