~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Robert Collins
  • Date: 2005-11-05 15:23:57 UTC
  • mto: This revision was merged to the branch mainline in revision 1503.
  • Revision ID: robertc@robertcollins.net-20051105152357-2b072e3f033d6596
Move set_root_id to WorkingTree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
540
540
                raise BzrError("unknown kind %r" % kind)
541
541
        self.branch._write_inventory(inv)
542
542
 
 
543
    @needs_write_lock
 
544
    def set_root_id(self, file_id):
 
545
        """Set the root id for this tree."""
 
546
        inv = self.read_working_inventory()
 
547
        orig_root_id = inv.root.file_id
 
548
        del inv._byid[inv.root.file_id]
 
549
        inv.root.file_id = file_id
 
550
        inv._byid[inv.root.file_id] = inv.root
 
551
        for fid in inv:
 
552
            entry = inv[fid]
 
553
            if entry.parent_id in (None, orig_root_id):
 
554
                entry.parent_id = inv.root.file_id
 
555
        self.branch._write_inventory(inv)
 
556
 
543
557
    def unlock(self):
544
558
        """See Branch.unlock.
545
559