[MERGE] working tree cleanups

John Arbash Meinel john at arbash-meinel.com
Fri Jul 14 15:19:39 BST 2006


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

Robert Collins wrote:
> This is just a few tweaks to workingtree.py - import ordering, docstring
> typos, and making Format3 a little easier to derive from.
> 
> Rob
> 
> 
> ------------------------------------------------------------------------
> 
> === modified file 'bzrlib/workingtree.py'
> --- bzrlib/workingtree.py	2006-07-03 18:27:35 +0000
> +++ bzrlib/workingtree.py	2006-07-13 10:45:47 +0000
> @@ -53,6 +53,8 @@
>  
>  from bzrlib import bzrdir, errors, osutils, urlutils
>  from bzrlib.atomicfile import AtomicFile
> +import bzrlib.branch
> +import bzrlib.bzrdir as bzrdir
^^^ we already import bzrdir

from bzrlib import bzrdir

and I think that is the preferred form now. I know it will work much
better with demandload. And I believe pyflakes complains less.

>  from bzrlib.conflicts import Conflict, ConflictList, CONFLICT_SUFFIXES
>  from bzrlib.decorators import needs_read_lock, needs_write_lock
>  from bzrlib.errors import (BzrCheckError,
> @@ -95,13 +97,12 @@
>          DEPRECATED_PARAMETER,
>          zero_eight,
>          )
> -
> -from bzrlib.textui import show_status
> -import bzrlib.tree
> +from bzrlib.trace import mutter, note
>  from bzrlib.transform import build_tree
> -from bzrlib.trace import mutter, note
>  from bzrlib.transport import get_transport
>  from bzrlib.transport.local import LocalTransport
> +from bzrlib.textui import show_status
> +import bzrlib.tree
>  import bzrlib.ui
>  import bzrlib.xml5

+1 to this, though.
>  
> @@ -268,8 +269,7 @@
>              # share control object
>              self._control_files = self.branch.control_files
>          else:
> -            # only ready for format 3
> -            assert isinstance(self._format, WorkingTreeFormat3)
> +            # assume all other formats have their own control files.
>              assert isinstance(_control_files, LockableFiles), \
>                      "_control_files must be a LockableFiles, not %r" \
>                      % _control_files
> @@ -1724,7 +1724,7 @@
>            files, separate from the BzrDir format
>          - modifies the hash cache format
>          - is new in bzr 0.8
> -        - uses a LockDir to guard access to the repository
> +        - uses a LockDir to guard access for writes.
>      """
>  
>      def get_format_string(self):
> @@ -1794,7 +1794,14 @@
>              raise NotImplementedError
>          if not isinstance(a_bzrdir.transport, LocalTransport):
>              raise errors.NotLocalUrl(a_bzrdir.transport.base)
> -        control_files = self._open_control_files(a_bzrdir)
> +        return self._open(a_bzrdir, self._open_control_files(a_bzrdir))
> +
> +    def _open(self, a_bzrdir, control_files):
> +        """Open the tree itself.
> +        
> +        :param a_bzrdir: the dir for the tree.
> +        :param control_files: the control files for the tree.
> +        """
>          return WorkingTree3(a_bzrdir.root_transport.local_abspath('.'),
>                             _internal=True,
>                             _format=self,
> 

The old code wasn't returning anything. Is there a reason you changed
that? It seems like we probably should have been returning *something*,
though. So if you have a reason, +1.

John
=:->

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

iD8DBQFEt6f7JdeBCYSNAAMRAsVLAJ0TxJ+I1X2yY/hrud5GT5ZMvstLSACeM+FU
fY+gzOH9Iw2kFuy2hcPGwvA=
=cBN+
-----END PGP SIGNATURE-----




More information about the bazaar mailing list