comparison tests/test_utility_commands.py @ 1555:cff81f35b31e

cleanup: reference Abort from mercurial.error instead of mercurial.util It's been there since hg 1.7 or so, which lets us avoid any need for compat shims.
author Augie Fackler <raf@durin42.com>
date Sat, 24 Mar 2018 16:39:30 -0400
parents 8410a978c650
children d55c9d0ba350
comparison
equal deleted inserted replaced
1554:258fb67fb956 1555:cff81f35b31e
3 import os 3 import os
4 import unittest 4 import unittest
5 import re 5 import re
6 6
7 from hgext import rebase 7 from hgext import rebase
8 from mercurial import error as hgerror
8 from mercurial import hg 9 from mercurial import hg
9 from mercurial import revlog 10 from mercurial import revlog
10 from mercurial import context 11 from mercurial import context
11 from mercurial import node 12 from mercurial import node
12 from mercurial import commands 13 from mercurial import commands
130 self._load_fixture_and_fetch('two_heads.svndump') 131 self._load_fixture_and_fetch('two_heads.svndump')
131 os.remove(self.repo.vfs.join('svn/branch_info')) 132 os.remove(self.repo.vfs.join('svn/branch_info'))
132 svncommands.updatemeta(self.ui(), self.repo, []) 133 svncommands.updatemeta(self.ui(), self.repo, [])
133 134
134 test_util.rmtree(self.repo.vfs.join('svn')) 135 test_util.rmtree(self.repo.vfs.join('svn'))
135 self.assertRaises(hgutil.Abort, 136 self.assertRaises(hgerror.Abort,
136 self.repo.svnmeta) 137 self.repo.svnmeta)
137 self.assertRaises(hgutil.Abort, 138 self.assertRaises(hgerror.Abort,
138 svncommands.info, 139 svncommands.info,
139 self.ui(), repo=self.repo, args=[]) 140 self.ui(), repo=self.repo, args=[])
140 self.assertRaises(hgutil.Abort, 141 self.assertRaises(hgerror.Abort,
141 svncommands.genignore, 142 svncommands.genignore,
142 self.ui(), repo=self.repo, args=[]) 143 self.ui(), repo=self.repo, args=[])
143 144
144 os.remove(self.repo.vfs.join('hgrc')) 145 os.remove(self.repo.vfs.join('hgrc'))
145 self.assertRaises(hgutil.Abort, 146 self.assertRaises(hgerror.Abort,
146 self.repo.svnmeta) 147 self.repo.svnmeta)
147 self.assertRaises(hgutil.Abort, 148 self.assertRaises(hgerror.Abort,
148 svncommands.info, 149 svncommands.info,
149 self.ui(), repo=self.repo, args=[]) 150 self.ui(), repo=self.repo, args=[])
150 self.assertRaises(hgutil.Abort, 151 self.assertRaises(hgerror.Abort,
151 svncommands.genignore, 152 svncommands.genignore,
152 self.ui(), repo=self.repo, args=[]) 153 self.ui(), repo=self.repo, args=[])
153 154
154 self.assertRaises(hgutil.Abort, 155 self.assertRaises(hgerror.Abort,
155 svncommands.rebuildmeta, 156 svncommands.rebuildmeta,
156 self.ui(), repo=self.repo, args=[]) 157 self.ui(), repo=self.repo, args=[])
157 158
158 def test_parent_output(self): 159 def test_parent_output(self):
159 self._load_fixture_and_fetch('two_heads.svndump') 160 self._load_fixture_and_fetch('two_heads.svndump')
367 otherurl = test_util.fileurl(otherpath) 368 otherurl = test_util.fileurl(otherpath)
368 self.load_and_fetch('replace_trunk_with_branch.svndump') 369 self.load_and_fetch('replace_trunk_with_branch.svndump')
369 # rebuildmeta with original repo 370 # rebuildmeta with original repo
370 svncommands.rebuildmeta(self.ui(), repo=self.repo, args=[]) 371 svncommands.rebuildmeta(self.ui(), repo=self.repo, args=[])
371 # rebuildmeta with unrelated repo 372 # rebuildmeta with unrelated repo
372 self.assertRaises(hgutil.Abort, 373 self.assertRaises(hgerror.Abort,
373 svncommands.rebuildmeta, 374 svncommands.rebuildmeta,
374 self.ui(), repo=self.repo, args=[otherurl]) 375 self.ui(), repo=self.repo, args=[otherurl])
375 # rebuildmeta --unsafe-skip-uuid-check with unrelated repo 376 # rebuildmeta --unsafe-skip-uuid-check with unrelated repo
376 svncommands.rebuildmeta(self.ui(), repo=self.repo, args=[otherurl], 377 svncommands.rebuildmeta(self.ui(), repo=self.repo, args=[otherurl],
377 unsafe_skip_uuid_check=True) 378 unsafe_skip_uuid_check=True)