##// END OF EJS Templates
diff: improve detection of renames when diffing across many revisions
Alexis S. L. Carvalho -
r3693:454b3a8c default
parent child Browse files
Show More
@@ -471,14 +471,15 b' def diff(repo, node1=None, node2=None, f'
471 r1, r2 = map(repo.changelog.rev, (n1, n2))
471 r1, r2 = map(repo.changelog.rev, (n1, n2))
472 src = None
472 src = None
473 while r2 > r1:
473 while r2 > r1:
474 cl = getchangelog(n2)[0]
474 cl = getchangelog(n2)
475 m = getmanifest(cl)
475 if f in cl[3]:
476 try:
476 m = getmanifest(cl[0])
477 src = getfile(f).renamed(m[f])
477 try:
478 except KeyError:
478 src = getfile(f).renamed(m[f])
479 return None
479 except KeyError:
480 if src:
480 return None
481 f = src[0]
481 if src:
482 f = src[0]
482 n2 = repo.changelog.parents(n2)[0]
483 n2 = repo.changelog.parents(n2)[0]
483 r2 = repo.changelog.rev(n2)
484 r2 = repo.changelog.rev(n2)
484 return src
485 return src
@@ -60,3 +60,16 b' rm binfile.bin'
60 hg import -mfoo b.diff
60 hg import -mfoo b.diff
61 cmp binfile.bin $TESTDIR/binfile.bin
61 cmp binfile.bin $TESTDIR/binfile.bin
62
62
63 echo
64 echo '% diff across many revisions'
65 hg mv dst dst2
66 hg ci -m 'mv dst dst2' -d '0 0'
67
68 echo >> start
69 hg ci -m 'change start' -d '0 0'
70
71 hg revert -r -2 start
72 hg mv dst2 dst3
73 hg ci -m 'mv dst2 dst3; revert start' -d '0 0'
74
75 hg diff --git -r 9:11
@@ -65,3 +65,8 b' fQItJW-{SoTm)8|5##k|m00000NkvXXu0mjf{mKw'
65
65
66 % import binary diff
66 % import binary diff
67 applying b.diff
67 applying b.diff
68
69 % diff across many revisions
70 diff --git a/dst2 b/dst3
71 rename from dst2
72 rename to dst3
General Comments 0
You need to be logged in to leave comments. Login now