~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:21:52 UTC
  • mto: This revision was merged to the branch mainline in revision 2826.
  • Revision ID: aaron.bentley@utoronto.ca-20070913012152-6rahc1x9dn8wjkij
Ensure conversion from lightweight checkout works

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
                self.referenced_branch = branch
41
41
        except errors.NotBranchError:
42
42
            self.local_branch = None
 
43
            self.referenced_branch = None
43
44
        try:
44
45
            self.tree = bzrdir.open_workingtree()
45
46
        except errors.NoWorkingTree:
84
85
                if self.referenced_branch is not None:
85
86
                    self.destroy_reference = True
86
87
                    self.create_branch = True
 
88
                    if bound:
 
89
                        self.bind = True
 
90
                else:
 
91
                    raise errors.ReconfigurationNotSupported(self.bzrdir)
87
92
        else:
88
93
            if bound:
89
94
                if self.local_branch.get_bound_location() is None:
98
103
 
99
104
    def planned_changes(self):
100
105
        return (self.unbind or self.bind or self.destroy_tree
101
 
                or self.create_tree)
 
106
                or self.create_tree or self.destroy_reference
 
107
                or self.create_branch or self.create_repository)
102
108
 
103
109
    def _check(self):
104
110
        if self.destroy_tree:
117
123
            parent = self.local_branch.get_parent()
118
124
            if parent is not None:
119
125
                return parent
 
126
        elif self.referenced_branch is not None:
 
127
            return self.referenced_branch.base
120
128
        raise errors.NoBindLocation(self.bzrdir)
121
129
 
122
130
    def apply(self, force=False):
130
138
            reference_info = self.referenced_branch.last_revision_info()
131
139
            self.bzrdir.destroy_branch()
132
140
        if self.create_branch:
133
 
            new_branch = self.bzrdir.create_branch()
134
 
            new_branch.set_last_revision_info(*reference_info)
 
141
            local_branch = self.bzrdir.create_branch()
 
142
            local_branch.set_last_revision_info(*reference_info)
 
143
        else:
 
144
            local_branch = self.local_branch
135
145
        if self.destroy_tree:
136
146
            self.bzrdir.destroy_workingtree()
137
147
        if self.create_tree:
143
153
                bind_location = self._select_bind_location()
144
154
            else:
145
155
                bind_location = self.new_bound_location
146
 
            self.local_branch.bind(branch.Branch.open(bind_location))
 
156
            local_branch.bind(branch.Branch.open(bind_location))