/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: John Arbash Meinel
  • Date: 2006-04-27 13:56:44 UTC
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: john@arbash-meinel.com-20060427135644-a14d2899c0b147fa
More changes to get 'bzr branch' and 'bzr pull' to work

Show diffs side-by-side

added added

removed removed

Lines of Context:
580
580
    aliases = ['get', 'clone']
581
581
 
582
582
    def run(self, from_location, to_location=None, revision=None, basis=None):
 
583
        from bzrlib.transport import get_transport
583
584
        if revision is None:
584
585
            revision = [None]
585
586
        elif len(revision) > 1:
611
612
                name = None
612
613
            else:
613
614
                name = os.path.basename(to_location) + '\n'
 
615
 
 
616
            to_transport = get_transport(to_location)
614
617
            try:
615
 
                os.mkdir(to_location)
616
 
            except OSError, e:
617
 
                if e.errno == errno.EEXIST:
618
 
                    raise BzrCommandError('Target directory "%s" already'
619
 
                                          ' exists.' % to_location)
620
 
                if e.errno == errno.ENOENT:
621
 
                    raise BzrCommandError('Parent of "%s" does not exist.' %
622
 
                                          to_location)
623
 
                else:
624
 
                    raise
 
618
                to_transport.mkdir('.')
 
619
            except bzrlib.errors.FileExists:
 
620
                raise BzrCommandError('Target directory "%s" already'
 
621
                                      ' exists.' % to_location)
 
622
            except bzrlib.errors.NoSuchFile:
 
623
                raise BzrCommandError('Parent of "%s" does not exist.' %
 
624
                                      to_location)
625
625
            try:
626
626
                # preserve whatever source format we have.
627
 
                dir = br_from.bzrdir.sprout(to_location, revision_id, basis_dir)
 
627
                dir = br_from.bzrdir.sprout(to_transport.base,
 
628
                        revision_id, basis_dir)
628
629
                branch = dir.open_branch()
629
630
            except bzrlib.errors.NoSuchRevision:
 
631
                # TODO: jam 20060426 This only works on local paths
 
632
                #       and it would be nice if 'bzr branch' could
 
633
                #       work on a remote path
630
634
                rmtree(to_location)
631
635
                msg = "The branch %s has no revision %s." % (from_location, revision[0])
632
636
                raise BzrCommandError(msg)