~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to tools/history2weaves.py

  • Committer: Martin Pool
  • Date: 2005-09-19 11:27:35 UTC
  • Revision ID: mbp@sourcefrog.net-20050919112735-c374eb341661fea5
- write out new revisions after conversion

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
        self.text_count = 0
103
103
        self.revisions = {}
104
104
        self.inventories = {}
 
105
        self.ancestries = {}
105
106
        self.convert()
106
107
        
107
108
 
136
137
                and rev_id not in self.absent_revisions):
137
138
                self._load_one_rev(rev_id)
138
139
        self.pb.clear()
139
 
        to_import = self._make_order()
 
140
        to_import = self._make_order()[:500]
140
141
        for i, rev_id in enumerate(to_import):
141
142
            self.pb.update('converting revision', i, len(to_import))
142
143
            self._convert_one_rev(rev_id)
143
 
 
 
144
        self.pb.clear()
144
145
        print '(not really) upgraded to weaves:'
145
146
        print '  %6d revisions and inventories' % len(self.revisions)
146
147
        print '  %6d absent revisions removed' % len(self.absent_revisions)
147
148
        print '  %6d texts' % self.text_count
148
 
 
149
149
        self._write_all_weaves()
 
150
        self._write_all_revs()
150
151
 
151
152
 
152
153
    def _write_all_weaves(self):
161
162
            self.pb.clear()
162
163
        ## write_atomic_weave(self.anc_weave, 'weaves/ancestry.weave')
163
164
 
164
 
        
 
165
 
 
166
    def _write_all_revs(self):
 
167
        """Write all revisions out in new form."""
 
168
        try:
 
169
            for i, rev_id in enumerate(self.converted_revs):
 
170
                self.pb.update('write revision', i, len(self.converted_revs))
 
171
                f = file('new-revisions/%s' % rev_id, 'wb')
 
172
                try:
 
173
                    serializer_v5.write_revision(self.revisions[rev_id], f)
 
174
                finally:
 
175
                    f.close()
 
176
        finally:
 
177
            self.pb.clear()
 
178
            
165
179
    def _load_one_rev(self, rev_id):
166
180
        """Load a revision object into memory.
167
181