[PATCH 2 of 6] require: Add a link to the wiki page in missing requirement abort message

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat Jun 18 06:10:00 CDT 2011


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1308390046 -7200
# Node ID 32b4e7235e553a5444e8e78e9390a4ecc1291586
# Parent  66ccbdcb709dc6cc23db7f19d54ebafd7efe103e
require: Add a link to the wiki page in missing requirement abort message

Directly pointing the user to the meaningful page of the wiki shoudl greatly
ease resolution of missing requirement issue.

diff -r 66ccbdcb709d -r 32b4e7235e55 mercurial/dispatch.py
--- a/mercurial/dispatch.py	Sat Jun 18 02:43:40 2011 +0200
+++ b/mercurial/dispatch.py	Sat Jun 18 11:40:46 2011 +0200
@@ -123,6 +123,10 @@
         else:
             ui.warn(_("hg: %s\n") % inst.args[1])
             commands.help_(ui, 'shortlist')
+    except error.MissingRequirementError, inst:
+        ui.warn(_("abort: %s\n" % inst))
+        m = _("(see http://mercurial.selenic.com/wiki/RequiresFile for details)\n")
+        ui.warn(m)
     except error.RepoError, inst:
         ui.warn(_("abort: %s!\n") % inst)
     except error.ResponseError, inst:
diff -r 66ccbdcb709d -r 32b4e7235e55 mercurial/scmutil.py
--- a/mercurial/scmutil.py	Sat Jun 18 02:43:40 2011 +0200
+++ b/mercurial/scmutil.py	Sat Jun 18 11:40:46 2011 +0200
@@ -701,7 +701,6 @@
             if not r or not r[0].isalnum():
                 msg = _(".hg/requires file is corrupt")
                 raise error.CorruptRequirementError(msg)
-            msg = _("unknown repository format: requires feature '%s' "
-                    "(upgrade Mercurial)") % r
+            msg = _("unknown repository format: requires feature '%s'") % r
             raise error.MissingRequirementError(msg)
     return requirements
diff -r 66ccbdcb709d -r 32b4e7235e55 tests/test-commit.t
--- a/tests/test-commit.t	Sat Jun 18 02:43:40 2011 +0200
+++ b/tests/test-commit.t	Sat Jun 18 11:40:46 2011 +0200
@@ -98,7 +98,8 @@
   $ echo foo >> foo
   $ echo fake >> .hg/requires
   $ hg commit -m bla
-  abort: unknown repository format: requires feature 'fake' (upgrade Mercurial)!
+  abort: unknown repository format: requires feature 'fake'
+  (see http://mercurial.selenic.com/wiki/RequiresFile for details)
   [255]
 
   $ cd ..
diff -r 66ccbdcb709d -r 32b4e7235e55 tests/test-identify.t
--- a/tests/test-identify.t	Sat Jun 18 02:43:40 2011 +0200
+++ b/tests/test-identify.t	Sat Jun 18 11:40:46 2011 +0200
@@ -107,11 +107,13 @@
 
   $ echo fake >> .hg/requires
   $ hg id
-  abort: unknown repository format: requires feature 'fake' (upgrade Mercurial)!
+  abort: unknown repository format: requires feature 'fake'
+  (see http://mercurial.selenic.com/wiki/RequiresFile for details)
   [255]
 
   $ cd ..
   $ hg id test
-  abort: unknown repository format: requires feature 'fake' (upgrade Mercurial)!
+  abort: unknown repository format: requires feature 'fake'
+  (see http://mercurial.selenic.com/wiki/RequiresFile for details)
   [255]
 
diff -r 66ccbdcb709d -r 32b4e7235e55 tests/test-requires.t
--- a/tests/test-requires.t	Sat Jun 18 02:43:40 2011 +0200
+++ b/tests/test-requires.t	Sat Jun 18 11:40:46 2011 +0200
@@ -9,5 +9,6 @@
   [255]
   $ echo indoor-pool > .hg/requires
   $ hg tip
-  abort: unknown repository format: requires feature 'indoor-pool' (upgrade Mercurial)!
+  abort: unknown repository format: requires feature 'indoor-pool'
+  (see http://mercurial.selenic.com/wiki/RequiresFile for details)
   [255]


More information about the Mercurial-devel mailing list