Rev 5607: (jelmer) More lazy loading of bzrlib.ui and bzrlib.urlutils. (Jelmer in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Jan 13 02:09:52 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5607 [merge]
revision-id: pqm at pqm.ubuntu.com-20110113020950-fj3kzj8wviwrkcrn
parent: pqm at pqm.ubuntu.com-20110113012941-v9j2hrptxaaxvi7l
parent: jelmer at samba.org-20110113013226-1d41bwtmps9y68wm
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2011-01-13 02:09:50 +0000
message:
(jelmer) More lazy loading of bzrlib.ui and bzrlib.urlutils. (Jelmer
Vernooij)
modified:
bzrlib/check.py check.py-20050309040759-f3a679400c06bcc1
bzrlib/commit.py commit.py-20050511101309-79ec1a0168e0e825
bzrlib/trace.py trace.py-20050309040759-c8ed824bdcd4748a
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
=== modified file 'bzrlib/check.py'
--- a/bzrlib/check.py 2010-04-30 11:35:43 +0000
+++ b/bzrlib/check.py 2011-01-13 00:14:31 +0000
@@ -46,13 +46,15 @@
indicating that the revision was found/not found.
"""
-from bzrlib import errors
+from bzrlib import (
+ errors,
+ ui,
+ )
from bzrlib.branch import Branch
from bzrlib.bzrdir import BzrDir
from bzrlib.revision import NULL_REVISION
from bzrlib.symbol_versioning import deprecated_function, deprecated_in
from bzrlib.trace import note
-import bzrlib.ui
from bzrlib.workingtree import WorkingTree
class Check(object):
@@ -88,7 +90,7 @@
if callback_refs is None:
callback_refs = {}
self.repository.lock_read()
- self.progress = bzrlib.ui.ui_factory.nested_progress_bar()
+ self.progress = ui.ui_factory.nested_progress_bar()
try:
self.progress.update('check', 0, 4)
if self.check_repo:
@@ -287,7 +289,7 @@
"""Check all the weaves we can get our hands on.
"""
weave_ids = []
- storebar = bzrlib.ui.ui_factory.nested_progress_bar()
+ storebar = ui.ui_factory.nested_progress_bar()
try:
self._check_weaves(storebar)
finally:
=== modified file 'bzrlib/commit.py'
--- a/bzrlib/commit.py 2011-01-10 23:58:01 +0000
+++ b/bzrlib/commit.py 2011-01-13 01:32:26 +0000
@@ -55,6 +55,7 @@
revision,
trace,
tree,
+ ui,
)
from bzrlib.branch import Branch
from bzrlib.cleanup import OperationWithCleanups
@@ -72,7 +73,6 @@
from bzrlib.inventory import Inventory, InventoryEntry, make_entry
from bzrlib import symbol_versioning
from bzrlib.urlutils import unescape_for_display
-import bzrlib.ui
class NullCommitReporter(object):
@@ -346,7 +346,7 @@
not self.branch.repository._format.supports_tree_reference and
(self.branch.repository._format.fast_deltas or
len(self.parents) < 2))
- self.pb = bzrlib.ui.ui_factory.nested_progress_bar()
+ self.pb = ui.ui_factory.nested_progress_bar()
operation.add_cleanup(self.pb.finished)
self.basis_revid = self.work_tree.last_revision()
self.basis_tree = self.work_tree.basis_tree()
=== modified file 'bzrlib/trace.py'
--- a/bzrlib/trace.py 2010-10-05 23:30:18 +0000
+++ b/bzrlib/trace.py 2011-01-13 00:14:31 +0000
@@ -123,14 +123,12 @@
# FIXME: clearing the ui and then going through the abstract logging
# framework is whack; we should probably have a logging Handler that
# deals with terminal output if needed.
- import bzrlib.ui
- bzrlib.ui.ui_factory.clear_term()
+ ui.ui_factory.clear_term()
_bzr_logger.info(*args, **kwargs)
def warning(*args, **kwargs):
- import bzrlib.ui
- bzrlib.ui.ui_factory.clear_term()
+ ui.ui_factory.clear_term()
_bzr_logger.warning(*args, **kwargs)
=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py 2011-01-12 18:25:01 +0000
+++ b/bzrlib/transform.py 2011-01-13 01:32:26 +0000
@@ -19,7 +19,6 @@
from stat import S_ISREG, S_IEXEC
import time
-import bzrlib
from bzrlib import (
errors,
lazy_import,
@@ -40,6 +39,7 @@
revision as _mod_revision,
trace,
ui,
+ urlutils,
)
""")
from bzrlib.errors import (DuplicateKey, MalformedTransform, NoSuchFile,
@@ -64,8 +64,6 @@
deprecated_method,
)
from bzrlib.trace import warning
-import bzrlib.ui
-import bzrlib.urlutils as urlutils
ROOT_PARENT = "root-parent"
@@ -1677,7 +1675,7 @@
"""
if not no_conflicts:
self._check_malformed()
- child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
+ child_pb = ui.ui_factory.nested_progress_bar()
try:
if precomputed_delta is None:
child_pb.update('Apply phase', 0, 2)
@@ -1710,7 +1708,7 @@
def _generate_inventory_delta(self):
"""Generate an inventory delta for the current transform."""
inventory_delta = []
- child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
+ child_pb = ui.ui_factory.nested_progress_bar()
new_paths = self._inventory_altered()
total_entries = len(new_paths) + len(self._removed_id)
try:
@@ -1778,7 +1776,7 @@
"""
tree_paths = list(self._tree_path_ids.iteritems())
tree_paths.sort(reverse=True)
- child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
+ child_pb = ui.ui_factory.nested_progress_bar()
try:
for num, data in enumerate(tree_paths):
path, trans_id = data
@@ -1813,7 +1811,7 @@
modified_paths = []
new_path_file_ids = dict((t, self.final_file_id(t)) for p, t in
new_paths)
- child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
+ child_pb = ui.ui_factory.nested_progress_bar()
try:
for num, (path, trans_id) in enumerate(new_paths):
if (num % 10) == 0:
@@ -2431,7 +2429,7 @@
if num > 0: # more than just a root
raise errors.WorkingTreeAlreadyPopulated(base=wt.basedir)
file_trans_id = {}
- top_pb = bzrlib.ui.ui_factory.nested_progress_bar()
+ top_pb = ui.ui_factory.nested_progress_bar()
pp = ProgressPhase("Build phase", 2, top_pb)
if tree.inventory.root is not None:
# This is kind of a hack: we should be altering the root
@@ -2450,7 +2448,7 @@
pp.next_phase()
file_trans_id[wt.get_root_id()] = \
tt.trans_id_tree_file_id(wt.get_root_id())
- pb = bzrlib.ui.ui_factory.nested_progress_bar()
+ pb = ui.ui_factory.nested_progress_bar()
try:
deferred_contents = []
num = 0
@@ -2780,7 +2778,7 @@
def _prepare_revert_transform(working_tree, target_tree, tt, filenames,
backups, pp, basis_tree=None,
merge_modified=None):
- child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
+ child_pb = ui.ui_factory.nested_progress_bar()
try:
if merge_modified is None:
merge_modified = working_tree.merge_modified()
@@ -2789,7 +2787,7 @@
merge_modified, basis_tree)
finally:
child_pb.finished()
- child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
+ child_pb = ui.ui_factory.nested_progress_bar()
try:
raw_conflicts = resolve_conflicts(tt, child_pb,
lambda t, c: conflict_pass(t, c, target_tree))
More information about the bazaar-commits
mailing list