~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/push.py

  • Committer: Vincent Ladeuil
  • Date: 2008-09-11 19:36:38 UTC
  • mfrom: (3703 +trunk)
  • mto: (3705.1.1 trunk2)
  • mto: This revision was merged to the branch mainline in revision 3708.
  • Revision ID: v.ladeuil+lp@free.fr-20080911193638-wtjyc1kcmacc6t1f
merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
        # Now the target directory exists, but doesn't have a .bzr
102
102
        # directory. So we need to create it, along with any work to create
103
103
        # all of the dependent branches, etc.
104
 
        if stacked_on is not None:
105
 
            # This should be buried in the clone method itself. TODO.
106
 
            try:
107
 
                # if the from format is stackable, this will either work or
108
 
                # trigger NotStacked. If it's not, an error will be given to
109
 
                # the user.
110
 
                br_from.get_stacked_on_url()
111
 
            except errors.NotStacked:
112
 
                pass
113
 
            # now we need to sprout the repository,
114
 
            dir_to = br_from.bzrdir._format.initialize_on_transport(to_transport)
115
 
            br_from.repository._format.initialize(dir_to)
116
 
            br_to = br_from._format.initialize(dir_to)
117
 
            br_to.set_stacked_on_url(stacked_on)
118
 
            # and copy the data up.
119
 
            br_from.push(br_to)
120
 
        else:
121
 
            dir_to = br_from.bzrdir.clone_on_transport(to_transport,
122
 
                revision_id=revision_id)
 
104
        dir_to = br_from.bzrdir.clone_on_transport(to_transport,
 
105
            revision_id=revision_id, stacked_on=stacked_on)
123
106
        br_to = dir_to.open_branch()
124
107
        # TODO: Some more useful message about what was copied
125
 
        if stacked_on is not None:
126
 
            note('Created new stacked branch referring to %s.' % stacked_on)
 
108
        try:
 
109
            finally_stacked_on = br_to.get_stacked_on_url()
 
110
        except (errors.UnstackableBranchFormat,
 
111
                errors.UnstackableRepositoryFormat,
 
112
                errors.NotStacked):
 
113
            finally_stacked_on = None
 
114
        if finally_stacked_on is not None:
 
115
            note('Created new stacked branch referring to %s.' %
 
116
                 finally_stacked_on)
127
117
        else:
128
118
            note('Created new branch.')
129
119
        # We successfully created the target, remember it