~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

  • Committer: Martin Pool
  • Date: 2005-09-22 12:16:45 UTC
  • Revision ID: mbp@sourcefrog.net-20050922121645-fdb6c854fc533bf5
- upgrade checks if branch is uptodate before anything else

Show diffs side-by-side

added added

removed removed

Lines of Context:
108
108
 
109
109
 
110
110
    def convert(self):
 
111
        if not self._open_branch():
 
112
            return
111
113
        note('starting upgrade of %s', self.base)
112
114
        self._backup_control_dir()
113
115
        note('starting upgrade')
115
117
        self.pb = ProgressBar()
116
118
        if not os.path.isdir(self.base + '/.bzr/weaves'):
117
119
            os.mkdir(self.base + '/.bzr/weaves')
118
 
        self.inv_weave = Weave('__inventory')
119
 
        self.anc_weave = Weave('__ancestry')
 
120
        self.inv_weave = Weave('inventory')
 
121
        self.anc_weave = Weave('ancestry')
120
122
        self.ancestries = {}
121
123
        # holds in-memory weaves for all files
122
124
        self.text_weaves = {}
123
 
        self.branch = Branch(self.base, relax_version_check=True)
124
 
        if self.branch._branch_format == 5:
125
 
            note('this branch is already in the most current format')
126
 
            return
127
 
        if self.branch._branch_format != 4:
128
 
            raise BzrError("cannot upgrade from branch format %r" %
129
 
                           self.branch._branch_format)
130
125
        os.remove(self.branch.controlfilename('branch-format'))
131
126
        self._convert_working_inv()
132
127
        rev_history = self.branch.revision_history()
155
150
        self._cleanup_spare_files()
156
151
 
157
152
 
 
153
    def _open_branch(self):
 
154
        self.branch = Branch(self.base, relax_version_check=True)
 
155
        if self.branch._branch_format == 5:
 
156
            note('this branch is already in the most current format')
 
157
            return False
 
158
        if self.branch._branch_format != 4:
 
159
            raise BzrError("cannot upgrade from branch format %r" %
 
160
                           self.branch._branch_format)
 
161
        return True
 
162
 
 
163
 
158
164
    def _set_new_format(self):
159
165
        f = self.branch.controlfile('branch-format', 'wb')
160
166
        try: