Rev 4504: (andrew) Fix some trivial bugs and unused/redundant imports reported in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Jul 2 12:37:43 BST 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4504 [merge]
revision-id: pqm at pqm.ubuntu.com-20090702113738-5qda6d3y80z4l3o5
parent: pqm at pqm.ubuntu.com-20090702075724-9zff533wsm7xszzy
parent: andrew.bennetts at canonical.com-20090701110138-gpwz6o06w572m9v0
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-07-02 12:37:38 +0100
message:
(andrew) Fix some trivial bugs and unused/redundant imports reported
by pyflakes.
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/btree_index.py index.py-20080624222253-p0x5f92uyh5hw734-7
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/chk_map.py chk_map.py-20081001014447-ue6kkuhofvdecvxa-1
bzrlib/chk_serializer.py chk_serializer.py-20081002064345-2tofdfj2eqq01h4b-1
bzrlib/groupcompress.py groupcompress.py-20080705181503-ccbxd6xuy1bdnrpu-8
bzrlib/index.py index.py-20070712131115-lolkarso50vjr64s-1
bzrlib/inventory.py inventory.py-20050309040759-6648b84ca2005b37
bzrlib/progress.py progress.py-20050610070202-df9faaab791964c0
bzrlib/repofmt/groupcompress_repo.py repofmt.py-20080715094215-wp1qfvoo7093c8qr-1
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2009-06-19 00:33:36 +0000
+++ b/bzrlib/branch.py 2009-07-01 10:30:41 +0000
@@ -35,7 +35,6 @@
symbol_versioning,
transport,
tsort,
- ui,
urlutils,
)
from bzrlib.config import BranchConfig, TransportConfig
@@ -2909,7 +2908,7 @@
@staticmethod
def _get_branch_formats_to_test():
"""Return a tuple with the Branch formats to use when testing."""
- raise NotImplementedError(self._get_branch_formats_to_test)
+ raise NotImplementedError(InterBranch._get_branch_formats_to_test)
def pull(self, overwrite=False, stop_revision=None,
possible_transports=None, local=False):
@@ -3070,7 +3069,6 @@
_override_hook_source_branch=_override_hook_source_branch)
finally:
self.source.unlock()
- return result
def _push_with_bound_branches(self, overwrite, stop_revision,
_override_hook_source_branch=None):
=== modified file 'bzrlib/btree_index.py'
--- a/bzrlib/btree_index.py 2009-06-22 12:52:39 +0000
+++ b/bzrlib/btree_index.py 2009-07-01 10:51:47 +0000
@@ -17,12 +17,8 @@
"""B+Tree indices"""
-import array
-import bisect
from bisect import bisect_right
-from copy import deepcopy
import math
-import struct
import tempfile
import zlib
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2009-07-01 19:06:14 +0000
+++ b/bzrlib/builtins.py 2009-07-02 11:37:38 +0000
@@ -45,7 +45,6 @@
revision as _mod_revision,
symbol_versioning,
transport,
- tree as _mod_tree,
ui,
urlutils,
views,
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py 2009-06-22 15:13:45 +0000
+++ b/bzrlib/bzrdir.py 2009-07-01 10:49:05 +0000
@@ -70,7 +70,6 @@
do_catching_redirections,
get_transport,
local,
- remote as remote_transport,
)
from bzrlib.weave import Weave
""")
=== modified file 'bzrlib/chk_map.py'
--- a/bzrlib/chk_map.py 2009-06-26 09:24:34 +0000
+++ b/bzrlib/chk_map.py 2009-07-01 10:52:23 +0000
@@ -38,14 +38,12 @@
"""
import heapq
-import time
from bzrlib import lazy_import
lazy_import.lazy_import(globals(), """
from bzrlib import versionedfile
""")
from bzrlib import (
- errors,
lru_cache,
osutils,
registry,
=== modified file 'bzrlib/chk_serializer.py'
--- a/bzrlib/chk_serializer.py 2009-06-15 19:04:38 +0000
+++ b/bzrlib/chk_serializer.py 2009-07-01 10:46:27 +0000
@@ -16,15 +16,10 @@
"""Serializer object for CHK based inventory storage."""
-from cStringIO import (
- StringIO,
- )
-
from bzrlib import (
bencode,
cache_utf8,
inventory,
- osutils,
revision as _mod_revision,
xml5,
xml6,
=== modified file 'bzrlib/groupcompress.py'
--- a/bzrlib/groupcompress.py 2009-06-29 14:51:13 +0000
+++ b/bzrlib/groupcompress.py 2009-07-01 10:47:37 +0000
@@ -16,8 +16,6 @@
"""Core compression logic for compressing streams of related files."""
-from itertools import izip
-from cStringIO import StringIO
import time
import zlib
try:
@@ -28,13 +26,11 @@
from bzrlib import (
annotate,
debug,
- diff,
errors,
graph as _mod_graph,
knit,
osutils,
pack,
- patiencediff,
trace,
)
from bzrlib.graph import Graph
=== modified file 'bzrlib/index.py'
--- a/bzrlib/index.py 2009-06-10 03:56:49 +0000
+++ b/bzrlib/index.py 2009-07-01 10:53:08 +0000
@@ -39,7 +39,6 @@
from bzrlib import (
debug,
errors,
- symbol_versioning,
)
_HEADER_READV = (0, 200)
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py 2009-06-18 18:18:36 +0000
+++ b/bzrlib/inventory.py 2009-07-01 10:50:24 +0000
@@ -27,11 +27,10 @@
# created, but it's not for now.
ROOT_ID = "TREE_ROOT"
-from copy import deepcopy
-
from bzrlib.lazy_import import lazy_import
lazy_import(globals(), """
import collections
+import copy
import os
import re
import tarfile
@@ -43,7 +42,6 @@
generate_ids,
osutils,
symbol_versioning,
- workingtree,
)
""")
@@ -1192,7 +1190,7 @@
def _get_mutable_inventory(self):
"""See CommonInventory._get_mutable_inventory."""
- return deepcopy(self)
+ return copy.deepcopy(self)
def __iter__(self):
"""Iterate over all file-ids."""
=== modified file 'bzrlib/progress.py'
--- a/bzrlib/progress.py 2009-06-10 03:56:49 +0000
+++ b/bzrlib/progress.py 2009-07-01 10:54:51 +0000
@@ -25,20 +25,15 @@
import sys
import time
import os
-import warnings
from bzrlib import (
errors,
- osutils,
- trace,
- ui,
)
from bzrlib.trace import mutter
from bzrlib.symbol_versioning import (
deprecated_function,
deprecated_in,
- deprecated_method,
)
=== modified file 'bzrlib/repofmt/groupcompress_repo.py'
--- a/bzrlib/repofmt/groupcompress_repo.py 2009-06-29 14:51:13 +0000
+++ b/bzrlib/repofmt/groupcompress_repo.py 2009-07-01 10:45:13 +0000
@@ -30,7 +30,6 @@
osutils,
pack,
remote,
- repository,
revision as _mod_revision,
trace,
ui,
@@ -39,7 +38,6 @@
BTreeGraphIndex,
BTreeBuilder,
)
-from bzrlib.index import GraphIndex, GraphIndexBuilder
from bzrlib.groupcompress import (
_GCGraphIndex,
GroupCompressVersionedFiles,
=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py 2009-06-26 09:24:34 +0000
+++ b/bzrlib/repofmt/pack_repo.py 2009-07-01 10:42:14 +0000
@@ -36,10 +36,7 @@
)
from bzrlib.index import (
CombinedGraphIndex,
- GraphIndex,
- GraphIndexBuilder,
GraphIndexPrefixAdapter,
- InMemoryGraphIndex,
)
from bzrlib.knit import (
KnitPlainFactory,
@@ -55,7 +52,6 @@
lockable_files,
lockdir,
revision as _mod_revision,
- symbol_versioning,
)
from bzrlib.decorators import needs_write_lock
@@ -75,7 +71,6 @@
RootCommitBuilder,
StreamSource,
)
-import bzrlib.revision as _mod_revision
from bzrlib.trace import (
mutter,
warning,
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2009-06-26 09:24:34 +0000
+++ b/bzrlib/repository.py 2009-07-01 10:28:44 +0000
@@ -57,9 +57,6 @@
entry_factory,
)
from bzrlib import registry
-from bzrlib.symbol_versioning import (
- deprecated_method,
- )
from bzrlib.trace import (
log_exception_quietly, note, mutter, mutter_callsite, warning)
@@ -788,8 +785,8 @@
# references.
raise errors.UnsupportedOperation(tree.add_reference,
self.repository)
- entry.reference_revision = \
- tree.get_reference_revision(change[0])
+ reference_revision = tree.get_reference_revision(change[0])
+ entry.reference_revision = reference_revision
if (carry_over_possible and
parent_entry.reference_revision == reference_revision):
carried_over = True
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2009-07-01 15:50:51 +0000
+++ b/bzrlib/tests/__init__.py 2009-07-02 11:37:38 +0000
@@ -3007,7 +3007,7 @@
"""
concurrency = osutils.local_concurrency()
result = []
- from subunit import TestProtocolClient, ProtocolTestCase
+ from subunit import ProtocolTestCase
class TestInSubprocess(ProtocolTestCase):
def __init__(self, process, name):
ProtocolTestCase.__init__(self, process.stdout)
=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py 2009-06-10 03:56:49 +0000
+++ b/bzrlib/tree.py 2009-07-01 10:56:49 +0000
@@ -19,7 +19,6 @@
import os
from collections import deque
-from cStringIO import StringIO
import bzrlib
from bzrlib import (
@@ -30,17 +29,16 @@
osutils,
revision as _mod_revision,
rules,
- symbol_versioning,
)
from bzrlib.decorators import needs_read_lock
-from bzrlib.errors import BzrError, BzrCheckError, NoSuchId
+from bzrlib.errors import BzrError, NoSuchId
from bzrlib import errors
-from bzrlib.inventory import Inventory, InventoryFile
+from bzrlib.inventory import InventoryFile
from bzrlib.inter import InterObject
from bzrlib.osutils import fingerprint_file
import bzrlib.revision
from bzrlib.symbol_versioning import deprecated_function, deprecated_in
-from bzrlib.trace import mutter, note
+from bzrlib.trace import note
class Tree(object):
@@ -437,7 +435,7 @@
raise NotImplementedError(self.annotate_iter)
def _get_plan_merge_data(self, file_id, other, base):
- from bzrlib import merge, versionedfile
+ from bzrlib import versionedfile
vf = versionedfile._PlanMergeVersionedFile(file_id)
last_revision_a = self._get_file_revision(file_id, vf, 'this:')
last_revision_b = other._get_file_revision(file_id, vf, 'other:')
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py 2009-06-17 03:41:33 +0000
+++ b/bzrlib/workingtree.py 2009-07-01 10:40:07 +0000
@@ -48,8 +48,6 @@
import itertools
import operator
import stat
-from time import time
-import warnings
import re
import bzrlib
@@ -57,29 +55,25 @@
branch,
bzrdir,
conflicts as _mod_conflicts,
- dirstate,
errors,
generate_ids,
globbing,
hashcache,
ignores,
+ inventory,
merge,
revision as _mod_revision,
revisiontree,
- repository,
textui,
trace,
transform,
ui,
- urlutils,
views,
xml5,
- xml6,
xml7,
)
import bzrlib.branch
from bzrlib.transport import get_transport
-import bzrlib.ui
from bzrlib.workingtree_4 import (
WorkingTreeFormat4,
WorkingTreeFormat5,
@@ -89,19 +83,16 @@
from bzrlib import symbol_versioning
from bzrlib.decorators import needs_read_lock, needs_write_lock
-from bzrlib.inventory import InventoryEntry, Inventory, ROOT_ID, TreeReference
from bzrlib.lockable_files import LockableFiles
from bzrlib.lockdir import LockDir
import bzrlib.mutabletree
from bzrlib.mutabletree import needs_tree_write_lock
from bzrlib import osutils
from bzrlib.osutils import (
- compact_date,
file_kind,
isdir,
normpath,
pathjoin,
- rand_chars,
realpath,
safe_unicode,
splitpath,
@@ -111,13 +102,12 @@
from bzrlib.trace import mutter, note
from bzrlib.transport.local import LocalTransport
from bzrlib.progress import DummyProgress, ProgressPhase
-from bzrlib.revision import NULL_REVISION, CURRENT_REVISION
+from bzrlib.revision import CURRENT_REVISION
from bzrlib.rio import RioReader, rio_file, Stanza
-from bzrlib.symbol_versioning import (deprecated_passed,
- deprecated_method,
- deprecated_function,
- DEPRECATED_PARAMETER,
- )
+from bzrlib.symbol_versioning import (
+ deprecated_passed,
+ DEPRECATED_PARAMETER,
+ )
MERGE_MODIFIED_HEADER_1 = "BZR merge-modified list format 1"
@@ -889,7 +879,7 @@
branch.last_revision().
"""
from bzrlib.merge import Merger, Merge3Merger
- pb = bzrlib.ui.ui_factory.nested_progress_bar()
+ pb = ui.ui_factory.nested_progress_bar()
try:
merger = Merger(self.branch, this_tree=self, pb=pb)
merger.pp = ProgressPhase("Merge phase", 5, pb)
@@ -1081,10 +1071,10 @@
branch.BranchReferenceFormat().initialize(tree_bzrdir, new_branch)
else:
tree_bzrdir = branch_bzrdir
- wt = tree_bzrdir.create_workingtree(NULL_REVISION)
+ wt = tree_bzrdir.create_workingtree(_mod_revision.NULL_REVISION)
wt.set_parent_ids(self.get_parent_ids())
my_inv = self.inventory
- child_inv = Inventory(root_id=None)
+ child_inv = inventory.Inventory(root_id=None)
new_root = my_inv[file_id]
my_inv.remove_recursive_id(file_id)
new_root.parent_id = None
@@ -1416,7 +1406,8 @@
inv = self.inventory
for entry in moved:
try:
- self._move_entry(_RenameEntry(entry.to_rel, entry.from_id,
+ self._move_entry(WorkingTree._RenameEntry(
+ entry.to_rel, entry.from_id,
entry.to_tail, entry.to_parent_id, entry.from_rel,
entry.from_tail, entry.from_parent_id,
entry.only_change_inv))
@@ -1573,7 +1564,7 @@
@needs_write_lock
def pull(self, source, overwrite=False, stop_revision=None,
change_reporter=None, possible_transports=None, local=False):
- top_pb = bzrlib.ui.ui_factory.nested_progress_bar()
+ top_pb = ui.ui_factory.nested_progress_bar()
source.lock_read()
try:
pp = ProgressPhase("Pull phase", 2, top_pb)
@@ -1587,7 +1578,7 @@
if new_revision_info != old_revision_info:
pp.next_phase()
repository = self.branch.repository
- pb = bzrlib.ui.ui_factory.nested_progress_bar()
+ pb = ui.ui_factory.nested_progress_bar()
basis_tree.lock_read()
try:
new_basis_tree = self.branch.basis_tree()
@@ -2042,7 +2033,7 @@
if filenames is None and len(self.get_parent_ids()) > 1:
parent_trees = []
last_revision = self.last_revision()
- if last_revision != NULL_REVISION:
+ if last_revision != _mod_revision.NULL_REVISION:
if basis_tree is None:
basis_tree = self.basis_tree()
basis_tree.lock_read()
@@ -2086,7 +2077,6 @@
def set_inventory(self, new_inventory_list):
from bzrlib.inventory import (Inventory,
InventoryDirectory,
- InventoryEntry,
InventoryFile,
InventoryLink)
inv = Inventory(self.get_root_id())
@@ -2634,7 +2624,7 @@
def _change_last_revision(self, revision_id):
"""See WorkingTree._change_last_revision."""
- if revision_id is None or revision_id == NULL_REVISION:
+ if revision_id is None or revision_id == _mod_revision.NULL_REVISION:
try:
self._transport.delete('last-revision')
except errors.NoSuchFile:
@@ -2804,7 +2794,7 @@
no working tree. (See bug #43064).
"""
sio = StringIO()
- inv = Inventory()
+ inv = inventory.Inventory()
xml5.serializer_v5.write_inventory(inv, sio, working=True)
sio.seek(0)
transport.put_file('inventory', sio, file_mode)
@@ -2826,7 +2816,7 @@
branch.generate_revision_history(revision_id)
finally:
branch.unlock()
- inv = Inventory()
+ inv = inventory.Inventory()
wt = WorkingTree2(a_bzrdir.root_transport.local_abspath('.'),
branch,
inv,
@@ -2949,7 +2939,7 @@
# only set an explicit root id if there is one to set.
if basis_tree.inventory.root is not None:
wt.set_root_id(basis_tree.get_root_id())
- if revision_id == NULL_REVISION:
+ if revision_id == _mod_revision.NULL_REVISION:
wt.set_parent_trees([])
else:
wt.set_parent_trees([(revision_id, basis_tree)])
@@ -2962,7 +2952,7 @@
return wt
def _initial_inventory(self):
- return Inventory()
+ return inventory.Inventory()
def __init__(self):
super(WorkingTreeFormat3, self).__init__()
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py 2009-06-24 22:35:17 +0000
+++ b/bzrlib/workingtree_4.py 2009-07-02 11:37:38 +0000
@@ -28,72 +28,43 @@
from bzrlib.lazy_import import lazy_import
lazy_import(globals(), """
-from bisect import bisect_left
-import collections
-from copy import deepcopy
import errno
-import itertools
-import operator
import stat
-from time import time
-import warnings
import bzrlib
from bzrlib import (
bzrdir,
cache_utf8,
- conflicts as _mod_conflicts,
debug,
- delta,
dirstate,
errors,
generate_ids,
- globbing,
- ignores,
- merge,
osutils,
revision as _mod_revision,
revisiontree,
- textui,
trace,
transform,
- urlutils,
views,
- xml5,
- xml6,
)
import bzrlib.branch
-from bzrlib.transport import get_transport
import bzrlib.ui
""")
-from bzrlib import symbol_versioning
from bzrlib.decorators import needs_read_lock, needs_write_lock
from bzrlib.filters import filtered_input_file, internal_size_sha_file_byname
-from bzrlib.inventory import InventoryEntry, Inventory, ROOT_ID, entry_factory
+from bzrlib.inventory import Inventory, ROOT_ID, entry_factory
import bzrlib.mutabletree
from bzrlib.mutabletree import needs_tree_write_lock
from bzrlib.osutils import (
file_kind,
isdir,
- normpath,
pathjoin,
- rand_chars,
realpath,
safe_unicode,
- splitpath,
)
-from bzrlib.trace import mutter, note
+from bzrlib.trace import mutter
from bzrlib.transport.local import LocalTransport
from bzrlib.tree import InterTree
-from bzrlib.progress import DummyProgress, ProgressPhase
-from bzrlib.revision import NULL_REVISION, CURRENT_REVISION
-from bzrlib.rio import RioReader, rio_file, Stanza
-from bzrlib.symbol_versioning import (deprecated_passed,
- deprecated_method,
- deprecated_function,
- DEPRECATED_PARAMETER,
- )
from bzrlib.tree import Tree
from bzrlib.workingtree import WorkingTree, WorkingTree3, WorkingTreeFormat3
@@ -1051,7 +1022,7 @@
def set_last_revision(self, new_revision):
"""Change the last revision in the working tree."""
parents = self.get_parent_ids()
- if new_revision in (NULL_REVISION, None):
+ if new_revision in (_mod_revision.NULL_REVISION, None):
if len(parents) >= 2:
raise AssertionError(
"setting the last parent to none with a pending merge is "
@@ -1403,7 +1374,7 @@
wt.lock_tree_write()
try:
self._init_custom_control_files(wt)
- if revision_id in (None, NULL_REVISION):
+ if revision_id in (None, _mod_revision.NULL_REVISION):
if branch.repository.supports_rich_root():
wt._set_root_id(generate_ids.gen_root_id())
else:
@@ -1420,7 +1391,7 @@
pass
if basis is None:
basis = branch.repository.revision_tree(revision_id)
- if revision_id == NULL_REVISION:
+ if revision_id == _mod_revision.NULL_REVISION:
parents_list = []
else:
parents_list = [(revision_id, basis)]
@@ -2016,13 +1987,13 @@
require_versioned, want_unversioned=want_unversioned)
parent_ids = self.target.get_parent_ids()
if not (self.source._revision_id in parent_ids
- or self.source._revision_id == NULL_REVISION):
+ or self.source._revision_id == _mod_revision.NULL_REVISION):
raise AssertionError(
"revision {%s} is not stored in {%s}, but %s "
"can only be used for trees stored in the dirstate"
% (self.source._revision_id, self.target, self.iter_changes))
target_index = 0
- if self.source._revision_id == NULL_REVISION:
+ if self.source._revision_id == _mod_revision.NULL_REVISION:
source_index = None
indices = (target_index,)
else:
@@ -2090,7 +2061,7 @@
(revisiontree.RevisionTree, DirStateRevisionTree)):
return False
# the source revid must be in the target dirstate
- if not (source._revision_id == NULL_REVISION or
+ if not (source._revision_id == _mod_revision.NULL_REVISION or
source._revision_id in target.get_parent_ids()):
# TODO: what about ghosts? it may well need to
# check for them explicitly.
More information about the bazaar-commits
mailing list