Show More
@@ -467,6 +467,9 b' def diff(repo, node1=None, node2=None, f' | |||
|
467 | 467 | if not modified and not added and not removed: |
|
468 | 468 | return |
|
469 | 469 | |
|
470 | # returns False if there was no rename between n1 and n2 | |
|
471 | # returns None if the file was created between n1 and n2 | |
|
472 | # returns the (file, node) present in n1 that was renamed to f in n2 | |
|
470 | 473 | def renamedbetween(f, n1, n2): |
|
471 | 474 | r1, r2 = map(repo.changelog.rev, (n1, n2)) |
|
472 | 475 | orig = f |
@@ -483,12 +486,12 b' def diff(repo, node1=None, node2=None, f' | |||
|
483 | 486 | f = src[0] |
|
484 | 487 | n2 = repo.changelog.parents(n2)[0] |
|
485 | 488 | r2 = repo.changelog.rev(n2) |
|
486 | if orig == f: | |
|
487 | return None | |
|
488 | 489 | cl = getchangelog(n1) |
|
489 | 490 | m = getmanifest(cl[0]) |
|
490 | 491 | if f not in m: |
|
491 | 492 | return None |
|
493 | if f == orig: | |
|
494 | return False | |
|
492 | 495 | return f, m[f] |
|
493 | 496 | |
|
494 | 497 | if node2: |
@@ -518,7 +521,7 b' def diff(repo, node1=None, node2=None, f' | |||
|
518 | 521 | if src: |
|
519 | 522 | f = src |
|
520 | 523 | of = renamedbetween(f, node1, parent) |
|
521 | if of: | |
|
524 | if of or of is None: | |
|
522 | 525 | return of |
|
523 | 526 | elif src: |
|
524 | 527 | cl = getchangelog(parent)[0] |
@@ -112,3 +112,18 b' hg diff --git' | |||
|
112 | 112 | echo |
|
113 | 113 | echo "% ...but there's another copy between the original rev and the wd" |
|
114 | 114 | hg diff --git -r -2 |
|
115 | echo | |
|
116 | echo "% ...but the source of the copy was created after the original rev" | |
|
117 | hg diff --git -r -3 | |
|
118 | hg ci -m 'mv created2 created3' | |
|
119 | ||
|
120 | echo > brand-new | |
|
121 | hg add brand-new | |
|
122 | hg ci -m 'add brand-new' | |
|
123 | hg mv brand-new brand-new2 | |
|
124 | echo '% created in parent of wd; renamed in the wd' | |
|
125 | hg diff --git | |
|
126 | ||
|
127 | echo | |
|
128 | echo '% created between r1 and parent of wd; renamed in the wd' | |
|
129 | hg diff --git -r -2 |
@@ -113,3 +113,23 b' rename to created3' | |||
|
113 | 113 | diff --git a/created b/created3 |
|
114 | 114 | rename from created |
|
115 | 115 | rename to created3 |
|
116 | ||
|
117 | % ...but the source of the copy was created after the original rev | |
|
118 | diff --git a/created3 b/created3 | |
|
119 | new file mode 100644 | |
|
120 | --- /dev/null | |
|
121 | +++ b/created3 | |
|
122 | @@ -0,0 +1,1 @@ | |
|
123 | + | |
|
124 | % created in parent of wd; renamed in the wd | |
|
125 | diff --git a/brand-new b/brand-new2 | |
|
126 | rename from brand-new | |
|
127 | rename to brand-new2 | |
|
128 | ||
|
129 | % created between r1 and parent of wd; renamed in the wd | |
|
130 | diff --git a/brand-new2 b/brand-new2 | |
|
131 | new file mode 100644 | |
|
132 | --- /dev/null | |
|
133 | +++ b/brand-new2 | |
|
134 | @@ -0,0 +1,1 @@ | |
|
135 | + |
General Comments 0
You need to be logged in to leave comments.
Login now