Mercurial > public > mercurial-scm > hg-stable
diff mercurial/commands.py @ 3072:bc3fe3b5b785
Never apply string formatting to generated errors with util.Abort.
Otherwise error messages containing % chars yield errors or worse.
Fixed (hopefully) all users of util.Abort.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 08 Sep 2006 09:36:18 +0200 |
parents | 547d1a4aa105 |
children | 4c9fcb5e3b82 |
line wrap: on
line diff
--- a/mercurial/commands.py Fri Sep 08 02:16:16 2006 +0200 +++ b/mercurial/commands.py Fri Sep 08 09:36:18 2006 +0200 @@ -274,7 +274,7 @@ try: num = repo.changelog.rev(repo.lookup(val)) except KeyError: - raise util.Abort(_('invalid revision identifier %s'), val) + raise util.Abort(_('invalid revision identifier %s') % val) return num def revpair(ui, repo, revs): @@ -341,7 +341,7 @@ try: if filename: if os.path.exists(filename): - raise util.Abort(_("file '%s' already exists"), filename) + raise util.Abort(_("file '%s' already exists") % filename) fh = open(filename, "wb") else: fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg") @@ -1269,7 +1269,7 @@ try: ui.write(r.revision(r.lookup(rev))) except KeyError: - raise util.Abort(_('invalid revision identifier %s'), rev) + raise util.Abort(_('invalid revision identifier %s') % rev) def debugindex(ui, file_): """dump the contents of an index file""" @@ -2484,7 +2484,7 @@ try: httpd = hgweb.server.create_server(ui, repo) except socket.error, inst: - raise util.Abort(_('cannot start server: ') + inst.args[1]) + raise util.Abort(_('cannot start server: %s') % inst.args[1]) if ui.verbose: addr, port = httpd.socket.getsockname() @@ -2734,7 +2734,7 @@ repo.ui.warn(_("Using head %s for branch %s\n") % (short(node), branch)) else: - raise util.Abort(_("branch %s not found\n") % (branch)) + raise util.Abort(_("branch %s not found") % branch) else: node = node and repo.lookup(node) or repo.changelog.tip() return node @@ -3449,7 +3449,7 @@ u.warn(_("abort: could not lock %s: %s\n") % (inst.desc or inst.filename, inst.strerror)) except revlog.RevlogError, inst: - u.warn(_("abort: "), inst, "!\n") + u.warn(_("abort: %s!\n") % inst) except util.SignalInterrupt: u.warn(_("killed!\n")) except KeyboardInterrupt: @@ -3482,7 +3482,7 @@ else: u.warn(_("abort: %s\n") % inst.strerror) except util.Abort, inst: - u.warn(_('abort: '), inst.args[0] % inst.args[1:], '\n') + u.warn(_("abort: %s\n") % inst) except TypeError, inst: # was this an argument error? tb = traceback.extract_tb(sys.exc_info()[2])