diff tests/test_rebuildmeta.py @ 821:f28e0f54a6ef

svnmeta: store youngest revision pulled from subversion This prevents re-pulling the same revision over and over, which was a problem when the most recent revision was a tagging revision that wouldn't exist properly in the revmap. This should also allow users to not re-pull huge volumes of commits that have no effect on the hg repository.
author Augie Fackler <durin42@gmail.com>
date Tue, 24 May 2011 21:07:27 -0500
parents 86d124a8768e
children e9af7eba88db
line wrap: on
line diff
--- a/tests/test_rebuildmeta.py
+++ b/tests/test_rebuildmeta.py
@@ -12,6 +12,17 @@ from mercurial import ui
 from hgsubversion import svncommands
 from hgsubversion import svnmeta
 
+# These test repositories have harmless skew in rebuildmeta for the
+# last-pulled-rev because the last rev in svn causes absolutely no
+# changes in hg.
+expect_youngest_skew = [('file_mixed_with_branches.svndump', False, False),
+                        ('file_mixed_with_branches.svndump', True, False),
+                        ('unrelatedbranch.svndump', False, False),
+                        ('unrelatedbranch.svndump', True, False),
+                        ]
+
+
+
 def _do_case(self, name, stupid, single):
     subdir = test_util.subdir.get(name, '')
     layout = 'auto'
@@ -44,12 +55,18 @@ def _do_case(self, name, stupid, single)
     self.assertTrue(os.path.isdir(os.path.join(src.path, 'svn')),
                     'no .hg/svn directory in the destination!')
     dest = hg.repository(u, os.path.dirname(dest.path))
-    for tf in ('rev_map', 'uuid', 'tagmap', 'layout', 'subdir', ):
+    for tf in ('lastpulled', 'rev_map', 'uuid', 'tagmap', 'layout', 'subdir', ):
+
         stf = os.path.join(src.path, 'svn', tf)
         self.assertTrue(os.path.isfile(stf), '%r is missing!' % stf)
         dtf = os.path.join(dest.path, 'svn', tf)
         self.assertTrue(os.path.isfile(dtf), '%r is missing!' % tf)
         old, new = open(stf).read(), open(dtf).read()
+        if tf == 'lastpulled' and (name,
+                                   stupid, single) in expect_youngest_skew:
+            self.assertNotEqual(old, new,
+                                'rebuildmeta unexpected match on youngest rev!')
+            continue
         self.assertMultiLineEqual(old, new)
         self.assertEqual(src.branchtags(), dest.branchtags())
     srcbi = pickle.load(open(os.path.join(src.path, 'svn', 'branch_info')))