~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-04-27 06:47:50 UTC
  • mfrom: (4294.2.12 push.roundtrips)
  • Revision ID: pqm@pqm.ubuntu.com-20090427064750-e9obd6h83omt86ps
(robertc) Reduce roundtrips needed to push a new branch by coalescing
        many steps of the initialisation process. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1017
1017
        if revision is not None:
1018
1018
            revision_id = revision.in_history(br_from).rev_id
1019
1019
        else:
1020
 
            revision_id = br_from.last_revision()
 
1020
            revision_id = None
1021
1021
 
1022
1022
        # Get the stacked_on branch, if any
1023
1023
        if stacked_on is not None:
1575
1575
                    "\nYou may supply --create-prefix to create all"
1576
1576
                    " leading parent directories."
1577
1577
                    % location)
1578
 
            _create_prefix(to_transport)
 
1578
            to_transport.create_prefix()
1579
1579
 
1580
1580
        try:
1581
1581
            a_bzrdir = bzrdir.BzrDir.open_from_transport(to_transport)
5583
5583
                   dry_run=dry_run, no_prompt=force)
5584
5584
 
5585
5585
 
5586
 
def _create_prefix(cur_transport):
5587
 
    needed = [cur_transport]
5588
 
    # Recurse upwards until we can create a directory successfully
5589
 
    while True:
5590
 
        new_transport = cur_transport.clone('..')
5591
 
        if new_transport.base == cur_transport.base:
5592
 
            raise errors.BzrCommandError(
5593
 
                "Failed to create path prefix for %s."
5594
 
                % cur_transport.base)
5595
 
        try:
5596
 
            new_transport.mkdir('.')
5597
 
        except errors.NoSuchFile:
5598
 
            needed.append(new_transport)
5599
 
            cur_transport = new_transport
5600
 
        else:
5601
 
            break
5602
 
    # Now we only need to create child directories
5603
 
    while needed:
5604
 
        cur_transport = needed.pop()
5605
 
        cur_transport.ensure_base()
5606
 
 
5607
 
 
5608
5586
# these get imported and then picked up by the scan for cmd_*
5609
5587
# TODO: Some more consistent way to split command definitions across files;
5610
5588
# we do need to load at least some information about them to know of