[PATCH 1 of 6 STABLE] doc: add hint to PatchError for fail of path element stripping

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Thu Apr 26 07:38:25 CDT 2012


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1335443568 -32400
# Branch stable
# Node ID 366b70de30e317936fc99a8f7db38e35e5fecce4
# Parent  e3c7ca15cde24f7e1ef5018fcfd902f4d6c95adc
doc: add hint to PatchError for fail of path element stripping

when this kind of error occurs, users who are not so familiar with
plain "patch" command doesn't know what they should do.

diff -r e3c7ca15cde2 -r 366b70de30e3 mercurial/patch.py
--- a/mercurial/patch.py	Mon Apr 23 00:38:22 2012 +0900
+++ b/mercurial/patch.py	Thu Apr 26 21:32:48 2012 +0900
@@ -1067,7 +1067,9 @@
         i = path.find('/', i)
         if i == -1:
             raise PatchError(_("unable to strip away %d of %d dirs from %s") %
-                             (count, strip, path))
+                             (count, strip, path),
+                             hint=_("please check whether paths in diff"
+                                    " header are long enough"))
         i += 1
         # consume '//' in the path
         while i < pathlen - 1 and path[i] == '/':


More information about the Mercurial-devel mailing list