/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: John Arbash Meinel
  • Date: 2009-06-17 19:08:25 UTC
  • mto: This revision was merged to the branch mainline in revision 4460.
  • Revision ID: john@arbash-meinel.com-20090617190825-ktfk82li57rf2im6
It seems that fetch() no longer returns the number of revisions fetched.
It still does for *some* InterRepository fetch paths, but the generic one does not.
It is also not easy to get it to, since the Source and Sink are the ones
that would know how many keys were transmitted, and they are potentially 'remote'
objects.

This was also only tested to occur as a by-product in a random 'test_commit' test.
I assume if we really wanted the assurance, we would have a per_repo or interrepo
test for it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
17
17
"""UI helper for the push command."""
18
18
 
19
19
from bzrlib import (
 
20
    builtins,
 
21
    branch,
20
22
    bzrdir,
21
23
    errors,
22
24
    revision as _mod_revision,
88
90
            br_to = br_from.create_clone_on_transport(to_transport,
89
91
                revision_id=revision_id, stacked_on=stacked_on,
90
92
                create_prefix=create_prefix, use_existing_dir=use_existing_dir)
91
 
        except errors.FileExists, err:
92
 
            if err.path.endswith('/.bzr'):
93
 
                raise errors.BzrCommandError(
94
 
                    "Target directory %s already contains a .bzr directory, "
95
 
                    "but it is not valid." % (location,))
 
93
        except errors.FileExists:
96
94
            if not use_existing_dir:
97
95
                raise errors.BzrCommandError("Target directory %s"
98
 
                     " already exists, but does not have a .bzr"
 
96
                     " already exists, but does not have a valid .bzr"
99
97
                     " directory. Supply --use-existing-dir to push"
100
98
                     " there anyway." % location)
101
 
            # This shouldn't occur, but if it does the FileExists error will be
102
 
            # more informative than an UnboundLocalError for br_to.
103
 
            raise
104
99
        except errors.NoSuchFile:
105
100
            if not create_prefix:
106
101
                raise errors.BzrCommandError("Parent directory of %s"
108
103
                    "\nYou may supply --create-prefix to create all"
109
104
                    " leading parent directories."
110
105
                    % location)
111
 
            # This shouldn't occur (because create_prefix is true, so
112
 
            # create_clone_on_transport should be catching NoSuchFile and
113
 
            # creating the missing directories) but if it does the original
114
 
            # NoSuchFile error will be more informative than an
115
 
            # UnboundLocalError for br_to.
116
 
            raise
117
106
        except errors.TooManyRedirections:
118
107
            raise errors.BzrCommandError("Too many redirections trying "
119
108
                                         "to make %s." % location)
136
125
                    "already exists at the destination location.")
137
126
        try:
138
127
            push_result = dir_to.push_branch(br_from, revision_id, overwrite, 
139
 
                remember, create_prefix)
 
128
                remember)
140
129
        except errors.DivergedBranches:
141
130
            raise errors.BzrCommandError('These branches have diverged.'
142
131
                                    '  See "bzr help diverged-branches"'
143
132
                                    ' for more information.')
144
 
        except errors.NoRoundtrippingSupport, e:
145
 
            raise errors.BzrCommandError("It is not possible to losslessly "
146
 
                "push to %s. You may want to use dpush instead." % 
147
 
                    e.target_branch.mapping.vcs.abbreviation)
148
133
        except errors.NoRepositoryPresent:
149
134
            # we have a bzrdir but no branch or repository
150
135
            # XXX: Figure out what to do other than complain.