Show More
@@ -252,10 +252,9 b' def matchall(repo):' | |||||
252 | def matchfiles(repo, files): |
|
252 | def matchfiles(repo, files): | |
253 | return _match.exact(repo.root, repo.getcwd(), files) |
|
253 | return _match.exact(repo.root, repo.getcwd(), files) | |
254 |
|
254 | |||
255 |
def findrenames(repo, |
|
255 | def findrenames(repo, match=None, threshold=0.5): | |
256 | '''find renamed files -- yields (before, after, score) tuples''' |
|
256 | '''find renamed files -- yields (before, after, score) tuples''' | |
257 | if added is None or removed is None: |
|
257 | added, removed = repo.status(match=match)[1:3] | |
258 | added, removed = repo.status()[1:3] |
|
|||
259 | ctx = repo['.'] |
|
258 | ctx = repo['.'] | |
260 | for a in added: |
|
259 | for a in added: | |
261 | aa = repo.wread(a) |
|
260 | aa = repo.wread(a) | |
@@ -310,7 +309,7 b' def addremove(repo, pats=[], opts={}, dr' | |||||
310 | repo.remove(remove) |
|
309 | repo.remove(remove) | |
311 | repo.add(add) |
|
310 | repo.add(add) | |
312 | if similarity > 0: |
|
311 | if similarity > 0: | |
313 |
for old, new, score in findrenames(repo, |
|
312 | for old, new, score in findrenames(repo, m, similarity): | |
314 | oldexact, newexact = m.exact(old), m.exact(new) |
|
313 | oldexact, newexact = m.exact(old), m.exact(new) | |
315 | if repo.ui.verbose or not oldexact or not newexact: |
|
314 | if repo.ui.verbose or not oldexact or not newexact: | |
316 | oldrel, newrel = m.rel(old), m.rel(new) |
|
315 | oldrel, newrel = m.rel(old), m.rel(new) |
@@ -46,4 +46,22 b' hg addremove -s foo' | |||||
46 | hg addremove -s -1 |
|
46 | hg addremove -s -1 | |
47 | hg addremove -s 1e6 |
|
47 | hg addremove -s 1e6 | |
48 |
|
48 | |||
|
49 | cd .. | |||
|
50 | ||||
|
51 | echo '% issue 1527' | |||
|
52 | hg init rep3; cd rep3 | |||
|
53 | mkdir d | |||
|
54 | echo a > d/a | |||
|
55 | hg add d/a | |||
|
56 | hg commit -m 1 | |||
|
57 | ||||
|
58 | mv d/a d/b | |||
|
59 | hg addremove -s80 | |||
|
60 | hg debugstate | |||
|
61 | mv d/b c | |||
|
62 | echo "% no copies found here (since the target isn't in d" | |||
|
63 | hg addremove -s80 d | |||
|
64 | echo "% copies here" | |||
|
65 | hg addremove -s80 | |||
|
66 | ||||
49 | true |
|
67 | true |
@@ -18,3 +18,15 b' recording removal of tiny-file as rename' | |||||
18 | abort: similarity must be a number |
|
18 | abort: similarity must be a number | |
19 | abort: similarity must be between 0 and 100 |
|
19 | abort: similarity must be between 0 and 100 | |
20 | abort: similarity must be between 0 and 100 |
|
20 | abort: similarity must be between 0 and 100 | |
|
21 | % issue 1527 | |||
|
22 | removing d/a | |||
|
23 | adding d/b | |||
|
24 | recording removal of d/a as rename to d/b (100% similar) | |||
|
25 | r 0 0 1970-01-01 00:00:00 d/a | |||
|
26 | a 0 -1 unset d/b | |||
|
27 | copy: d/a -> d/b | |||
|
28 | % no copies found here (since the target isn't in d | |||
|
29 | removing d/b | |||
|
30 | % copies here | |||
|
31 | adding c | |||
|
32 | recording removal of d/a as rename to c (100% similar) |
General Comments 0
You need to be logged in to leave comments.
Login now