~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/push.py

  • Committer: John Arbash Meinel
  • Date: 2010-02-17 17:11:16 UTC
  • mfrom: (4797.2.17 2.1)
  • mto: (4797.2.18 2.1)
  • mto: This revision was merged to the branch mainline in revision 5055.
  • Revision ID: john@arbash-meinel.com-20100217171116-h7t9223ystbnx5h8
merge bzr.2.1 in preparation for NEWS entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008 Canonical Ltd
 
1
# Copyright (C) 2008, 2009, 2010 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
90
90
            br_to = br_from.create_clone_on_transport(to_transport,
91
91
                revision_id=revision_id, stacked_on=stacked_on,
92
92
                create_prefix=create_prefix, use_existing_dir=use_existing_dir)
93
 
        except errors.FileExists:
 
93
        except errors.FileExists, err:
 
94
            if err.path.endswith('/.bzr'):
 
95
                raise errors.BzrCommandError(
 
96
                    "Target directory %s already contains a .bzr directory, "
 
97
                    "but it is not valid." % (location,))
94
98
            if not use_existing_dir:
95
99
                raise errors.BzrCommandError("Target directory %s"
96
 
                     " already exists, but does not have a valid .bzr"
 
100
                     " already exists, but does not have a .bzr"
97
101
                     " directory. Supply --use-existing-dir to push"
98
102
                     " there anyway." % location)
 
103
            # This shouldn't occur, but if it does the FileExists error will be
 
104
            # more informative than an UnboundLocalError for br_to.
 
105
            raise
99
106
        except errors.NoSuchFile:
100
107
            if not create_prefix:
101
108
                raise errors.BzrCommandError("Parent directory of %s"
103
110
                    "\nYou may supply --create-prefix to create all"
104
111
                    " leading parent directories."
105
112
                    % location)
 
113
            # This shouldn't occur (because create_prefix is true, so
 
114
            # create_clone_on_transport should be catching NoSuchFile and
 
115
            # creating the missing directories) but if it does the original
 
116
            # NoSuchFile error will be more informative than an
 
117
            # UnboundLocalError for br_to.
 
118
            raise
106
119
        except errors.TooManyRedirections:
107
120
            raise errors.BzrCommandError("Too many redirections trying "
108
121
                                         "to make %s." % location)
130
143
            raise errors.BzrCommandError('These branches have diverged.'
131
144
                                    '  See "bzr help diverged-branches"'
132
145
                                    ' for more information.')
 
146
        except errors.NoRoundtrippingSupport, e:
 
147
            raise errors.BzrCommandError("It is not possible to losslessly "
 
148
                "push to %s. You may want to use dpush instead." % 
 
149
                    e.target_branch.mapping.vcs.abbreviation)
133
150
        except errors.NoRepositoryPresent:
134
151
            # we have a bzrdir but no branch or repository
135
152
            # XXX: Figure out what to do other than complain.