copies: don't detect copies as "divergent renames"
(For the purposes of this patch copy is defined as a rename where the
source continues to exist.)
--- a/mercurial/copies.py Sat Oct 09 11:02:11 2010 -0500
+++ b/mercurial/copies.py Sun Oct 10 09:48:37 2010 -0500
@@ -195,8 +195,8 @@
diverge2 = set()
for of, fl in diverge.items():
- if len(fl) == 1:
- del diverge[of] # not actually divergent
+ if len(fl) == 1 or of in c2:
+ del diverge[of] # not actually divergent, or not a rename
else:
diverge2.update(fl) # reverse map for below
--- a/tests/test-rename-merge1.t Sat Oct 09 11:02:11 2010 -0500
+++ b/tests/test-rename-merge1.t Sun Oct 10 09:48:37 2010 -0500
@@ -75,3 +75,27 @@
$ hg debugrename b
b renamed from a:dd03b83622e78778b403775d0d074b9ac7387a66
+This used to trigger a "divergent renames" warning, despite no renames
+
+ $ hg cp b b3
+ $ hg cp b b4
+ $ hg ci -A -m 'copy b twice'
+ $ hg up eb92d88a9712
+ 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+ $ hg up
+ 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ hg rm b3 b4
+ $ hg ci -m 'clean up a bit of our mess'
+
+We'd rather not warn on divergent renames done in the same changeset (issue2113)
+
+ $ hg cp b b3
+ $ hg mv b b4
+ $ hg ci -A -m 'divergent renames in same changeset'
+ $ hg up c761c6948de0
+ 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+ $ hg up
+ warning: detected divergent renames of b to:
+ b3
+ b4
+ 2 files updated, 0 files merged, 1 files removed, 0 files unresolved