Show More
@@ -151,7 +151,6 b' def readgitpatch(fp, firstline=None):' | |||
|
151 | 151 | self.oldpath = None |
|
152 | 152 | self.mode = None |
|
153 | 153 | self.op = 'MODIFY' |
|
154 | self.copymod = False | |
|
155 | 154 | self.lineno = 0 |
|
156 | 155 | self.binary = False |
|
157 | 156 | |
@@ -182,7 +181,6 b' def readgitpatch(fp, firstline=None):' | |||
|
182 | 181 | elif gp: |
|
183 | 182 | if line.startswith('--- '): |
|
184 | 183 | if gp.op in ('COPY', 'RENAME'): |
|
185 | gp.copymod = True | |
|
186 | 184 | dopatch |= GP_FILTER |
|
187 | 185 | gitpatches.append(gp) |
|
188 | 186 | gp = None |
@@ -858,7 +856,7 b' def applydiff(ui, fp, changed, strip=1, ' | |||
|
858 | 856 | |
|
859 | 857 | (dopatch, gitpatches) = readgitpatch(fp, firstline) |
|
860 | 858 | for gp in gitpatches: |
|
861 |
if gp. |
|
|
859 | if gp.op in ('COPY', 'RENAME'): | |
|
862 | 860 | copyfile(gp.oldpath, gp.path, basedir=cwd) |
|
863 | 861 | |
|
864 | 862 | fp.seek(pos) |
@@ -1030,15 +1028,13 b' def updatedir(ui, repo, patches):' | |||
|
1030 | 1028 | for f in patches: |
|
1031 | 1029 | ctype, gp = patches[f] |
|
1032 | 1030 | if ctype == 'RENAME': |
|
1033 |
copies.append((gp.oldpath, gp.path |
|
|
1031 | copies.append((gp.oldpath, gp.path)) | |
|
1034 | 1032 | removes[gp.oldpath] = 1 |
|
1035 | 1033 | elif ctype == 'COPY': |
|
1036 |
copies.append((gp.oldpath, gp.path |
|
|
1034 | copies.append((gp.oldpath, gp.path)) | |
|
1037 | 1035 | elif ctype == 'DELETE': |
|
1038 | 1036 | removes[gp.path] = 1 |
|
1039 |
for src, dst |
|
|
1040 | if not after: | |
|
1041 | copyfile(src, dst, repo.root) | |
|
1037 | for src, dst in copies: | |
|
1042 | 1038 | repo.copy(src, dst) |
|
1043 | 1039 | removes = removes.keys() |
|
1044 | 1040 | if removes: |
@@ -198,3 +198,19 b' index 0000000..257cc56' | |||
|
198 | 198 | EOF |
|
199 | 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