Show More
@@ -151,7 +151,6 b' def readgitpatch(fp, firstline=None):' | |||||
151 | self.oldpath = None |
|
151 | self.oldpath = None | |
152 | self.mode = None |
|
152 | self.mode = None | |
153 | self.op = 'MODIFY' |
|
153 | self.op = 'MODIFY' | |
154 | self.copymod = False |
|
|||
155 | self.lineno = 0 |
|
154 | self.lineno = 0 | |
156 | self.binary = False |
|
155 | self.binary = False | |
157 |
|
156 | |||
@@ -182,7 +181,6 b' def readgitpatch(fp, firstline=None):' | |||||
182 | elif gp: |
|
181 | elif gp: | |
183 | if line.startswith('--- '): |
|
182 | if line.startswith('--- '): | |
184 | if gp.op in ('COPY', 'RENAME'): |
|
183 | if gp.op in ('COPY', 'RENAME'): | |
185 | gp.copymod = True |
|
|||
186 | dopatch |= GP_FILTER |
|
184 | dopatch |= GP_FILTER | |
187 | gitpatches.append(gp) |
|
185 | gitpatches.append(gp) | |
188 | gp = None |
|
186 | gp = None | |
@@ -858,7 +856,7 b' def applydiff(ui, fp, changed, strip=1, ' | |||||
858 |
|
856 | |||
859 | (dopatch, gitpatches) = readgitpatch(fp, firstline) |
|
857 | (dopatch, gitpatches) = readgitpatch(fp, firstline) | |
860 | for gp in gitpatches: |
|
858 | for gp in gitpatches: | |
861 |
if gp. |
|
859 | if gp.op in ('COPY', 'RENAME'): | |
862 | copyfile(gp.oldpath, gp.path, basedir=cwd) |
|
860 | copyfile(gp.oldpath, gp.path, basedir=cwd) | |
863 |
|
861 | |||
864 | fp.seek(pos) |
|
862 | fp.seek(pos) | |
@@ -1030,15 +1028,13 b' def updatedir(ui, repo, patches):' | |||||
1030 | for f in patches: |
|
1028 | for f in patches: | |
1031 | ctype, gp = patches[f] |
|
1029 | ctype, gp = patches[f] | |
1032 | if ctype == 'RENAME': |
|
1030 | if ctype == 'RENAME': | |
1033 |
copies.append((gp.oldpath, gp.path |
|
1031 | copies.append((gp.oldpath, gp.path)) | |
1034 | removes[gp.oldpath] = 1 |
|
1032 | removes[gp.oldpath] = 1 | |
1035 | elif ctype == 'COPY': |
|
1033 | elif ctype == 'COPY': | |
1036 |
copies.append((gp.oldpath, gp.path |
|
1034 | copies.append((gp.oldpath, gp.path)) | |
1037 | elif ctype == 'DELETE': |
|
1035 | elif ctype == 'DELETE': | |
1038 | removes[gp.path] = 1 |
|
1036 | removes[gp.path] = 1 | |
1039 |
for src, dst |
|
1037 | for src, dst in copies: | |
1040 | if not after: |
|
|||
1041 | copyfile(src, dst, repo.root) |
|
|||
1042 | repo.copy(src, dst) |
|
1038 | repo.copy(src, dst) | |
1043 | removes = removes.keys() |
|
1039 | removes = removes.keys() | |
1044 | if removes: |
|
1040 | if removes: |
@@ -198,3 +198,19 b' index 0000000..257cc56' | |||||
198 | EOF |
|
198 | EOF | |
199 | cat "foo bar" |
|
199 | cat "foo bar" | |
200 |
|
200 | |||
|
201 | echo % copy then modify the original file | |||
|
202 | hg import -m copy-mod-orig - <<EOF | |||
|
203 | diff --git a/foo2 b/foo2 | |||
|
204 | index 257cc56..fe08ec6 100644 | |||
|
205 | --- a/foo2 | |||
|
206 | +++ b/foo2 | |||
|
207 | @@ -1 +1,2 @@ | |||
|
208 | foo | |||
|
209 | +new line | |||
|
210 | diff --git a/foo2 b/foo3 | |||
|
211 | similarity index 100% | |||
|
212 | copy from foo2 | |||
|
213 | copy to foo3 | |||
|
214 | EOF | |||
|
215 | ||||
|
216 | cat foo3 |
General Comments 0
You need to be logged in to leave comments.
Login now