##// END OF EJS Templates
addremove/findrenames: find renames according to the match object (issue1527)...
Benoit Boissinot -
r8489:1a96f1d9 default
parent child Browse files
Show More
@@ -252,10 +252,9 b' def matchall(repo):'
252 252 def matchfiles(repo, files):
253 253 return _match.exact(repo.root, repo.getcwd(), files)
254 254
255 def findrenames(repo, added=None, removed=None, threshold=0.5):
255 def findrenames(repo, match=None, threshold=0.5):
256 256 '''find renamed files -- yields (before, after, score) tuples'''
257 if added is None or removed is None:
258 added, removed = repo.status()[1:3]
257 added, removed = repo.status(match=match)[1:3]
259 258 ctx = repo['.']
260 259 for a in added:
261 260 aa = repo.wread(a)
@@ -310,7 +309,7 b' def addremove(repo, pats=[], opts={}, dr'
310 309 repo.remove(remove)
311 310 repo.add(add)
312 311 if similarity > 0:
313 for old, new, score in findrenames(repo, add, remove, similarity):
312 for old, new, score in findrenames(repo, m, similarity):
314 313 oldexact, newexact = m.exact(old), m.exact(new)
315 314 if repo.ui.verbose or not oldexact or not newexact:
316 315 oldrel, newrel = m.rel(old), m.rel(new)
@@ -46,4 +46,22 b' hg addremove -s foo'
46 46 hg addremove -s -1
47 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 67 true
@@ -18,3 +18,15 b' recording removal of tiny-file as rename'
18 18 abort: similarity must be a number
19 19 abort: similarity must be between 0 and 100
20 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