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