Patchwork [hglib] hglib: make all imports absolute (issue4520)

login
register
mail settings
Submitter Brett Cannon
Date March 13, 2015, 6:46 p.m.
Message ID <c1b966866ed7d9bf2f3a.1426272411@bcannon-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/8058/
State Accepted
Headers show

Comments

Brett Cannon - March 13, 2015, 6:46 p.m.
# HG changeset patch
# User Brett Cannon <brett@python.org>
# Date 1426272373 14400
#      Fri Mar 13 14:46:13 2015 -0400
# Node ID c1b966866ed7d9bf2f3ac8a0ad0f95af17e53984
# Parent  98829bf71f10ec15c39595c53617747daf49137a
hglib: make all imports absolute (issue4520)
Matt Mackall - March 13, 2015, 9:47 p.m.
On Fri, 2015-03-13 at 14:46 -0400, Brett Cannon wrote:
> # HG changeset patch
> # User Brett Cannon <brett@python.org>
> # Date 1426272373 14400
> #      Fri Mar 13 14:46:13 2015 -0400
> # Node ID c1b966866ed7d9bf2f3ac8a0ad0f95af17e53984
> # Parent  98829bf71f10ec15c39595c53617747daf49137a
> hglib: make all imports absolute (issue4520)

Queued, thanks.

Patch

diff -r 98829bf71f10 -r c1b966866ed7 hglib/__init__.py
--- 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'
 
diff -r 98829bf71f10 -r c1b966866ed7 hglib/client.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 hglib/context.py
--- 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
diff -r 98829bf71f10 -r c1b966866ed7 hglib/util.py
--- 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:
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-annotate.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-bookmarks.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-branch.py
--- 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
 
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-branches.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-bundle.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-clone.py
--- 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
 
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-commit.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-config.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-context.py
--- 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
 
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-copy.py
--- 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
 
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-diff.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-encoding.py
--- 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
 
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-forget.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-grep.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-heads.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-hglib.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-hidden.py
--- 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
 
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-import.py
--- 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("""
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-init.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-log.py
--- 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
 
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-manifest.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-merge.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-move.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-outgoing-incoming.py
--- 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
 
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-parents.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-paths.py
--- 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
 
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-phase.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-pull.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-push.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-remove.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-resolve.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-status.py
--- 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):
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-summary.py
--- 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
 
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-tags.py
--- 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
 
diff -r 98829bf71f10 -r c1b966866ed7 tests/test-update.py
--- 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