[MERGE] init remote branches

Wouter van Heyst larstiq at larstiq.dyndns.org
Thu Jul 13 20:02:17 BST 2006


On Thu, Jul 13, 2006 at 01:54:36PM -0500, John Arbash Meinel wrote:
> -----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.

I'm not very fond of 't', I'll try 't' and some mix of
to_transport/from_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.

We have several instances of those, yeah ;)

> 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.

Ah, forgot to delete those two lines.

> > +    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))

Wouter van Heyst




More information about the bazaar mailing list