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