Mercurial > public > mercurial-scm > hg
diff hgext/convert/git.py @ 26587:56b2bcea2529
error: get Abort from 'error' instead of 'util'
The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be
confused about that and gives all the credit to 'util' instead of the
hardworking 'error'. In a spirit of equity, we break the cycle of injustice and
give back to 'error' the respect it deserves. And screw that 'util' poser.
For great justice.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 08 Oct 2015 12:55:45 -0700 |
parents | e63d05fbae84 |
children | aaa33ec3c951 |
line wrap: on
line diff
--- a/hgext/convert/git.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/convert/git.py Thu Oct 08 12:55:45 2015 -0700 @@ -97,7 +97,7 @@ # The default value (50) is based on the default for 'git diff'. similarity = ui.configint('convert', 'git.similarity', default=50) if similarity < 0 or similarity > 100: - raise util.Abort(_('similarity must be between 0 and 100')) + raise error.Abort(_('similarity must be between 0 and 100')) if similarity > 0: self.simopt = '-C%d%%' % similarity findcopiesharder = ui.configbool('convert', 'git.findcopiesharder', @@ -123,14 +123,14 @@ heads, ret = self.gitread('git rev-parse --branches --remotes') heads = heads.splitlines() if ret: - raise util.Abort(_('cannot retrieve git heads')) + raise error.Abort(_('cannot retrieve git heads')) else: heads = [] for rev in self.revs: rawhead, ret = self.gitread("git rev-parse --verify %s" % rev) heads.append(rawhead[:-1]) if ret: - raise util.Abort(_('cannot retrieve git head "%s"') % rev) + raise error.Abort(_('cannot retrieve git head "%s"') % rev) return heads def catfile(self, rev, type): @@ -140,11 +140,11 @@ self.catfilepipe[0].flush() info = self.catfilepipe[1].readline().split() if info[1] != type: - raise util.Abort(_('cannot read %r object at %s') % (type, rev)) + raise error.Abort(_('cannot read %r object at %s') % (type, rev)) size = int(info[2]) data = self.catfilepipe[1].read(size) if len(data) < size: - raise util.Abort(_('cannot read %r object at %s: unexpected size') + raise error.Abort(_('cannot read %r object at %s: unexpected size') % (type, rev)) # read the trailing newline self.catfilepipe[1].read(1) @@ -210,7 +210,7 @@ def getchanges(self, version, full): if full: - raise util.Abort(_("convert from git do not support --full")) + raise error.Abort(_("convert from git do not support --full")) self.modecache = {} fh = self.gitopen("git diff-tree -z --root -m -r %s %s" % ( self.simopt, version)) @@ -283,7 +283,7 @@ copies[fdest] = f entry = None if fh.close(): - raise util.Abort(_('cannot read changes in %s') % version) + raise error.Abort(_('cannot read changes in %s') % version) if subexists[0]: if subdeleted[0]: @@ -342,13 +342,13 @@ for line in fh: line = line.strip() if line.startswith("error:") or line.startswith("fatal:"): - raise util.Abort(_('cannot read tags from %s') % self.path) + raise error.Abort(_('cannot read tags from %s') % self.path) node, tag = line.split(None, 1) if not tag.startswith(prefix): continue alltags[tag[len(prefix):]] = node if fh.close(): - raise util.Abort(_('cannot read tags from %s') % self.path) + raise error.Abort(_('cannot read tags from %s') % self.path) # Filter out tag objects for annotated tag refs for tag in alltags: @@ -376,7 +376,7 @@ '"%s^%s" --' % (version, version, i + 1)) changes = [f.rstrip('\n') for f in fh] if fh.close(): - raise util.Abort(_('cannot read changes in %s') % version) + raise error.Abort(_('cannot read changes in %s') % version) return changes