~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/reconfigure.py

  • Committer: Aaron Bentley
  • Date: 2008-04-06 03:34:14 UTC
  • mto: This revision was merged to the branch mainline in revision 3364.
  • Revision ID: aaron@aaronbentley.com-20080406033414-bghccvp8kk2nt1av
Flesh out to_sharing

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
            self.repository = self.bzrdir.find_repository()
32
32
        except errors.NoRepositoryPresent:
33
33
            self.repository = None
 
34
        else:
 
35
            if (self.repository.bzrdir.root_transport.base ==
 
36
                self.bzrdir.root_transport.base):
 
37
                self.local_repository = self.repository
 
38
            else:
 
39
                self.local_repository = None
34
40
        try:
35
41
            branch = self.bzrdir.open_branch()
36
42
            if branch.bzrdir.root_transport.base == bzrdir.root_transport.base:
121
127
        """Convert a standalone branch into a sharing branch"""
122
128
        reconfiguration = klass(bzrdir)
123
129
        reconfiguration._set_sharing(sharing=True)
 
130
        if not reconfiguration.changes_planned():
 
131
            raise errors.AlreadySharing(bzrdir)
124
132
        return reconfiguration
125
133
 
126
134
    def _plan_changes(self, want_tree, want_branch, want_bound,
167
175
        if sharing is None:
168
176
            return
169
177
        if sharing:
170
 
            self._destroy_repository = True
 
178
            if self.local_repository is not None:
 
179
                self._destroy_repository = True
171
180
 
172
181
    def changes_planned(self):
173
182
        """Return True if changes are planned, False otherwise"""
174
183
        return (self._unbind or self._bind or self._destroy_tree
175
184
                or self._create_tree or self._destroy_reference
176
185
                or self._create_branch or self._create_repository
177
 
                or self._create_reference)
 
186
                or self._create_reference or self._destroy_repository)
178
187
 
179
188
    def _check(self):
180
189
        """Raise if reconfiguration would destroy local changes"""