Merge lp:~jelmer/bzr/branch-lazy-import into lp:bzr

Proposed by Jelmer Vernooij
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: 6106
Proposed branch: lp:~jelmer/bzr/branch-lazy-import
Merge into: lp:bzr
Diff against target: 92 lines (+9/-13)
1 file modified
bzrlib/branch.py (+9/-13)
To merge this branch: bzr merge lp:~jelmer/bzr/branch-lazy-import
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+73142@code.launchpad.net

Commit message

Bug #835545, lazy_import modules rather than objects to allow pydoc to work.

Description of the change

Fix "pydoc bzrlib.branch" by importing modules, not objects, using lazy_import.

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 8/27/2011 7:01 PM, Jelmer Vernooij wrote:
> Jelmer Vernooij has proposed merging
> lp:~jelmer/bzr/branch-lazy-import into lp:bzr.
>
> Requested reviews: bzr-core (bzr-core) Related bugs: Bug #835545 in
> Bazaar: "bzrlib.errors.IllegalUseOfScopeReplacer in pydoc call"
> https://bugs.launchpad.net/bzr/+bug/835545
>
> For more details, see:
> https://code.launchpad.net/~jelmer/bzr/branch-lazy-import/+merge/73142
>
> Fix "pydoc bzrlib.branch" by importing modules, not objects, using
> lazy_import.

 merge: approve

I'm definitely in favor of module imports anyway.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5aAp0ACgkQJdeBCYSNAAOfsQCgwSjbyesdhIUDEAztXLpLm5ZV
rVIAnjL7ME2ybupRinuVM94nYH4hpB6Q
=FLes
-----END PGP SIGNATURE-----

review: Approve
Revision history for this message
John A Meinel (jameinel) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/branch.py'
2--- bzrlib/branch.py 2011-08-19 22:34:02 +0000
3+++ bzrlib/branch.py 2011-08-27 17:01:27 +0000
4@@ -19,7 +19,7 @@
5
6 from bzrlib.lazy_import import lazy_import
7 lazy_import(globals(), """
8-from itertools import chain
9+import itertools
10 from bzrlib import (
11 bzrdir,
12 cache_utf8,
13@@ -35,15 +35,11 @@
14 repository,
15 revision as _mod_revision,
16 rio,
17+ tag as _mod_tag,
18 transport,
19 ui,
20 urlutils,
21 )
22-from bzrlib.config import BranchConfig, TransportConfig
23-from bzrlib.tag import (
24- BasicTags,
25- DisabledTags,
26- )
27 """)
28
29 from bzrlib import (
30@@ -216,7 +212,7 @@
31
32 :return: A bzrlib.config.BranchConfig.
33 """
34- return BranchConfig(self)
35+ return _mod_config.BranchConfig(self)
36
37 def _get_config(self):
38 """Get the concrete config for just the config in this branch.
39@@ -514,7 +510,7 @@
40 # The decision to include the start or not
41 # depends on the stop_rule if a stop is provided
42 # so pop this node back into the iterator
43- rev_iter = chain(iter([node]), rev_iter)
44+ rev_iter = itertools.chain(iter([node]), rev_iter)
45 break
46 if stop_revision_id is None:
47 # Yield everything
48@@ -1679,7 +1675,7 @@
49 Note that it is normal for branch to be a RemoteBranch when using tags
50 on a RemoteBranch.
51 """
52- return DisabledTags(branch)
53+ return _mod_tag.DisabledTags(branch)
54
55 def network_name(self):
56 """A simple byte string uniquely identifying this format for RPC calls.
57@@ -2125,7 +2121,7 @@
58
59 def make_tags(self, branch):
60 """See bzrlib.branch.BranchFormat.make_tags()."""
61- return BasicTags(branch)
62+ return _mod_tag.BasicTags(branch)
63
64 def supports_set_append_revisions_only(self):
65 return True
66@@ -2156,7 +2152,7 @@
67
68 def make_tags(self, branch):
69 """See bzrlib.branch.BranchFormat.make_tags()."""
70- return BasicTags(branch)
71+ return _mod_tag.BasicTags(branch)
72
73 def supports_set_append_revisions_only(self):
74 return True
75@@ -2203,7 +2199,7 @@
76
77 def make_tags(self, branch):
78 """See bzrlib.branch.BranchFormat.make_tags()."""
79- return BasicTags(branch)
80+ return _mod_tag.BasicTags(branch)
81
82 supports_reference_locations = False
83
84@@ -2421,7 +2417,7 @@
85 base = property(_get_base, doc="The URL for the root of this branch.")
86
87 def _get_config(self):
88- return TransportConfig(self._transport, 'branch.conf')
89+ return _mod_config.TransportConfig(self._transport, 'branch.conf')
90
91 def is_locked(self):
92 return self.control_files.is_locked()