comparison hggit/verify.py @ 1128:6141895a53c9

compat: switch from hgutil.Abort to error.Abort
author Kevin Bullock <kbullock@ringworld.org>
date Wed, 02 May 2018 20:43:17 -0500
parents bd1a01f98154
children
comparison
equal deleted inserted replaced
1127:108d9303ef71 1128:6141895a53c9
6 # of the GNU General Public License, incorporated herein by reference. 6 # of the GNU General Public License, incorporated herein by reference.
7 7
8 import stat 8 import stat
9 9
10 from mercurial import error 10 from mercurial import error
11 from mercurial import util as hgutil
12 from mercurial.i18n import _ 11 from mercurial.i18n import _
13 12
14 from dulwich import diff_tree 13 from dulwich import diff_tree
15 from dulwich.objects import Commit, S_IFGITLINK 14 from dulwich.objects import Commit, S_IFGITLINK
16 15
26 handler = repo.githandler 25 handler = repo.githandler
27 26
28 gitsha = handler.map_git_get(hgctx.hex()) 27 gitsha = handler.map_git_get(hgctx.hex())
29 if not gitsha: 28 if not gitsha:
30 # TODO deal better with commits in the middle of octopus merges 29 # TODO deal better with commits in the middle of octopus merges
31 raise hgutil.Abort(_('no git commit found for rev %s') % hgctx, 30 raise error.Abort(_('no git commit found for rev %s') % hgctx,
32 hint=_('if this is an octopus merge, ' 31 hint=_('if this is an octopus merge, '
33 'verify against the last rev')) 32 'verify against the last rev'))
34 33
35 try: 34 try:
36 gitcommit = handler.git.get_object(gitsha) 35 gitcommit = handler.git.get_object(gitsha)
37 except KeyError: 36 except KeyError:
38 raise hgutil.Abort(_('git equivalent %s for rev %s not found!') % 37 raise error.Abort(_('git equivalent %s for rev %s not found!') %
39 (gitsha, hgctx)) 38 (gitsha, hgctx))
40 if not isinstance(gitcommit, Commit): 39 if not isinstance(gitcommit, Commit):
41 raise hgutil.Abort(_('git equivalent %s for rev %s is not a commit!') % 40 raise error.Abort(_('git equivalent %s for rev %s is not a commit!') %
42 (gitsha, hgctx)) 41 (gitsha, hgctx))
43 42
44 ui.status(_('verifying rev %s against git commit %s\n') % (hgctx, gitsha)) 43 ui.status(_('verifying rev %s against git commit %s\n') % (hgctx, gitsha))
45 failed = False 44 failed = False
46 45
47 # TODO check commit message and other metadata 46 # TODO check commit message and other metadata