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. Log in to comment