##// 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 def updatedir(ui, repo, patches, wlock=N
341 341 if not patches:
342 342 return
343 343 copies = []
344 removes = []
344 removes = {}
345 345 cfiles = patches.keys()
346 346 cwd = repo.getcwd()
347 347 if cwd:
@@ -350,16 +350,18 def updatedir(ui, repo, patches, wlock=N
350 350 ctype, gp = patches[f]
351 351 if ctype == 'RENAME':
352 352 copies.append((gp.oldpath, gp.path, gp.copymod))
353 removes.append(gp.oldpath)
353 removes[gp.oldpath] = 1
354 354 elif ctype == 'COPY':
355 355 copies.append((gp.oldpath, gp.path, gp.copymod))
356 356 elif ctype == 'DELETE':
357 removes.append(gp.path)
357 removes[gp.path] = 1
358 358 for src, dst, after in copies:
359 359 if not after:
360 360 copyfile(src, dst, repo.root)
361 361 repo.copy(src, dst, wlock=wlock)
362 removes = removes.keys()
362 363 if removes:
364 removes.sort()
363 365 repo.remove(removes, True, wlock=wlock)
364 366 for f in patches:
365 367 ctype, gp = patches[f]
@@ -127,3 +127,19 EOF
127 127
128 128 hg locate copy2
129 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 a
37 37 b
38 38 c
39 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