Show More
@@ -469,6 +469,7 b' def diff(repo, node1=None, node2=None, f' | |||||
469 |
|
469 | |||
470 | def renamedbetween(f, n1, n2): |
|
470 | def renamedbetween(f, n1, n2): | |
471 | r1, r2 = map(repo.changelog.rev, (n1, n2)) |
|
471 | r1, r2 = map(repo.changelog.rev, (n1, n2)) | |
|
472 | orig = f | |||
472 | src = None |
|
473 | src = None | |
473 | while r2 > r1: |
|
474 | while r2 > r1: | |
474 | cl = getchangelog(n2) |
|
475 | cl = getchangelog(n2) | |
@@ -482,7 +483,13 b' def diff(repo, node1=None, node2=None, f' | |||||
482 | f = src[0] |
|
483 | f = src[0] | |
483 | n2 = repo.changelog.parents(n2)[0] |
|
484 | n2 = repo.changelog.parents(n2)[0] | |
484 | r2 = repo.changelog.rev(n2) |
|
485 | r2 = repo.changelog.rev(n2) | |
485 | return src |
|
486 | if orig == f: | |
|
487 | return None | |||
|
488 | cl = getchangelog(n1) | |||
|
489 | m = getmanifest(cl[0]) | |||
|
490 | if f not in m: | |||
|
491 | return None | |||
|
492 | return f, m[f] | |||
486 |
|
493 | |||
487 | if node2: |
|
494 | if node2: | |
488 | change = getchangelog(node2) |
|
495 | change = getchangelog(node2) |
@@ -73,3 +73,24 b' hg mv dst2 dst3' | |||||
73 | hg ci -m 'mv dst2 dst3; revert start' -d '0 0' |
|
73 | hg ci -m 'mv dst2 dst3; revert start' -d '0 0' | |
74 |
|
74 | |||
75 | hg diff --git -r 9:11 |
|
75 | hg diff --git -r 9:11 | |
|
76 | ||||
|
77 | echo a >> foo | |||
|
78 | hg add foo | |||
|
79 | hg ci -m 'add foo' | |||
|
80 | echo b >> foo | |||
|
81 | hg ci -m 'change foo' | |||
|
82 | hg mv foo bar | |||
|
83 | hg ci -m 'mv foo bar' | |||
|
84 | echo c >> bar | |||
|
85 | hg ci -m 'change bar' | |||
|
86 | ||||
|
87 | echo | |||
|
88 | echo '% file created before r1 and renamed before r2' | |||
|
89 | hg diff --git -r -3:-1 | |||
|
90 | echo | |||
|
91 | echo '% file created in r1 and renamed before r2' | |||
|
92 | hg diff --git -r -4:-1 | |||
|
93 | echo | |||
|
94 | echo '% file created after r1 and renamed before r2' | |||
|
95 | hg diff --git -r -5:-1 | |||
|
96 |
@@ -70,3 +70,35 b' applying b.diff' | |||||
70 | diff --git a/dst2 b/dst3 |
|
70 | diff --git a/dst2 b/dst3 | |
71 | rename from dst2 |
|
71 | rename from dst2 | |
72 | rename to dst3 |
|
72 | rename to dst3 | |
|
73 | ||||
|
74 | % file created before r1 and renamed before r2 | |||
|
75 | diff --git a/foo b/bar | |||
|
76 | rename from foo | |||
|
77 | rename to bar | |||
|
78 | --- a/bar | |||
|
79 | +++ b/bar | |||
|
80 | @@ -1,2 +1,3 @@ a | |||
|
81 | a | |||
|
82 | b | |||
|
83 | +c | |||
|
84 | ||||
|
85 | % file created in r1 and renamed before r2 | |||
|
86 | diff --git a/foo b/bar | |||
|
87 | rename from foo | |||
|
88 | rename to bar | |||
|
89 | --- a/bar | |||
|
90 | +++ b/bar | |||
|
91 | @@ -1,1 +1,3 @@ a | |||
|
92 | a | |||
|
93 | +b | |||
|
94 | +c | |||
|
95 | ||||
|
96 | % file created after r1 and renamed before r2 | |||
|
97 | diff --git a/bar b/bar | |||
|
98 | new file mode 100644 | |||
|
99 | --- /dev/null | |||
|
100 | +++ b/bar | |||
|
101 | @@ -0,0 +1,3 @@ | |||
|
102 | +a | |||
|
103 | +b | |||
|
104 | +c |
General Comments 0
You need to be logged in to leave comments.
Login now