##// END OF EJS Templates
util: use error.Abort instead of local alias
Yuya Nishihara -
r37114:895f209b default
parent child Browse files
Show More
@@ -282,7 +282,7 b' class digester(object):'
282 282 self._hashes = {}
283 283 for k in digests:
284 284 if k not in DIGESTS:
285 raise Abort(_('unknown digest type: %s') % k)
285 raise error.Abort(_('unknown digest type: %s') % k)
286 286 self._hashes[k] = DIGESTS[k]()
287 287 if s:
288 288 self.update(s)
@@ -293,7 +293,7 b' class digester(object):'
293 293
294 294 def __getitem__(self, key):
295 295 if key not in DIGESTS:
296 raise Abort(_('unknown digest type: %s') % k)
296 raise error.Abort(_('unknown digest type: %s') % k)
297 297 return nodemod.hex(self._hashes[key].digest())
298 298
299 299 def __iter__(self):
@@ -332,12 +332,12 b' class digestchecker(object):'
332 332
333 333 def validate(self):
334 334 if self._size != self._got:
335 raise Abort(_('size mismatch: expected %d, got %d') %
335 raise error.Abort(_('size mismatch: expected %d, got %d') %
336 336 (self._size, self._got))
337 337 for k, v in self._digests.items():
338 338 if v != self._digester[k]:
339 339 # i18n: first parameter is a digest name
340 raise Abort(_('%s mismatch: expected %s, got %s') %
340 raise error.Abort(_('%s mismatch: expected %s, got %s') %
341 341 (k, v, self._digester[k]))
342 342
343 343 try:
@@ -1528,7 +1528,7 b' def tempfilter(s, cmd):'
1528 1528 if pycompat.sysplatform == 'OpenVMS' and code & 1:
1529 1529 code = 0
1530 1530 if code:
1531 raise Abort(_("command '%s' failed: %s") %
1531 raise error.Abort(_("command '%s' failed: %s") %
1532 1532 (cmd, explainexit(code)))
1533 1533 return readfile(outname)
1534 1534 finally:
@@ -1831,7 +1831,7 b' def copyfile(src, dest, hardlink=False, '
1831 1831 oldstat.stat[stat.ST_MTIME] + 1) & 0x7fffffff
1832 1832 os.utime(dest, (advanced, advanced))
1833 1833 except shutil.Error as inst:
1834 raise Abort(str(inst))
1834 raise error.Abort(str(inst))
1835 1835
1836 1836 def copyfiles(src, dst, hardlink=None, progress=lambda t, pos: None):
1837 1837 """Copy a directory tree using hardlinks if possible."""
@@ -2809,7 +2809,8 b' def getport(port):'
2809 2809 try:
2810 2810 return socket.getservbyname(pycompat.sysstr(port))
2811 2811 except socket.error:
2812 raise Abort(_("no port number associated with service '%s'") % port)
2812 raise error.Abort(_("no port number associated with service '%s'")
2813 % port)
2813 2814
2814 2815 class url(object):
2815 2816 r"""Reliable URL parser.
@@ -2970,7 +2971,7 b' class url(object):'
2970 2971
2971 2972 if (self.host and self.scheme == 'file' and
2972 2973 self.host not in ('localhost', '127.0.0.1', '[::1]')):
2973 raise Abort(_('file:// URLs can only refer to localhost'))
2974 raise error.Abort(_('file:// URLs can only refer to localhost'))
2974 2975
2975 2976 self.path = path
2976 2977
General Comments 0
You need to be logged in to leave comments. Login now