##// END OF EJS Templates
Never apply string formatting to generated errors with util.Abort....
Thomas Arendsen Hein -
r3072:bc3fe3b5 default
parent child Browse files
Show More
@@ -1479,7 +1479,7 b' def fold(ui, repo, *files, **opts):'
1479 1479 if not files:
1480 1480 raise util.Abort(_('qfold requires at least one patch name'))
1481 1481 if not q.check_toppatch(repo):
1482 raise util.Abort(_('No patches applied\n'))
1482 raise util.Abort(_('No patches applied'))
1483 1483
1484 1484 message = commands.logmessage(opts)
1485 1485 if opts['edit']:
@@ -53,8 +53,8 b' def make_filename(repo, pat, node,'
53 53 i += 1
54 54 return ''.join(newname)
55 55 except KeyError, inst:
56 raise util.Abort(_("invalid format spec '%%%s' in output file name"),
57 inst.args[0])
56 raise util.Abort(_("invalid format spec '%%%s' in output file name") %
57 inst.args[0])
58 58
59 59 def make_file(repo, pat, node=None,
60 60 total=None, seqno=None, revwidth=None, mode='wb', pathname=None):
@@ -274,7 +274,7 b' def revfix(repo, val, defval):'
274 274 try:
275 275 num = repo.changelog.rev(repo.lookup(val))
276 276 except KeyError:
277 raise util.Abort(_('invalid revision identifier %s'), val)
277 raise util.Abort(_('invalid revision identifier %s') % val)
278 278 return num
279 279
280 280 def revpair(ui, repo, revs):
@@ -341,7 +341,7 b' def write_bundle(cg, filename=None, comp'
341 341 try:
342 342 if filename:
343 343 if os.path.exists(filename):
344 raise util.Abort(_("file '%s' already exists"), filename)
344 raise util.Abort(_("file '%s' already exists") % filename)
345 345 fh = open(filename, "wb")
346 346 else:
347 347 fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg")
@@ -1269,7 +1269,7 b' def debugdata(ui, file_, rev):'
1269 1269 try:
1270 1270 ui.write(r.revision(r.lookup(rev)))
1271 1271 except KeyError:
1272 raise util.Abort(_('invalid revision identifier %s'), rev)
1272 raise util.Abort(_('invalid revision identifier %s') % rev)
1273 1273
1274 1274 def debugindex(ui, file_):
1275 1275 """dump the contents of an index file"""
@@ -2484,7 +2484,7 b' def serve(ui, repo, **opts):'
2484 2484 try:
2485 2485 httpd = hgweb.server.create_server(ui, repo)
2486 2486 except socket.error, inst:
2487 raise util.Abort(_('cannot start server: ') + inst.args[1])
2487 raise util.Abort(_('cannot start server: %s') % inst.args[1])
2488 2488
2489 2489 if ui.verbose:
2490 2490 addr, port = httpd.socket.getsockname()
@@ -2734,7 +2734,7 b' def _lookup(repo, node, branch=None):'
2734 2734 repo.ui.warn(_("Using head %s for branch %s\n")
2735 2735 % (short(node), branch))
2736 2736 else:
2737 raise util.Abort(_("branch %s not found\n") % (branch))
2737 raise util.Abort(_("branch %s not found") % branch)
2738 2738 else:
2739 2739 node = node and repo.lookup(node) or repo.changelog.tip()
2740 2740 return node
@@ -3449,7 +3449,7 b' def dispatch(args):'
3449 3449 u.warn(_("abort: could not lock %s: %s\n") %
3450 3450 (inst.desc or inst.filename, inst.strerror))
3451 3451 except revlog.RevlogError, inst:
3452 u.warn(_("abort: "), inst, "!\n")
3452 u.warn(_("abort: %s!\n") % inst)
3453 3453 except util.SignalInterrupt:
3454 3454 u.warn(_("killed!\n"))
3455 3455 except KeyboardInterrupt:
@@ -3482,7 +3482,7 b' def dispatch(args):'
3482 3482 else:
3483 3483 u.warn(_("abort: %s\n") % inst.strerror)
3484 3484 except util.Abort, inst:
3485 u.warn(_('abort: '), inst.args[0] % inst.args[1:], '\n')
3485 u.warn(_("abort: %s\n") % inst)
3486 3486 except TypeError, inst:
3487 3487 # was this an argument error?
3488 3488 tb = traceback.extract_tb(sys.exc_info()[2])
@@ -115,7 +115,7 b' def clone(ui, source, dest=None, pull=Fa'
115 115 source = localpath(source)
116 116
117 117 if os.path.exists(dest):
118 raise util.Abort(_("destination '%s' already exists"), dest)
118 raise util.Abort(_("destination '%s' already exists") % dest)
119 119
120 120 class DirCleanup(object):
121 121 def __init__(self, dir_):
@@ -325,7 +325,7 b' class httprepository(remoterepository):'
325 325 rfp.close()
326 326 except socket.error, err:
327 327 if err[0] in (errno.ECONNRESET, errno.EPIPE):
328 raise util.Abort(_('push failed: %s'), err[1])
328 raise util.Abort(_('push failed: %s') % err[1])
329 329 raise util.Abort(err[1])
330 330 finally:
331 331 fp.close()
@@ -133,7 +133,7 b' class localrepository(repo.repository):'
133 133 except Exception, exc:
134 134 if isinstance(exc, util.Abort):
135 135 self.ui.warn(_('error: %s hook failed: %s\n') %
136 (hname, exc.args[0] % exc.args[1:]))
136 (hname, exc.args[0]))
137 137 else:
138 138 self.ui.warn(_('error: %s hook raised an exception: '
139 139 '%s\n') % (hname, exc))
General Comments 0
You need to be logged in to leave comments. Login now