[MERGE] init remote branches

John Arbash Meinel john at arbash-meinel.com
Thu Jul 13 19:54:36 BST 2006


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

Wouter van Heyst wrote:
> Hi,
> 
> the attached bundle allows init to also work on remote locations (bug
> #48904), it doesn't yet have create-prefix support since my last attempt
> at that didn't really turn out well, but I think it is better to submit
> this now for 0.9 and try create-prefix again later on. 
> 
> The branch is located at http://bzr.richtlijn.be/remote-init/
> 
> Wouter van Heyst
> 


>  from bzrlib.commands import Command, display_command
>  from bzrlib.errors import (BzrError, BzrCheckError, BzrCommandError, 
>                             NotBranchError, DivergedBranches, NotConflicted,
> -                           NoSuchFile, NoWorkingTree, FileInWrongBranch,
> -                           NotVersionedError, NotABundle)
> +                           NoSuchFile, NoWorkingTree, FileExists,
> +                           FileInWrongBranch, NotVersionedError, NotABundle)
>  from bzrlib.merge import Merge3Merger
>  from bzrlib.option import Option
>  from bzrlib.progress import DummyProgress, ProgressPhase
>  from bzrlib.revision import common_ancestor
>  from bzrlib.revisionspec import RevisionSpec
>  from bzrlib.trace import mutter, note, log_error, warning, is_quiet, info
> +import bzrlib.transport
>  from bzrlib.transport.local import LocalTransport
>  import bzrlib.urlutils as urlutils
>  from bzrlib.workingtree import WorkingTree


^- I thought we wanted to switch to:

from bzrlib import transport

v- And then 't = transport.get_transport(location)'

I won't stick on this, though. Because it is still better than doing:
from bzrlib.transport import get_transport.

> -        transport = get_transport(location)
> +        transport = bzrlib.transport.get_transport(location)
>          location_url = transport.base

I suppose it means you have to change the name of any variable named
'transport', though.

...

v- Needs another space here

> @@ -104,3 +105,32 @@
>          """Init creates no default ignore rules."""
>          self.run_bzr('init')
>          self.assertFalse(os.path.exists('.bzrignore'))
> +
> +class TestSFTPInit(TestCaseWithSFTPServer):
> +
> +    def test_init(self):
> +        # init on a remote url should succeed.
> +        out, err = self.run_bzr('init', self.get_url())
> +        self.assertEqual('', out)
> +        self.assertEqual('', err)


v- You seem to be repeating yourself here once with a direct init +
assertContainsRe, and then a second time with run_bzr_error.


> +    def test_init_existing_branch(self):
> +        # when there is already a branch present, make mention
> +        self.make_branch('.')
> +
> +        # rely on SFTPServer get_url() pointing at '.'
> +        out, err = self.run_bzr('init', self.get_url(), retcode=3)
> +        self.assertContainsRe(err, 'Already a branch')
> +        self.run_bzr_error(['Already a branch'], 'init', self.get_url())
> +
> +        # make sure using 'bzr checkout' is not suggested
> +        # for remote locations missing a working tree
> +        self.assertFalse(re.search(r'checkout', err))

Otherwise seems decent. I think we need a NEWS entry, though.

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

iD8DBQFEtpbsJdeBCYSNAAMRAmOWAJ49qvsNW+WDnugkUR6gPVQDw5mUXgCdFMtY
3VnT/Au1zyc7any5m99OIM8=
=ZQss
-----END PGP SIGNATURE-----




More information about the bazaar mailing list