~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: Aaron Bentley
  • Date: 2005-10-13 21:29:09 UTC
  • mfrom: (1451)
  • mto: (1185.25.1)
  • mto: This revision was merged to the branch mainline in revision 1460.
  • Revision ID: abentley@troll-20051013212909-cfde7d2d05ccd47e
Merged latest from robert collins

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# (C) 2005 Canonical Ltd
2
 
 
 
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
5
5
# the Free Software Foundation; either version 2 of the License, or
6
6
# (at your option) any later version.
7
 
 
 
7
#
8
8
# This program is distributed in the hope that it will be useful,
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
# GNU General Public License for more details.
12
 
 
 
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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.id2path(self.file_id), tree)
 
136
        self._read_tree_state(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.id2path(to_entry.file_id),
142
 
                                      to_tree)
 
141
            to_entry._read_tree_state(to_tree)
143
142
        self._diff(text_diff, from_label, tree, to_label, to_entry, to_tree,
144
143
                   output_to, reverse)
145
144
 
326
325
        text stored in the text store or weave.
327
326
        """
328
327
        mutter('new parents of %s are %r', path, previous_entries)
329
 
        self._read_tree_state(path, work_tree)
 
328
        self._read_tree_state(work_tree)
330
329
        if len(previous_entries) == 1:
331
330
            # cannot be unchanged unless there is only one parent file rev.
332
331
            parent_ie = previous_entries.values()[0]
392
391
            compatible = False
393
392
        return compatible
394
393
 
395
 
    def _read_tree_state(self, path, work_tree):
 
394
    def _read_tree_state(self, work_tree):
396
395
        """Populate fields in the inventory entry from the given tree.
397
396
        
398
397
        Note that this should be modified to be a noop on virtual trees
544
543
        if tree.is_executable(self.file_id):
545
544
            os.chmod(fullpath, 0755)
546
545
 
547
 
    def _read_tree_state(self, path, work_tree):
 
546
    def _read_tree_state(self, work_tree):
548
547
        """See InventoryEntry._read_tree_state."""
549
548
        self.text_sha1 = work_tree.get_file_sha1(self.file_id)
550
549
        self.executable = work_tree.is_executable(self.file_id)
654
653
        except OSError,e:
655
654
            raise BzrError("Failed to create symlink %r -> %r, error: %s" % (fullpath, self.symlink_target, e))
656
655
 
657
 
    def _read_tree_state(self, path, work_tree):
 
656
    def _read_tree_state(self, work_tree):
658
657
        """See InventoryEntry._read_tree_state."""
659
658
        self.symlink_target = work_tree.get_symlink_target(self.file_id)
660
659