diff tests/test_fetch_renames.py @ 69:63ece4ea25c9

hg_delta_editor: register copies only if files are unchanged between source and dest Handle copies of items from revision X into revision Y where X is not the parent of Y. This cannot happen in Mercurial because copies always happen between parents and children. A file copy is recorded if: 1- Source and destination revs are in the same branch. 2- The file is unchanged (content, type, removal) through all revisions between destination and source, not including source and destination. Directory copies are registered only if the previous rules apply on all copied items. [1] is there because file copies across branches are meaningless in Mercurial world. We could have tried to remap the source rev to a similar one in the correct branch, but anyway the intent is wrong. [2] is more questionable but I think it's better this way for we live in a non-perfect svn world. In theory, 99% of copies out there should come from the direct parent. But the direct parent is a fuzzy notion when you can have a working directory composed of different directory at different revisions. So we assume that stuff copied from past revisions exactly matching the content of the direct parent revision is really copied from the parent revision. The alternative would be to discard the copy, which would always happen unless people kept updating the working directory after every commit (see tests).
author Patrick Mezard <pmezard@gmail.com>
date Wed, 05 Nov 2008 13:37:08 +0100
parents e0c86ebe05e3
children 9c1b53abefcb
line wrap: on
line diff
--- a/tests/test_fetch_renames.py
+++ b/tests/test_fetch_renames.py
@@ -53,6 +53,10 @@ class TestFetchRenames(unittest.TestCase
                 },
             5: {
                 'c1': ('c', 'c\nc\n'),
+                },
+            9: {
+                'unchanged2': ('unchanged', 'unchanged\n'),
+                'unchangeddir2/f': ('unchangeddir/f', 'unchanged2\n'),
                 }
             }
         for rev in repo:
@@ -60,7 +64,8 @@ class TestFetchRenames(unittest.TestCase
             copymap = copies.get(rev, {})
             for f in ctx.manifest():
                 cp = ctx[f].renamed()
-                self.assertEqual(bool(cp), bool(copymap.get(f)))
+                self.assertEqual(bool(cp), bool(copymap.get(f)),
+                                 'copy records differ for %s in %d' % (f, rev))
                 if not cp:
                     continue
                 self.assertEqual(cp[0], copymap[f][0])