~bzr/ubuntu/maverick/bzr/beta-ppa

« back to all changes in this revision

Viewing changes to bzrlib/push.py

Merge from main PPA.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""UI helper for the push command."""
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
from bzrlib import (
20
 
    bzrdir,
 
22
    controldir,
21
23
    errors,
22
24
    revision as _mod_revision,
23
25
    transport,
79
81
    """
80
82
    to_transport = transport.get_transport(location)
81
83
    try:
82
 
        dir_to = bzrdir.BzrDir.open_from_transport(to_transport)
 
84
        dir_to = controldir.ControlDir.open_from_transport(to_transport)
83
85
    except errors.NotBranchError:
84
86
        # Didn't find anything
85
87
        dir_to = None
90
92
                revision_id=revision_id, stacked_on=stacked_on,
91
93
                create_prefix=create_prefix, use_existing_dir=use_existing_dir,
92
94
                no_tree=no_tree)
 
95
        except errors.AlreadyControlDirError, err:
 
96
            raise errors.BzrCommandError(gettext(
 
97
                "Target directory %s already contains a .bzr directory, "
 
98
                "but it is not valid.") % (location,))
93
99
        except errors.FileExists, err:
94
 
            if err.path.endswith('/.bzr'):
95
 
                raise errors.BzrCommandError(gettext(
96
 
                    "Target directory %s already contains a .bzr directory, "
97
 
                    "but it is not valid.") % (location,))
98
100
            if not use_existing_dir:
99
101
                raise errors.BzrCommandError(gettext("Target directory %s"
100
102
                     " already exists, but does not have a .bzr"
150
152
                "push to %s. You may want to use dpush instead.") % 
151
153
                    e.target_branch.mapping.vcs.abbreviation)
152
154
        except errors.NoRepositoryPresent:
153
 
            # we have a bzrdir but no branch or repository
 
155
            # we have a controldir but no branch or repository
154
156
            # XXX: Figure out what to do other than complain.
155
157
            raise errors.BzrCommandError(gettext("At %s you have a valid .bzr"
156
158
                " control directory, but not a branch or repository. This"