~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Wouter van Heyst
  • Date: 2006-06-07 11:13:02 UTC
  • mfrom: (1747 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: larstiq@larstiq.dyndns.org-20060607111302-bce5a90c86f0d764
[merge] bzr.dev 1747

Show diffs side-by-side

added added

removed removed

Lines of Context:
539
539
            path = self._inventory.id2path(file_id)
540
540
        return self._hashcache.get_sha1(path)
541
541
 
 
542
    def get_file_mtime(self, file_id, path=None):
 
543
        if not path:
 
544
            path = self._inventory.id2path(file_id)
 
545
        return os.lstat(self.abspath(path)).st_mtime
 
546
 
542
547
    if not supports_executable():
543
548
        def is_executable(self, file_id, path=None):
544
549
            return self._inventory[file_id].executable
1193
1198
 
1194
1199
    def _cache_basis_inventory(self, new_revision):
1195
1200
        """Cache new_revision as the basis inventory."""
 
1201
        # TODO: this should allow the ready-to-use inventory to be passed in,
 
1202
        # as commit already has that ready-to-use [while the format is the
 
1203
        # same, that is].
1196
1204
        try:
1197
1205
            # this double handles the inventory - unpack and repack - 
1198
1206
            # but is easier to understand. We can/should put a conditional
1199
1207
            # in here based on whether the inventory is in the latest format
1200
1208
            # - perhaps we should repack all inventories on a repository
1201
1209
            # upgrade ?
1202
 
            inv = self.branch.repository.get_inventory(new_revision)
1203
 
            inv.revision_id = new_revision
1204
 
            xml = bzrlib.xml5.serializer_v5.write_inventory_to_string(inv)
 
1210
            # the fast path is to copy the raw xml from the repository. If the
 
1211
            # xml contains 'revision_id="', then we assume the right 
 
1212
            # revision_id is set. We must check for this full string, because a
 
1213
            # root node id can legitimately look like 'revision_id' but cannot
 
1214
            # contain a '"'.
 
1215
            xml = self.branch.repository.get_inventory_xml(new_revision)
 
1216
            if not 'revision_id="' in xml.split('\n', 1)[0]:
 
1217
                inv = self.branch.repository.deserialise_inventory(
 
1218
                    new_revision, xml)
 
1219
                inv.revision_id = new_revision
 
1220
                xml = bzrlib.xml5.serializer_v5.write_inventory_to_string(inv)
1205
1221
 
1206
1222
            path = self._basis_inventory_name()
1207
1223
            self._control_files.put_utf8(path, xml)