# HG changeset patch # User Augie Fackler # Date 1465182106 14400 # Node ID ab15749252b0f4a3beedc111099b7d5094358b89 # Parent 59d4b24a0f47f45aa4a506df8bf5c484b7dc6cfb 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. diff --git a/hgsubversion/maps.py b/hgsubversion/maps.py --- 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: diff --git a/tests/test_tags.py b/tests/test_tags.py --- 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):