diff mercurial/dispatch.py @ 18227:720308f741cb

dispatch: show empty filename in OSError aborts Mercurial would sometimes exit with: abort: No such file or directory where str of the actual OSError exception was the more helpful: [Errno 2] No such file or directory: '' The exception will now always show the filename and quote it: abort: No such file or directory: ''
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 07 Jan 2013 02:00:29 +0100
parents 0f9013112eba
children 5bb610f87d1d
line wrap: on
line diff
--- a/mercurial/dispatch.py	Sun Jan 06 04:04:44 2013 +0100
+++ b/mercurial/dispatch.py	Mon Jan 07 02:00:29 2013 +0100
@@ -183,8 +183,8 @@
         else:
             raise
     except OSError, inst:
-        if getattr(inst, "filename", None):
-            ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename))
+        if getattr(inst, "filename", None) is not None:
+            ui.warn(_("abort: %s: '%s'\n") % (inst.strerror, inst.filename))
         else:
             ui.warn(_("abort: %s\n") % inst.strerror)
     except KeyboardInterrupt: