comparison hgext/convert/darcs.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 baea47cafe75
children aaa33ec3c951
comparison
equal deleted inserted replaced
26586:d51c658d3f04 26587:56b2bcea2529
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 from common import NoRepo, checktool, commandline, commit, converter_source 8 from common import NoRepo, checktool, commandline, commit, converter_source
9 from mercurial.i18n import _ 9 from mercurial.i18n import _
10 from mercurial import util 10 from mercurial import util, error
11 import os, shutil, tempfile, re, errno 11 import os, shutil, tempfile, re, errno
12 12
13 # The naming drift of ElementTree is fun! 13 # The naming drift of ElementTree is fun!
14 14
15 try: 15 try:
37 raise NoRepo(_("%s does not look like a darcs repository") % path) 37 raise NoRepo(_("%s does not look like a darcs repository") % path)
38 38
39 checktool('darcs') 39 checktool('darcs')
40 version = self.run0('--version').splitlines()[0].strip() 40 version = self.run0('--version').splitlines()[0].strip()
41 if version < '2.1': 41 if version < '2.1':
42 raise util.Abort(_('darcs version 2.1 or newer needed (found %r)') % 42 raise error.Abort(_('darcs version 2.1 or newer needed (found %r)')
43 version) 43 % version)
44 44
45 if "ElementTree" not in globals(): 45 if "ElementTree" not in globals():
46 raise util.Abort(_("Python ElementTree module is not available")) 46 raise error.Abort(_("Python ElementTree module is not available"))
47 47
48 self.path = os.path.realpath(path) 48 self.path = os.path.realpath(path)
49 49
50 self.lastrev = None 50 self.lastrev = None
51 self.changes = {} 51 self.changes = {}
156 output, status = self.run('revert', all=True, repodir=self.tmppath) 156 output, status = self.run('revert', all=True, repodir=self.tmppath)
157 self.checkexit(status, output) 157 self.checkexit(status, output)
158 158
159 def getchanges(self, rev, full): 159 def getchanges(self, rev, full):
160 if full: 160 if full:
161 raise util.Abort(_("convert from darcs do not support --full")) 161 raise error.Abort(_("convert from darcs do not support --full"))
162 copies = {} 162 copies = {}
163 changes = [] 163 changes = []
164 man = None 164 man = None
165 for elt in self.changes[rev].find('summary').getchildren(): 165 for elt in self.changes[rev].find('summary').getchildren():
166 if elt.tag in ('add_directory', 'remove_directory'): 166 if elt.tag in ('add_directory', 'remove_directory'):
190 self.lastrev = rev 190 self.lastrev = rev
191 return sorted(changes), copies, set() 191 return sorted(changes), copies, set()
192 192
193 def getfile(self, name, rev): 193 def getfile(self, name, rev):
194 if rev != self.lastrev: 194 if rev != self.lastrev:
195 raise util.Abort(_('internal calling inconsistency')) 195 raise error.Abort(_('internal calling inconsistency'))
196 path = os.path.join(self.tmppath, name) 196 path = os.path.join(self.tmppath, name)
197 try: 197 try:
198 data = util.readfile(path) 198 data = util.readfile(path)
199 mode = os.lstat(path).st_mode 199 mode = os.lstat(path).st_mode
200 except IOError as inst: 200 except IOError as inst: