relative import should be used

Issue #399 new
Shun-ichi Goto created an issue

In recent hgsubversion code, loadin will be failed.

abort: No module named hgsubversion!

This error is occured in the case of specifying the extension path like this:

[extensions]
hgsubversion=c:/develop/hg/hgsubversion

This error is due to the lines import hgsubversion.util as util in layouts/standard.py and from hgsubversion import svnwrap in layouts/detect.py

Here's a patch to fix by using relative importing.

diff -r 3e160afaa7db hgsubversion/layouts/detect.py
--- a/hgsubversion/layouts/detect.py    Thu Aug 09 11:37:55 2012 +0900
+++ b/hgsubversion/layouts/detect.py    Tue Jul 02 11:45:26 2013 +0900
@@ -10,7 +10,7 @@

 from mercurial import util as hgutil

-from hgsubversion import svnwrap
+from .. import svnwrap

 def layout_from_subversion(svn, revision=None, ui=None):
     """ Guess what layout to use based on directories under the svn root.
diff -r 3e160afaa7db hgsubversion/layouts/standard.py
--- a/hgsubversion/layouts/standard.py  Thu Aug 09 11:37:55 2012 +0900
+++ b/hgsubversion/layouts/standard.py  Tue Jul 02 11:45:26 2013 +0900
@@ -2,7 +2,7 @@
 import pickle

 import base
-import hgsubversion.util as util
+from .. import util

 class StandardLayout(base.BaseLayout):
     """The standard trunk, branches, tags layout"""

Comments (5)

  1. Augie Fackler repo owner

    Can you please mail the patch to the list using hg email? The issue tracker is where patches go to die.

  2. Augie Fackler repo owner

    Also, this patch isn't acceptable if we want to keep working on Python 2.4, which I think we do.

  3. Shun-ichi Goto reporter

    I've posted the patches to the ML about this issue (work with python 2.4 and later) and two more fix to work with python 2.4.

  4. Log in to comment