changeset 148:c1b966866ed7

hglib: make all imports absolute (issue4520)
author Brett Cannon <brett@python.org>
date Fri, 13 Mar 2015 14:46:13 -0400
parents 98829bf71f10
children 958307b30af3
files hglib/__init__.py hglib/client.py hglib/context.py hglib/util.py tests/test-annotate.py tests/test-bookmarks.py tests/test-branch.py tests/test-branches.py tests/test-bundle.py tests/test-clone.py tests/test-commit.py tests/test-config.py tests/test-context.py tests/test-copy.py tests/test-diff.py tests/test-encoding.py tests/test-forget.py tests/test-grep.py tests/test-heads.py tests/test-hglib.py tests/test-hidden.py tests/test-import.py tests/test-init.py tests/test-log.py tests/test-manifest.py tests/test-merge.py tests/test-move.py tests/test-outgoing-incoming.py tests/test-parents.py tests/test-paths.py tests/test-phase.py tests/test-pull.py tests/test-push.py tests/test-remove.py tests/test-resolve.py tests/test-status.py tests/test-summary.py tests/test-tags.py tests/test-update.py
diffstat 39 files changed, 62 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/hglib/__init__.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/hglib/__init__.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import client, subprocess, util, error
+import subprocess
+from hglib import client, util, error
 
 HGPATH = 'hg'
 
--- a/hglib/client.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/hglib/client.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,7 +1,8 @@
 import subprocess, os, struct, re, datetime
-import hglib, error, util, templates, merge, context
+import hglib
+from hglib import error, util, templates, merge, context
 
-from util import b, cmdbuilder, BytesIO
+from hglib.util import b, cmdbuilder, BytesIO
 
 class revision(tuple):
     def __new__(cls, rev, node, tags, branch, author, desc, date):
--- a/hglib/context.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/hglib/context.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,5 +1,6 @@
+import hglib.client  # Circular dependency.
+from hglib import util, templates
 from hglib.error import CommandError
-import client, util, templates
 from hglib.util import b
 
 _nullcset = [b('-1'), b('0000000000000000000000000000000000000000'), b(''),
@@ -13,7 +14,7 @@
         if changeid == b(''):
             changeid = b('.')
         self._repo = repo
-        if isinstance(changeid, client.revision):
+        if isinstance(changeid, hglib.client.revision):
             cset = changeid
         elif changeid == -1:
             cset = _nullcset
--- a/hglib/util.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/hglib/util.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import itertools, error, os, subprocess, sys
+import itertools, os, subprocess, sys
+from hglib import error
 try:
     from io import BytesIO
 except ImportError:
--- a/tests/test-annotate.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-annotate.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,4 @@
-import common
+from tests import common
 from hglib.util import b
 
 class test_annotate(common.basetest):
--- a/tests/test-bookmarks.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-bookmarks.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,4 @@
-import common
+from tests import common
 from hglib.util import b
 
 class test_bookmarks(common.basetest):
--- a/tests/test-branch.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-branch.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,4 @@
-import common
+from tests import common
 import hglib
 from hglib.util import b
 
--- a/tests/test-branches.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-branches.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import common, hglib
+from tests import common
+import hglib
 from hglib.util import b
 
 class test_branches(common.basetest):
--- a/tests/test-bundle.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-bundle.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,4 @@
-import common
+from tests import common
 from hglib.util import b
 
 class test_bundle(common.basetest):
--- a/tests/test-clone.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-clone.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,5 +1,5 @@
 import os
-import common
+from tests import common
 import hglib
 from hglib.util import b
 
--- a/tests/test-commit.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-commit.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import common, hglib, datetime
+from tests import common
+import hglib, datetime
 from hglib.util import b
 
 class test_commit(common.basetest):
--- a/tests/test-config.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-config.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import os, common, hglib
+from tests import common
+import os, hglib
 from hglib.util import b
 
 class test_config(common.basetest):
--- a/tests/test-context.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-context.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,6 +1,7 @@
 import sys
+from tests import common
 from hglib.error import CommandError
-import common, hglib
+import hglib
 from hglib import context
 from hglib.util import b
 
--- a/tests/test-copy.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-copy.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,4 @@
-import common
+from tests import common
 import hglib
 from hglib.util import b
 
--- a/tests/test-diff.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-diff.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,4 @@
-import common
+from tests import common
 from hglib.util import b
 
 class test_diff(common.basetest):
--- a/tests/test-encoding.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-encoding.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,4 @@
-import common
+from tests import common
 import hglib
 from hglib.util import b
 
--- a/tests/test-forget.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-forget.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,4 @@
-import common
+from tests import common
 from hglib.util import b
 
 class test_forget(common.basetest):
--- a/tests/test-grep.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-grep.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,4 @@
-import common
+from tests import common
 from hglib.util import b
 
 class test_grep(common.basetest):
--- a/tests/test-heads.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-heads.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,4 @@
-import common
+from tests import common
 from hglib.util import b
 
 class test_heads(common.basetest):
--- a/tests/test-hglib.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-hglib.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import common, hglib
+from tests import common
+import hglib
 
 class test_hglib(common.basetest):
     def setUp(self):
--- a/tests/test-hidden.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-hidden.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import common, hglib, datetime
+from tests import common
+import hglib, datetime
 from hglib.error import CommandError
 from hglib.util import b
 
--- a/tests/test-import.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-import.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import common, os
+import os
+from tests import common
 from hglib.util import b, BytesIO
 
 patch = b("""
--- a/tests/test-init.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-init.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import hglib, common, shutil
+from tests import common
+import hglib, shutil
 from hglib.util import b
 
 class test_init(common.basetest):
--- a/tests/test-log.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-log.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,4 @@
-import common
+from tests import common
 import hglib
 from hglib.util import b
 
--- a/tests/test-manifest.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-manifest.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import common, hglib, os, stat
+from tests import common
+import hglib, os, stat
 from hglib.util import b
 
 class test_manifest(common.basetest):
--- a/tests/test-merge.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-merge.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import common, hglib
+from tests import common
+import hglib
 from hglib.util import b
 
 class test_merge(common.basetest):
--- a/tests/test-move.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-move.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import common, os
+import os
+from tests import common
 from hglib.util import b
 
 class test_move(common.basetest):
--- a/tests/test-outgoing-incoming.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-outgoing-incoming.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,4 @@
-import common
+from tests import common
 import hglib
 from hglib.util import b
 
--- a/tests/test-parents.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-parents.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,4 @@
-import common
+from tests import common
 from hglib.util import b
 
 class test_parents(common.basetest):
--- a/tests/test-paths.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-paths.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import common, os
+import os
+from tests import common
 import hglib
 from hglib.util import b
 
--- a/tests/test-phase.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-phase.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import common, hglib
+from tests import common
+import hglib
 from hglib.util import b
 
 class test_phase(common.basetest):
--- a/tests/test-pull.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-pull.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import common, hglib
+from tests import common
+import hglib
 from hglib.util import b
 
 class test_pull(common.basetest):
--- a/tests/test-push.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-push.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import common, hglib
+from tests import common
+import hglib
 from hglib.util import b
 
 class test_push(common.basetest):
--- a/tests/test-remove.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-remove.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,4 @@
-import common
+from tests import common
 from hglib.util import b
 
 class test_remove(common.basetest):
--- a/tests/test-resolve.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-resolve.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import common, hglib
+from tests import common
+import hglib
 from hglib.util import b
 
 class test_resolve(common.basetest):
--- a/tests/test-status.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-status.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,5 @@
-import common, os
+import os
+from tests import common
 from hglib.util import b
 
 class test_status(common.basetest):
--- a/tests/test-summary.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-summary.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,4 @@
-import common
+from tests import common
 import hglib
 from hglib.util import b
 
--- a/tests/test-tags.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-tags.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,4 @@
-import common
+from tests import common
 import hglib
 from hglib.util import b
 
--- a/tests/test-update.py	Fri Mar 13 12:28:06 2015 -0500
+++ b/tests/test-update.py	Fri Mar 13 14:46:13 2015 -0400
@@ -1,4 +1,4 @@
-import common
+from tests import common
 from hglib import error
 from hglib.util import b