relative import should be used

Shun-ichi Goto avatarShun-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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.