~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: Robert Collins
  • Date: 2005-10-17 11:56:54 UTC
  • mfrom: (1185.16.59)
  • Revision ID: robertc@robertcollins.net-20051017115654-662239e1587524a8
mergeĀ fromĀ martin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
133
133
        text_diff will be used for textual difference calculation.
134
134
        This is a template method, override _diff in child classes.
135
135
        """
136
 
        self._read_tree_state(tree)
 
136
        self._read_tree_state(tree.id2path(self.file_id), tree)
137
137
        if to_entry:
138
138
            # cannot diff from one kind to another - you must do a removal
139
139
            # and an addif they do not match.
140
140
            assert self.kind == to_entry.kind
141
 
            to_entry._read_tree_state(to_tree)
 
141
            to_entry._read_tree_state(to_tree.id2path(to_entry.file_id),
 
142
                                      to_tree)
142
143
        self._diff(text_diff, from_label, tree, to_label, to_entry, to_tree,
143
144
                   output_to, reverse)
144
145
 
325
326
        text stored in the text store or weave.
326
327
        """
327
328
        mutter('new parents of %s are %r', path, previous_entries)
328
 
        self._read_tree_state(work_tree)
 
329
        self._read_tree_state(path, work_tree)
329
330
        if len(previous_entries) == 1:
330
331
            # cannot be unchanged unless there is only one parent file rev.
331
332
            parent_ie = previous_entries.values()[0]
391
392
            compatible = False
392
393
        return compatible
393
394
 
394
 
    def _read_tree_state(self, work_tree):
 
395
    def _read_tree_state(self, path, work_tree):
395
396
        """Populate fields in the inventory entry from the given tree.
396
397
        
397
398
        Note that this should be modified to be a noop on virtual trees
547
548
        if tree.is_executable(self.file_id):
548
549
            os.chmod(fullpath, 0755)
549
550
 
550
 
    def _read_tree_state(self, work_tree):
 
551
    def _read_tree_state(self, path, work_tree):
551
552
        """See InventoryEntry._read_tree_state."""
552
553
        self.text_sha1 = work_tree.get_file_sha1(self.file_id)
553
554
        self.executable = work_tree.is_executable(self.file_id)
657
658
        except OSError,e:
658
659
            raise BzrError("Failed to create symlink %r -> %r, error: %s" % (fullpath, self.symlink_target, e))
659
660
 
660
 
    def _read_tree_state(self, work_tree):
 
661
    def _read_tree_state(self, path, work_tree):
661
662
        """See InventoryEntry._read_tree_state."""
662
663
        self.symlink_target = work_tree.get_symlink_target(self.file_id)
663
664