/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/push.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from __future__ import absolute_import
20
20
 
21
 
from . import (
22
 
    branch as _mod_branch,
 
21
from bzrlib import (
23
22
    controldir,
24
23
    errors,
25
24
    revision as _mod_revision,
26
25
    transport,
27
26
    )
28
 
from .trace import (
 
27
from bzrlib.trace import (
29
28
    note,
30
29
    warning,
31
30
    )
32
 
from .i18n import gettext
 
31
from bzrlib.i18n import gettext
33
32
 
34
33
 
35
34
class PushResult(object):
61
60
 
62
61
def _show_push_branch(br_from, revision_id, location, to_file, verbose=False,
63
62
    overwrite=False, remember=False, stacked_on=None, create_prefix=False,
64
 
    use_existing_dir=False, no_tree=False, lossy=False):
 
63
    use_existing_dir=False, no_tree=False):
65
64
    """Push a branch to a location.
66
65
 
67
66
    :param br_from: the source branch
78
77
    :param create_prefix: if True, create the necessary parent directories
79
78
        at the destination if they don't already exist
80
79
    :param use_existing_dir: if True, proceed even if the destination
81
 
        directory exists without a current control directory in it
82
 
    :param lossy: Allow lossy push
 
80
        directory exists without a current .bzr directory in it
83
81
    """
84
82
    to_transport = transport.get_transport(location)
85
83
    try:
94
92
                revision_id=revision_id, stacked_on=stacked_on,
95
93
                create_prefix=create_prefix, use_existing_dir=use_existing_dir,
96
94
                no_tree=no_tree)
97
 
        except errors.AlreadyControlDirError as err:
 
95
        except errors.AlreadyControlDirError, err:
98
96
            raise errors.BzrCommandError(gettext(
99
97
                "Target directory %s already contains a .bzr directory, "
100
98
                "but it is not valid.") % (location,))
101
 
        except errors.FileExists as err:
 
99
        except errors.FileExists, err:
102
100
            if not use_existing_dir:
103
101
                raise errors.BzrCommandError(gettext("Target directory %s"
104
102
                     " already exists, but does not have a .bzr"
127
125
        # TODO: Some more useful message about what was copied
128
126
        try:
129
127
            push_result.stacked_on = br_to.get_stacked_on_url()
130
 
        except (_mod_branch.UnstackableBranchFormat,
 
128
        except (errors.UnstackableBranchFormat,
131
129
                errors.UnstackableRepositoryFormat,
132
130
                errors.NotStacked):
133
131
            push_result.stacked_on = None
144
142
            warning("Ignoring request for a stacked branch as repository "
145
143
                    "already exists at the destination location.")
146
144
        try:
147
 
            push_result = dir_to.push_branch(br_from, revision_id, overwrite,
148
 
                remember, create_prefix, lossy=lossy)
 
145
            push_result = dir_to.push_branch(br_from, revision_id, overwrite, 
 
146
                remember, create_prefix)
149
147
        except errors.DivergedBranches:
150
148
            raise errors.BzrCommandError(gettext('These branches have diverged.'
151
 
                                    '  See "brz help diverged-branches"'
 
149
                                    '  See "bzr help diverged-branches"'
152
150
                                    ' for more information.'))
153
 
        except errors.NoRoundtrippingSupport as e:
 
151
        except errors.NoRoundtrippingSupport, e:
154
152
            raise errors.BzrCommandError(gettext("It is not possible to losslessly "
155
153
                "push to %s. You may want to use dpush instead.") % 
156
154
                    e.target_branch.mapping.vcs.abbreviation)
163
161
                " directory out of the way and try again.") % location)
164
162
        if push_result.workingtree_updated == False:
165
163
            warning("This transport does not update the working " 
166
 
                    "tree of: %s. See 'brz help working-trees' for "
 
164
                    "tree of: %s. See 'bzr help working-trees' for "
167
165
                    "more information." % push_result.target_branch.base)
168
166
    push_result.report(to_file)
169
167
    if verbose:
170
168
        br_to = push_result.target_branch
171
169
        br_to.lock_read()
172
170
        try:
173
 
            from .log import show_branch_change
 
171
            from bzrlib.log import show_branch_change
174
172
            show_branch_change(br_to, to_file, push_result.old_revno, 
175
173
                               push_result.old_revid)
176
174
        finally: