~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/reconfigure.py

  • Committer: Aaron Bentley
  • Date: 2007-09-13 01:54:20 UTC
  • mto: This revision was merged to the branch mainline in revision 2826.
  • Revision ID: aaron.bentley@utoronto.ca-20070913015420-l766kszjaexug01y
Cleanups

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
            self.create_tree = True
104
104
 
105
105
    def planned_changes(self):
 
106
        """Return True if changes are planned, False otherwise"""
106
107
        return (self.unbind or self.bind or self.destroy_tree
107
108
                or self.create_tree or self.destroy_reference
108
109
                or self.create_branch or self.create_repository)
109
110
 
110
111
    def _check(self):
 
112
        """Raise if reconfiguration would destroy local changes"""
111
113
        if self.destroy_tree:
112
114
            changes = self.tree.changes_from(self.tree.basis_tree())
113
115
            if changes.has_changed():
114
116
                raise errors.UncommittedChanges(self.tree)
115
117
 
116
118
    def _select_bind_location(self):
 
119
        """Select a location to bind to.
 
120
 
 
121
        Preference is:
 
122
        1. user specified location
 
123
        2. branch reference location (it's a kind of bind location)
 
124
        3. previous bind location (it was a good choice once)
 
125
        4. push location (it's writeable, so committable)
 
126
        5. parent location (it's pullable, so update-from-able)
 
127
        """
 
128
        if self.new_bound_location is not None:
 
129
            return self.new_bound_location
117
130
        if self.local_branch is not None:
118
131
            old_bound = self.local_branch.get_old_bound_location()
119
132
            if old_bound is not None:
153
166
        if self.unbind:
154
167
            self.local_branch.unbind()
155
168
        if self.bind:
156
 
            if self.new_bound_location is None:
157
 
                bind_location = self._select_bind_location()
158
 
            else:
159
 
                bind_location = self.new_bound_location
 
169
            bind_location = self._select_bind_location()
160
170
            local_branch.bind(branch.Branch.open(bind_location))