##// END OF EJS Templates
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho -
r3701:05c8704a default
parent child Browse files
Show More
@@ -341,7 +341,7 b' def updatedir(ui, repo, patches, wlock=N'
341 if not patches:
341 if not patches:
342 return
342 return
343 copies = []
343 copies = []
344 removes = []
344 removes = {}
345 cfiles = patches.keys()
345 cfiles = patches.keys()
346 cwd = repo.getcwd()
346 cwd = repo.getcwd()
347 if cwd:
347 if cwd:
@@ -350,16 +350,18 b' def updatedir(ui, repo, patches, wlock=N'
350 ctype, gp = patches[f]
350 ctype, gp = patches[f]
351 if ctype == 'RENAME':
351 if ctype == 'RENAME':
352 copies.append((gp.oldpath, gp.path, gp.copymod))
352 copies.append((gp.oldpath, gp.path, gp.copymod))
353 removes.append(gp.oldpath)
353 removes[gp.oldpath] = 1
354 elif ctype == 'COPY':
354 elif ctype == 'COPY':
355 copies.append((gp.oldpath, gp.path, gp.copymod))
355 copies.append((gp.oldpath, gp.path, gp.copymod))
356 elif ctype == 'DELETE':
356 elif ctype == 'DELETE':
357 removes.append(gp.path)
357 removes[gp.path] = 1
358 for src, dst, after in copies:
358 for src, dst, after in copies:
359 if not after:
359 if not after:
360 copyfile(src, dst, repo.root)
360 copyfile(src, dst, repo.root)
361 repo.copy(src, dst, wlock=wlock)
361 repo.copy(src, dst, wlock=wlock)
362 removes = removes.keys()
362 if removes:
363 if removes:
364 removes.sort()
363 repo.remove(removes, True, wlock=wlock)
365 repo.remove(removes, True, wlock=wlock)
364 for f in patches:
366 for f in patches:
365 ctype, gp = patches[f]
367 ctype, gp = patches[f]
@@ -127,3 +127,19 b' EOF'
127
127
128 hg locate copy2
128 hg locate copy2
129 hg cat rename2
129 hg cat rename2
130
131 echo % one file renamed multiple times
132 hg import -mmultirenames - <<EOF
133 diff --git a/rename2 b/rename3
134 rename from rename2
135 rename to rename3
136 diff --git a/rename2 b/rename3-2
137 rename from rename2
138 rename to rename3-2
139 EOF
140 hg log -vCr. --template '{rev} {files} / {file_copies%filecopy}\n'
141
142 hg locate rename2 rename3 rename3-2
143 hg cat rename3
144 echo
145 hg cat rename3-2
@@ -37,3 +37,20 b' a'
37 b
37 b
38 c
38 c
39 a
39 a
40 % one file renamed multiple times
41 applying patch from stdin
42 9 rename2 rename3 rename3-2 / rename3 (rename2)rename3-2 (rename2)
43 rename2: No such file or directory
44 rename3
45 rename3-2
46 a
47 a
48 b
49 c
50 a
51
52 a
53 a
54 b
55 c
56 a
General Comments 0
You need to be logged in to leave comments. Login now