[patch] add pyflakes; clean up cruft

Martin Pool mbp at canonical.com
Fri Jun 16 06:10:32 BST 2006


This patch adds make targets to run the 'pyflakes' static checker, and
cleans up some things I found by running it.  Seeking +1 or comments.

The patch itself is long and generally uninteresting so to summarise:

 - You can now say "make pyflakes" 

 - Remove most occurrences of 'from foo import *', which is generally
   thought bad style and prevents other checks

 - Fix ForbiddenFileError, BadFileKindError to produce consistent
   messages

 - Remove some dead code, particularly when it can't possibly run.

 - Remove some deprecated-since-0.7 code.

 - Remove deltas_for_log_dummy, deltas_for_log_reverse, 
   deltas_for_log_forward, which seem to be unused and not working.

 - Generally move towards a style of importing modules at the top level 
   and mostly not importing classes/functions from within them, as 
   much new code does for errors.  I think this works reasonably well; 
   it allows for doing demand loading in the future and is fairly clear
   to read.

 - Generally remove 'import bzrlib' in favour of importing the
   particular submodules that are needed.

 - Give visible warning on failing to unlike msgfilename.

 - Remove ScratchTextStore

 - Change tests to call new check api on branch & repo rather than the 
   old functional interface

On the whole I think pyflakes is a useful adjunct to the kinds of
checking we already get by running the test suite.  I found several
things that were crufty and some things that were outright wrong.  

The outright errors are in code that is not reached from the test suite.
Some of this is bonafide dead code that I've deleted; some is just
untested, and particularly tends to be in error handling code.

After these changes there are still some warnings, in these categories:

 - warnings in copied-in external code (effbot, configobject)
 - we're doing something basically reasonable that pyflakes doesn't
   like, e.g. trying to import a module from two places
 - something we should fix but that I didn't want to change right now
 - "imported but unused", which is relatively unimportant and can be 
   cleaned up later

I am pleased that it didn't give any outright false positives, as PyLint
tends to do.  It should be possible in the future to get to and stay at
no warnings.

-- 
Martin
-------------- next part --------------
=== modified file 'Makefile'
--- Makefile	2006-05-11 02:23:31 +0000
+++ Makefile	2006-06-16 01:12:25 +0000
@@ -1,4 +1,4 @@
-all: 
+all:
 
 check:
 	./bzr selftest -v $(tests)
@@ -8,7 +8,16 @@
 check-msgeditor:
 	./bzr --no-plugins selftest -v msgeditor
 
-clean: 
+# Run Python style checker (apt-get install pyflakes)
+pyflakes:
+	pyflakes bzrlib
+
+pyflakes-nounused:
+	# There are many of these warnings at the moment and they're not a
+	# high priority to fix
+	pyflakes bzrlib | grep -v ' imported but unused'
+
+clean:
 	./setup.py clean
 	-find . -name "*.pyc" -o -name "*.pyo" | xargs rm -f
 	rm -rf test????.tmp

=== modified file 'bzrlib/add.py'
--- bzrlib/add.py	2006-06-13 12:55:45 +0000
+++ bzrlib/add.py	2006-06-15 06:54:59 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005 Canonical Ltd
+# Copyright (C) 2005, 2006 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -14,8 +14,10 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+import errno
+import os
+from os.path import dirname
 import sys
-from os.path import dirname
 
 import bzrlib.errors as errors
 from bzrlib.inventory import InventoryEntry
@@ -132,8 +134,6 @@
     further dry-run tasks to take place. To restore the original inventory
     call tree.read_working_inventory().
     """
-    import os, errno
-    from bzrlib.errors import BadFileKindError, ForbiddenFileError
     assert isinstance(recurse, bool)
     if action is None:
         action = AddAction()
@@ -154,7 +154,7 @@
         # validate user parameters. Our recursive code avoids adding new files
         # that need such validation 
         if tree.is_control_filename(rf.raw_path):
-            raise ForbiddenFileError('cannot add control file %s' % filepath)
+            raise errors.ForbiddenFileError(filename=rf)
         
         abspath = tree.abspath(rf.raw_path)
         kind = bzrlib.osutils.file_kind(abspath)
@@ -163,7 +163,7 @@
             user_dirs.add(rf.raw_path)
         else:
             if not InventoryEntry.versionable_kind(kind):
-                raise BadFileKindError("cannot add %s of type %s" % (abspath, kind))
+                raise errors.BadFileKindError(filename=abspath, kind=kind)
         # ensure the named path is added, so that ignore rules in the later directory
         # walk dont skip it.
         # we dont have a parent ie known yet.: use the relatively slower inventory 

=== modified file 'bzrlib/annotate.py'
--- bzrlib/annotate.py	2006-02-22 10:35:05 +0000
+++ bzrlib/annotate.py	2006-06-08 11:42:05 +0000
@@ -26,10 +26,8 @@
 # e.g. "3:12 Tue", "13 Oct", "Oct 2005", etc.  
 
 import sys
-import os
 import time
 
-import bzrlib.weave
 from bzrlib.config import extract_email_address
 from bzrlib.errors import BzrError
 

=== modified file 'bzrlib/atomicfile.py'
--- bzrlib/atomicfile.py	2005-12-18 04:08:46 +0000
+++ bzrlib/atomicfile.py	2006-06-15 06:41:19 +0000
@@ -14,11 +14,11 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-
+import errno
+import os
 
 from warnings import warn
 from bzrlib.osutils import rename
-import errno
 
 class AtomicFile(object):
     """A file that does an atomic-rename to move into place.
@@ -35,7 +35,7 @@
         if mode != 'wb' and mode != 'wt':
             raise ValueError("invalid AtomicFile mode %r" % mode)
 
-        import os, socket
+        import socket
         self.tmpfilename = '%s.%d.%s.tmp' % (filename, os.getpid(),
                                              socket.gethostname())
         self.realfilename = filename
@@ -58,8 +58,7 @@
 
     def commit(self):
         """Close the file and move to final name."""
-        import sys, os
-        
+
         if self.closed:
             raise Exception('%r is already closed' % self)
 
@@ -81,7 +80,6 @@
 
     def abort(self):
         """Discard temporary file without committing changes."""
-        import os
 
         if self.closed:
             raise Exception('%r is already closed' % self)

=== modified file 'bzrlib/benchmarks/__init__.py'
--- bzrlib/benchmarks/__init__.py	2006-06-11 10:28:26 +0000
+++ bzrlib/benchmarks/__init__.py	2006-06-16 03:34:42 +0000
@@ -18,7 +18,7 @@
 """Benchmark test suite for bzr."""
 
 import bzrlib
-from bzrlib.tests import TestLoader
+from bzrlib.tests.TestUtil import TestLoader
 from bzrlib.tests.blackbox import ExternalBase
 
 class Benchmark(ExternalBase):

=== modified file 'bzrlib/branch.py'
--- bzrlib/branch.py	2006-06-12 02:11:45 +0000
+++ bzrlib/branch.py	2006-06-16 02:01:20 +0000
@@ -17,10 +17,6 @@
 
 from copy import deepcopy
 from cStringIO import StringIO
-import errno
-import os
-import shutil
-import sys
 from unittest import TestSuite
 from warnings import warn
 
@@ -30,39 +26,29 @@
 from bzrlib.decorators import needs_read_lock, needs_write_lock
 from bzrlib.delta import compare_trees
 import bzrlib.errors as errors
-from bzrlib.errors import (BzrError, InvalidRevisionNumber, InvalidRevisionId,
-                           NoSuchRevision, HistoryMissing, NotBranchError,
-                           DivergedBranches, LockError,
-                           UninitializableFormat,
-                           UnlistableStore,
-                           UnlistableBranch, NoSuchFile, NotVersionedError,
+from bzrlib.errors import (InvalidRevisionNumber,
+                           NotBranchError,
+                           DivergedBranches,
+                           NoSuchFile,
                            NoWorkingTree)
-import bzrlib.inventory as inventory
-from bzrlib.inventory import Inventory
 from bzrlib.lockable_files import LockableFiles, TransportLock
 from bzrlib.lockdir import LockDir
-from bzrlib.osutils import (isdir, quotefn,
-                            rename, splitpath, sha_file,
-                            file_kind, abspath, normpath, pathjoin,
-                            safe_unicode,
+from bzrlib.osutils import (
                             rmtree,
                             )
-from bzrlib.repository import Repository
 from bzrlib.revision import (
-                             is_ancestor,
                              NULL_REVISION,
-                             Revision,
                              )
-from bzrlib.store import copy_all
-from bzrlib.symbol_versioning import *
-from bzrlib.textui import show_status
+from bzrlib.symbol_versioning import (deprecated_function,
+                                      deprecated_method,
+                                      DEPRECATED_PARAMETER,
+                                      deprecated_passed,
+                                      zero_eight,
+                                      )
 from bzrlib.trace import mutter, note
-import bzrlib.transactions as transactions
-from bzrlib.transport import Transport, get_transport
-from bzrlib.tree import EmptyTree, RevisionTree
-import bzrlib.ui
+from bzrlib.tree import EmptyTree
+import bzrlib.ui as ui
 import bzrlib.urlutils as urlutils
-import bzrlib.xml5
 
 
 BZR_BRANCH_FORMAT_4 = "Bazaar-NG branch, format 0.0.4\n"
@@ -219,7 +205,7 @@
         if self.base == from_branch.base:
             return (0, [])
         if pb is None:
-            nested_pb = bzrlib.ui.ui_factory.nested_progress_bar()
+            nested_pb = ui.ui_factory.nested_progress_bar()
             pb = nested_pb
         else:
             nested_pb = None
@@ -361,7 +347,7 @@
         else:
             assert isinstance(stop_revision, int)
             if stop_revision > other_len:
-                raise bzrlib.errors.NoSuchRevision(self, stop_revision)
+                raise errors.NoSuchRevision(self, stop_revision)
         return other_history[self_len:stop_revision]
 
     def update_revisions(self, other, stop_revision=None):
@@ -564,6 +550,8 @@
         In particular this checks that revisions given in the revision-history
         do actually match up in the revision graph, and that they're all 
         present in the repository.
+        
+        Callers will typically also want to check the repository.
 
         :return: A BranchCheckResult.
         """
@@ -572,14 +560,14 @@
             try:
                 revision = self.repository.get_revision(revision_id)
             except errors.NoSuchRevision, e:
-                raise BzrCheckError("mainline revision {%s} not in repository"
-                        % revision_id)
+                raise errors.BzrCheckError("mainline revision {%s} not in repository"
+                            % revision_id)
             # In general the first entry on the revision history has no parents.
             # But it's not illegal for it to have parents listed; this can happen
             # in imports from Arch when the parents weren't reachable.
             if mainline_parent_id is not None:
                 if mainline_parent_id not in revision.parent_ids:
-                    raise BzrCheckError("previous revision {%s} not listed among "
+                    raise errors.BzrCheckError("previous revision {%s} not listed among "
                                         "parents of {%s}"
                                         % (mainline_parent_id, revision_id))
             mainline_parent_id = revision_id
@@ -899,7 +887,7 @@
         self._base = self._transport.base
         self._format = _format
         if _control_files is None:
-            raise BzrBadParameterMissing('_control_files')
+            raise ValueError('BzrBranch _control_files is None')
         self.control_files = _control_files
         if deprecated_passed(init):
             warn("BzrBranch.__init__(..., init=XXX): The init parameter is "
@@ -921,7 +909,7 @@
             if (not relax_version_check
                 and not self._format.is_supported()):
                 raise errors.UnsupportedFormatError(
-                        'sorry, branch format %r not supported' % fmt,
+                        'sorry, branch format %r not supported' % self._format,
                         ['use a different bzr version',
                          'or remove the .bzr directory'
                          ' and "bzr init" again'])
@@ -997,7 +985,7 @@
         FIXME: DELETE THIS METHOD when pre 0.8 support is removed.
         """
         if format is None:
-            format = BzrBranchFormat.find_format(self.bzrdir)
+            format = BranchFormat.find_format(self.bzrdir)
         self._format = format
         mutter("got branch format %s", self._format)
 
@@ -1152,7 +1140,6 @@
     @deprecated_method(zero_eight)
     def working_tree(self):
         """Create a Working tree object for this branch."""
-        from bzrlib.workingtree import WorkingTree
         from bzrlib.transport.local import LocalTransport
         if (self.base.find('://') != -1 or 
             not isinstance(self._transport, LocalTransport)):
@@ -1179,12 +1166,11 @@
 
     def get_parent(self):
         """See Branch.get_parent."""
-        import errno
         _locs = ['parent', 'pull', 'x-pull']
         assert self.base[-1] == '/'
         for l in _locs:
             try:
-                return urlutils.join(self.base[:-1], 
+                return urlutils.join(self.base[:-1],
                             self.control_files.get(l).read().strip('\n'))
             except NoSuchFile:
                 pass
@@ -1418,13 +1404,6 @@
 
 
 @deprecated_function(zero_eight)
-def ScratchBranch(*args, **kwargs):
-    """See bzrlib.bzrdir.ScratchDir."""
-    d = ScratchDir(*args, **kwargs)
-    return d.open_branch()
-
-
- at deprecated_function(zero_eight)
 def is_control_file(*args, **kwargs):
     """See bzrlib.workingtree.is_control_file."""
     return bzrlib.workingtree.is_control_file(*args, **kwargs)

=== modified file 'bzrlib/builtins.py'
--- bzrlib/builtins.py	2006-06-13 12:55:45 +0000
+++ bzrlib/builtins.py	2006-06-16 04:59:39 +0000
@@ -20,32 +20,25 @@
 import codecs
 import errno
 import os
-from shutil import rmtree
 import sys
 
-import bzrlib
-import bzrlib.branch
-from bzrlib.branch import Branch
-import bzrlib.bzrdir as bzrdir
+from bzrlib.branch import Branch, BranchReferenceFormat
+from bzrlib import (branch, bzrdir, errors, osutils, ui, config, user_encoding,
+    repository, log)
 from bzrlib.bundle.read_bundle import BundleReader
 from bzrlib.bundle.apply_bundle import merge_bundle
 from bzrlib.commands import Command, display_command
-import bzrlib.errors as errors
 from bzrlib.errors import (BzrError, BzrCheckError, BzrCommandError, 
                            NotBranchError, DivergedBranches, NotConflicted,
                            NoSuchFile, NoWorkingTree, FileInWrongBranch,
                            NotVersionedError, NotABundle)
-from bzrlib.log import show_one_log
 from bzrlib.merge import Merge3Merger
 from bzrlib.option import Option
-import bzrlib.osutils
 from bzrlib.progress import DummyProgress, ProgressPhase
 from bzrlib.revision import common_ancestor
 from bzrlib.revisionspec import RevisionSpec
-import bzrlib.trace
-from bzrlib.trace import mutter, note, log_error, warning, is_quiet
+from bzrlib.trace import mutter, note, log_error, warning, is_quiet, info
 from bzrlib.transport.local import LocalTransport
-import bzrlib.ui
 import bzrlib.urlutils as urlutils
 from bzrlib.workingtree import WorkingTree
 
@@ -94,11 +87,11 @@
         return bzrdir.BzrDirMetaFormat1()
     if typestring == "metaweave":
         format = bzrdir.BzrDirMetaFormat1()
-        format.repository_format = bzrlib.repository.RepositoryFormat7()
+        format.repository_format = repository.RepositoryFormat7()
         return format
     if typestring == "knit":
         format = bzrdir.BzrDirMetaFormat1()
-        format.repository_format = bzrlib.repository.RepositoryFormatKnit1()
+        format.repository_format = repository.RepositoryFormatKnit1()
         return format
     msg = "Unknown bzr format %s. Current formats are: default, knit,\n" \
           "metaweave and weave" % typestring
@@ -528,7 +521,7 @@
 
         old_rh = []
         try:
-            dir_to = bzrlib.bzrdir.BzrDir.open(location_url)
+            dir_to = bzrdir.BzrDir.open(location_url)
             br_to = dir_to.open_branch()
         except NotBranchError:
             # create a branch.
@@ -606,7 +599,6 @@
 
     def run(self, from_location, to_location=None, revision=None, basis=None):
         from bzrlib.transport import get_transport
-        from bzrlib.osutils import rmtree
         if revision is None:
             revision = [None]
         elif len(revision) > 1:
@@ -642,10 +634,10 @@
             to_transport = get_transport(to_location)
             try:
                 to_transport.mkdir('.')
-            except bzrlib.errors.FileExists:
+            except errors.FileExists:
                 raise BzrCommandError('Target directory "%s" already'
                                       ' exists.' % to_location)
-            except bzrlib.errors.NoSuchFile:
+            except errors.NoSuchFile:
                 raise BzrCommandError('Parent of "%s" does not exist.' %
                                       to_location)
             try:
@@ -653,12 +645,12 @@
                 dir = br_from.bzrdir.sprout(to_transport.base,
                         revision_id, basis_dir)
                 branch = dir.open_branch()
-            except bzrlib.errors.NoSuchRevision:
+            except errors.NoSuchRevision:
                 to_transport.delete_tree('.')
                 msg = "The branch %s has no revision %s." % (from_location, revision[0])
                 raise BzrCommandError(msg)
-            except bzrlib.errors.UnlistableBranch:
-                rmtree(to_location)
+            except errors.UnlistableBranch:
+                osutils.rmtree(to_location)
                 msg = "The branch %s cannot be used as a --basis" % (basis,)
                 raise BzrCommandError(msg)
             if name:
@@ -707,7 +699,7 @@
             raise BzrCommandError(
                 'bzr checkout --revision takes exactly 1 revision value')
         if branch_location is None:
-            branch_location = bzrlib.osutils.getcwd()
+            branch_location = osutils.getcwd()
             to_location = branch_location
         source = Branch.open(branch_location)
         if len(revision) == 1 and revision[0] is not None:
@@ -719,8 +711,8 @@
         # if the source and to_location are the same, 
         # and there is no working tree,
         # then reconstitute a branch
-        if (bzrlib.osutils.abspath(to_location) == 
-            bzrlib.osutils.abspath(branch_location)):
+        if (osutils.abspath(to_location) == 
+            osutils.abspath(branch_location)):
             try:
                 source.bzrdir.open_workingtree()
             except errors.NoWorkingTree:
@@ -737,14 +729,14 @@
                                       to_location)
             else:
                 raise
-        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
-        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrdir.BzrDirMetaFormat1())
+        old_format = bzrdir.BzrDirFormat.get_default_format()
+        bzrdir.BzrDirFormat.set_default_format(bzrdir.BzrDirMetaFormat1())
         try:
             if lightweight:
                 checkout = bzrdir.BzrDirMetaFormat1().initialize(to_location)
-                bzrlib.branch.BranchReferenceFormat().initialize(checkout, source)
+                branch.BranchReferenceFormat().initialize(checkout, source)
             else:
-                checkout_branch =  bzrlib.bzrdir.BzrDir.create_branch_convenience(
+                checkout_branch =  bzrdir.BzrDir.create_branch_convenience(
                     to_location, force_new_tree=False)
                 checkout = checkout_branch.bzrdir
                 checkout_branch.bind(source)
@@ -753,7 +745,7 @@
                     checkout_branch.set_revision_history(rh[:rh.index(revision_id) + 1])
             checkout.create_workingtree(revision_id)
         finally:
-            bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
+            bzrdir.BzrDirFormat.set_default_format(old_format)
 
 
 class cmd_renames(Command):
@@ -766,11 +758,11 @@
 
     @display_command
     def run(self, dir=u'.'):
+        from bzrlib.tree import find_renames
         tree = WorkingTree.open_containing(dir)[0]
         old_inv = tree.basis_tree().inventory
         new_inv = tree.read_working_inventory()
-
-        renames = list(bzrlib.tree.find_renames(old_inv, new_inv))
+        renames = list(find_renames(old_inv, new_inv))
         renames.sort()
         for old_name, new_name in renames:
             self.outf.write("%s => %s\n" % (old_name, new_name))
@@ -924,7 +916,7 @@
 
     def run(self, branch="."):
         from bzrlib.reconcile import reconcile
-        dir = bzrlib.bzrdir.BzrDir.open(branch)
+        dir = bzrdir.BzrDir.open(branch)
         reconcile(dir)
 
 
@@ -987,7 +979,6 @@
                             type=get_format_type),
                      ]
     def run(self, location=None, format=None):
-        from bzrlib.branch import Branch
         if format is None:
             format = get_format_type('default')
         if location is None:
@@ -1192,7 +1183,7 @@
             if file_id in basis_inv:
                 continue
             path = inv.id2path(file_id)
-            if not os.access(bzrlib.osutils.abspath(path), os.F_OK):
+            if not os.access(osutils.abspath(path), os.F_OK):
                 continue
             self.outf.write(path + '\n')
 
@@ -1307,7 +1298,7 @@
             (rev2, rev1) = (rev1, rev2)
 
         if (log_format == None):
-            default = bzrlib.config.BranchConfig(b).log_format()
+            default = config.BranchConfig(b).log_format()
             log_format = get_log_format(long=long, short=short, line=line, default=default)
         lf = log_formatter(log_format,
                            show_ids=show_ids,
@@ -1350,7 +1341,7 @@
         b = tree.branch
         inv = tree.read_working_inventory()
         file_id = inv.path2id(relpath)
-        for revno, revision_id, what in bzrlib.log.find_touching_revisions(b, file_id):
+        for revno, revision_id, what in log.find_touching_revisions(b, file_id):
             self.outf.write("%6d %s\n" % (revno, what))
 
 
@@ -1412,7 +1403,7 @@
     """List unknown files."""
     @display_command
     def run(self):
-        from bzrlib.osutils import quotefn
+        from osutils import quotefn
         for f in WorkingTree.open_containing(u'.')[0].unknowns():
             self.outf.write(quotefn(f) + '\n')
 
@@ -1584,7 +1575,7 @@
     hidden = True    
     @display_command
     def run(self):
-        print bzrlib.osutils.local_time_offset()
+        print osutils.local_time_offset()
 
 
 
@@ -1665,10 +1656,10 @@
             raise BzrCommandError("please specify either --message or --file")
         
         if file:
-            message = codecs.open(file, 'rt', bzrlib.user_encoding).read()
+            message = codecs.open(file, 'rt', user_encoding).read()
 
         if message == "":
-                raise BzrCommandError("empty commit message specified")
+            raise BzrCommandError("empty commit message specified")
         
         if verbose:
             reporter = ReportCommitToLog()
@@ -1767,14 +1758,13 @@
     def run(self, email=False):
         try:
             b = WorkingTree.open_containing(u'.')[0].branch
-            config = bzrlib.config.BranchConfig(b)
+            c = config.BranchConfig(b)
         except NotBranchError:
-            config = bzrlib.config.GlobalConfig()
-        
+            c = config.GlobalConfig()
         if email:
-            print config.user_email()
+            print c.user_email()
         else:
-            print config.username()
+            print c.username()
 
 
 class cmd_nick(Command):
@@ -1860,13 +1850,13 @@
         # we don't want progress meters from the tests to go to the
         # real output; and we don't want log messages cluttering up
         # the real logs.
-        save_ui = bzrlib.ui.ui_factory
-        print '%10s: %s' % ('bzr', bzrlib.osutils.realpath(sys.argv[0]))
+        save_ui = ui.ui_factory
+        print '%10s: %s' % ('bzr', osutils.realpath(sys.argv[0]))
         print '%10s: %s' % ('bzrlib', bzrlib.__path__[0])
         print
-        bzrlib.trace.info('running tests...')
+        info('running tests...')
         try:
-            bzrlib.ui.ui_factory = bzrlib.ui.SilentUIFactory()
+            ui.ui_factory = ui.SilentUIFactory()
             if testspecs_list is not None:
                 pattern = '|'.join(testspecs_list)
             else:
@@ -1887,29 +1877,27 @@
                               test_suite_factory=test_suite_factory,
                               lsprof_timed=lsprof_timed)
             if result:
-                bzrlib.trace.info('tests passed')
+                info('tests passed')
             else:
-                bzrlib.trace.info('tests failed')
+                info('tests failed')
             return int(not result)
         finally:
-            bzrlib.ui.ui_factory = save_ui
+            ui.ui_factory = save_ui
 
 
 def _get_bzr_branch():
     """If bzr is run from a branch, return Branch or None"""
-    import bzrlib.errors
-    from bzrlib.branch import Branch
-    from bzrlib.osutils import abspath
     from os.path import dirname
     
     try:
-        branch = Branch.open(dirname(abspath(dirname(__file__))))
+        branch = Branch.open(dirname(osutils.abspath(dirname(__file__))))
         return branch
-    except bzrlib.errors.BzrError:
+    except errors.BzrError:
         return None
     
 
 def show_version():
+    import bzrlib
     print "bzr (bazaar-ng) %s" % bzrlib.__version__
     # is bzrlib itself in a branch?
     branch = _get_bzr_branch()
@@ -1981,28 +1969,16 @@
         base_rev_id = common_ancestor(last1, last2, source)
 
         print 'merge base is revision %s' % base_rev_id
-        
-        return
-
-        if base_revno is None:
-            raise bzrlib.errors.UnrelatedBranches()
-
-        print ' r%-6d in %s' % (base_revno, branch)
-
-        other_revno = branch2.revision_id_to_revno(base_revid)
-        
-        print ' r%-6d in %s' % (other_revno, other)
-
 
 
 class cmd_merge(Command):
     """Perform a three-way merge.
     
-    The branch is the branch you will merge from.  By default, it will
-    merge the latest revision.  If you specify a revision, that
-    revision will be merged.  If you specify two revisions, the first
-    will be used as a BASE, and the second one as OTHER.  Revision
-    numbers are always relative to the specified branch.
+    The branch is the branch you will merge from.  By default, it will merge
+    the latest revision.  If you specify a revision, that revision will be
+    merged.  If you specify two revisions, the first will be used as a BASE,
+    and the second one as OTHER.  Revision numbers are always relative to the
+    specified branch.
 
     By default, bzr will try to merge in all new work from the other
     branch, automatically determining an appropriate base.  If this
@@ -2100,7 +2076,7 @@
             interesting_files = [path]
         else:
             interesting_files = None
-        pb = bzrlib.ui.ui_factory.nested_progress_bar()
+        pb = ui.ui_factory.nested_progress_bar()
         try:
             try:
                 conflict_count = merge(other, base, check_clean=(not force),
@@ -2114,7 +2090,7 @@
                 return 1
             else:
                 return 0
-        except bzrlib.errors.AmbiguousBase, e:
+        except errors.AmbiguousBase, e:
             m = ("sorry, bzr can't determine the right merge base yet\n"
                  "candidates are:\n  "
                  + "\n  ".join(e.bases)
@@ -2253,7 +2229,7 @@
             raise BzrCommandError('bzr revert --revision takes exactly 1 argument')
         else:
             rev_id = revision[0].in_history(tree.branch).rev_id
-        pb = bzrlib.ui.ui_factory.nested_progress_bar()
+        pb = ui.ui_factory.nested_progress_bar()
         try:
             tree.revert(file_list, 
                         tree.branch.repository.revision_tree(rev_id),
@@ -2307,7 +2283,6 @@
     takes_args = ['from_branch', 'to_branch']
     def run(self, from_branch, to_branch):
         from bzrlib.fetch import Fetcher
-        from bzrlib.branch import Branch
         from_b = Branch.open(from_branch)
         to_b = Branch.open(to_branch)
         Fetcher(to_b, from_b)
@@ -2336,14 +2311,14 @@
             show_ids=False, verbose=False):
         from bzrlib.missing import find_unmerged, iter_log_data
         from bzrlib.log import log_formatter
-        local_branch = bzrlib.branch.Branch.open_containing(u".")[0]
+        local_branch = Branch.open_containing(u".")[0]
         parent = local_branch.get_parent()
         if other_branch is None:
             other_branch = parent
             if other_branch is None:
                 raise BzrCommandError("No missing location known or specified.")
             print "Using last location: " + local_branch.get_parent()
-        remote_branch = bzrlib.branch.Branch.open(other_branch)
+        remote_branch = Branch.open(other_branch)
         if remote_branch.base == local_branch.base:
             remote_branch = local_branch
         local_branch.lock_read()
@@ -2352,7 +2327,7 @@
             try:
                 local_extra, remote_extra = find_unmerged(local_branch, remote_branch)
                 if (log_format == None):
-                    default = bzrlib.config.BranchConfig(local_branch).log_format()
+                    default = config.BranchConfig(local_branch).log_format()
                     log_format = get_log_format(long=long, short=short, line=line, default=default)
                 lf = log_formatter(log_format, sys.stdout,
                                    show_ids=show_ids,
@@ -2487,7 +2462,6 @@
     takes_options = ['revision']
     
     def run(self, revision_id_list=None, revision=None):
-        import bzrlib.config as config
         import bzrlib.gpg as gpg
         if revision_id_list is not None and revision is not None:
             raise BzrCommandError('You can only supply one of revision_id or --revision')
@@ -2555,7 +2529,7 @@
             raise BzrCommandError('Local branch is not bound')
 
 
-class cmd_uncommit(bzrlib.commands.Command):
+class cmd_uncommit(Command):
     """Remove the last committed revision.
 
     --verbose will print out what is being removed.
@@ -2579,7 +2553,6 @@
     def run(self, location=None, 
             dry_run=False, verbose=False,
             revision=None, force=False):
-        from bzrlib.branch import Branch
         from bzrlib.log import log_formatter
         import sys
         from bzrlib.uncommit import uncommit

=== modified file 'bzrlib/bzrdir.py'
--- bzrlib/bzrdir.py	2006-06-13 15:04:06 +0000
+++ bzrlib/bzrdir.py	2006-06-16 05:00:49 +0000
@@ -21,8 +21,9 @@
 """
 
 from copy import deepcopy
+from cStringIO import StringIO
 import os
-from cStringIO import StringIO
+from stat import S_ISDIR
 from unittest import TestSuite
 
 import bzrlib
@@ -39,7 +40,6 @@
 from bzrlib.store.revision.text import TextRevisionStore
 from bzrlib.store.text import TextStore
 from bzrlib.store.versioned import WeaveStore
-from bzrlib.symbol_versioning import *
 from bzrlib.trace import mutter
 from bzrlib.transactions import WriteTransaction
 from bzrlib.transport import get_transport

=== modified file 'bzrlib/check.py'
--- bzrlib/check.py	2006-06-10 23:16:19 +0000
+++ bzrlib/check.py	2006-06-16 03:04:45 +0000
@@ -32,11 +32,9 @@
 # raising them.  If there's more than one exception it'd be good to see them
 # all.
 
-from bzrlib.errors import BzrCheckError, NoSuchRevision
-from bzrlib.symbol_versioning import *
-from bzrlib.trace import mutter, note, warning
+from bzrlib.errors import BzrCheckError
 import bzrlib.ui
-
+from bzrlib.trace import note
 
 class Check(object):
     """Check a repository"""
@@ -79,7 +77,7 @@
 
     def plan_revisions(self):
         repository = self.repository
-        self.planned_revisions = set(repository.all_revision_ids())
+        self.planned_revisions = set(repository._all_revision_ids())
         self.progress.clear()
         inventoried = set(self.inventory_weave.versions())
         awol = self.planned_revisions - inventoried
@@ -148,9 +146,6 @@
             if inv_sha1 != rev.inventory_sha1:
                 raise BzrCheckError('Inventory sha1 hash doesn\'t match'
                     ' value in revision {%s}' % rev_id)
-        else:
-            self.missing_inventory_sha_cnt += 1
-            mutter("no inventory_sha1 on revision {%s}", rev_id)
         self._check_revision_tree(rev_id)
         self.checked_rev_cnt += 1
 

=== modified file 'bzrlib/commands.py'
--- bzrlib/commands.py	2006-06-10 13:27:24 +0000
+++ bzrlib/commands.py	2006-06-15 07:10:06 +0000
@@ -42,8 +42,8 @@
                            NotBranchError)
 from bzrlib.option import Option
 from bzrlib.revisionspec import RevisionSpec
-from bzrlib.symbol_versioning import *
-import bzrlib.trace
+from bzrlib.symbol_versioning import (deprecated_method, zero_eight)
+from bzrlib import trace
 from bzrlib.trace import mutter, note, log_error, warning, be_quiet
 
 plugin_cmds = {}
@@ -683,7 +683,7 @@
     import bzrlib.ui
     from bzrlib.ui.text import TextUIFactory
     ## bzrlib.trace.enable_default_logging()
-    bzrlib.trace.log_startup(argv)
+    trace.log_startup(argv)
     bzrlib.ui.ui_factory = TextUIFactory()
 
     argv = [a.decode(bzrlib.user_encoding) for a in argv[1:]]
@@ -706,10 +706,10 @@
         if (isinstance(e, IOError) 
             and hasattr(e, 'errno')
             and e.errno == errno.EPIPE):
-            bzrlib.trace.note('broken pipe')
+            note('broken pipe')
             return 3
         else:
-            bzrlib.trace.log_exception()
+            trace.log_exception()
             if os.environ.get('BZR_PDB'):
                 print '**** entering debugger'
                 import pdb

=== modified file 'bzrlib/commit.py'
--- bzrlib/commit.py	2006-06-13 11:44:27 +0000
+++ bzrlib/commit.py	2006-06-16 01:24:15 +0000
@@ -67,7 +67,7 @@
 import re
 import sys
 import time
-import pdb
+import warnings
 
 from cStringIO import StringIO
 
@@ -86,22 +86,11 @@
 from bzrlib.trace import mutter, note, warning
 from bzrlib.xml5 import serializer_v5
 from bzrlib.inventory import Inventory, ROOT_ID, InventoryEntry
-from bzrlib.symbol_versioning import *
+from bzrlib.symbol_versioning import (deprecated_passed,
+        DEPRECATED_PARAMETER)
 from bzrlib.workingtree import WorkingTree
 
 
- at deprecated_function(zero_seven)
-def commit(*args, **kwargs):
-    """Commit a new revision to a branch.
-
-    Function-style interface for convenience of old callers.
-
-    New code should use the Commit class instead.
-    """
-    ## XXX: Remove this in favor of Branch.commit?
-    Commit().commit(*args, **kwargs)
-
-
 class NullCommitReporter(object):
     """I report on progress of a commit."""
 
@@ -221,7 +210,7 @@
         mutter('preparing to commit')
 
         if deprecated_passed(branch):
-            warn("Commit.commit (branch, ...): The branch parameter is "
+            warnings.warn("Commit.commit (branch, ...): The branch parameter is "
                  "deprecated as of bzr 0.8. Please use working_tree= instead.",
                  DeprecationWarning, stacklevel=2)
             self.branch = branch

=== modified file 'bzrlib/config.py'
--- bzrlib/config.py	2006-06-10 00:21:11 +0000
+++ bzrlib/config.py	2006-06-15 07:41:24 +0000
@@ -486,7 +486,7 @@
         if base is None:
             base = os.environ.get('HOME', None)
         if base is None:
-            raise BzrError('You must have one of BZR_HOME, APPDATA, or HOME set')
+            raise errors.BzrError('You must have one of BZR_HOME, APPDATA, or HOME set')
         return pathjoin(base, 'bazaar', '2.0')
     else:
         # cygwin, linux, and darwin all have a $HOME directory

=== modified file 'bzrlib/diff.py'
--- bzrlib/diff.py	2006-06-06 22:59:58 +0000
+++ bzrlib/diff.py	2006-06-15 07:33:43 +0000
@@ -21,7 +21,8 @@
 import bzrlib.errors as errors
 from bzrlib.patiencediff import unified_diff
 import bzrlib.patiencediff
-from bzrlib.symbol_versioning import *
+from bzrlib.symbol_versioning import (deprecated_function,
+        zero_eight)
 from bzrlib.textfile import check_text_lines
 from bzrlib.trace import mutter
 

=== modified file 'bzrlib/errors.py'
--- bzrlib/errors.py	2006-06-10 00:21:11 +0000
+++ bzrlib/errors.py	2006-06-15 06:50:57 +0000
@@ -333,14 +333,12 @@
         self.paths_as_string = ' '.join([quotefn(p) for p in paths])
 
 
-class BadFileKindError(BzrError):
-    """Specified file is of a kind that cannot be added.
-
-    (For example a symlink or device file.)"""
-
-
-class ForbiddenFileError(BzrError):
-    """Cannot operate on a file because it is a control file."""
+class BadFileKindError(BzrNewError):
+    """Cannot operate on %(filename)s of unsupported kind %(kind)s"""
+
+
+class ForbiddenFileError(BzrNewError):
+    """Cannot operate on %(filename)s because it is a control file"""
 
 
 class LockError(BzrNewError):

=== modified file 'bzrlib/export/tar_exporter.py'
--- bzrlib/export/tar_exporter.py	2005-12-29 03:26:31 +0000
+++ bzrlib/export/tar_exporter.py	2006-06-16 01:27:46 +0000
@@ -1,15 +1,15 @@
-# Copyright (C) 2005 Canonical Ltd
-
+# Copyright (C) 2005, 2006 Canonical Ltd
+#
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
 # (at your option) any later version.
-
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-
+#
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
@@ -20,6 +20,7 @@
 import os
 from bzrlib.trace import mutter
 import tarfile
+from bzrlib import errors, export
 
 
 def tar_exporter(tree, dest, root, compression=None):
@@ -32,11 +33,8 @@
     now = time()
     compression = str(compression or '')
     if root is None:
-        root = get_root_name(dest)
-    try:
-        ball = tarfile.open(dest, 'w:' + compression)
-    except tarfile.CompressionError, e:
-        raise BzrError(str(e))
+        root = export.get_root_name(dest)
+    ball = tarfile.open(dest, 'w:' + compression)
     mutter('export version %r', tree)
     inv = tree.inventory
     for dp, ie in inv.iter_entries():

=== modified file 'bzrlib/fetch.py'
--- bzrlib/fetch.py	2006-06-12 01:53:19 +0000
+++ bzrlib/fetch.py	2006-06-15 06:50:58 +0000
@@ -33,13 +33,15 @@
 
 import bzrlib
 import bzrlib.errors as errors
-from bzrlib.errors import (InstallFailed, NoSuchRevision,
-                           MissingText)
+from bzrlib.errors import (InstallFailed,
+                           )
 from bzrlib.trace import mutter
-from bzrlib.progress import ProgressBar, ProgressPhase
-from bzrlib.reconcile import RepoReconciler
+from bzrlib.progress import ProgressPhase
 from bzrlib.revision import NULL_REVISION
-from bzrlib.symbol_versioning import *
+from bzrlib.symbol_versioning import (deprecated_function,
+        deprecated_method,
+        zero_eight,
+        )
 
 
 # TODO: Avoid repeatedly opening weaves so many times.

=== modified file 'bzrlib/info.py'
--- bzrlib/info.py	2006-06-06 12:06:20 +0000
+++ bzrlib/info.py	2006-06-15 07:08:26 +0000
@@ -24,7 +24,8 @@
                            NoRepositoryPresent, NotLocalUrl)
 from bzrlib.missing import find_unmerged
 import bzrlib.osutils as osutils
-from bzrlib.symbol_versioning import *
+from bzrlib.symbol_versioning import (deprecated_function, 
+        zero_eight)
 
 
 def plural(n, base='', pl=None):

=== modified file 'bzrlib/knit.py'
--- bzrlib/knit.py	2006-06-12 01:53:19 +0000
+++ bzrlib/knit.py	2006-06-16 05:03:34 +0000
@@ -75,7 +75,7 @@
 from bzrlib.errors import FileExists, NoSuchFile, KnitError, \
         InvalidRevisionId, KnitCorrupt, KnitHeaderError, \
         RevisionNotPresent, RevisionAlreadyPresent
-from bzrlib.tuned_gzip import *
+from bzrlib.tuned_gzip import GzipFile
 from bzrlib.trace import mutter
 from bzrlib.osutils import contains_whitespace, contains_linebreaks, \
      sha_strings
@@ -554,7 +554,7 @@
             records = []
             for comp_id in basis_versions:
                 data_pos, data_size = basis._index.get_data_position(comp_id)
-                records.append((piece_id, data_pos, data_size))
+                records.append((comp_id, data_pos, data_size))
             components.update(basis._data.read_records(records))
 
         records = []
@@ -992,7 +992,7 @@
         # position in _history is the 'official' index for a revision
         # but the values may have come from a newer entry.
         # so - wc -l of a knit index is != the number of unique names
-        # in the weave.
+        # in the knit.
         self._history = []
         pb = bzrlib.ui.ui_factory.nested_progress_bar()
         try:

=== modified file 'bzrlib/lock.py'
--- bzrlib/lock.py	2006-03-03 07:31:24 +0000
+++ bzrlib/lock.py	2006-06-08 11:41:47 +0000
@@ -38,7 +38,7 @@
 import os
 import sys
 
-from bzrlib.trace import mutter, note, warning
+from bzrlib.trace import mutter
 from bzrlib.errors import LockError
 
 class _base_Lock(object):

=== modified file 'bzrlib/lockable_files.py'
--- bzrlib/lockable_files.py	2006-06-06 12:06:20 +0000
+++ bzrlib/lockable_files.py	2006-06-15 07:40:31 +0000
@@ -19,11 +19,13 @@
 #import traceback
 
 import bzrlib
-from bzrlib.decorators import *
+from bzrlib.decorators import (needs_read_lock,
+        needs_write_lock)
 import bzrlib.errors as errors
 from bzrlib.errors import BzrError
 from bzrlib.osutils import file_iterator, safe_unicode
-from bzrlib.symbol_versioning import *
+from bzrlib.symbol_versioning import (deprecated_method, 
+        zero_eight)
 from bzrlib.trace import mutter, note
 import bzrlib.transactions as transactions
 import bzrlib.urlutils as urlutils

=== modified file 'bzrlib/lockdir.py'
--- bzrlib/lockdir.py	2006-06-10 00:21:11 +0000
+++ bzrlib/lockdir.py	2006-06-15 06:50:59 +0000
@@ -96,7 +96,6 @@
 
 import os
 import time
-from warnings import warn
 from StringIO import StringIO
 
 import bzrlib.config
@@ -106,7 +105,6 @@
         LockBreakMismatch,
         LockBroken,
         LockContention,
-        LockError,
         LockNotHeld,
         NoSuchFile,
         PathError,

=== modified file 'bzrlib/log.py'
--- bzrlib/log.py	2006-06-10 00:21:11 +0000
+++ bzrlib/log.py	2006-06-15 07:31:59 +0000
@@ -51,6 +51,9 @@
 
 
 # TODO: option to show delta summaries for merged-in revisions
+#
+# TODO: deltas_for_log_reverse seems no longer called; delete it?
+
 import re
 
 from bzrlib.delta import compare_trees
@@ -258,88 +261,6 @@
             lf.show_merge(rev, merge_depth)
 
 
-def deltas_for_log_dummy(branch, which_revs):
-    """Return all the revisions without intermediate deltas.
-
-    Useful for log commands that won't need the delta information.
-    """
-    
-    for revno, revision_id in which_revs:
-        yield revno, branch.get_revision(revision_id), None
-
-
-def deltas_for_log_reverse(branch, which_revs):
-    """Compute deltas for display in latest-to-earliest order.
-
-    branch
-        Branch to traverse
-
-    which_revs
-        Sequence of (revno, revision_id) for the subset of history to examine
-
-    returns 
-        Sequence of (revno, rev, delta)
-
-    The delta is from the given revision to the next one in the
-    sequence, which makes sense if the log is being displayed from
-    newest to oldest.
-    """
-    last_revno = last_revision_id = last_tree = None
-    for revno, revision_id in which_revs:
-        this_tree = branch.revision_tree(revision_id)
-        this_revision = branch.get_revision(revision_id)
-        
-        if last_revno:
-            yield last_revno, last_revision, compare_trees(this_tree, last_tree, False)
-
-        this_tree = EmptyTree(branch.get_root_id())
-
-        last_revno = revno
-        last_revision = this_revision
-        last_tree = this_tree
-
-    if last_revno:
-        if last_revno == 1:
-            this_tree = EmptyTree(branch.get_root_id())
-        else:
-            this_revno = last_revno - 1
-            this_revision_id = branch.revision_history()[this_revno]
-            this_tree = branch.revision_tree(this_revision_id)
-        yield last_revno, last_revision, compare_trees(this_tree, last_tree, False)
-
-
-def deltas_for_log_forward(branch, which_revs):
-    """Compute deltas for display in forward log.
-
-    Given a sequence of (revno, revision_id) pairs, return
-    (revno, rev, delta).
-
-    The delta is from the given revision to the next one in the
-    sequence, which makes sense if the log is being displayed from
-    newest to oldest.
-    """
-    last_revno = last_revision_id = last_tree = None
-    prev_tree = EmptyTree(branch.get_root_id())
-
-    for revno, revision_id in which_revs:
-        this_tree = branch.revision_tree(revision_id)
-        this_revision = branch.get_revision(revision_id)
-
-        if not last_revno:
-            if revno == 1:
-                last_tree = EmptyTree(branch.get_root_id())
-            else:
-                last_revno = revno - 1
-                last_revision_id = branch.revision_history()[last_revno]
-                last_tree = branch.revision_tree(last_revision_id)
-
-        yield revno, this_revision, compare_trees(last_tree, this_tree, False)
-
-        last_revno = revno
-        last_revision = this_revision
-        last_tree = this_tree
-
-
 class LogFormatter(object):
     """Abstract class to display log messages."""
 

=== modified file 'bzrlib/lsprof.py'
--- bzrlib/lsprof.py	2005-12-08 07:10:37 +0000
+++ bzrlib/lsprof.py	2006-06-08 11:41:30 +0000
@@ -4,7 +4,7 @@
 # instead of just the Stats object
 
 import sys
-from _lsprof import Profiler, profiler_entry, profiler_subentry
+from _lsprof import Profiler, profiler_entry
 
 __all__ = ['profile', 'Stats']
 

=== modified file 'bzrlib/merge.py'
--- bzrlib/merge.py	2006-06-10 00:21:11 +0000
+++ bzrlib/merge.py	2006-06-16 01:14:21 +0000
@@ -1,15 +1,15 @@
 # Copyright (C) 2005, 2006 Canonical Ltd
-
+#
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
 # (at your option) any later version.
-
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-
+#
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
@@ -18,8 +18,8 @@
 import os
 import errno
 from tempfile import mkdtemp
+import warnings
 
-import bzrlib
 from bzrlib.branch import Branch
 from bzrlib.conflicts import ConflictList, Conflict
 from bzrlib.delta import compare_trees
@@ -41,13 +41,12 @@
 from bzrlib.osutils import rename, pathjoin, rmtree
 from progress import DummyProgress, ProgressPhase
 from bzrlib.revision import common_ancestor, is_ancestor, NULL_REVISION
-from bzrlib.symbol_versioning import *
 from bzrlib.textfile import check_text_lines
 from bzrlib.trace import mutter, warning, note
 from bzrlib.transform import (TreeTransform, resolve_conflicts, cook_conflicts,
                               FinalPaths, create_by_entry, unique_add)
 from bzrlib.versionedfile import WeaveMerge
-import bzrlib.ui
+from bzrlib import ui
 
 # TODO: Report back as changes are merged in
 
@@ -120,7 +119,7 @@
             changes = compare_trees(self.other_tree, other_basis_tree)
             if changes.has_changed():
                 raise WorkingTreeNotRevision(self.this_tree)
-            other_rev_id = other_basis
+            other_rev_id = self.other_basis
             self.other_tree = other_basis_tree
 
     def file_revisions(self, file_id):
@@ -368,7 +367,7 @@
         self.tt = TreeTransform(working_tree, self.pb)
         try:
             self.pp.next_phase()
-            child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
+            child_pb = ui.ui_factory.nested_progress_bar()
             try:
                 for num, file_id in enumerate(all_ids):
                     child_pb.update('Preparing file merge', num, len(all_ids))
@@ -379,7 +378,7 @@
                 child_pb.finished()
                 
             self.pp.next_phase()
-            child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
+            child_pb = ui.ui_factory.nested_progress_bar()
             try:
                 fs_conflicts = resolve_conflicts(self.tt, child_pb)
             finally:
@@ -896,7 +895,7 @@
                      branch.get_revision_tree(base_revision))'
         """
     if this_tree is None:
-        warn("bzrlib.merge.merge_inner requires a this_tree parameter as of "
+        warnings.warn("bzrlib.merge.merge_inner requires a this_tree parameter as of "
              "bzrlib version 0.8.",
              DeprecationWarning,
              stacklevel=2)

=== modified file 'bzrlib/msgeditor.py'
--- bzrlib/msgeditor.py	2006-06-06 12:06:20 +0000
+++ bzrlib/msgeditor.py	2006-06-15 07:39:35 +0000
@@ -26,6 +26,7 @@
 import bzrlib
 import bzrlib.config as config
 from bzrlib.errors import BzrError
+from bzrlib.trace import warning
 
 
 def _get_editor():
@@ -142,7 +143,7 @@
             try:
                 os.unlink(msgfilename)
             except IOError, e:
-                mutter("failed to unlink %s: %s; ignored", msgfilename, e)
+                warning("failed to unlink %s: %s; ignored", msgfilename, e)
 
 
 def make_commit_message_template(working_tree, specific_files):

=== modified file 'bzrlib/option.py'
--- bzrlib/option.py	2006-06-10 00:21:11 +0000
+++ bzrlib/option.py	2006-06-15 06:50:57 +0000
@@ -19,8 +19,7 @@
 
 import re
 
-import bzrlib.commands
-from bzrlib.trace import warning, mutter
+from bzrlib.trace import warning
 from bzrlib.revisionspec import RevisionSpec
 from bzrlib.errors import BzrCommandError
 

=== modified file 'bzrlib/osutils.py'
--- bzrlib/osutils.py	2006-06-13 12:55:45 +0000
+++ bzrlib/osutils.py	2006-06-15 07:08:58 +0000
@@ -46,9 +46,9 @@
                            PathNotChild,
                            IllegalPath,
                            )
-from bzrlib.symbol_versioning import *
+from bzrlib.symbol_versioning import (deprecated_function, 
+        zero_nine)
 from bzrlib.trace import mutter
-import bzrlib.win32console
 
 
 def make_readonly(filename):

=== modified file 'bzrlib/patiencediff.py'
--- bzrlib/patiencediff.py	2006-05-29 00:50:34 +0000
+++ bzrlib/patiencediff.py	2006-06-08 11:29:38 +0000
@@ -17,7 +17,6 @@
 
 
 from bisect import bisect
-from copy import copy
 import difflib
 import os
 import sys

=== modified file 'bzrlib/reconcile.py'
--- bzrlib/reconcile.py	2006-06-12 01:53:19 +0000
+++ bzrlib/reconcile.py	2006-06-15 07:36:25 +0000
@@ -20,12 +20,9 @@
 __all__ = ['reconcile', 'Reconciler', 'RepoReconciler', 'KnitReconciler']
 
 
-import bzrlib.branch
-import bzrlib.errors as errors
-import bzrlib.progress
+from bzrlib import ui
 from bzrlib.trace import mutter
 from bzrlib.tsort import TopoSorter
-import bzrlib.ui as ui
 
 
 def reconcile(dir, other=None):

=== modified file 'bzrlib/repository.py'
--- bzrlib/repository.py	2006-06-12 02:11:45 +0000
+++ bzrlib/repository.py	2006-06-16 03:28:17 +0000
@@ -21,11 +21,9 @@
 import time
 from unittest import TestSuite
 
-import bzrlib.bzrdir as bzrdir
+from bzrlib import bzrdir, check, gpg, errors, xml5, ui, transactions, osutils
 from bzrlib.decorators import needs_read_lock, needs_write_lock
-import bzrlib.errors as errors
 from bzrlib.errors import InvalidRevisionId
-import bzrlib.gpg as gpg
 from bzrlib.graph import Graph
 from bzrlib.inter import InterObject
 from bzrlib.inventory import Inventory
@@ -37,15 +35,15 @@
 from bzrlib.revision import NULL_REVISION, Revision
 from bzrlib.store.versioned import VersionedFileStore, WeaveStore
 from bzrlib.store.text import TextStore
-from bzrlib.symbol_versioning import *
+from bzrlib.symbol_versioning import (deprecated_method,
+        zero_nine, 
+        )
 from bzrlib.trace import mutter, note
 from bzrlib.tree import RevisionTree
 from bzrlib.tsort import topo_sort
 from bzrlib.testament import Testament
 from bzrlib.tree import EmptyTree
-import bzrlib.ui
 from bzrlib.weave import WeaveFile
-import bzrlib.xml5
 
 
 class Repository(object):
@@ -72,11 +70,11 @@
         assert inv.revision_id is None or inv.revision_id == revid, \
             "Mismatch between inventory revision" \
             " id and insertion revid (%r, %r)" % (inv.revision_id, revid)
-        inv_text = bzrlib.xml5.serializer_v5.write_inventory_to_string(inv)
-        inv_sha1 = bzrlib.osutils.sha_string(inv_text)
+        inv_text = xml5.serializer_v5.write_inventory_to_string(inv)
+        inv_sha1 = osutils.sha_string(inv_text)
         inv_vf = self.control_weaves.get_weave('inventory',
                                                self.get_transaction())
-        self._inventory_add_lines(inv_vf, revid, parents, bzrlib.osutils.split_lines(inv_text))
+        self._inventory_add_lines(inv_vf, revid, parents, osutils.split_lines(inv_text))
         return inv_sha1
 
     def _inventory_add_lines(self, inv_vf, revid, parents, lines):
@@ -226,7 +224,7 @@
         For instance, if the repository is at URL/.bzr/repository,
         Repository.open(URL) -> a Repository instance.
         """
-        control = bzrlib.bzrdir.BzrDir.open(base)
+        control = bzrdir.BzrDir.open(base)
         return control.open_repository()
 
     def copy_content_into(self, destination, revision_id=None, basis=None):
@@ -277,9 +275,9 @@
             result = a_bzrdir.create_repository()
         # FIXME RBC 20060209 split out the repository type to avoid this check ?
         elif isinstance(a_bzrdir._format,
-                      (bzrlib.bzrdir.BzrDirFormat4,
-                       bzrlib.bzrdir.BzrDirFormat5,
-                       bzrlib.bzrdir.BzrDirFormat6)):
+                      (bzrdir.BzrDirFormat4,
+                       bzrdir.BzrDirFormat5,
+                       bzrdir.BzrDirFormat6)):
             result = a_bzrdir.open_repository()
         else:
             result = self._format.initialize(a_bzrdir, shared=self.is_shared())
@@ -412,7 +410,7 @@
         :param revision_id: The expected revision id of the inventory.
         :param xml: A serialised inventory.
         """
-        return bzrlib.xml5.serializer_v5.read_inventory_from_string(xml)
+        return xml5.serializer_v5.read_inventory_from_string(xml)
 
     @needs_read_lock
     def get_inventory_xml(self, revision_id):
@@ -422,7 +420,7 @@
             iw = self.get_inventory_weave()
             return iw.get_text(revision_id)
         except IndexError:
-            raise bzrlib.errors.HistoryMissing(self, 'inventory', revision_id)
+            raise errors.HistoryMissing(self, 'inventory', revision_id)
 
     @needs_read_lock
     def get_inventory_sha1(self, revision_id):
@@ -465,7 +463,7 @@
         """
         result = Graph()
         if not revision_ids:
-            pending = set(self.all_revision_ids())
+            pending = set(self._all_revision_ids())
             required = set([])
         else:
             pending = set(revision_ids)
@@ -624,7 +622,7 @@
         return self._check(revision_ids)
 
     def _check(self, revision_ids):
-        result = bzrlib.check.Check(self)
+        result = check.Check(self)
         result.check()
         return result
 
@@ -861,7 +859,7 @@
         vf = self._get_revision_vf()
         versions = set(vf.versions())
         if not revision_ids:
-            pending = set(self.all_revision_ids())
+            pending = set(self._all_revision_ids())
             required = set([])
         else:
             pending = set(revision_ids)
@@ -901,8 +899,9 @@
         reconciler.reconcile()
         return reconciler
     
-    def revision_parents(self, revid):
-        return self._get_revision_vf().get_parents(rev_id)
+    def revision_parents(self, revision_id):
+        return self._get_revision_vf().get_parents(revision_id)
+
 
 class RepositoryFormat(object):
     """A repository format.
@@ -1071,7 +1070,7 @@
         
         # Create an empty weave
         sio = StringIO()
-        bzrlib.weavefile.write_weave_v5(Weave(), sio)
+        write_weave_v5(Weave(), sio)
         empty_weave = sio.getvalue()
 
         mutter('creating repository in %s.', a_bzrdir.transport.base)
@@ -1137,7 +1136,7 @@
 
     def __init__(self):
         super(RepositoryFormat4, self).__init__()
-        self._matchingbzrdir = bzrlib.bzrdir.BzrDirFormat4()
+        self._matchingbzrdir = bzrdir.BzrDirFormat4()
 
     def get_format_description(self):
         """See RepositoryFormat.get_format_description()."""
@@ -1186,7 +1185,7 @@
 
     def __init__(self):
         super(RepositoryFormat5, self).__init__()
-        self._matchingbzrdir = bzrlib.bzrdir.BzrDirFormat5()
+        self._matchingbzrdir = bzrdir.BzrDirFormat5()
 
     def get_format_description(self):
         """See RepositoryFormat.get_format_description()."""
@@ -1216,7 +1215,7 @@
 
     def __init__(self):
         super(RepositoryFormat6, self).__init__()
-        self._matchingbzrdir = bzrlib.bzrdir.BzrDirFormat6()
+        self._matchingbzrdir = bzrdir.BzrDirFormat6()
 
     def get_format_description(self):
         """See RepositoryFormat.get_format_description()."""
@@ -1240,7 +1239,7 @@
 
     def __init__(self):
         super(MetaDirRepositoryFormat, self).__init__()
-        self._matchingbzrdir = bzrlib.bzrdir.BzrDirMetaFormat1()
+        self._matchingbzrdir = bzrdir.BzrDirMetaFormat1()
 
     def _create_control_files(self, a_bzrdir):
         """Create the required files and the initial control_files object."""
@@ -1321,7 +1320,7 @@
 
         # Create an empty weave
         sio = StringIO()
-        bzrlib.weavefile.write_weave_v5(Weave(), sio)
+        write_weave_v5(Weave(), sio)
         empty_weave = sio.getvalue()
 
         mutter('creating repository in %s.', a_bzrdir.transport.base)
@@ -1432,7 +1431,7 @@
         repo_transport = a_bzrdir.get_repository_transport(None)
         control_files = LockableFiles(repo_transport, 'lock', LockDir)
         control_store = self._get_control_store(repo_transport, control_files)
-        transaction = bzrlib.transactions.WriteTransaction()
+        transaction = transactions.WriteTransaction()
         # trigger a write of the inventory store.
         control_store.get_weave_or_empty('inventory', transaction)
         _revision_store = self._get_revision_store(repo_transport, control_files)
@@ -1641,7 +1640,7 @@
                 pass
             # FIXME do not peek!
             if self.source.control_files._transport.listable():
-                pb = bzrlib.ui.ui_factory.nested_progress_bar()
+                pb = ui.ui_factory.nested_progress_bar()
                 try:
                     self.target.weave_store.copy_all_ids(
                         self.source.weave_store,
@@ -2070,7 +2069,7 @@
             # TODO: Rather than invoking sha_strings here, _add_text_to_weave
             # should return the SHA1 and size
             self._add_text_to_weave(file_id, new_lines, file_parents.keys())
-            return bzrlib.osutils.sha_strings(new_lines), \
+            return osutils.sha_strings(new_lines), \
                 sum(map(len, new_lines))
 
     def modified_link(self, file_id, file_parents, link_target):

=== modified file 'bzrlib/revision.py'
--- bzrlib/revision.py	2006-06-13 13:24:40 +0000
+++ bzrlib/revision.py	2006-06-15 06:50:58 +0000
@@ -1,4 +1,4 @@
-# (C) 2005 Canonical
+# Copyright (C) 2005, 2006 Canonical
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -18,12 +18,13 @@
 # perhaps show them in log -v and allow them as options to the commit command.
 
 
-import bzrlib.errors
 import bzrlib.errors as errors
 from bzrlib.graph import node_distances, select_farthest, all_descendants, Graph
 from bzrlib.osutils import contains_whitespace
 from bzrlib.progress import DummyProgress
-from bzrlib.symbol_versioning import *
+from bzrlib.symbol_versioning import (deprecated_function,
+        zero_eight,
+        )
 
 NULL_REVISION="null:"
 
@@ -130,7 +131,7 @@
                 yield ancestor, distance
             try:
                 revision = revision_source.get_revision(ancestor)
-            except bzrlib.errors.NoSuchRevision, e:
+            except errors.NoSuchRevision, e:
                 if e.revision == revision_id:
                     raise 
                 else:
@@ -220,7 +221,7 @@
     root_b, ancestors_b, descendants_b = revision_graph(
         revision_b, revision_source)
     if root != root_b:
-        raise bzrlib.errors.NoCommonRoot(revision_a, revision_b)
+        raise errors.NoCommonRoot(revision_a, revision_b)
     common = set()
     for node, node_anc in ancestors_b.iteritems():
         if node in ancestors:
@@ -273,15 +274,15 @@
                 
             root = NULL_REVISION
             common.add(NULL_REVISION)
-        except bzrlib.errors.NoCommonRoot:
-            raise bzrlib.errors.NoCommonAncestor(revision_a, revision_b)
+        except errors.NoCommonRoot:
+            raise errors.NoCommonAncestor(revision_a, revision_b)
             
         pb.update('Picking ancestor', 2, 3)
         distances = node_distances (descendants, ancestors, root)
         pb.update('Picking ancestor', 3, 2)
         farthest = select_farthest(distances, common)
         if farthest is None or farthest == NULL_REVISION:
-            raise bzrlib.errors.NoCommonAncestor(revision_a, revision_b)
+            raise errors.NoCommonAncestor(revision_a, revision_b)
     finally:
         pb.clear()
     return farthest
@@ -306,7 +307,7 @@
         for source in self._revision_sources:
             try:
                 return source.get_revision(revision_id)
-            except bzrlib.errors.NoSuchRevision, e:
+            except errors.NoSuchRevision, e:
                 pass
         raise e
 
@@ -419,14 +420,14 @@
     """
     root, ancestors, descendants = revision_graph(rev_id, rev_source)
     if len(descendants) == 0:
-        raise NoSuchRevision(rev_source, rev_id)
+        raise errors.NoSuchRevision(rev_source, rev_id)
     if ancestor_id not in descendants:
         rev_source.get_revision(ancestor_id)
-        raise bzrlib.errors.NotAncestor(rev_id, ancestor_id)
+        raise errors.NotAncestor(rev_id, ancestor_id)
     root_descendants = all_descendants(descendants, ancestor_id)
     root_descendants.add(ancestor_id)
     if rev_id not in root_descendants:
-        raise bzrlib.errors.NotAncestor(rev_id, ancestor_id)
+        raise errors.NotAncestor(rev_id, ancestor_id)
     distances = node_distances(descendants, ancestors, ancestor_id,
                                root_descendants=root_descendants)
 

=== modified file 'bzrlib/sign_my_commits.py'
--- bzrlib/sign_my_commits.py	2006-06-10 23:16:19 +0000
+++ bzrlib/sign_my_commits.py	2006-06-16 02:59:39 +0000
@@ -17,10 +17,9 @@
 """Command which looks for unsigned commits by the current user, and signs them.
 """
 
+from bzrlib import config, gpg
 from bzrlib.commands import Command
-import bzrlib.config
-import bzrlib.errors as errors
-import bzrlib.gpg
+from bzrlib.bzrdir import BzrDir
 from bzrlib.option import Option
 
 
@@ -44,18 +43,16 @@
 
     def run(self, location=None, committer=None, dry_run=False):
         if location is None:
-            bzrdir = bzrlib.bzrdir.BzrDir.open_containing('.')[0]
+            bzrdir = BzrDir.open_containing('.')[0]
         else:
             # Passed in locations should be exact
-            bzrdir = bzrlib.bzrdir.BzrDir.open(location)
+            bzrdir = BzrDir.open(location)
         branch = bzrdir.open_branch()
         repo = branch.repository
-        config = bzrlib.config.BranchConfig(branch)
-
+        branch_config = config.BranchConfig(branch)
         if committer is None:
-            committer = config.username()
-
-        gpg_strategy = bzrlib.gpg.GPGStrategy(config)
+            committer = branch_config.username()
+        gpg_strategy = gpg.GPGStrategy(branch_config)
 
         count = 0
         repo.lock_write()

=== modified file 'bzrlib/status.py'
--- bzrlib/status.py	2006-05-17 13:03:45 +0000
+++ bzrlib/status.py	2006-06-08 11:42:40 +0000
@@ -18,10 +18,12 @@
 
 from bzrlib.delta import compare_trees
 from bzrlib.diff import _raise_if_nonexistent
-from bzrlib.errors import NoSuchRevision
+import bzrlib.errors as errors
 from bzrlib.log import line_log
 from bzrlib.osutils import is_inside_any
-from bzrlib.symbol_versioning import *
+from bzrlib.symbol_versioning import (deprecated_function,
+        zero_eight,
+        )
 
 # TODO: when showing single-line logs, truncate to the width of the terminal
 # if known, but only if really going to the terminal (not into a file)
@@ -122,15 +124,15 @@
             try:
                 rev_id = revision[0].in_history(wt.branch).rev_id
                 old = wt.branch.repository.revision_tree(rev_id)
-            except NoSuchRevision, e:
-                raise BzrCommandError(str(e))
+            except errors.NoSuchRevision, e:
+                raise errors.BzrCommandError(str(e))
             if (len(revision) > 1) and (revision[1].spec is not None):
                 try:
                     rev_id = revision[1].in_history(wt.branch).rev_id
                     new = wt.branch.repository.revision_tree(rev_id)
                     new_is_working_tree = False
-                except NoSuchRevision, e:
-                    raise BzrCommandError(str(e))
+                except errors.NoSuchRevision, e:
+                    raise errors.BzrCommandError(str(e))
             else:
                 new = wt
         _raise_if_nonexistent(specific_files, old, new)
@@ -180,8 +182,8 @@
                 mm_revision = branch.repository.get_revision(mmerge)
                 print >> to_file, '   ', line_log(mm_revision, 75)
                 ignore.add(mmerge)
-        except NoSuchRevision:
-            print >> to_file, ' ', merge 
+        except errors.NoSuchRevision:
+            print >> to_file, ' ', merge
         
 def list_paths(header, paths, specific_files, to_file):
     done_header = False

=== modified file 'bzrlib/store/__init__.py'
--- bzrlib/store/__init__.py	2006-06-09 09:04:53 +0000
+++ bzrlib/store/__init__.py	2006-06-16 04:00:45 +0000
@@ -32,7 +32,7 @@
 import bzrlib
 import bzrlib.errors as errors
 from bzrlib.errors import BzrError, UnlistableStore, TransportNotPossible
-from bzrlib.symbol_versioning import *
+from bzrlib.symbol_versioning import (deprecated_function, zero_eight)
 from bzrlib.trace import mutter
 from bzrlib.transport import Transport
 from bzrlib.transport.local import LocalTransport

=== modified file 'bzrlib/store/text.py'
--- bzrlib/store/text.py	2006-04-04 10:20:54 +0000
+++ bzrlib/store/text.py	2006-06-16 04:00:37 +0000
@@ -120,7 +120,3 @@
             from cStringIO import StringIO
             sio = StringIO(f.read())
             return gzip.GzipFile(mode='rb', fileobj=sio)
-
-
-def ScratchTextStore():
-    return TextStore(ScratchTransport())

=== modified file 'bzrlib/store/versioned/__init__.py'
--- bzrlib/store/versioned/__init__.py	2006-05-23 04:29:35 +0000
+++ bzrlib/store/versioned/__init__.py	2006-06-16 04:29:28 +0000
@@ -22,13 +22,15 @@
 import os
 from cStringIO import StringIO
 import urllib
+from warnings import warn
 
+from bzrlib import errors
 from bzrlib.weavefile import read_weave, write_weave_v5
 from bzrlib.weave import WeaveFile, Weave
 from bzrlib.store import TransportStore
 from bzrlib.atomicfile import AtomicFile
-from bzrlib.errors import NoSuchFile, FileExists
-from bzrlib.symbol_versioning import *
+from bzrlib.symbol_versioning import (deprecated_method,
+        zero_eight)
 from bzrlib.trace import mutter
 import bzrlib.ui
 
@@ -112,7 +114,7 @@
         fn = self.filename(file_id)
         try:
             return self._transport.put(fn, f, mode=self._file_mode)
-        except NoSuchFile:
+        except errors.NoSuchFile:
             if not self._prefixed:
                 raise
             self._transport.mkdir(os.path.dirname(fn), mode=self._dir_mode)
@@ -173,7 +175,7 @@
             # for the common case.
             weave = self._versionedfile_class(_filename, self._transport, self._file_mode, create=True,
                                               **self._versionedfile_kwargs)
-        except NoSuchFile:
+        except errors.NoSuchFile:
             if not self._prefixed:
                 # unexpected error - NoSuchFile is expected to be raised on a
                 # missing dir only and that only occurs when we are prefixed.
@@ -194,7 +196,7 @@
         _filename = self.filename(file_id)
         try:
             return self.get_weave(file_id, transaction, _filename=_filename)
-        except NoSuchFile:
+        except errors.NoSuchFile:
             weave = self._make_new_versionedfile(file_id, transaction,
                 known_missing=True, _filename=_filename)
             transaction.map.add_weave(file_id, weave)
@@ -255,7 +257,7 @@
             warn("Please pass to_transaction into "
                  "versioned_store.copy_all_ids.", stacklevel=2)
         if not store_from.listable():
-            raise UnlistableStore(store_from)
+            raise errors.UnlistableStore(store_from)
         ids = []
         for count, file_id in enumerate(store_from):
             if pb:

=== modified file 'bzrlib/tests/__init__.py'
--- bzrlib/tests/__init__.py	2006-06-12 18:16:35 +0000
+++ bzrlib/tests/__init__.py	2006-06-16 03:35:33 +0000
@@ -69,7 +69,11 @@
 from bzrlib.transport.local import LocalRelpathServer
 from bzrlib.transport.readonly import ReadonlyServer
 from bzrlib.trace import mutter
-from bzrlib.tests.TestUtil import TestLoader, TestSuite
+from bzrlib.tests import TestUtil
+from bzrlib.tests.TestUtil import (
+                          TestSuite,
+                          TestLoader,
+                          )
 from bzrlib.tests.treeshape import build_tree_contents
 import bzrlib.urlutils as urlutils
 from bzrlib.workingtree import WorkingTree, WorkingTreeFormat2
@@ -1129,7 +1133,7 @@
 
 
 def filter_suite_by_re(suite, pattern):
-    result = TestSuite()
+    result = TestUtil.TestSuite()
     filter_re = re.compile(pattern)
     for test in iter_suite_tests(suite):
         if filter_re.search(test.id()):
@@ -1271,7 +1275,7 @@
     test_transport_implementations = [
         'bzrlib.tests.test_transport_implementations']
 
-    suite = TestSuite()
+    suite = TestUtil.TestSuite()
     loader = TestUtil.TestLoader()
     from bzrlib.transport import TransportTestProviderAdapter
     adapter = TransportTestProviderAdapter()

=== modified file 'bzrlib/tests/blackbox/test_annotate.py'
--- bzrlib/tests/blackbox/test_annotate.py	2006-05-05 01:29:34 +0000
+++ bzrlib/tests/blackbox/test_annotate.py	2006-06-16 03:49:38 +0000
@@ -28,7 +28,6 @@
 import os
 import shutil
 import sys
-import os
 
 from bzrlib.branch import Branch
 from bzrlib.errors import BzrCommandError

=== modified file 'bzrlib/tests/blackbox/test_branch.py'
--- bzrlib/tests/blackbox/test_branch.py	2006-05-24 16:21:15 +0000
+++ bzrlib/tests/blackbox/test_branch.py	2006-06-16 03:50:13 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005,2006 by Canonical Ltd
+# Copyright (C) 2005, 2006 by Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -19,8 +19,7 @@
 
 import os
 
-import bzrlib.branch
-import bzrlib.bzrdir
+from bzrlib import branch, bzrdir
 from bzrlib.repository import RepositoryFormatKnit1
 from bzrlib.tests.blackbox import ExternalBase
 from bzrlib.workingtree import WorkingTree
@@ -44,7 +43,7 @@
         self.example_branch()
         os.chdir('..')
         self.runbzr('branch a b')
-        b = bzrlib.branch.Branch.open('b')
+        b = branch.Branch.open('b')
         self.assertEqual('b\n', b.control_files.get_utf8('branch-name').read())
         self.runbzr('branch a c -r 1')
         os.chdir('b')
@@ -66,14 +65,14 @@
         self.assertFalse(source.branch.repository.has_revision('2'))
         dir = source.bzrdir
         self.runbzr('branch source target --basis commit_tree')
-        target = bzrlib.bzrdir.BzrDir.open('target')
+        target = bzrdir.BzrDir.open('target')
         self.assertEqual('2', target.open_branch().last_revision())
         self.assertEqual('2', target.open_workingtree().last_revision())
         self.assertTrue(target.open_branch().repository.has_revision('2'))
 
     def test_branch_only_copies_history(self):
         # Knit branches should only push the history for the current revision.
-        format = bzrlib.bzrdir.BzrDirMetaFormat1()
+        format = bzrdir.BzrDirMetaFormat1()
         format.repository_format = RepositoryFormatKnit1()
         shared_repo = self.make_repository('repo', format=format, shared=True)
         shared_repo.set_make_working_trees(True)

=== modified file 'bzrlib/tests/blackbox/test_logformats.py'
--- bzrlib/tests/blackbox/test_logformats.py	2006-03-12 20:42:58 +0000
+++ bzrlib/tests/blackbox/test_logformats.py	2006-06-16 03:51:27 +0000
@@ -14,7 +14,7 @@
         return self.run_bzr(*args, **kwargs)[0]
 
     def test_log_default_format(self):
-        setup_config()
+        self.setup_config()
 
         self.bzr('init')
         open('a', 'wb').write('foo\n')
@@ -42,7 +42,7 @@
         self.assertEquals(7, len(self.bzr('log', '--log-format', 'short').split('\n')))
 
     def test_missing_default_format(self):
-        setup_config()
+        self.setup_config()
 
         os.mkdir('a')
         os.chdir('a')
@@ -69,7 +69,7 @@
         os.chdir('..')
 
     def test_missing_format_arg(self):
-        setup_config()
+        self.setup_config()
 
         os.mkdir('a')
         os.chdir('a')
@@ -96,7 +96,7 @@
         os.chdir('..')
 
 
-def setup_config():
+    def setup_config(self):
         if os.path.isfile(config_filename()):
                 # Something is wrong in environment, 
                 # we risk overwriting users config 
@@ -108,4 +108,3 @@
                 "log_format=line\n")
 
         open(config_filename(),'wb').write(CONFIG)
-

=== modified file 'bzrlib/tests/branch_implementations/test_branch.py'
--- bzrlib/tests/branch_implementations/test_branch.py	2006-06-10 23:16:19 +0000
+++ bzrlib/tests/branch_implementations/test_branch.py	2006-06-16 04:38:19 +0000
@@ -1,4 +1,4 @@
-# (C) 2005, 2006 Canonical Ltd
+# Copyright (C) 2005, 2006 Canonical Ltd
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -19,23 +19,18 @@
 import os
 import sys
 
-import bzrlib.branch
-import bzrlib.bzrdir as bzrdir
+from bzrlib import branch, bzrdir, errors, gpg, transactions, repository
 from bzrlib.branch import Branch, needs_read_lock, needs_write_lock
-from bzrlib.commit import commit
-import bzrlib.errors as errors
 from bzrlib.errors import (FileExists,
                            NoSuchRevision,
                            NoSuchFile,
                            UninitializableFormat,
                            NotBranchError,
                            )
-import bzrlib.gpg
 from bzrlib.osutils import getcwd
 from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
 from bzrlib.tests.bzrdir_implementations.test_bzrdir import TestCaseWithBzrDir
 from bzrlib.trace import mutter
-import bzrlib.transactions as transactions
 from bzrlib.transport import get_transport
 from bzrlib.transport.http import HttpServer
 from bzrlib.transport.memory import MemoryServer
@@ -227,7 +222,7 @@
         branch = wt.branch
         wt.commit("base", allow_pointless=True, rev_id='A')
         from bzrlib.testament import Testament
-        strategy = bzrlib.gpg.LoopbackGPGStrategy(None)
+        strategy = gpg.LoopbackGPGStrategy(None)
         branch.repository.sign_revision('A', strategy)
         self.assertEqual(Testament.from_revision(branch.repository, 
                          'A').as_short_text(),
@@ -237,7 +232,7 @@
         wt = self.make_branch_and_tree('.')
         branch = wt.branch
         branch.repository.store_revision_signature(
-            bzrlib.gpg.LoopbackGPGStrategy(None), 'FOO', 'A')
+            gpg.LoopbackGPGStrategy(None), 'FOO', 'A')
         self.assertRaises(errors.NoSuchRevision,
                           branch.repository.has_signature_for_revision_id,
                           'A')
@@ -249,7 +244,7 @@
         wt = self.make_branch_and_tree('source')
         wt.commit('A', allow_pointless=True, rev_id='A')
         wt.branch.repository.sign_revision('A',
-            bzrlib.gpg.LoopbackGPGStrategy(None))
+            gpg.LoopbackGPGStrategy(None))
         #FIXME: clone should work to urls,
         # wt.clone should work to disks.
         self.build_tree(['target/'])
@@ -307,7 +302,7 @@
             return
         self.assertEqual(repo.bzrdir.root_transport.base,
                          child_branch.repository.bzrdir.root_transport.base)
-        child_branch = bzrlib.branch.Branch.open(self.get_url('child'))
+        child_branch = branch.Branch.open(self.get_url('child'))
         self.assertEqual(repo.bzrdir.root_transport.base,
                          child_branch.repository.bzrdir.root_transport.base)
 
@@ -326,7 +321,7 @@
 
     def test_get_commit_builder(self):
         self.assertIsInstance(self.make_branch(".").get_commit_builder([]), 
-            bzrlib.repository.CommitBuilder)
+            repository.CommitBuilder)
 
 
 class ChrootedTests(TestCaseWithBranch):
@@ -353,24 +348,6 @@
         branch, relpath = Branch.open_containing(self.get_readonly_url('g/p/q'))
         self.assertEqual('g/p/q', relpath)
         
-# TODO: rewrite this as a regular unittest, without relying on the displayed output        
-#         >>> from bzrlib.commit import commit
-#         >>> bzrlib.trace.silent = True
-#         >>> br1 = ScratchBranch(files=['foo', 'bar'])
-#         >>> br1.working_tree().add('foo')
-#         >>> br1.working_tree().add('bar')
-#         >>> commit(br1, "lala!", rev_id="REVISION-ID-1", verbose=False)
-#         >>> br2 = ScratchBranch()
-#         >>> br2.update_revisions(br1)
-#         Added 2 texts.
-#         Added 1 inventories.
-#         Added 1 revisions.
-#         >>> br2.revision_history()
-#         [u'REVISION-ID-1']
-#         >>> br2.update_revisions(br1)
-#         Added 0 revisions.
-#         >>> br1.text_store.total_size() == br2.text_store.total_size()
-#         True
 
 class InstrumentedTransaction(object):
 
@@ -527,7 +504,7 @@
         t = get_transport(self.get_url())
         readonly_t = get_transport(self.get_readonly_url())
         made_branch = self.make_branch('.')
-        self.failUnless(isinstance(made_branch, bzrlib.branch.Branch))
+        self.failUnless(isinstance(made_branch, branch.Branch))
 
         # find it via bzrdir opening:
         opened_control = bzrdir.BzrDir.open(readonly_t.base)
@@ -538,7 +515,7 @@
                         self.branch_format.__class__))
 
         # find it via Branch.open
-        opened_branch = bzrlib.branch.Branch.open(readonly_t.base)
+        opened_branch = branch.Branch.open(readonly_t.base)
         self.failUnless(isinstance(opened_branch, made_branch.__class__))
         self.assertEqual(made_branch._format.__class__,
                          opened_branch._format.__class__)
@@ -548,4 +525,4 @@
         except NotImplementedError:
             return
         self.assertEqual(self.branch_format,
-                         bzrlib.branch.BranchFormat.find_format(opened_control))
+                         branch.BranchFormat.find_format(opened_control))

=== modified file 'bzrlib/tests/bzrdir_implementations/test_bzrdir.py'
--- bzrlib/tests/bzrdir_implementations/test_bzrdir.py	2006-05-17 04:09:58 +0000
+++ bzrlib/tests/bzrdir_implementations/test_bzrdir.py	2006-06-16 04:00:11 +0000
@@ -1,4 +1,4 @@
-# (C) 2005, 2006 Canonical Ltd
+# Copyright (C) 2005, 2006 Canonical Ltd
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -18,14 +18,13 @@
 
 from cStringIO import StringIO
 import os
-from stat import *
+from stat import S_ISDIR
 import sys
 
 import bzrlib.branch
 import bzrlib.bzrdir as bzrdir
 from bzrlib.branch import Branch, needs_read_lock, needs_write_lock
 from bzrlib.check import check
-from bzrlib.commit import commit
 import bzrlib.errors as errors
 from bzrlib.errors import (FileExists,
                            NoSuchRevision,

=== modified file 'bzrlib/tests/repository_implementations/test_repository.py'
--- bzrlib/tests/repository_implementations/test_repository.py	2006-05-26 06:08:47 +0000
+++ bzrlib/tests/repository_implementations/test_repository.py	2006-06-16 01:03:12 +0000
@@ -23,7 +23,6 @@
 import bzrlib
 import bzrlib.bzrdir as bzrdir
 from bzrlib.branch import Branch, needs_read_lock, needs_write_lock
-from bzrlib.commit import commit
 import bzrlib.errors as errors
 from bzrlib.errors import (FileExists,
                            NoSuchRevision,

=== modified file 'bzrlib/tests/test_commit_merge.py'
--- bzrlib/tests/test_commit_merge.py	2006-02-20 09:50:27 +0000
+++ bzrlib/tests/test_commit_merge.py	2006-06-16 03:42:36 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005 by Canonical Ltd
+# Copyright (C) 2005, 2006 by Canonical Ltd
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -20,9 +20,8 @@
 
 from bzrlib.tests import TestCaseWithTransport
 from bzrlib.branch import Branch
-from bzrlib.errors import PointlessCommit, BzrError, PointlessCommit
+from bzrlib.errors import PointlessCommit, BzrError
 from bzrlib.tests.test_revision import make_branches
-from bzrlib.check import check
 
 
 class TestCommitMerge(TestCaseWithTransport):
@@ -93,5 +92,7 @@
         self.assertEquals(inv['ecks-id'].revision, 'x at u-0-1')
         self.assertEquals(inv['why-id'].revision, 'y at u-0-1')
 
-        check(bx, False)
-        check(by, False)
+        bx.check()
+        by.check()
+        bx.repository.check([bx.last_revision()])
+        by.repository.check([by.last_revision()])

=== modified file 'bzrlib/tests/test_conflicts.py'
--- bzrlib/tests/test_conflicts.py	2006-04-18 22:41:16 +0000
+++ bzrlib/tests/test_conflicts.py	2006-06-16 03:48:18 +0000
@@ -17,9 +17,13 @@
 
 import os
 
+from bzrlib import bzrdir
 from bzrlib.tests import TestCaseWithTransport, TestCase
 from bzrlib.branch import Branch
-from bzrlib.conflicts import *
+from bzrlib.conflicts import (MissingParent, ContentsConflict, TextConflict,
+        PathConflict, DuplicateID, DuplicateEntry, ParentLoop, UnversionedParent,
+        ConflictList, 
+        restore)
 from bzrlib.errors import NotConflicted
 
 
@@ -46,7 +50,7 @@
     def test_conflicts(self):
         """Conflicts are detected properly"""
         tree = self.make_branch_and_tree('.',
-            format=bzrlib.bzrdir.BzrDirFormat6())
+            format=bzrdir.BzrDirFormat6())
         b = tree.branch
         file('hello', 'w').write('hello world4')
         file('hello.THIS', 'w').write('hello world2')

=== modified file 'bzrlib/tests/test_diff.py'
--- bzrlib/tests/test_diff.py	2006-06-06 22:59:58 +0000
+++ bzrlib/tests/test_diff.py	2006-06-16 03:43:25 +0000
@@ -21,7 +21,6 @@
 from bzrlib.errors import BinaryFile
 import bzrlib.patiencediff
 from bzrlib.tests import TestCase, TestCaseWithTransport, TestCaseInTempDir
-from bzrlib.tests import TestCase, TestCaseInTempDir
 
 
 def udiff_lines(old, new, allow_binary=False):

=== modified file 'bzrlib/tests/test_merge.py'
--- bzrlib/tests/test_merge.py	2006-04-09 06:19:54 +0000
+++ bzrlib/tests/test_merge.py	2006-06-16 01:02:02 +0000
@@ -1,9 +1,24 @@
+# Copyright (C) 2005, 2006 by Canonical Ltd
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
 import os
 from StringIO import StringIO
 
 from bzrlib.branch import Branch
 from bzrlib.builtins import merge
-from bzrlib.commit import commit
 from bzrlib.errors import UnrelatedBranches, NoCommits, BzrCommandError
 from bzrlib.merge import transform_tree, merge_inner
 from bzrlib.osutils import pathjoin

=== modified file 'bzrlib/tests/test_merge_core.py'
--- bzrlib/tests/test_merge_core.py	2006-05-05 01:15:53 +0000
+++ bzrlib/tests/test_merge_core.py	2006-06-16 03:31:09 +0000
@@ -124,12 +124,6 @@
     def change_perms_tree(self, id, tree, mode):
         os.chmod(tree.full_path(id), mode)
 
-    def merge_changeset(self, merge_factory):
-        conflict_handler = changeset.ExceptionConflictHandler()
-        return make_merge_changeset(self.cset, self.this, self.base,
-                                    self.other, conflict_handler,
-                                    merge_factory)
-
     def apply_inv_change(self, inventory_change, orig_inventory):
         orig_inventory_by_path = {}
         for file_id, path in orig_inventory.iteritems():
@@ -168,14 +162,6 @@
             new_inventory[file_id] = path
         return new_inventory
 
-    def apply_changeset(self, cset, conflict_handler=None):
-        inventory_change = changeset.apply_changeset(cset,
-                                                     self.this.inventory_dict,
-                                                     self.this.dir,
-                                                     conflict_handler)
-        self.this.inventory_dict =  self.apply_inv_change(inventory_change, 
-                                                     self.this.inventory_dict)
-
     def cleanup(self):
         rmtree(self.dir)
 

=== modified file 'bzrlib/tests/test_progress.py'
--- bzrlib/tests/test_progress.py	2006-03-08 19:51:44 +0000
+++ bzrlib/tests/test_progress.py	2006-06-16 03:38:29 +0000
@@ -16,7 +16,12 @@
 
 from StringIO import StringIO
 
-from bzrlib.progress import *
+from bzrlib.progress import (
+        DummyProgress, ChildProgress,
+        TTYProgressBar,
+        DotsProgressBar,
+        ProgressBarStack,
+        )
 from bzrlib.tests import TestCase
 
 class FakeStack:

=== modified file 'bzrlib/tests/test_repository.py'
--- bzrlib/tests/test_repository.py	2006-06-05 17:19:03 +0000
+++ bzrlib/tests/test_repository.py	2006-06-16 03:31:28 +0000
@@ -22,7 +22,7 @@
 also see this file.
 """
 
-from stat import *
+from stat import S_ISDIR
 from StringIO import StringIO
 
 import bzrlib

=== modified file 'bzrlib/tests/test_revision.py'
--- bzrlib/tests/test_revision.py	2006-06-06 12:06:20 +0000
+++ bzrlib/tests/test_revision.py	2006-06-16 01:01:17 +0000
@@ -20,7 +20,6 @@
 
 from bzrlib.branch import Branch
 from bzrlib.errors import NoSuchRevision
-from bzrlib.commit import commit
 from bzrlib.graph import Graph
 from bzrlib.revision import (find_present_ancestors, combined_graph,
                              common_ancestor,
@@ -147,7 +146,6 @@
 class TestIntermediateRevisions(TestCaseWithTransport):
 
     def setUp(self):
-        from bzrlib.commit import commit
         TestCaseWithTransport.setUp(self)
         self.br1, self.br2 = make_branches(self)
         wt1 = self.br1.bzrdir.open_workingtree()

=== modified file 'bzrlib/tests/test_selftest.py'
--- bzrlib/tests/test_selftest.py	2006-06-12 01:12:14 +0000
+++ bzrlib/tests/test_selftest.py	2006-06-16 03:32:21 +0000
@@ -35,6 +35,7 @@
                           )
 from bzrlib.tests.TestUtil import _load_module_by_name
 import bzrlib.errors as errors
+from bzrlib.trace import note
 
 
 class SelftestTests(TestCase):

=== modified file 'bzrlib/tests/test_source.py'
--- bzrlib/tests/test_source.py	2006-03-05 02:20:07 +0000
+++ bzrlib/tests/test_source.py	2006-06-15 06:11:03 +0000
@@ -72,4 +72,4 @@
         # written. Note that this is an exact equality so that when the number
         # drops, it is not given a buffer but rather this test updated
         # immediately.
-        self.assertEqual(4, occurences)
+        self.assertEqual(3, occurences)

=== modified file 'bzrlib/tests/test_textfile.py'
--- bzrlib/tests/test_textfile.py	2006-04-19 02:16:05 +0000
+++ bzrlib/tests/test_textfile.py	2006-06-16 01:32:47 +0000
@@ -18,7 +18,7 @@
 
 from bzrlib.errors import BinaryFile
 from bzrlib.tests import TestCase, TestCaseInTempDir
-from bzrlib.textfile import *
+from bzrlib.textfile import text_file, check_text_lines, check_text_path
 
 
 class TextFile(TestCase):

=== modified file 'bzrlib/tests/test_tuned_gzip.py'
--- bzrlib/tests/test_tuned_gzip.py	2006-04-20 04:52:19 +0000
+++ bzrlib/tests/test_tuned_gzip.py	2006-06-16 01:33:37 +0000
@@ -25,7 +25,7 @@
 import zlib
 
 
-from bzrlib.tuned_gzip import *
+from bzrlib import tuned_gzip
 
 
 class FakeDecompress(object):
@@ -74,7 +74,7 @@
         # read more bytes if there is less than 8 bytes (the 
         # gzip trailer) unread.
         stream = StringIO('\0\0\0\0\0\0\0\0')
-        myfile = GzipFile(fileobj=stream)
+        myfile = tuned_gzip.GzipFile(fileobj=stream)
         # disable the _new_member check, we are microtesting.
         myfile._new_member = False
         myfile.crc = zlib.crc32('')

=== modified file 'bzrlib/tests/test_whitebox.py'
--- bzrlib/tests/test_whitebox.py	2006-05-05 01:15:53 +0000
+++ bzrlib/tests/test_whitebox.py	2006-06-16 01:03:37 +0000
@@ -1,8 +1,24 @@
+# Copyright (C) 2005, 2006 by Canonical Ltd
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
 import os
 import unittest
 
 from bzrlib.tests import TestCaseWithTransport, TestCase
-from bzrlib.branch import ScratchBranch, Branch
+from bzrlib.branch import Branch
 from bzrlib.errors import PathNotChild
 from bzrlib.osutils import relpath, pathjoin, abspath, realpath
 

=== modified file 'bzrlib/tests/test_workingtree.py'
--- bzrlib/tests/test_workingtree.py	2006-05-19 06:00:00 +0000
+++ bzrlib/tests/test_workingtree.py	2006-06-16 02:56:42 +0000
@@ -20,17 +20,14 @@
 
 import bzrlib
 from bzrlib.branch import Branch
-import bzrlib.bzrdir as bzrdir
+from bzrlib import bzrdir, conflicts, errors, workingtree
 from bzrlib.bzrdir import BzrDir
-from bzrlib.conflicts import *
-import bzrlib.errors as errors
 from bzrlib.errors import NotBranchError, NotVersionedError
 from bzrlib.lockdir import LockDir
 from bzrlib.osutils import pathjoin, getcwd, has_symlinks
 from bzrlib.tests import TestCaseWithTransport, TestSkipped
 from bzrlib.trace import mutter
 from bzrlib.transport import get_transport
-import bzrlib.workingtree as workingtree
 from bzrlib.workingtree import (TreeEntry, TreeDirectory, TreeFile, TreeLink,
                                 WorkingTree)
 
@@ -219,20 +216,20 @@
         self.assertRaises(errors.UnsupportedOperation, tree.set_conflicts,
                           None)
         file('lala.BASE', 'wb').write('labase')
-        expected = ContentsConflict('lala')
+        expected = conflicts.ContentsConflict('lala')
         self.assertEqual(list(tree.conflicts()), [expected])
         file('lala', 'wb').write('la')
         tree.add('lala', 'lala-id')
-        expected = ContentsConflict('lala', file_id='lala-id')
+        expected = conflicts.ContentsConflict('lala', file_id='lala-id')
         self.assertEqual(list(tree.conflicts()), [expected])
         file('lala.THIS', 'wb').write('lathis')
         file('lala.OTHER', 'wb').write('laother')
         # When "text conflict"s happen, stem, THIS and OTHER are text
-        expected = TextConflict('lala', file_id='lala-id')
+        expected = conflicts.TextConflict('lala', file_id='lala-id')
         self.assertEqual(list(tree.conflicts()), [expected])
         os.unlink('lala.OTHER')
         os.mkdir('lala.OTHER')
-        expected = ContentsConflict('lala', file_id='lala-id')
+        expected = conflicts.ContentsConflict('lala', file_id='lala-id')
         self.assertEqual(list(tree.conflicts()), [expected])
 
 

=== modified file 'bzrlib/tests/treeshape.py'
--- bzrlib/tests/treeshape.py	2005-12-01 17:25:16 +0000
+++ bzrlib/tests/treeshape.py	2006-06-16 03:42:59 +0000
@@ -65,7 +65,7 @@
         filenames.sort()
         for fn in filenames:
             fullpath = pathjoin(dirpath, fn)
-            self.assertFalse(fullpath[-1] in '@/')
+            assert not (fullpath[-1] in '@/')
             info = os.lstat(fullpath)
             if stat.S_ISLNK(info.st_mode):
                 yield (fullpath + '@', os.readlink(fullpath))

=== modified file 'bzrlib/tests/workingtree_implementations/test_commit.py'
--- bzrlib/tests/workingtree_implementations/test_commit.py	2006-06-08 14:17:29 +0000
+++ bzrlib/tests/workingtree_implementations/test_commit.py	2006-06-16 03:57:20 +0000
@@ -1,4 +1,4 @@
-# (C) 2005,2006 Canonical Ltd
+# Copyright (C) 2005, 2006 Canonical Ltd
 # Authors:  Robert Collins <robert.collins at canonical.com>
 #
 # This program is free software; you can redistribute it and/or modify
@@ -18,20 +18,13 @@
 from cStringIO import StringIO
 import os
 
-import bzrlib
-import bzrlib.branch
-from bzrlib.branch import Branch
-import bzrlib.bzrdir as bzrdir
-from bzrlib.bzrdir import BzrDir
-import bzrlib.errors as errors
+from bzrlib import branch, bzrdir, errors, ui, workingtree
 from bzrlib.errors import (NotBranchError, NotVersionedError, 
                            UnsupportedOperation)
 from bzrlib.osutils import pathjoin, getcwd, has_symlinks
 from bzrlib.tests import TestSkipped, TestCase
 from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
 from bzrlib.trace import mutter
-import bzrlib.ui as ui
-import bzrlib.workingtree as workingtree
 from bzrlib.workingtree import (TreeEntry, TreeDirectory, TreeFile, TreeLink,
                                 WorkingTree)
 

=== modified file 'bzrlib/tests/workingtree_implementations/test_is_control_filename.py'
--- bzrlib/tests/workingtree_implementations/test_is_control_filename.py	2006-02-16 02:53:00 +0000
+++ bzrlib/tests/workingtree_implementations/test_is_control_filename.py	2006-06-16 03:55:58 +0000
@@ -1,4 +1,4 @@
-# (C) 2006 Canonical Ltd
+# Copyright (C) 2006 Canonical Ltd
 # Authors:  Robert Collins <robert.collins at canonical.com>
 #
 # This program is free software; you can redistribute it and/or modify
@@ -15,24 +15,10 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from cStringIO import StringIO
 import os
 
-import bzrlib
-import bzrlib.branch
-from bzrlib.branch import Branch
-import bzrlib.bzrdir as bzrdir
-from bzrlib.bzrdir import BzrDir
-import bzrlib.errors as errors
-from bzrlib.errors import NotBranchError, NotVersionedError
 from bzrlib.osutils import basename
-from bzrlib.tests import TestSkipped
 from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
-from bzrlib.trace import mutter
-from bzrlib.transport import get_transport
-import bzrlib.workingtree as workingtree
-from bzrlib.workingtree import (TreeEntry, TreeDirectory, TreeFile, TreeLink,
-                                WorkingTree)
 
 
 class TestIsControlFilename(TestCaseWithWorkingTree):

=== modified file 'bzrlib/tests/workingtree_implementations/test_pull.py'
--- bzrlib/tests/workingtree_implementations/test_pull.py	2006-02-22 05:45:47 +0000
+++ bzrlib/tests/workingtree_implementations/test_pull.py	2006-06-16 03:58:21 +0000
@@ -1,4 +1,4 @@
-# (C) 2006 Canonical Ltd
+# Copyright (C) 2006 Canonical Ltd
 # Authors:  Robert Collins <robert.collins at canonical.com>
 #
 # This program is free software; you can redistribute it and/or modify
@@ -18,21 +18,13 @@
 from cStringIO import StringIO
 import os
 
-import bzrlib
-import bzrlib.branch
-from bzrlib.branch import Branch
-import bzrlib.bzrdir as bzrdir
-from bzrlib.bzrdir import BzrDir
-import bzrlib.errors as errors
+from bzrlib import errors
 from bzrlib.errors import NotBranchError, NotVersionedError
 from bzrlib.osutils import basename
 from bzrlib.tests import TestSkipped
 from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
 from bzrlib.trace import mutter
 from bzrlib.transport import get_transport
-import bzrlib.workingtree as workingtree
-from bzrlib.workingtree import (TreeEntry, TreeDirectory, TreeFile, TreeLink,
-                                WorkingTree)
 
 
 class TestPull(TestCaseWithWorkingTree):

=== modified file 'bzrlib/tests/workingtree_implementations/test_workingtree.py'
--- bzrlib/tests/workingtree_implementations/test_workingtree.py	2006-06-06 12:06:20 +0000
+++ bzrlib/tests/workingtree_implementations/test_workingtree.py	2006-06-16 03:54:01 +0000
@@ -1,4 +1,4 @@
-# (C) 2005,2006 Canonical Ltd
+# Copyright (C) 2005, 2006 Canonical Ltd
 # Authors:  Robert Collins <robert.collins at canonical.com>
 #
 # This program is free software; you can redistribute it and/or modify
@@ -19,22 +19,16 @@
 import os
 
 import bzrlib
-import bzrlib.branch
-from bzrlib.branch import Branch
-import bzrlib.bzrdir as bzrdir
-from bzrlib.bzrdir import BzrDir
-import bzrlib.errors as errors
+from bzrlib import branch, bzrdir, errors, urlutils, workingtree
 from bzrlib.errors import (NotBranchError, NotVersionedError, 
                            UnsupportedOperation)
 from bzrlib.osutils import pathjoin, getcwd, has_symlinks
 from bzrlib.tests import TestSkipped
 from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
 from bzrlib.trace import mutter
-import bzrlib.urlutils as urlutils
-import bzrlib.workingtree as workingtree
 from bzrlib.workingtree import (TreeEntry, TreeDirectory, TreeFile, TreeLink,
                                 WorkingTree)
-
+from bzrlib.conflicts import ConflictList
 
 class TestWorkingTree(TestCaseWithWorkingTree):
 
@@ -175,7 +169,7 @@
     def test_initialize(self):
         # initialize should create a working tree and branch in an existing dir
         t = self.make_branch_and_tree('.')
-        b = Branch.open('.')
+        b = branch.Branch.open('.')
         self.assertEqual(t.branch.base, b.base)
         t2 = WorkingTree.open('.')
         self.assertEqual(t.basedir, t2.basedir)
@@ -388,7 +382,7 @@
         # current format
         self.build_tree(['checkout/', 'tree/file'])
         checkout = bzrdir.BzrDirMetaFormat1().initialize('checkout')
-        bzrlib.branch.BranchReferenceFormat().initialize(checkout, main_branch)
+        branch.BranchReferenceFormat().initialize(checkout, main_branch)
         old_tree = self.workingtree_format.initialize(checkout)
         # now commit to 'tree'
         wt.add('file')
@@ -419,7 +413,7 @@
         # current format
         self.build_tree(['checkout/', 'tree/file'])
         checkout = bzrdir.BzrDirMetaFormat1().initialize('checkout')
-        bzrlib.branch.BranchReferenceFormat().initialize(checkout, main_branch)
+        branch.BranchReferenceFormat().initialize(checkout, main_branch)
         old_tree = self.workingtree_format.initialize(checkout)
         # now commit to 'tree'
         wt.add('file')
@@ -526,7 +520,7 @@
         tree.add('blo')
         tree.commit("blah", allow_pointless=False)
         base = tree.basis_tree()
-        BzrDir.open("mine").sprout("other")
+        bzrdir.BzrDir.open("mine").sprout("other")
         file('other/bloo', 'wb').write('two')
         othertree = WorkingTree.open('other')
         othertree.commit('blah', allow_pointless=False)
@@ -540,7 +534,6 @@
         self.assertEqual(len(tree.conflicts()), 1)
 
     def test_clear_merge_conflicts(self):
-        from bzrlib.conflicts import ConflictList
         tree = self.make_merge_conflicts()
         self.assertEqual(len(tree.conflicts()), 1)
         try:

=== modified file 'bzrlib/trace.py'
--- bzrlib/trace.py	2006-06-10 00:21:11 +0000
+++ bzrlib/trace.py	2006-06-15 06:50:58 +0000
@@ -135,7 +135,7 @@
     # information if something goes wrong.  In a future version this
     # file will be removed on successful completion.
     global _file_handler, _bzr_log_file
-    import stat, codecs
+    import codecs
 
     trace_fname = os.path.join(os.path.expanduser(tracefilename))
     _rollover_trace_maybe(trace_fname)

=== modified file 'bzrlib/transform.py'
--- bzrlib/transform.py	2006-06-13 12:55:45 +0000
+++ bzrlib/transform.py	2006-06-15 07:07:54 +0000
@@ -539,9 +539,9 @@
         if child_id is None:
             return lexists(self._tree.abspath(childpath))
         else:
-            if tt.final_parent(child_id) != parent_id:
+            if self.final_parent(child_id) != parent_id:
                 return False
-            if child_id in tt._removed_contents:
+            if child_id in self._removed_contents:
                 # XXX What about dangling file-ids?
                 return False
             else:

=== modified file 'bzrlib/transport/__init__.py'
--- bzrlib/transport/__init__.py	2006-06-09 09:04:53 +0000
+++ bzrlib/transport/__init__.py	2006-06-16 03:29:55 +0000
@@ -30,18 +30,21 @@
 from collections import deque
 from copy import deepcopy
 import re
-from stat import *
+from stat import S_ISDIR
 import sys
 from unittest import TestSuite
 import urllib
 import urlparse
+import warnings
 
 import bzrlib
 import bzrlib.errors as errors
 from bzrlib.errors import DependencyNotPresent
 import bzrlib.osutils as osutils
 from bzrlib.osutils import pumpfile
-from bzrlib.symbol_versioning import *
+from bzrlib.symbol_versioning import (deprecated_passed, deprecated_method, deprecated_function, 
+        DEPRECATED_PARAMETER,
+        zero_eight)
 from bzrlib.trace import mutter, warning
 import bzrlib.urlutils as urlutils
 
@@ -63,7 +66,7 @@
     # working, etc.
     global _protocol_handlers
     if deprecated_passed(override):
-        warn("register_transport(override) is deprecated")
+        warnings.warn("register_transport(override) is deprecated")
     _protocol_handlers.setdefault(prefix, []).insert(0, klass)
 
 

=== modified file 'bzrlib/transport/fakenfs.py'
--- bzrlib/transport/fakenfs.py	2006-04-02 22:42:19 +0000
+++ bzrlib/transport/fakenfs.py	2006-06-16 01:30:10 +0000
@@ -22,7 +22,7 @@
 To get a fake nfs transport use get_transport('fakenfs+' + real_url)
 """
 
-from stat import *
+from stat import S_ISDIR
 
 import bzrlib.errors as errors
 from bzrlib.transport.decorator import TransportDecorator, DecoratorServer

=== modified file 'bzrlib/transport/ftp.py'
--- bzrlib/transport/ftp.py	2006-05-22 05:32:51 +0000
+++ bzrlib/transport/ftp.py	2006-06-16 01:29:58 +0000
@@ -670,7 +670,7 @@
             *why* it cannot make a directory.
             """
             if len (line) != 2:
-                self.command_not_understood (string.join (line))
+                self.command_not_understood(''.join(line))
             else:
                 path = line[1]
                 try:

=== modified file 'bzrlib/transport/http/_urllib.py'
--- bzrlib/transport/http/_urllib.py	2006-04-06 05:28:00 +0000
+++ bzrlib/transport/http/_urllib.py	2006-06-16 01:30:32 +0000
@@ -14,6 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+import errno
 import urllib, urllib2
 
 import bzrlib  # for the version

=== modified file 'bzrlib/transport/memory.py'
--- bzrlib/transport/memory.py	2006-05-02 20:46:11 +0000
+++ bzrlib/transport/memory.py	2006-06-16 03:30:13 +0000
@@ -24,8 +24,9 @@
 import os
 import errno
 import re
-from stat import *
+from stat import S_IFREG, S_IFDIR
 from cStringIO import StringIO
+import warnings
 
 from bzrlib.errors import TransportError, NoSuchFile, FileExists, LockError
 from bzrlib.trace import mutter
@@ -260,7 +261,7 @@
     def __del__(self):
         # Should this warn, or actually try to cleanup?
         if self.transport:
-            warn("MemoryLock %r not explicitly unlocked" % (self.path,))
+            warnings.warn("MemoryLock %r not explicitly unlocked" % (self.path,))
             self.unlock()
 
     def unlock(self):

=== modified file 'bzrlib/ui/__init__.py'
--- bzrlib/ui/__init__.py	2006-05-04 08:39:32 +0000
+++ bzrlib/ui/__init__.py	2006-06-15 07:41:05 +0000
@@ -31,7 +31,7 @@
 import sys
 
 import bzrlib.progress
-from bzrlib.symbol_versioning import *
+from bzrlib.symbol_versioning import (deprecated_method, zero_eight)
 
 
 class UIFactory(object):

=== modified file 'bzrlib/ui/text.py'
--- bzrlib/ui/text.py	2006-05-09 01:57:17 +0000
+++ bzrlib/ui/text.py	2006-06-15 07:41:16 +0000
@@ -23,7 +23,8 @@
 import sys
 
 import bzrlib.progress
-from bzrlib.symbol_versioning import *
+from bzrlib.symbol_versioning import (deprecated_method, 
+        zero_eight)
 from bzrlib.ui import CLIUIFactory
 
 

=== modified file 'bzrlib/uncommit.py'
--- bzrlib/uncommit.py	2006-05-23 05:26:46 +0000
+++ bzrlib/uncommit.py	2006-06-08 11:30:22 +0000
@@ -18,7 +18,6 @@
 """
 
 import os
-import bzrlib
 from bzrlib.errors import BoundBranchOutOfDate
 
 def test_remove(filename):
@@ -35,7 +34,6 @@
     :param verbose: Print each step as you do it
     :param revno: Remove back to this revision
     """
-    from bzrlib.atomicfile import AtomicFile
     unlockable = []
     try:
         if tree is not None:

=== modified file 'bzrlib/versionedfile.py'
--- bzrlib/versionedfile.py	2006-06-12 01:53:19 +0000
+++ bzrlib/versionedfile.py	2006-06-15 07:01:04 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005 by Canonical Ltd
+# Copyright (C) 2005, 2006 by Canonical Ltd
 #
 # Authors:
 #   Johan Rydberg <jrydberg at gnu.org>
@@ -26,11 +26,14 @@
 
 import bzrlib.errors as errors
 from bzrlib.inter import InterObject
-from bzrlib.symbol_versioning import *
 from bzrlib.textmerge import TextMerge
 from bzrlib.transport.memory import MemoryTransport
 from bzrlib.tsort import topo_sort
 from bzrlib import ui
+from bzrlib.symbol_versioning import (deprecated_function,
+        deprecated_method,
+        zero_eight,
+        )
 
 
 class VersionedFile(object):

=== modified file 'bzrlib/weave.py'
--- bzrlib/weave.py	2006-06-10 00:21:11 +0000
+++ bzrlib/weave.py	2006-06-16 03:28:02 +0000
@@ -73,6 +73,7 @@
 import os
 import sha
 import time
+import warnings
 
 from bzrlib.trace import mutter
 from bzrlib.errors import (WeaveError, WeaveFormatError, WeaveParentMismatch,
@@ -84,7 +85,10 @@
 import bzrlib.errors as errors
 from bzrlib.osutils import sha_strings
 import bzrlib.patiencediff
-from bzrlib.symbol_versioning import *
+from bzrlib.symbol_versioning import (deprecated_method,
+        deprecated_function,
+        zero_eight,
+        )
 from bzrlib.tsort import topo_sort
 from bzrlib.versionedfile import VersionedFile, InterVersionedFile
 from bzrlib.weavefile import _read_weave_v5, write_weave_v5
@@ -635,7 +639,7 @@
 
     def annotate(self, version_id):
         if isinstance(version_id, int):
-            warn('Weave.annotate(int) is deprecated. Please use version names'
+            warnings.warn('Weave.annotate(int) is deprecated. Please use version names'
                  ' in all circumstances as of 0.8',
                  DeprecationWarning,
                  stacklevel=2
@@ -1239,7 +1243,7 @@
     from bzrlib.weavefile import read_weave
 
     wf = file(weave_file, 'rb')
-    w = read_weave(wf, WeaveVersionedFile)
+    w = read_weave(wf)
     # FIXME: doesn't work on pipes
     weave_size = wf.tell()
 
@@ -1419,47 +1423,9 @@
         raise ValueError('unknown command %r' % cmd)
     
 
-
-def profile_main(argv):
-    import tempfile, hotshot, hotshot.stats
-
-    prof_f = tempfile.NamedTemporaryFile()
-
-    prof = hotshot.Profile(prof_f.name)
-
-    ret = prof.runcall(main, argv)
-    prof.close()
-
-    stats = hotshot.stats.load(prof_f.name)
-    #stats.strip_dirs()
-    stats.sort_stats('cumulative')
-    ## XXX: Might like to write to stderr or the trace file instead but
-    ## print_stats seems hardcoded to stdout
-    stats.print_stats(20)
-            
-    return ret
-
-
-def lsprofile_main(argv): 
-    from bzrlib.lsprof import profile
-    ret,stats = profile(main, argv)
-    stats.sort()
-    stats.pprint()
-    return ret
-
-
 if __name__ == '__main__':
     import sys
-    if '--profile' in sys.argv:
-        args = sys.argv[:]
-        args.remove('--profile')
-        sys.exit(profile_main(args))
-    elif '--lsprof' in sys.argv:
-        args = sys.argv[:]
-        args.remove('--lsprof')
-        sys.exit(lsprofile_main(args))
-    else:
-        sys.exit(main(sys.argv))
+    sys.exit(main(sys.argv))
 
 
 class InterWeave(InterVersionedFile):

=== modified file 'bzrlib/weave_commands.py'
--- bzrlib/weave_commands.py	2006-03-24 11:12:04 +0000
+++ bzrlib/weave_commands.py	2006-06-08 11:27:16 +0000
@@ -23,7 +23,7 @@
 import sys
 
 from bzrlib.commands import Command
-from bzrlib.trace import mutter, warning
+from bzrlib.trace import warning
 
 class cmd_weave_list(Command):
     """List the revision ids present in a weave, in alphabetical order"""
@@ -64,7 +64,7 @@
     takes_args = ['weave_file', 'revision_a', 'revision_b']
 
     def run(self, weave_file, revision_a, revision_b):
-        from bzrlib.weavefile import read_weave, write_weave
+        from bzrlib.weavefile import read_weave
         w = read_weave(file(weave_file, 'rb'))
         for state, line in w.plan_merge(revision_a, revision_b):
             # make sure to print every line with a newline, even if it doesn't
@@ -84,7 +84,7 @@
     takes_args = ['weave_file', 'revision_a', 'revision_b']
 
     def run(self, weave_file, revision_a, revision_b):
-        from bzrlib.weavefile import read_weave, write_weave
+        from bzrlib.weavefile import read_weave
         w = read_weave(file(weave_file, 'rb'))
         p = w.plan_merge(revision_a, revision_b)
         sys.stdout.writelines(w.weave_merge(p))

=== modified file 'bzrlib/win32console.py'
--- bzrlib/win32console.py	2006-05-09 07:16:38 +0000
+++ bzrlib/win32console.py	2006-06-15 06:49:28 +0000
@@ -7,10 +7,12 @@
 
 import struct
 
+# We can cope without it; use a separate variable to help pyflakes
 try:
    import ctypes
+   has_ctypes = True
 except ImportError:
-   ctypes = None
+    has_ctypes = False
 
 
 WIN32_STDIN_HANDLE = -10
@@ -27,7 +29,7 @@
 
    Dependencies: ctypes should be installed.
    """
-   if ctypes is None:
+   if not has_ctypes:
        # no ctypes is found
        return (defaultx, defaulty)
 

=== modified file 'bzrlib/workingtree.py'
--- bzrlib/workingtree.py	2006-06-13 16:26:09 +0000
+++ bzrlib/workingtree.py	2006-06-16 01:22:14 +0000
@@ -49,10 +49,9 @@
 import re
 import stat
 from time import time
+import warnings
 
 from bzrlib.atomicfile import AtomicFile
-from bzrlib.branch import (Branch,
-                           quotefn)
 from bzrlib.conflicts import Conflict, ConflictList, CONFLICT_SUFFIXES
 import bzrlib.bzrdir as bzrdir
 from bzrlib.decorators import needs_read_lock, needs_write_lock
@@ -92,7 +91,13 @@
 from bzrlib.progress import DummyProgress, ProgressPhase
 from bzrlib.revision import NULL_REVISION
 from bzrlib.rio import RioReader, rio_file, Stanza
-from bzrlib.symbol_versioning import *
+from bzrlib.symbol_versioning import (deprecated_passed,
+        deprecated_method,
+        deprecated_function,
+        DEPRECATED_PARAMETER,
+        zero_eight,
+        )
+
 from bzrlib.textui import show_status
 import bzrlib.tree
 from bzrlib.transform import build_tree
@@ -231,7 +236,7 @@
         self.bzrdir = _bzrdir
         if not _internal:
             # not created via open etc.
-            warn("WorkingTree() is deprecated as of bzr version 0.8. "
+            warnings.warn("WorkingTree() is deprecated as of bzr version 0.8. "
                  "Please use bzrdir.open_workingtree or WorkingTree.open().",
                  DeprecationWarning,
                  stacklevel=2)
@@ -251,7 +256,7 @@
         mutter("opening working tree %r", basedir)
         if deprecated_passed(branch):
             if not _internal:
-                warn("WorkingTree(..., branch=XXX) is deprecated as of bzr 0.8."
+                warnings.warn("WorkingTree(..., branch=XXX) is deprecated as of bzr 0.8."
                      " Please use bzrdir.open_workingtree() or"
                      " WorkingTree.open().",
                      DeprecationWarning,
@@ -260,8 +265,6 @@
             self._branch = branch
         else:
             self._branch = self.bzrdir.open_branch()
-        assert isinstance(self.branch, Branch), \
-            "branch %r is not a Branch" % self.branch
         self.basedir = realpath(basedir)
         # if branch is at our basedir and is a format 6 or less
         if isinstance(self._format, WorkingTreeFormat2):
@@ -417,7 +420,7 @@
         XXX: When BzrDir is present, these should be created through that 
         interface instead.
         """
-        warn('delete WorkingTree.create', stacklevel=3)
+        warnings.warn('delete WorkingTree.create', stacklevel=3)
         transport = get_transport(directory)
         if branch.bzrdir.root_transport.base == transport.base:
             # same dir 
@@ -593,7 +596,7 @@
         inv = self.read_working_inventory()
         for f,file_id in zip(files, ids):
             if self.is_control_filename(f):
-                raise BzrError("cannot add control file %s" % quotefn(f))
+                raise errors.ForbiddenFileError(filename=f)
 
             fp = splitpath(f)
 
@@ -601,19 +604,13 @@
                 raise BzrError("cannot add top-level %r" % f)
 
             fullpath = normpath(self.abspath(f))
-
             try:
                 kind = file_kind(fullpath)
             except OSError, e:
                 if e.errno == errno.ENOENT:
                     raise NoSuchFile(fullpath)
-                # maybe something better?
-                raise BzrError('cannot add: not a regular file, symlink or directory: %s' % quotefn(f))
-
             if not InventoryEntry.versionable_kind(kind):
-                raise BzrError('cannot add: not a versionable file ('
-                               'i.e. regular file, symlink or directory): %s' % quotefn(f))
-
+                raise errors.BadFileKindError(filename=f, kind=kind)
             if file_id is None:
                 inv.add_path(f, kind=kind)
             else:
@@ -1269,14 +1266,13 @@
                 # TODO: Perhaps make this just a warning, and continue?
                 # This tends to happen when 
                 raise NotVersionedError(path=f)
-            mutter("remove inventory entry %s {%s}", quotefn(f), fid)
             if verbose:
                 # having remove it, it must be either ignored or unknown
                 if self.is_ignored(f):
                     new_status = 'I'
                 else:
                     new_status = '?'
-                show_status(new_status, inv[fid].kind, quotefn(f), to_file=to_file)
+                show_status(new_status, inv[fid].kind, f, to_file=to_file)
             del inv[fid]
 
         self._write_inventory(inv)

=== modified file 'bzrlib/xml5.py'
--- bzrlib/xml5.py	2006-05-24 08:26:20 +0000
+++ bzrlib/xml5.py	2006-06-15 06:50:59 +0000
@@ -1,3 +1,5 @@
+# Copyright (C) 2005, 2006 Canonical Ltd
+#
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
@@ -13,10 +15,10 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
-from bzrlib.xml_serializer import ElementTree, SubElement, Element, Serializer
+from bzrlib.xml_serializer import SubElement, Element, Serializer
 from bzrlib.inventory import ROOT_ID, Inventory, InventoryEntry
 import bzrlib.inventory as inventory
-from bzrlib.revision import Revision        
+from bzrlib.revision import Revision
 from bzrlib.errors import BzrError
 
 
@@ -197,11 +199,11 @@
             return
         for prop_elt in props_elt:
             assert prop_elt.tag == 'property', \
-                "bad tag under properties list: %r" % p.tag
+                "bad tag under properties list: %r" % prop_elt.tag
             name = prop_elt.get('name')
             value = prop_elt.text
             assert name not in rev.properties, \
-                "repeated property %r" % p.name
+                "repeated property %r" % name
             rev.properties[name] = value
 
 



More information about the bazaar mailing list