changeset 1570:d55c9d0ba350

tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
author Paul Morelle <paul.morelle@octobus.net>
date Fri, 25 May 2018 11:52:03 +0200
parents 4afe8d7e4602
children f8ca09a97492
files tests/test_fetch_branches.py tests/test_fetch_command.py tests/test_fetch_mappings.py tests/test_push_command.py tests/test_single_dir_clone.py tests/test_single_dir_push.py tests/test_tags.py tests/test_unaffected_core.py tests/test_util.py tests/test_utility_commands.py
diffstat 10 files changed, 217 insertions(+), 187 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test_fetch_branches.py
+++ b/tests/test_fetch_branches.py
@@ -8,6 +8,8 @@ from mercurial import node
 
 from hgsubversion import compathacks
 
+revsymbol = test_util.revsymbol
+
 class TestFetchBranches(test_util.TestBase):
     stupid_mode_tests = True
 
@@ -46,44 +48,44 @@ class TestFetchBranches(test_util.TestBa
 
     def test_unorderedbranch(self):
         repo = self._load_fixture_and_fetch('unorderedbranch.svndump')
-        r = repo['branch']
+        r = revsymbol(repo, 'branch')
         self.assertEqual(0, r.parents()[0].rev())
         self.assertEqual(['a', 'c', 'z'], sorted(r.manifest()))
 
     def test_renamed_branch_to_trunk(self):
         repo = self._load_fixture_and_fetch('branch_rename_to_trunk.svndump')
-        self.assertEqual(repo['default'].parents()[0].branch(), 'dev_branch')
-        self.assert_('iota' in repo['default'])
-        self.assertEqual(repo['old_trunk'].parents()[0].branch(), 'default')
-        self.assert_('iota' not in repo['old_trunk'])
+        self.assertEqual(revsymbol(repo, 'default').parents()[0].branch(), 'dev_branch')
+        self.assert_('iota' in revsymbol(repo, 'default'))
+        self.assertEqual(revsymbol(repo, 'old_trunk').parents()[0].branch(), 'default')
+        self.assert_('iota' not in revsymbol(repo, 'old_trunk'))
         expected = ['default', 'old_trunk']
         self.assertEqual(self.openbranches(repo), expected)
 
     def test_replace_trunk_with_branch(self):
         repo = self._load_fixture_and_fetch('replace_trunk_with_branch.svndump')
-        self.assertEqual(repo['default'].parents()[0].branch(), 'test')
-        self.assertEqual(repo['tip'].branch(), 'default')
-        self.assertEqual(repo['tip'].extra().get('close'), '1')
+        self.assertEqual(revsymbol(repo, 'default').parents()[0].branch(), 'test')
+        self.assertEqual(revsymbol(repo, 'tip').branch(), 'default')
+        self.assertEqual(revsymbol(repo, 'tip').extra().get('close'), '1')
         self.assertEqual(self.openbranches(repo), ['default'])
 
     def test_copybeforeclose(self):
         repo = self._load_fixture_and_fetch('copybeforeclose.svndump')
-        self.assertEqual(repo['tip'].branch(), 'test')
-        self.assertEqual(repo['test'].extra().get('close'), '1')
-        self.assertEqual(repo['test']['b'].data(), 'a\n')
+        self.assertEqual(revsymbol(repo, 'tip').branch(), 'test')
+        self.assertEqual(revsymbol(repo, 'test').extra().get('close'), '1')
+        self.assertEqual(revsymbol(repo, 'test')['b'].data(), 'a\n')
 
     def test_copyafterclose(self):
         repo = self._load_fixture_and_fetch('copyafterclose.svndump')
-        self.assertEqual(repo['tip'].branch(), 'test')
-        self.assert_('file' in repo['test'])
-        self.assertEqual(repo['test']['file'].data(), 'trunk2\n')
-        self.assert_('dir/file' in repo['test'])
-        self.assertEqual(repo['test']['dir/file'].data(), 'trunk2\n')
+        self.assertEqual(revsymbol(repo, 'tip').branch(), 'test')
+        self.assert_('file' in revsymbol(repo, 'test'))
+        self.assertEqual(revsymbol(repo, 'test')['file'].data(), 'trunk2\n')
+        self.assert_('dir/file' in revsymbol(repo, 'test'))
+        self.assertEqual(revsymbol(repo, 'test')['dir/file'].data(), 'trunk2\n')
 
 
     def test_branch_create_with_dir_delete_works(self):
         repo = self._load_fixture_and_fetch('branch_create_with_dir_delete.svndump')
-        self.assertEqual(sorted(repo['tip'].manifest().keys()),
+        self.assertEqual(sorted(revsymbol(repo, 'tip').manifest().keys()),
                          ['alpha', 'beta', 'gamma', 'iota', ])
 
     def test_branch_tip_update_to_default(self):
@@ -115,13 +117,13 @@ class TestFetchBranches(test_util.TestBa
         openb, closedb = self.branches(repo)
         self.assertEqual(openb, [])
         self.assertEqual(closedb, ['dev_branch'])
-        self.assertEqual(list(repo['dev_branch']), ['foo'])
+        self.assertEqual(list(revsymbol(repo, 'dev_branch')), ['foo'])
 
     def test_replace_branch_with_branch(self):
         repo = self._load_fixture_and_fetch('replace_branch_with_branch.svndump')
         self.assertEqual(7, test_util.repolen(repo))
         # tip is former topological branch1 being closed
-        ctx = repo['tip']
+        ctx = revsymbol(repo, 'tip')
         self.assertEqual('1', ctx.extra().get('close', '0'))
         self.assertEqual('branch1', ctx.branch())
         # r5 is where the replacement takes place
--- a/tests/test_fetch_command.py
+++ b/tests/test_fetch_command.py
@@ -10,6 +10,8 @@ from mercurial import node
 from mercurial import ui
 from mercurial import encoding
 
+revsymbol = test_util.revsymbol
+
 class TestBasicRepoLayout(test_util.TestBase):
     stupid_mode_tests = True
 
@@ -21,31 +23,31 @@ class TestBasicRepoLayout(test_util.Test
 
     def test_fresh_fetch_single_rev(self):
         repo = self._load_fixture_and_fetch('single_rev.svndump')
-        self.assertEqual(node.hex(repo['tip'].node()),
+        self.assertEqual(node.hex(revsymbol(repo, 'tip').node()),
                          '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
-        self.assertEqual(repo['tip'].extra()['convert_revision'],
+        self.assertEqual(revsymbol(repo, 'tip').extra()['convert_revision'],
                          'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/trunk@2')
-        self.assertEqual(repo['tip'], repo[0])
+        self.assertEqual(revsymbol(repo, 'tip'), repo[0])
 
     def test_fresh_fetch_two_revs(self):
         repo = self._load_fixture_and_fetch('two_revs.svndump')
         self.assertEqual(node.hex(repo[0].node()),
                          '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
-        self.assertEqual(node.hex(repo['tip'].node()),
+        self.assertEqual(node.hex(revsymbol(repo, 'tip').node()),
                          'c95251e0dd04697deee99b79cc407d7db76e6a5f')
-        self.assertEqual(repo['tip'], repo[1])
+        self.assertEqual(revsymbol(repo, 'tip'), repo[1])
 
     def test_branches(self):
         repo = self._load_fixture_and_fetch('simple_branch.svndump')
         self.assertEqual(node.hex(repo[0].node()),
                          'a1ff9f5d90852ce7f8e607fa144066b0a06bdc57')
-        self.assertEqual(node.hex(repo['tip'].node()),
+        self.assertEqual(node.hex(revsymbol(repo, 'tip').node()),
                          '545e36ed13615e39c5c8fb0c325109d8cb8e00c3')
-        self.assertEqual(len(repo['tip'].parents()), 1)
-        self.assertEqual(repo['tip'].parents()[0], repo['default'])
-        self.assertEqual(repo['tip'].extra()['convert_revision'],
+        self.assertEqual(len(revsymbol(repo, 'tip').parents()), 1)
+        self.assertEqual(revsymbol(repo, 'tip').parents()[0], revsymbol(repo, 'default'))
+        self.assertEqual(revsymbol(repo, 'tip').extra()['convert_revision'],
                          'svn:3cd547df-371e-4add-bccf-aba732a2baf5/branches/the_branch@4')
-        self.assertEqual(repo['default'].extra()['convert_revision'],
+        self.assertEqual(revsymbol(repo, 'default').extra()['convert_revision'],
                          'svn:3cd547df-371e-4add-bccf-aba732a2baf5/trunk@3')
         self.assertEqual(len(repo.heads()), 1)
 
@@ -53,14 +55,14 @@ class TestBasicRepoLayout(test_util.Test
         repo = self._load_fixture_and_fetch('two_heads.svndump')
         self.assertEqual(node.hex(repo[0].node()),
                          '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
-        self.assertEqual(node.hex(repo['tip'].node()),
+        self.assertEqual(node.hex(revsymbol(repo, 'tip').node()),
                          '1083037b18d85cd84fa211c5adbaeff0fea2cd9f')
-        self.assertEqual(node.hex(repo['the_branch'].node()),
+        self.assertEqual(node.hex(revsymbol(repo, 'the_branch').node()),
                          '4e256962fc5df545e2e0a51d0d1dc61c469127e6')
-        self.assertEqual(node.hex(repo['the_branch'].parents()[0].node()),
+        self.assertEqual(node.hex(revsymbol(repo, 'the_branch').parents()[0].node()),
                          'f1ff5b860f5dbb9a59ad0921a79da77f10f25109')
-        self.assertEqual(len(repo['tip'].parents()), 1)
-        self.assertEqual(repo['tip'], repo['default'])
+        self.assertEqual(len(revsymbol(repo, 'tip').parents()), 1)
+        self.assertEqual(revsymbol(repo, 'tip'), revsymbol(repo, 'default'))
         self.assertEqual(len(repo.heads()), 2)
 
     def test_many_special_cases(self):
@@ -70,20 +72,20 @@ class TestBasicRepoLayout(test_util.Test
                          '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
         # two possible hashes for bw compat to hg < 1.5, since hg 1.5
         # sorts entries in extra()
-        self.assertTrue(node.hex(repo['tip'].node()) in
+        self.assertTrue(node.hex(revsymbol(repo, 'tip').node()) in
                          ('e92012d8c170a0236c84166167f149c2e28548c6',
                          'b7bdc73041b1852563deb1ef3f4153c2fe4484f2'))
-        self.assertEqual(node.hex(repo['the_branch'].node()),
+        self.assertEqual(node.hex(revsymbol(repo, 'the_branch').node()),
                          '4e256962fc5df545e2e0a51d0d1dc61c469127e6')
-        self.assertEqual(node.hex(repo['the_branch'].parents()[0].node()),
+        self.assertEqual(node.hex(revsymbol(repo, 'the_branch').parents()[0].node()),
                          'f1ff5b860f5dbb9a59ad0921a79da77f10f25109')
-        self.assertEqual(len(repo['tip'].parents()), 1)
-        self.assertEqual(repo['tip'], repo['default'])
+        self.assertEqual(len(revsymbol(repo, 'tip').parents()), 1)
+        self.assertEqual(revsymbol(repo, 'tip'), revsymbol(repo, 'default'))
         self.assertEqual(len(repo.heads()), 2)
 
     def test_file_mixed_with_branches(self):
         repo = self._load_fixture_and_fetch('file_mixed_with_branches.svndump')
-        self.assertEqual(node.hex(repo['default'].node()),
+        self.assertEqual(node.hex(revsymbol(repo, 'default').node()),
                          '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
         assert 'README' not in repo
         assert '../branches' not in repo
@@ -91,48 +93,48 @@ class TestBasicRepoLayout(test_util.Test
     def test_files_copied_from_outside_btt(self):
         repo = self._load_fixture_and_fetch(
             'test_files_copied_from_outside_btt.svndump')
-        self.assertEqual(node.hex(repo['tip'].node()),
+        self.assertEqual(node.hex(revsymbol(repo, 'tip').node()),
                          '3c78170e30ddd35f2c32faa0d8646ab75bba4f73')
         self.assertEqual(test_util.repolen(repo), 2)
 
     def test_file_renamed_in_from_outside_btt(self):
         repo = self._load_fixture_and_fetch(
                     'file_renamed_in_from_outside_btt.svndump')
-        self.assert_('LICENSE.file' in repo['default'])
+        self.assert_('LICENSE.file' in revsymbol(repo, 'default'))
 
     def test_renamed_dir_in_from_outside_btt_not_repo_root(self):
         repo = self._load_fixture_and_fetch(
                     'fetch_missing_files_subdir.svndump', subdir='foo')
-        self.assertEqual(node.hex(repo['tip'].node()),
+        self.assertEqual(node.hex(revsymbol(repo, 'tip').node()),
                          '269dcdd4361b2847e9f4288d4500e55d35df1f52')
-        self.assert_('bar/alpha' in repo['tip'])
-        self.assert_('foo' in repo['tip'])
-        self.assert_('bar/alpha' not in repo['tip'].parents()[0])
-        self.assert_('foo' in repo['tip'].parents()[0])
+        self.assert_('bar/alpha' in revsymbol(repo, 'tip'))
+        self.assert_('foo' in revsymbol(repo, 'tip'))
+        self.assert_('bar/alpha' not in revsymbol(repo, 'tip').parents()[0])
+        self.assert_('foo' in revsymbol(repo, 'tip').parents()[0])
 
     def test_oldest_not_trunk_and_tag_vendor_branch(self):
         repo = self._load_fixture_and_fetch(
             'tagged_vendor_and_oldest_not_trunk.svndump')
-        self.assertEqual(node.hex(repo['oldest'].node()),
+        self.assertEqual(node.hex(revsymbol(repo, 'oldest').node()),
                          '926671740dec045077ab20f110c1595f935334fa')
-        self.assertEqual(repo['tip'].parents()[0].parents()[0],
-                         repo['oldest'])
-        self.assertEqual(node.hex(repo['tip'].node()),
+        self.assertEqual(revsymbol(repo, 'tip').parents()[0].parents()[0],
+                         revsymbol(repo, 'oldest'))
+        self.assertEqual(node.hex(revsymbol(repo, 'tip').node()),
                          '1a6c3f30911d57abb67c257ec0df3e7bc44786f7')
 
     def test_propedit_with_nothing_else(self):
         repo = self._load_fixture_and_fetch('branch_prop_edit.svndump')
-        self.assertEqual(repo['tip'].description(), 'Commit bogus propchange.')
-        self.assertEqual(repo['tip'].branch(), 'dev_branch')
+        self.assertEqual(revsymbol(repo, 'tip').description(), 'Commit bogus propchange.')
+        self.assertEqual(revsymbol(repo, 'tip').branch(), 'dev_branch')
 
     def test_entry_deletion(self):
         repo = self._load_fixture_and_fetch('delentries.svndump')
-        files = list(sorted(repo['tip'].manifest()))
+        files = list(sorted(revsymbol(repo, 'tip').manifest()))
         self.assertEqual(['aa', 'd1/c', 'd1/d2prefix'], files)
 
     def test_fetch_when_trunk_has_no_files(self):
         repo = self._load_fixture_and_fetch('file_not_in_trunk_root.svndump')
-        self.assertEqual(repo['tip'].branch(), 'default')
+        self.assertEqual(revsymbol(repo, 'tip').branch(), 'default')
 
     def test_path_quoting(self):
         repo_path = self.load_svndump('non_ascii_path_1.svndump')
@@ -150,7 +152,7 @@ class TestBasicRepoLayout(test_util.Test
         repo = hg.repository(ui, wc_path)
         repo2 = hg.repository(ui, wc2_path)
 
-        self.assertEqual(repo['tip'].extra()['convert_revision'],
+        self.assertEqual(revsymbol(repo, 'tip').extra()['convert_revision'],
                          repo2['tip'].extra()['convert_revision'])
         self.assertEqual(test_util.repolen(repo), test_util.repolen(repo2))
 
@@ -181,28 +183,28 @@ class TestStupidPull(test_util.TestBase)
         repo = self._load_fixture_and_fetch('two_heads.svndump')
         self.assertEqual(node.hex(repo[0].node()),
                          '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
-        self.assertEqual(node.hex(repo['tip'].node()),
+        self.assertEqual(node.hex(revsymbol(repo, 'tip').node()),
                          '1083037b18d85cd84fa211c5adbaeff0fea2cd9f')
-        self.assertEqual(node.hex(repo['the_branch'].node()),
+        self.assertEqual(node.hex(revsymbol(repo, 'the_branch').node()),
                          '4e256962fc5df545e2e0a51d0d1dc61c469127e6')
-        self.assertEqual(repo['the_branch'].extra()['convert_revision'],
+        self.assertEqual(revsymbol(repo, 'the_branch').extra()['convert_revision'],
                          'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/branches/the_branch@5')
-        self.assertEqual(node.hex(repo['the_branch'].parents()[0].node()),
+        self.assertEqual(node.hex(revsymbol(repo, 'the_branch').parents()[0].node()),
                          'f1ff5b860f5dbb9a59ad0921a79da77f10f25109')
-        self.assertEqual(len(repo['tip'].parents()), 1)
-        self.assertEqual(repo['default'].extra()['convert_revision'],
+        self.assertEqual(len(revsymbol(repo, 'tip').parents()), 1)
+        self.assertEqual(revsymbol(repo, 'default').extra()['convert_revision'],
                          'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/trunk@6')
-        self.assertEqual(repo['tip'], repo['default'])
+        self.assertEqual(revsymbol(repo, 'tip'), revsymbol(repo, 'default'))
         self.assertEqual(len(repo.heads()), 2)
 
     def test_oldest_not_trunk_and_tag_vendor_branch(self):
         repo = self._load_fixture_and_fetch(
             'tagged_vendor_and_oldest_not_trunk.svndump')
-        self.assertEqual(node.hex(repo['oldest'].node()),
+        self.assertEqual(node.hex(revsymbol(repo, 'oldest').node()),
                          '926671740dec045077ab20f110c1595f935334fa')
-        self.assertEqual(repo['tip'].parents()[0].parents()[0],
-                         repo['oldest'])
-        self.assertEqual(node.hex(repo['tip'].node()),
+        self.assertEqual(revsymbol(repo, 'tip').parents()[0].parents()[0],
+                         revsymbol(repo, 'oldest'))
+        self.assertEqual(node.hex(revsymbol(repo, 'tip').node()),
                          '1a6c3f30911d57abb67c257ec0df3e7bc44786f7')
 
     def test_empty_repo(self):
--- a/tests/test_fetch_mappings.py
+++ b/tests/test_fetch_mappings.py
@@ -15,6 +15,8 @@ from hgsubversion import svncommands
 from hgsubversion import util
 from hgsubversion import verify
 
+revsymbol = test_util.revsymbol
+
 class MapTests(test_util.TestBase):
     stupid_mode_tests = True
 
@@ -46,7 +48,7 @@ class MapTests(test_util.TestBase):
                        self.wc_path, authors=self.authors)
         self.assertEqual(self.repo[0].user(),
                          'Augie Fackler <durin42@gmail.com>')
-        self.assertEqual(self.repo['tip'].user(),
+        self.assertEqual(revsymbol(self.repo, 'tip').user(),
                         'evil@5b65bade-98f3-4993-a01f-b7a6710da339')
 
     def test_author_map_closing_author(self):
@@ -60,7 +62,7 @@ class MapTests(test_util.TestBase):
                        self.wc_path, authors=self.authors)
         self.assertEqual(self.repo[0].user(),
                          'Augie@5b65bade-98f3-4993-a01f-b7a6710da339')
-        self.assertEqual(self.repo['tip'].user(),
+        self.assertEqual(revsymbol(self.repo, 'tip').user(),
                         'Testy <test@test>')
 
     def test_author_map_no_author(self):
@@ -114,7 +116,7 @@ class MapTests(test_util.TestBase):
                        self.wc_path, authors=self.authors)
         self.assertEqual(self.repo[0].user(),
                          'Augie Fackler <durin42@gmail.com>')
-        self.assertEqual(self.repo['tip'].user(),
+        self.assertEqual(revsymbol(self.repo, 'tip').user(),
                         'evil@5b65bade-98f3-4993-a01f-b7a6710da339')
 
     def test_author_map_mapauthorscmd(self):
@@ -124,7 +126,7 @@ class MapTests(test_util.TestBase):
         commands.clone(ui, test_util.fileurl(repo_path),
                        self.wc_path)
         self.assertEqual(self.repo[0].user(), 'svn: Augie')
-        self.assertEqual(self.repo['tip'].user(), 'svn: evil')
+        self.assertEqual(revsymbol(self.repo, 'tip').user(), 'svn: evil')
 
     def _loadwithfilemap(self, svndump, filemapcontent,
             failonmissing=True):
@@ -145,14 +147,14 @@ class MapTests(test_util.TestBase):
         repo = self._loadwithfilemap('replace_trunk_with_branch.svndump',
             "include alpha\n")
         self.assertEqual(node.hex(repo[0].node()), '88e2c7492d83e4bf30fbb2dcbf6aa24d60ac688d')
-        self.assertEqual(node.hex(repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155')
+        self.assertEqual(node.hex(revsymbol(repo, 'default').node()), 'e524296152246b3837fe9503c83b727075835155')
 
     @test_util.requiresreplay
     def test_file_map_exclude(self):
         repo = self._loadwithfilemap('replace_trunk_with_branch.svndump',
             "exclude alpha\n")
         self.assertEqual(node.hex(repo[0].node()), '2c48f3525926ab6c8b8424bcf5eb34b149b61841')
-        self.assertEqual(node.hex(repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1')
+        self.assertEqual(node.hex(revsymbol(repo, 'default').node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1')
 
     @test_util.requiresreplay
     def test_file_map_rule_order(self):
@@ -163,7 +165,7 @@ class MapTests(test_util.TestBase):
         # because it's excluded after the root directory.
         self.assertEqual(sorted(self.repo[0].manifest().keys()),
                          ['alpha', 'beta'])
-        self.assertEqual(sorted(self.repo['default'].manifest().keys()),
+        self.assertEqual(sorted(revsymbol(self.repo, 'default').manifest().keys()),
                          ['alpha', 'beta'])
 
     @test_util.requiresreplay
@@ -368,7 +370,7 @@ class MapTests(test_util.TestBase):
     def test_empty_log_message(self):
         repo, repo_path = self.load_and_fetch('empty-log-message.svndump')
 
-        self.assertEqual(repo['tip'].description(), '')
+        self.assertEqual(revsymbol(repo, 'tip').description(), '')
 
         test_util.rmtree(self.wc_path)
 
@@ -376,4 +378,4 @@ class MapTests(test_util.TestBase):
         ui.setconfig('hgsubversion', 'defaultmessage', 'blyf')
         commands.clone(ui, test_util.fileurl(repo_path), self.wc_path)
 
-        self.assertEqual(self.repo['tip'].description(), 'blyf')
+        self.assertEqual(revsymbol(self.repo, 'tip').description(), 'blyf')
--- a/tests/test_push_command.py
+++ b/tests/test_push_command.py
@@ -23,6 +23,8 @@ from hgsubversion import compathacks
 
 import time
 
+revsymbol = test_util.revsymbol
+
 
 class PushTests(test_util.TestBase):
     obsolete_mode_tests = True
@@ -44,7 +46,7 @@ class PushTests(test_util.TestBase):
                                                   copied=False)
             raise IOError()
         ctx = context.memctx(repo,
-                             (repo['default'].node(), node.nullid),
+                             (revsymbol(repo, 'default').node(), node.nullid),
                              'automated test',
                              [],
                              file_callback,
@@ -52,10 +54,10 @@ class PushTests(test_util.TestBase):
                              '2008-10-07 20:59:48 -0500',
                              {'branch': 'default', })
         new_hash = repo.commitctx(ctx)
-        hg.update(repo, repo['tip'].node())
-        old_tip = repo['tip'].node()
+        hg.update(repo, revsymbol(repo, 'tip').node())
+        old_tip = revsymbol(repo, 'tip').node()
         self.pushrevisions()
-        tip = self.repo['tip']
+        tip = revsymbol(self.repo, 'tip')
         self.assertEqual(tip.node(), old_tip)
 
     def test_push_add_of_added_upstream_gives_sane_error(self):
@@ -70,7 +72,7 @@ class PushTests(test_util.TestBase):
                                                   isexec=False,
                                                   copied=False)
             raise IOError()
-        p1 = repo['default'].node()
+        p1 = revsymbol(repo, 'default').node()
         ctx = context.memctx(repo,
                              (p1, node.nullid),
                              'automated test',
@@ -80,10 +82,10 @@ class PushTests(test_util.TestBase):
                              '2008-10-07 20:59:48 -0500',
                              {'branch': 'default', })
         new_hash = repo.commitctx(ctx)
-        hg.update(repo, repo['tip'].node())
-        old_tip = repo['tip'].node()
+        hg.update(repo, revsymbol(repo, 'tip').node())
+        old_tip = revsymbol(repo, 'tip').node()
         self.pushrevisions()
-        tip = self.repo['tip']
+        tip = revsymbol(self.repo, 'tip')
         self.assertNotEqual(tip.node(), old_tip)
 
         # This node adds the same file as the first one we added, and
@@ -99,13 +101,13 @@ class PushTests(test_util.TestBase):
                              '2008-10-07 20:59:48 -0500',
                              {'branch': 'default', })
         new_hash = repo.commitctx(ctx)
-        hg.update(repo, repo['tip'].node())
-        old_tip = repo['tip'].node()
+        hg.update(repo, revsymbol(repo, 'tip').node())
+        old_tip = revsymbol(repo, 'tip').node()
         try:
           self.pushrevisions()
         except hgerror.Abort, e:
           assert "pull again and rebase" in str(e)
-        tip = self.repo['tip']
+        tip = revsymbol(self.repo, 'tip')
         self.assertEqual(tip.node(), old_tip)
 
     def test_cant_push_with_changes(self):
@@ -119,7 +121,7 @@ class PushTests(test_util.TestBase):
                                               isexec=False,
                                               copied=False)
         ctx = context.memctx(repo,
-                             (repo['default'].node(), node.nullid),
+                             (revsymbol(repo, 'default').node(), node.nullid),
                              'automated test',
                              ['adding_file'],
                              file_callback,
@@ -127,14 +129,14 @@ class PushTests(test_util.TestBase):
                              '2008-10-07 20:59:48 -0500',
                              {'branch': 'default', })
         new_hash = repo.commitctx(ctx)
-        hg.update(repo, repo['tip'].node())
+        hg.update(repo, revsymbol(repo, 'tip').node())
         # Touch an existing file
         repo.wwrite('beta', 'something else', '')
         try:
             self.pushrevisions()
         except hgerror.Abort:
             pass
-        tip = self.repo['tip']
+        tip = revsymbol(self.repo, 'tip')
         self.assertEqual(new_hash, tip.node())
 
     def internal_push_over_svnserve(self, subdir='', commit=True):
@@ -193,8 +195,8 @@ class PushTests(test_util.TestBase):
                            self.wc_path, noupdate=True)
 
             repo = self.repo
-            old_tip = repo['tip'].node()
-            expected_parent = repo['default'].node()
+            old_tip = revsymbol(repo, 'tip').node()
+            expected_parent = revsymbol(repo, 'default').node()
             def file_callback(repo, memctx, path):
                 if path == 'adding_file':
                     return compathacks.makememfilectx(repo,
@@ -206,7 +208,7 @@ class PushTests(test_util.TestBase):
                                                       copied=False)
                 raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
             ctx = context.memctx(repo,
-                                 parents=(repo['default'].node(), node.nullid),
+                                 parents=(revsymbol(repo, 'default').node(), node.nullid),
                                  text='automated test',
                                  files=['adding_file'],
                                  filectxfn=file_callback,
@@ -216,10 +218,10 @@ class PushTests(test_util.TestBase):
             new_hash = repo.commitctx(ctx)
             if not commit:
                 return # some tests use this test as an extended setup.
-            hg.update(repo, repo['tip'].node())
-            oldauthor = repo['tip'].user()
+            hg.update(repo, revsymbol(repo, 'tip').node())
+            oldauthor = revsymbol(repo, 'tip').user()
             commands.push(repo.ui, repo)
-            tip = self.repo['tip']
+            tip = revsymbol(self.repo, 'tip')
             self.assertNotEqual(oldauthor, tip.user())
             self.assertNotEqual(tip.node(), old_tip)
             self.assertEqual(tip.parents()[0].node(), expected_parent)
@@ -242,8 +244,8 @@ class PushTests(test_util.TestBase):
 
     def test_push_to_default(self, commit=True):
         repo = self.repo
-        old_tip = repo['tip'].node()
-        expected_parent = repo['default'].node()
+        old_tip = revsymbol(repo, 'tip').node()
+        expected_parent = revsymbol(repo, 'default').node()
         def file_callback(repo, memctx, path):
             if path == 'adding_file':
                 return compathacks.makememfilectx(repo,
@@ -255,7 +257,7 @@ class PushTests(test_util.TestBase):
                                                   copied=False)
             raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
         ctx = context.memctx(repo,
-                             (repo['default'].node(), node.nullid),
+                             (revsymbol(repo, 'default').node(), node.nullid),
                              'automated test',
                              ['adding_file'],
                              file_callback,
@@ -265,9 +267,9 @@ class PushTests(test_util.TestBase):
         new_hash = repo.commitctx(ctx)
         if not commit:
             return # some tests use this test as an extended setup.
-        hg.update(repo, repo['tip'].node())
+        hg.update(repo, revsymbol(repo, 'tip').node())
         self.pushrevisions()
-        tip = self.repo['tip']
+        tip = revsymbol(self.repo, 'tip')
         self.assertNotEqual(tip.node(), old_tip)
         self.assertEqual(node.hex(tip.parents()[0].node()),
                          node.hex(expected_parent))
@@ -283,7 +285,7 @@ class PushTests(test_util.TestBase):
                                               islink=False,
                                               isexec=False,
                                               copied=False)
-        oldtiphash = self.repo['default'].node()
+        oldtiphash = revsymbol(self.repo, 'default').node()
         lr = self.repo
         ctx = context.memctx(lr,
                              (lr[0].node(), revlog.nullid,),
@@ -306,17 +308,17 @@ class PushTests(test_util.TestBase):
         repo = self.repo
         hg.update(repo, newhash)
         commands.push(repo.ui, repo)
-        self.assertEqual(self.repo['tip'].parents()[0].parents()[0].node(), oldtiphash)
-        self.assertEqual(self.repo['tip'].files(), ['delta', ])
-        self.assertEqual(sorted(self.repo['tip'].manifest().keys()),
+        self.assertEqual(revsymbol(self.repo, 'tip').parents()[0].parents()[0].node(), oldtiphash)
+        self.assertEqual(revsymbol(self.repo, 'tip').files(), ['delta', ])
+        self.assertEqual(sorted(revsymbol(self.repo, 'tip').manifest().keys()),
                          ['alpha', 'beta', 'delta', 'gamma'])
 
     def test_push_two_revs(self):
         # set up some work for us
         self.test_push_to_default(commit=False)
         repo = self.repo
-        old_tip = repo['tip'].node()
-        expected_parent = repo['tip'].parents()[0].node()
+        old_tip = revsymbol(repo, 'tip').node()
+        expected_parent = revsymbol(repo, 'tip').parents()[0].node()
         def file_callback(repo, memctx, path):
             if path == 'adding_file2':
                 return compathacks.makememfilectx(repo,
@@ -328,7 +330,7 @@ class PushTests(test_util.TestBase):
                                                   copied=False)
             raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
         ctx = context.memctx(repo,
-                             (repo['default'].node(), node.nullid),
+                             (revsymbol(repo, 'default').node(), node.nullid),
                              'automated test',
                              ['adding_file2'],
                              file_callback,
@@ -336,9 +338,9 @@ class PushTests(test_util.TestBase):
                              '2008-10-07 20:59:48 -0500',
                              {'branch': 'default', })
         new_hash = repo.commitctx(ctx)
-        hg.update(repo, repo['tip'].node())
+        hg.update(repo, revsymbol(repo, 'tip').node())
         self.pushrevisions()
-        tip = self.repo['tip']
+        tip = revsymbol(self.repo, 'tip')
         self.assertNotEqual(tip.node(), old_tip)
         self.assertNotEqual(tip.parents()[0].node(), old_tip)
         self.assertEqual(tip.parents()[0].parents()[0].node(), expected_parent)
@@ -365,7 +367,7 @@ class PushTests(test_util.TestBase):
                                                   copied=False)
             raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
         ctx = context.memctx(repo,
-                             (repo['the_branch'].node(), node.nullid),
+                             (revsymbol(repo, 'the_branch').node(), node.nullid),
                              'automated test',
                              ['adding_file'],
                              file_callback,
@@ -373,10 +375,10 @@ class PushTests(test_util.TestBase):
                              '2008-10-07 20:59:48 -0500',
                              {'branch': 'the_branch', })
         new_hash = repo.commitctx(ctx)
-        hg.update(repo, repo['tip'].node())
+        hg.update(repo, revsymbol(repo, 'tip').node())
         if push:
             self.pushrevisions()
-            tip = self.repo['tip']
+            tip = revsymbol(self.repo, 'tip')
             self.assertNotEqual(tip.node(), new_hash)
             self.assertEqual(tip['adding_file'].data(), 'foo')
             self.assertEqual(tip.branch(), 'the_branch')
@@ -408,18 +410,18 @@ class PushTests(test_util.TestBase):
                                 args=[test_util.fileurl(self.repo_path)])
 
 
-        hg.update(self.repo, self.repo['tip'].node())
-        oldnode = self.repo['tip'].hex()
+        hg.update(self.repo, revsymbol(self.repo, 'tip').node())
+        oldnode = revsymbol(self.repo, 'tip').hex()
         self.pushrevisions(expected_extra_back=1)
-        self.assertNotEqual(oldnode, self.repo['tip'].hex(), 'Revision was not pushed.')
+        self.assertNotEqual(oldnode, revsymbol(self.repo, 'tip').hex(), 'Revision was not pushed.')
 
     def test_delete_file(self):
         repo = self.repo
         def file_callback(repo, memctx, path):
             return compathacks.filectxfn_deleted(memctx, path)
-        old_files = set(repo['default'].manifest().keys())
+        old_files = set(revsymbol(repo, 'default').manifest().keys())
         ctx = context.memctx(repo,
-                             (repo['default'].node(), node.nullid),
+                             (revsymbol(repo, 'default').node(), node.nullid),
                              'automated test',
                              ['alpha'],
                              file_callback,
@@ -427,9 +429,9 @@ class PushTests(test_util.TestBase):
                              '2008-10-29 21:26:00 -0500',
                              {'branch': 'default', })
         new_hash = repo.commitctx(ctx)
-        hg.update(repo, repo['tip'].node())
+        hg.update(repo, revsymbol(repo, 'tip').node())
         self.pushrevisions()
-        tip = self.repo['tip']
+        tip = revsymbol(self.repo, 'tip')
         self.assertEqual(old_files,
                          set(tip.manifest().keys() + ['alpha']))
         self.assert_('alpha' not in tip.manifest())
@@ -448,7 +450,7 @@ class PushTests(test_util.TestBase):
                                                   copied=False)
             raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
         ctx = context.memctx(repo,
-                             (repo['tip'].node(), node.nullid),
+                             (revsymbol(repo, 'tip').node(), node.nullid),
                              'message',
                              ['gamma', ],
                              file_callback,
@@ -456,11 +458,11 @@ class PushTests(test_util.TestBase):
                              '2008-10-29 21:26:00 -0500',
                              {'branch': 'default', })
         new_hash = repo.commitctx(ctx)
-        hg.clean(repo, repo['tip'].node())
+        hg.clean(repo, revsymbol(repo, 'tip').node())
         self.pushrevisions()
-        tip = self.repo['tip']
+        tip = revsymbol(self.repo, 'tip')
         self.assertNotEqual(tip.node(), new_hash)
-        self.assert_('@' in self.repo['tip'].user())
+        self.assert_('@' in revsymbol(self.repo, 'tip').user())
         self.assertEqual(tip['gamma'].flags(), 'x')
         self.assertEqual(tip['gamma'].data(), 'foo')
         self.assertEqual(sorted([x for x in tip.manifest().keys() if 'x' not in
@@ -481,7 +483,7 @@ class PushTests(test_util.TestBase):
                                                   copied=False)
             raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
         ctx = context.memctx(repo,
-                             (repo['tip'].node(), node.nullid),
+                             (revsymbol(repo, 'tip').node(), node.nullid),
                              'message',
                              ['gamma', ],
                              file_callback,
@@ -489,11 +491,11 @@ class PushTests(test_util.TestBase):
                              '2008-10-29 21:26:00 -0500',
                              {'branch': 'default', })
         new_hash = repo.commitctx(ctx)
-        hg.update(repo, repo['tip'].node())
+        hg.update(repo, revsymbol(repo, 'tip').node())
         self.pushrevisions()
         # grab a new repo instance (self.repo is an @property functions)
         repo = self.repo
-        tip = repo['tip']
+        tip = revsymbol(repo, 'tip')
         self.assertNotEqual(tip.node(), new_hash)
         self.assertEqual(tip['gamma'].flags(), 'l')
         self.assertEqual(tip['gamma'].data(), 'foo')
@@ -513,7 +515,7 @@ class PushTests(test_util.TestBase):
             raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
 
         ctx = context.memctx(repo,
-                             (repo['tip'].node(), node.nullid),
+                             (revsymbol(repo, 'tip').node(), node.nullid),
                              'message',
                              ['gamma', ],
                              file_callback2,
@@ -521,11 +523,11 @@ class PushTests(test_util.TestBase):
                              '2014-08-08 20:11:41 -0700',
                              {'branch': 'default', })
         repo.commitctx(ctx)
-        hg.update(repo, repo['tip'].node())
+        hg.update(repo, revsymbol(repo, 'tip').node())
         self.pushrevisions()
         # grab a new repo instance (self.repo is an @property functions)
         repo = self.repo
-        tip = repo['tip']
+        tip = revsymbol(repo, 'tip')
         self.assertEqual(tip['gamma'].flags(), 'l')
         self.assertEqual(tip['gamma'].data(), 'a'*129)
 
@@ -541,7 +543,7 @@ class PushTests(test_util.TestBase):
             raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
 
         ctx = context.memctx(repo,
-                             (repo['tip'].node(), node.nullid),
+                             (revsymbol(repo, 'tip').node(), node.nullid),
                              'message',
                              ['gamma', ],
                              file_callback3,
@@ -549,10 +551,10 @@ class PushTests(test_util.TestBase):
                              '2014-08-08 20:16:25 -0700',
                              {'branch': 'default', })
         repo.commitctx(ctx)
-        hg.update(repo, repo['tip'].node())
+        hg.update(repo, revsymbol(repo, 'tip').node())
         self.pushrevisions()
         repo = self.repo
-        tip = repo['tip']
+        tip = revsymbol(repo, 'tip')
         self.assertEqual(tip['gamma'].flags(), 'l')
         self.assertEqual(tip['gamma'].data(), 'a' * 64 + 'b' * 65)
 
@@ -575,7 +577,7 @@ class PushTests(test_util.TestBase):
                                               isexec=execute,
                                               copied=False)
         ctx = context.memctx(repo,
-                             (repo['default'].node(), node.nullid),
+                             (revsymbol(repo, 'default').node(), node.nullid),
                              'message',
                              ['alpha', ],
                              file_callback,
@@ -583,9 +585,9 @@ class PushTests(test_util.TestBase):
                              '2008-1-1 00:00:00 -0500',
                              {'branch': 'default', })
         new_hash = repo.commitctx(ctx)
-        hg.update(repo, repo['tip'].node())
+        hg.update(repo, revsymbol(repo, 'tip').node())
         self.pushrevisions()
-        tip = self.repo['tip']
+        tip = revsymbol(self.repo, 'tip')
         self.assertNotEqual(tip.node(), new_hash)
         self.assertEqual(tip['alpha'].data(), 'foo')
         self.assertEqual(tip.parents()[0]['alpha'].flags(), '')
@@ -602,7 +604,7 @@ class PushTests(test_util.TestBase):
                                               isexec=execute,
                                               copied=False)
         ctx = context.memctx(repo,
-                             (repo['default'].node(), node.nullid),
+                             (revsymbol(repo, 'default').node(), node.nullid),
                              'mutate already-special file alpha',
                              ['alpha', ],
                              file_callback2,
@@ -610,9 +612,9 @@ class PushTests(test_util.TestBase):
                              '2008-1-1 00:00:00 -0500',
                              {'branch': 'default', })
         new_hash = repo.commitctx(ctx)
-        hg.update(repo, repo['tip'].node())
+        hg.update(repo, revsymbol(repo, 'tip').node())
         self.pushrevisions()
-        tip = self.repo['tip']
+        tip = revsymbol(self.repo, 'tip')
         self.assertNotEqual(tip.node(), new_hash)
         self.assertEqual(tip['alpha'].data(), 'bar')
         self.assertEqual(tip.parents()[0]['alpha'].flags(), expected_flags)
@@ -628,7 +630,7 @@ class PushTests(test_util.TestBase):
                                               isexec=False,
                                               copied=False)
         ctx = context.memctx(repo,
-                             (repo['default'].node(), node.nullid),
+                             (revsymbol(repo, 'default').node(), node.nullid),
                              'convert alpha back to regular file',
                              ['alpha', ],
                              file_callback3,
@@ -636,9 +638,9 @@ class PushTests(test_util.TestBase):
                              '2008-01-01 00:00:00 -0500',
                              {'branch': 'default', })
         new_hash = repo.commitctx(ctx)
-        hg.update(repo, repo['tip'].node())
+        hg.update(repo, revsymbol(repo, 'tip').node())
         self.pushrevisions()
-        tip = self.repo['tip']
+        tip = revsymbol(self.repo, 'tip')
         self.assertNotEqual(tip.node(), new_hash)
         self.assertEqual(tip['alpha'].data(), 'bar')
         self.assertEqual(tip.parents()[0]['alpha'].flags(), expected_flags)
@@ -648,7 +650,7 @@ class PushTests(test_util.TestBase):
         self.test_push_two_revs()
         changes = [('adding_file', 'adding_file', 'different_content',),
                    ]
-        par = self.repo['tip'].rev()
+        par = revsymbol(self.repo, 'tip').rev()
         self.commitchanges(changes, parent=par)
         self.pushrevisions()
         changes = [('adding_file', 'adding_file',
@@ -675,28 +677,28 @@ class PushTests(test_util.TestBase):
         # confused the dirstate and made it believe the file was deleted.
         fn = 'pi\xc3\xa8ce/test'
         changes = [(fn, fn, 'a')]
-        par = self.repo['tip'].rev()
+        par = revsymbol(self.repo, 'tip').rev()
         self.commitchanges(changes, parent=par)
         self.pushrevisions()
 
     def test_push_emptying_changeset(self):
-        r = self.repo['tip']
+        r = revsymbol(self.repo, 'tip')
         changes = [
                 ('alpha', None, None),
                 ('beta', None, None),
                 ]
-        parent = self.repo['tip'].rev()
+        parent = revsymbol(self.repo, 'tip').rev()
         self.commitchanges(changes, parent=parent)
         self.pushrevisions()
-        self.assertEqual(len(self.repo['tip'].manifest()), 0)
+        self.assertEqual(len(revsymbol(self.repo, 'tip').manifest()), 0)
 
         # Try to re-add a file after emptying the branch
         changes = [
                 ('alpha', 'alpha', 'alpha'),
                 ]
-        self.commitchanges(changes, parent=self.repo['tip'].rev())
+        self.commitchanges(changes, parent=revsymbol(self.repo, 'tip').rev())
         self.pushrevisions()
-        self.assertEqual(['alpha'], list(self.repo['tip'].manifest()))
+        self.assertEqual(['alpha'], list(revsymbol(self.repo, 'tip').manifest()))
 
     def test_push_without_pushing_children(self):
         '''
@@ -705,7 +707,7 @@ class PushTests(test_util.TestBase):
         '''
 
         oldlen = test_util.repolen(self.repo)
-        oldtiphash = self.repo['default'].node()
+        oldtiphash = revsymbol(self.repo, 'default').node()
 
         changes = [('gamma', 'gamma', 'sometext')]
         newhash1 = self.commitchanges(changes)
@@ -720,7 +722,7 @@ class PushTests(test_util.TestBase):
         self.assertEqual(test_util.repolen(self.repo), oldlen + 2)
 
         # verify that the first commit is pushed, and the second is not
-        commit2 = self.repo['tip']
+        commit2 = revsymbol(self.repo, 'tip')
         self.assertEqual(commit2.files(), ['delta', ])
         self.assertEqual(util.getsvnrev(commit2), None)
         commit1 = commit2.parents()[0]
@@ -736,7 +738,7 @@ class PushTests(test_util.TestBase):
         '''
 
         oldlen = test_util.repolen(self.repo)
-        oldtiphash = self.repo['default'].node()
+        oldtiphash = revsymbol(self.repo, 'default').node()
 
         changes = [('gamma', 'gamma', 'sometext')]
         newhash = self.commitchanges(changes)
@@ -751,7 +753,7 @@ class PushTests(test_util.TestBase):
         self.assertEqual(test_util.repolen(self.repo), oldlen + 2)
 
         # verify that both commits are pushed
-        commit1 = self.repo['tip']
+        commit1 = revsymbol(self.repo, 'tip')
         self.assertEqual(commit1.files(), ['delta', 'gamma'])
 
         prefix = 'svn:' + self.repo.svnmeta().uuid
@@ -764,7 +766,7 @@ class PushTests(test_util.TestBase):
 
     def test_push_in_subdir(self, commit=True):
         repo = self.repo
-        old_tip = repo['tip'].node()
+        old_tip = revsymbol(repo, 'tip').node()
         def file_callback(repo, memctx, path):
             if path == 'adding_file' or path == 'newdir/new_file':
                 testData = 'fooFirstFile'
@@ -779,7 +781,7 @@ class PushTests(test_util.TestBase):
                                                   copied=False)
             raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
         ctx = context.memctx(repo,
-                             (repo['default'].node(), node.nullid),
+                             (revsymbol(repo, 'default').node(), node.nullid),
                              'automated test',
                              ['adding_file'],
                              file_callback,
@@ -790,7 +792,7 @@ class PushTests(test_util.TestBase):
         p = os.path.join(repo.root, "newdir")
         os.mkdir(p)
         ctx = context.memctx(repo,
-                             (repo['default'].node(), node.nullid),
+                             (revsymbol(repo, 'default').node(), node.nullid),
                              'automated test',
                              ['newdir/new_file'],
                              file_callback,
@@ -799,9 +801,9 @@ class PushTests(test_util.TestBase):
                              {'branch': 'default', })
         os.chdir(p)
         new_hash = repo.commitctx(ctx)
-        hg.update(repo, repo['tip'].node())
+        hg.update(repo, revsymbol(repo, 'tip').node())
         self.pushrevisions()
-        tip = self.repo['tip']
+        tip = revsymbol(self.repo, 'tip')
         self.assertNotEqual(tip.node(), old_tip)
         self.assertEqual(p, os.getcwd())
         self.assertEqual(tip['adding_file'].data(), 'fooFirstFile')
@@ -820,7 +822,7 @@ class PushTests(test_util.TestBase):
 
         self.test_push_to_branch(push=False)
         commands.push(ui, repo)
-        newctx = self.repo['.']
-        self.assertNotEqual(newctx.node(), self.repo['tip'].node())
+        newctx = revsymbol(self.repo, '.')
+        self.assertNotEqual(newctx.node(), revsymbol(self.repo, 'tip').node())
         self.assertEqual(newctx['adding_file'].data(), 'foo')
         self.assertEqual(newctx.branch(), 'the_branch')
--- a/tests/test_single_dir_clone.py
+++ b/tests/test_single_dir_clone.py
@@ -12,6 +12,8 @@ from mercurial import ui
 
 from hgsubversion import compathacks
 
+revsymbol = test_util.revsymbol
+
 class TestSingleDirClone(test_util.TestBase):
     stupid_mode_tests = True
 
@@ -36,7 +38,7 @@ class TestSingleDirClone(test_util.TestB
                                             layout='auto')
         self.assertEqual(compathacks.branchset(repo),
                          set(['default', 'branch_from_tag']))
-        oldmanifest = test_util.filtermanifest(repo['default'].manifest().keys())
+        oldmanifest = test_util.filtermanifest(revsymbol(repo, 'default').manifest().keys())
         # remove standard layout
         shutil.rmtree(self.wc_path)
         # try again with subdir to get single dir clone
@@ -44,7 +46,7 @@ class TestSingleDirClone(test_util.TestB
                                             layout='auto',
                                             subdir='trunk')
         self.assertEqual(compathacks.branchset(repo), set(['default', ]))
-        self.assertEqual(repo['default'].manifest().keys(), oldmanifest)
+        self.assertEqual(revsymbol(repo, 'default').manifest().keys(), oldmanifest)
 
     def test_clone_subdir_is_file_prefix(self):
         FIXTURE = 'subdir_is_file_prefix.svndump'
--- a/tests/test_single_dir_push.py
+++ b/tests/test_single_dir_push.py
@@ -10,6 +10,8 @@ from mercurial import hg
 from mercurial import node
 from mercurial import ui
 
+revsymbol = test_util.revsymbol
+
 from hgsubversion import compathacks
 
 class TestSingleDirPush(test_util.TestBase):
@@ -157,7 +159,7 @@ class TestSingleDirPush(test_util.TestBa
         parent = repo['tip'].node()
         commit_to_branch('default', parent)
         commit_to_branch('foo', parent)
-        hg.update(repo, repo['foo'].node())
+        hg.update(repo, revsymbol(repo, 'foo').node())
         self.pushrevisions()
         repo = self.repo # repo is outdated after the rebase happens, refresh
         self.assertTrue('foo' in test_util.svnls(repo_path, ''))
@@ -165,7 +167,7 @@ class TestSingleDirPush(test_util.TestBa
         # Have to cross to another branch head, so hg.update doesn't work
         commands.update(self.ui(),
                         self.repo,
-                        self.repo.branchheads('default')[1],
+                        node.hex(self.repo.branchheads('default')[1]),
                         clean=True)
         self.pushrevisions()
         self.assertTrue('default' in test_util.svnls(repo_path, ''))
--- a/tests/test_tags.py
+++ b/tests/test_tags.py
@@ -13,18 +13,20 @@ from hgsubversion import compathacks
 from hgsubversion import svncommands
 from hgsubversion import svnrepo
 
+revsymbol = test_util.revsymbol
+
 class TestTags(test_util.TestBase):
     stupid_mode_tests = True
 
     def test_tags(self):
         repo = self._load_fixture_and_fetch('basic_tag_tests.svndump')
         self.assertEqual(sorted(repo.tags()), ['copied_tag', 'tag_r3', 'tip'])
-        self.assertEqual(repo['tag_r3'], repo['copied_tag'])
-        self.assertEqual(repo['tag_r3'].rev(), 1)
+        self.assertEqual(revsymbol(repo, 'tag_r3'), revsymbol(repo, 'copied_tag'))
+        self.assertEqual(revsymbol(repo,'tag_r3').rev(), 1)
 
     def test_remove_tag(self):
         repo = self._load_fixture_and_fetch('remove_tag_test.svndump')
-        self.assertEqual(repo['tag_r3'].rev(), 1)
+        self.assertEqual(revsymbol(repo, 'tag_r3').rev(), 1)
         self.assert_('copied_tag' not in repo.tags())
 
     def test_rename_tag(self):
@@ -50,15 +52,17 @@ rename a tag
     def test_branch_from_tag(self):
         repo = self._load_fixture_and_fetch('branch_from_tag.svndump')
         self.assert_('branch_from_tag' in compathacks.branchset(repo))
-        self.assertEqual(repo[1], repo['tag_r3'])
-        self.assertEqual(repo['branch_from_tag'].parents()[0], repo['copied_tag'])
+        self.assertEqual(repo[1], revsymbol(repo, 'tag_r3'))
+        self.assertEqual(revsymbol(repo, 'branch_from_tag').parents()[0],
+                         revsymbol(repo, 'copied_tag'))
 
     def test_tag_by_renaming_branch(self):
         repo = self._load_fixture_and_fetch('tag_by_rename_branch.svndump')
         branches = set(repo[h] for h in repo.heads())
         self.assert_('dummy' not in branches)
-        self.assertEqual(repo['dummy'], repo['tip'].parents()[0],
-                         '%r != %r[0]' % (repo['dummy'],
+        self.assertEqual(revsymbol(repo, 'dummy'),
+                         revsymbol(repo, 'tip').parents()[0],
+                         '%r != %r[0]' % (revsymbol(repo, 'dummy'),
                                               repo['tip'].parents()))
         extra = repo['tip'].extra().copy()
         extra.pop('convert_revision', None)
@@ -129,7 +133,7 @@ rename a tag
             'branch': 'magic',
             'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/will-edit@19'})
        self.assertEqual(willedit, repo.tags()['will-edit'])
-       self.assertEqual(sorted(repo['will-edit'].manifest().keys()),
+       self.assertEqual(sorted(revsymbol(repo, 'will-edit').manifest().keys()),
                         ['alpha', 'beta', 'gamma'])
        self.assertEqual(
            repo[alsoedit].extra(),
@@ -137,17 +141,17 @@ rename a tag
             'branch': 'magic',
             'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/also-edit@14'})
        self.assertEqual(repo[alsoedit].parents()[0].node(), repo.tags()['also-edit'])
-       self.assertEqual(sorted(repo['also-edit'].manifest().keys()),
+       self.assertEqual(sorted(revsymbol(repo, 'also-edit').manifest().keys()),
                         ['.hgtags', 'alpha', 'beta', 'delta', 'gamma', 'iota',
                          'lambda', 'omega'])
 
-       self.assertEqual(editlater, repo['edit-later'].node())
+       self.assertEqual(editlater, revsymbol(repo, 'edit-later').node())
        self.assertEqual(
            repo[closeme].extra(),
            {'close': '1',
             'branch': 'closeme',
             'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/branches/closeme@17'})
-       self.assertEqual('alpha\nalpha\n', repo['edit-at-create']['alpha'].data())
+       self.assertEqual('alpha\nalpha\n', revsymbol(repo, 'edit-at-create')['alpha'].data())
 
     def test_tags_in_unusual_location(self):
         repo = self._load_fixture_and_fetch('tag_name_same_as_branch.svndump')
--- a/tests/test_unaffected_core.py
+++ b/tests/test_unaffected_core.py
@@ -10,6 +10,8 @@ from mercurial import hg
 from mercurial import node
 from mercurial import ui
 
+revsymbol = test_util.revsymbol
+
 def _dispatch(ui, cmd):
     assert '--quiet' in cmd
     try:
@@ -91,4 +93,4 @@ class TestMercurialCore(test_util.TestBa
 
         repo2 = hg.repository(ui, self.wc_path + '2')
 
-        self.assertEqual(repo[branch].hex(), repo2['.'].hex())
+        self.assertEqual(revsymbol(repo, branch).hex(), revsymbol(repo2, '.').hex())
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -49,6 +49,13 @@ from hgsubversion import svnwrap
 from hgsubversion import util
 from hgsubversion import svnwrap
 
+try:
+    revsymbol = scmutil.revsymbol
+except AttributeError:
+    # Pre hg 4.6 way of resolving a symbol
+    def revsymbol(repo, symbol):
+        return repo[symbol]
+
 # Documentation for Subprocess.Popen() says:
 #   "Note that on Windows, you cannot set close_fds to true and
 #   also redirect the standard handles by setting stdin, stdout or
@@ -225,7 +232,7 @@ def repolen(repo, svnonly=False):
         revs -= obsolete.getrevs(repo, 'obsolete')
 
     if svnonly:
-        revs = set(r for r in revs if util.getsvnrev(repo[r]))
+        revs = set(r for r in revs if util.getsvnrev(revsymbol(repo, r)))
 
     return len(revs)
 
@@ -697,7 +704,10 @@ class TestBase(unittest.TestCase):
         - (source, None, None) to remove source.
         """
         repo = self.repo
-        parentctx = repo[parent]
+        if isinstance(parent, int):
+            parentctx = repo[parent]
+        else:
+            parentctx = revsymbol(repo, parent)
 
         changed, removed = [], []
         for source, dest, newdata in changes:
--- a/tests/test_utility_commands.py
+++ b/tests/test_utility_commands.py
@@ -19,6 +19,8 @@ from hgsubversion import verify
 from hgsubversion import wrappers
 from hgsubversion import compathacks
 
+revsymbol = test_util.revsymbol
+
 expected_info_output = '''URL: %(repourl)s/%(branch)s
 Repository Root: %(repourl)s
 Repository UUID: df2126f7-00ab-4d49-b42c-7e981dde0bcf
@@ -44,7 +46,7 @@ class UtilityTests(test_util.TestBase):
         else:
             config = {}
         repo, repo_path = self.load_and_fetch('two_heads.svndump', config=config)
-        hg.update(self.repo, 'the_branch')
+        hg.update(self.repo, revsymbol(self.repo, 'the_branch'))
         u = self.ui()
         u.pushbuffer()
         svncommands.info(u, self.repo)
@@ -56,7 +58,7 @@ class UtilityTests(test_util.TestBase):
                      'rev': 5,
                      })
         self.assertMultiLineEqual(actual, expected)
-        hg.update(self.repo, 'default')
+        hg.update(self.repo, revsymbol(self.repo, 'default'))
         u.pushbuffer()
         svncommands.info(u, self.repo)
         actual = u.popbuffer()
@@ -67,7 +69,7 @@ class UtilityTests(test_util.TestBase):
                      'rev': 6,
                      })
         self.assertMultiLineEqual(actual, expected)
-        hg.update(self.repo, 'default')
+        hg.update(self.repo, revsymbol(self.repo, 'default'))
         u.pushbuffer()
         svncommands.info(u, self.repo, rev=3)
         actual = u.popbuffer()
@@ -83,7 +85,7 @@ class UtilityTests(test_util.TestBase):
         repo2 = hg.repository(u, destpath)
         repo2.ui.setconfig('paths', 'default-push',
                            self.repo.ui.config('paths', 'default'))
-        hg.update(repo2, 'default')
+        hg.update(repo2, revsymbol(self.repo, 'default'))
         svncommands.rebuildmeta(u, repo2, [])
         u.pushbuffer()
         svncommands.info(u, repo2)
@@ -160,7 +162,7 @@ class UtilityTests(test_util.TestBase):
         self._load_fixture_and_fetch('two_heads.svndump')
         u = self.ui()
         u.pushbuffer()
-        parents = (self.repo['the_branch'].node(), revlog.nullid,)
+        parents = (revsymbol(self.repo, 'the_branch').node(), revlog.nullid,)
         def filectxfn(repo, memctx, path):
             return compathacks.makememfilectx(repo,
                                               memctx=memctx,
@@ -184,7 +186,7 @@ class UtilityTests(test_util.TestBase):
         actual = u.popbuffer()
         self.assertEqual(actual, '3:4e256962fc5d\n')
 
-        hg.update(self.repo, 'default')
+        hg.update(self.repo, revsymbol(self.repo, 'default'))
 
         # Make sure styles work
         u.pushbuffer()
@@ -206,7 +208,7 @@ class UtilityTests(test_util.TestBase):
     def test_outgoing_output(self):
         repo, repo_path = self.load_and_fetch('two_heads.svndump')
         u = self.ui()
-        parents = (self.repo['the_branch'].node(), revlog.nullid,)
+        parents = (revsymbol(self.repo, 'the_branch').node(), revlog.nullid,)
         def filectxfn(repo, memctx, path):
             return compathacks.makememfilectx(repo,
                                               memctx=memctx,
@@ -229,9 +231,9 @@ class UtilityTests(test_util.TestBase):
         u.pushbuffer()
         commands.outgoing(u, self.repo, repourl(repo_path))
         actual = u.popbuffer()
-        self.assertTrue(node.hex(self.repo['localbranch'].node())[:8] in actual)
+        self.assertTrue(node.hex(revsymbol(self.repo, 'localbranch').node())[:8] in actual)
         self.assertEqual(actual.strip(), '5:6de15430fa20')
-        hg.update(self.repo, 'default')
+        hg.update(self.repo, revsymbol(self.repo, 'default'))
         u.pushbuffer()
         commands.outgoing(u, self.repo, repourl(repo_path))
         actual = u.popbuffer()