# HG changeset patch # User Mads Kiilerich # Date 1357520429 -3600 # Node ID 720308f741cb53165fa0fe63d7ab27a6ca7fcb83 # Parent fe67db018bd762c21654adb2b30134da6d5a21ed 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: '' diff -r fe67db018bd7 -r 720308f741cb mercurial/dispatch.py --- 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: diff -r fe67db018bd7 -r 720308f741cb tests/test-audit-path.t --- a/tests/test-audit-path.t Sun Jan 06 04:04:44 2013 +0100 +++ b/tests/test-audit-path.t Mon Jan 07 02:00:29 2013 +0100 @@ -86,7 +86,7 @@ $ hg manifest -r4 /tmp/test $ hg update -Cr4 - abort: *: $TESTTMP/target//tmp/test (glob) + abort: *: '$TESTTMP/target//tmp/test' (glob) [255] $ cd .. diff -r fe67db018bd7 -r 720308f741cb tests/test-clone.t --- a/tests/test-clone.t Sun Jan 06 04:04:44 2013 +0100 +++ b/tests/test-clone.t Mon Jan 07 02:00:29 2013 +0100 @@ -558,7 +558,7 @@ $ hg init b $ cd b $ hg clone . ../a - abort: Permission denied: ../a + abort: Permission denied: '../a' [255] $ cd .. $ chmod 700 a diff -r fe67db018bd7 -r 720308f741cb tests/test-convert.t --- a/tests/test-convert.t Sun Jan 06 04:04:44 2013 +0100 +++ b/tests/test-convert.t Mon Jan 07 02:00:29 2013 +0100 @@ -316,7 +316,7 @@ $ chmod 000 bogusdir $ hg convert a bogusdir - abort: Permission denied: bogusdir + abort: Permission denied: 'bogusdir' [255] user permissions should succeed diff -r fe67db018bd7 -r 720308f741cb tests/test-dispatch.t --- a/tests/test-dispatch.t Sun Jan 06 04:04:44 2013 +0100 +++ b/tests/test-dispatch.t Mon Jan 07 02:00:29 2013 +0100 @@ -46,6 +46,12 @@ $ cd "$TESTTMP" +OSError ... and with filename even when it is empty + + $ hg -R a archive '' + abort: No such file or directory: '' + [255] + #if no-outer-repo No repo: