[PATCH 4 of 5] import: improve error reporting

Greg Ward greg-hg at gerg.ca
Sun Oct 2 13:37:33 CDT 2011


# HG changeset patch
# User Greg Ward <greg at gerg.ca>
# Date 1317520364 14400
# Node ID 6965157abf1cac4a190590acff61d08ef6319d06
# Parent  402b3a0d2c1e27e2e08878d14a0b7d71edf0d486
import: improve error reporting

When applying a series of patch files, it's nice to be explicitly told *which* file is broken.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3374,6 +3374,7 @@
             if patchurl == '-':
                 ui.status(_('applying patch from stdin\n'))
                 patchfile = ui.fin
+                patchurl = 'stdin'      # for error message
             else:
                 patchurl = os.path.join(base, patchurl)
                 ui.status(_('applying %s\n') % patchurl)
@@ -3391,7 +3392,7 @@
                     parents = [repo[node]]
 
             if not haspatch:
-                raise util.Abort(_('no diffs found'))
+                raise util.Abort(_('%s: no diffs found') % patchurl)
 
         if msgs:
             repo.savecommitmessage('\n* * *\n'.join(msgs))


More information about the Mercurial-devel mailing list