changeset 1439:ab15749252b0

TagMap: stop automagically running 'hg svn rebuildmeta' This resolves a layering violation that was causing us to hang on to a repo reference via meta. We don't change maps often enough to justify this.
author Augie Fackler <raf@durin42.com>
date Sun, 05 Jun 2016 23:01:46 -0400
parents 59d4b24a0f47
children 4d3a51e82147
files hgsubversion/maps.py tests/test_tags.py
diffstat 2 files changed, 6 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/maps.py
+++ b/hgsubversion/maps.py
@@ -3,11 +3,11 @@
 import errno
 import os
 import re
+from mercurial import error
 from mercurial import util as hgutil
 from mercurial.node import bin, hex, nullid
 
 import subprocess
-import svncommands
 import util
 
 class BaseMap(dict):
@@ -281,7 +281,6 @@ class Tags(dict):
 
     def __init__(self, meta, endrev=None):
         dict.__init__(self)
-        self.meta = meta
         self._filepath = meta.tagfile
         self._ui = meta.ui
         self.endrev = endrev
@@ -294,11 +293,8 @@ class Tags(dict):
         f = open(self._filepath)
         ver = int(f.readline())
         if ver < self.VERSION:
-            self._ui.status('tag map outdated, running rebuildmeta...\n')
-            f.close()
-            os.unlink(self._filepath)
-            svncommands.rebuildmeta(self._ui, self.meta.repo, ())
-            return
+            raise error.Abort(
+                'tag map outdated, please run `hg svn rebuildmeta`')
         elif ver != self.VERSION:
             raise hgutil.Abort('tagmap too new -- please upgrade')
         for l in f:
--- a/tests/test_tags.py
+++ b/tests/test_tags.py
@@ -4,6 +4,7 @@ import os, sys, cStringIO, difflib
 import unittest
 
 from mercurial import commands
+from mercurial import error
 from mercurial import hg
 from mercurial import node
 from mercurial import ui
@@ -164,14 +165,12 @@ rename a tag
              'magic2': '\xa3\xa2D\x86aM\xc0v\xb9\xb0\x18\x14\xad\xacwBUi}\xe2',
              })
 
-    def test_old_tag_map_rebuilds(self):
+    def test_old_tag_map_aborts(self):
         repo = self._load_fixture_and_fetch('tag_name_same_as_branch.svndump')
         tm = os.path.join(repo.path, 'svn', 'tagmap')
         open(tm, 'w').write('1\n')
         # force tags to load since it is lazily loaded when needed
-        repo.svnmeta().tags
-        commands.pull(repo.ui, repo)
-        self.assertEqual(open(tm).read().splitlines()[0], '2')
+        self.assertRaises(error.Abort, lambda: repo.svnmeta().tags)
 
     def _debug_print_tags(self, repo, ctx, fp):
         def formatnode(ctx):