/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: Martin Pool
  • Date: 2007-10-08 07:29:57 UTC
  • mfrom: (2894 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2895.
  • Revision ID: mbp@sourcefrog.net-20071008072957-uhm1gl1mqcsdc377
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    errors,
50
50
    generate_ids,
51
51
    globbing,
52
 
    hashcache,
53
52
    ignores,
54
53
    merge,
55
54
    osutils,
271
270
        self._dirstate = dirstate.DirState.on_file(local_path)
272
271
        return self._dirstate
273
272
 
274
 
    def _directory_is_tree_reference(self, relpath):
275
 
        # as a special case, if a directory contains control files then 
276
 
        # it's a tree reference, except that the root of the tree is not
277
 
        return relpath and osutils.isdir(self.abspath(relpath) + u"/.bzr")
278
 
        # TODO: We could ask all the control formats whether they
279
 
        # recognize this directory, but at the moment there's no cheap api
280
 
        # to do that.  Since we probably can only nest bzr checkouts and
281
 
        # they always use this name it's ok for now.  -- mbp 20060306
282
 
        #
283
 
        # FIXME: There is an unhandled case here of a subdirectory
284
 
        # containing .bzr but not a branch; that will probably blow up
285
 
        # when you try to commit it.  It might happen if there is a
286
 
        # checkout in a subdirectory.  This can be avoided by not adding
287
 
        # it.  mbp 20070306
288
 
 
289
273
    def filter_unversioned_files(self, paths):
290
274
        """Filter out paths that are versioned.
291
275
 
1099
1083
        if state._dirblock_state == dirstate.DirState.IN_MEMORY_MODIFIED:
1100
1084
            self._make_dirty(reset_inventory=True)
1101
1085
 
 
1086
    def _sha_from_stat(self, path, stat_result):
 
1087
        """Get a sha digest from the tree's stat cache.
 
1088
 
 
1089
        The default implementation assumes no stat cache is present.
 
1090
 
 
1091
        :param path: The path.
 
1092
        :param stat_result: The stat result being looked up.
 
1093
        """
 
1094
        state = self.current_dirstate()
 
1095
        # XXX: should we make the path be passed in as utf8 ?
 
1096
        entry = state._get_entry(0, path_utf8=cache_utf8.encode(path))
 
1097
        tree_details = entry[1][0]
 
1098
        packed_stat = dirstate.pack_stat(stat_result)
 
1099
        if tree_details[4] == packed_stat:
 
1100
            return tree_details[1]
 
1101
        else:
 
1102
            return None
 
1103
 
1102
1104
    @needs_read_lock
1103
1105
    def supports_tree_reference(self):
1104
1106
        return self._repo_supports_tree_reference
1557
1559
    def kind(self, file_id):
1558
1560
        return self.inventory[file_id].kind
1559
1561
 
 
1562
    def path_content_summary(self, path):
 
1563
        """See Tree.path_content_summary."""
 
1564
        id = self.inventory.path2id(path)
 
1565
        if id is None:
 
1566
            return ('missing', None, None, None)
 
1567
        entry = self._inventory[id]
 
1568
        kind = entry.kind
 
1569
        if kind == 'file':
 
1570
            return (kind, entry.text_size, entry.executable, entry.text_sha1)
 
1571
        elif kind == 'symlink':
 
1572
            return (kind, None, None, entry.symlink_target)
 
1573
        else:
 
1574
            return (kind, None, None, None)
 
1575
 
1560
1576
    def is_executable(self, file_id, path=None):
1561
1577
        ie = self.inventory[file_id]
1562
1578
        if ie.kind != "file":