changeset 97:4b2c5c4ffeff

Merge with main Tested against 1.3.1
author Patrick Mezard <pmezard@gmail.com>
date Thu, 24 Sep 2009 13:50:07 +0200
parents 872a57531db6 (diff) 43f2315ce536 (current diff)
children f5441510cbb0
files forest.py
diffstat 1 files changed, 16 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/forest.py	Thu Apr 09 03:22:34 2009 -0400
+++ b/forest.py	Thu Sep 24 13:50:07 2009 +0200
@@ -55,20 +55,10 @@
 import re
 import shutil
 
-from mercurial import cmdutil, commands, hg, hgweb, node, util
+from mercurial import cmdutil, commands, error, hg, hgweb, node, util
 from mercurial import localrepo, sshrepo, sshserver, httprepo, statichttprepo
 from mercurial.i18n import gettext as _
 
-# Import exceptions with backwards compatibility
-try:
-    from mercurial.error import RepoError, UnknownCommand
-except ImportError:
-    from mercurial.repo import RepoError
-    try:
-        from mercurial.cmdutil import UnknownCommand
-    except ImportError:
-        from mercurial.commands import UnknownCommand
-
 # For backwards compatibility, we need the following function definition.
 # If we didn't want that, we'd have just written:
 #     from mercurial.commands import 
@@ -87,6 +77,20 @@
 except AttributeError:
     findcmd.findcmd = commands.findcmd
     findcmd.__doc__ = commands.findcmd.__doc__
+for m in (error, cmdutil, commands):
+    if hasattr(m, "UnknownCommand"):
+        UnknownCommand = m.UnknownCommand
+        break
+try:
+    # Assign the exceptions explicitely to avoid demandload issues
+    import mercurial.repo
+    import mercurial.cmdutil
+    RepoError = mercurial.repo.RepoError
+    ParseError = mercurial.dispatch.ParseError
+except AttributeError:
+    import mercurial.error
+    RepoError = mercurial.error.RepoError
+    ParseError = mercurial.error.ParseError
 
 # For backwards compatibility, find the parseurl() function that splits
 # urls and revisions.  Mercurial 0.9.3 doesn't have this, so we need
@@ -1130,7 +1134,7 @@
 
     snapfile = snapshot or opts['snapfile']
     if not snapfile:
-        raise cmdutil.ParseError("fseed", _("invalid arguments"))
+        raise ParseError("fseed", _("invalid arguments"))
     forest = Forest(snapfile=snapfile)
     tip = opts['tip']
     dest = opts['root']