~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

  • Committer: Robert Collins
  • Date: 2005-09-30 04:52:11 UTC
  • mto: This revision was merged to the branch mainline in revision 1397.
  • Revision ID: robertc@robertcollins.net-20050930045210-1f157d2aaaa73c63
convert name_version to revision in inventory entries

Show diffs side-by-side

added added

removed removed

Lines of Context:
287
287
                ie = inv[file_id]
288
288
                if ie.kind == 'root_directory':
289
289
                    continue
290
 
                assert hasattr(ie, 'name_version'), \
291
 
                    'no name_version on {%s} in {%s}' % \
 
290
                assert hasattr(ie, 'revision'), \
 
291
                    'no revision on {%s} in {%s}' % \
292
292
                    (file_id, rev.revision_id)
293
293
                if ie.kind == 'file':
294
294
                    assert hasattr(ie, 'text_version')
328
328
        parent_invs = map(self._load_updated_inventory, rev.parent_ids)
329
329
        for file_id in inv:
330
330
            ie = inv[file_id]
331
 
            self._set_name_version(rev, ie, parent_invs)
 
331
            self._set_revision(rev, ie, parent_invs)
332
332
            if ie.kind != 'file':
333
333
                continue
334
334
            self._convert_file_version(rev, ie, parent_invs)
335
335
 
336
336
 
337
 
    def _set_name_version(self, rev, ie, parent_invs):
 
337
    def _set_revision(self, rev, ie, parent_invs):
338
338
        """Set name version for a file.
339
339
 
340
340
        Done in a slightly lazy way: if the file is renamed or in a merge revision
344
344
        if ie.kind == 'root_directory':
345
345
            return
346
346
        if len(parent_invs) != 1:
347
 
            ie.name_version = rev.revision_id
 
347
            ie.revision = rev.revision_id
348
348
        else:
349
349
            old_inv = parent_invs[0]
350
350
            if not old_inv.has_id(file_id):
351
 
                ie.name_version = rev.revision_id
 
351
                ie.revision = rev.revision_id
352
352
            else:
353
353
                old_ie = old_inv[file_id]
354
354
                if (old_ie.parent_id != ie.parent_id
355
355
                    or old_ie.name != ie.name):
356
 
                    ie.name_version = rev.revision_id
 
356
                    ie.revision = rev.revision_id
357
357
                else:
358
 
                    ie.name_version = old_ie.name_version
 
358
                    ie.revision = old_ie.revision
359
359
 
360
360
 
361
361