~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/index.py

  • Committer: Rory Yorke
  • Date: 2010-10-20 14:38:53 UTC
  • mto: This revision was merged to the branch mainline in revision 5519.
  • Revision ID: rory.yorke@gmail.com-20101020143853-9kfd2ldcjfroh8jw
Show missing files in bzr status (bug 134168).

"bzr status" will now show missing files, that is, those added with "bzr
add" and then removed by non bzr means (e.g., rm).

Blackbox tests were added for this case, and tests were also added to
test_delta, since the implementation change is in bzrlib.delta.

Might also affect bug 189709.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2011 Canonical Ltd
 
1
# Copyright (C) 2007-2010 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
31
31
 
32
32
from bzrlib.lazy_import import lazy_import
33
33
lazy_import(globals(), """
34
 
from bzrlib import (
35
 
    bisect_multi,
36
 
    revision as _mod_revision,
37
 
    trace,
38
 
    )
 
34
from bzrlib import trace
 
35
from bzrlib.bisect_multi import bisect_multi_bytes
 
36
from bzrlib.revision import NULL_REVISION
 
37
from bzrlib.trace import mutter
39
38
""")
40
39
from bzrlib import (
41
40
    debug,
445
444
            # We already did this
446
445
            return
447
446
        if 'index' in debug.debug_flags:
448
 
            trace.mutter('Reading entire index %s',
449
 
                          self._transport.abspath(self._name))
 
447
            mutter('Reading entire index %s', self._transport.abspath(self._name))
450
448
        if stream is None:
451
449
            stream = self._transport.get(self._name)
452
450
            if self._base_offset != 0:
673
671
        if self._nodes is not None:
674
672
            return self._iter_entries_from_total_buffer(keys)
675
673
        else:
676
 
            return (result[1] for result in bisect_multi.bisect_multi_bytes(
 
674
            return (result[1] for result in bisect_multi_bytes(
677
675
                self._lookup_keys_via_location, self._size, keys))
678
676
 
679
677
    def iter_entries_prefix(self, keys):
1290
1288
    def get_parent_map(self, keys):
1291
1289
        """See graph.StackedParentsProvider.get_parent_map"""
1292
1290
        search_keys = set(keys)
1293
 
        if _mod_revision.NULL_REVISION in search_keys:
1294
 
            search_keys.discard(_mod_revision.NULL_REVISION)
1295
 
            found_parents = {_mod_revision.NULL_REVISION:[]}
 
1291
        if NULL_REVISION in search_keys:
 
1292
            search_keys.discard(NULL_REVISION)
 
1293
            found_parents = {NULL_REVISION:[]}
1296
1294
        else:
1297
1295
            found_parents = {}
1298
1296
        for index, key, value, refs in self.iter_entries(search_keys):
1299
1297
            parents = refs[0]
1300
1298
            if not parents:
1301
 
                parents = (_mod_revision.NULL_REVISION,)
 
1299
                parents = (NULL_REVISION,)
1302
1300
            found_parents[key] = parents
1303
1301
        return found_parents
1304
1302
 
1436
1434
        """
1437
1435
        indices_info = zip(self._index_names, self._indices)
1438
1436
        if 'index' in debug.debug_flags:
1439
 
            trace.mutter('CombinedGraphIndex reordering: currently %r, '
1440
 
                         'promoting %r', indices_info, hit_indices)
 
1437
            mutter('CombinedGraphIndex reordering: currently %r, promoting %r',
 
1438
                   indices_info, hit_indices)
1441
1439
        hit_names = []
1442
1440
        unhit_names = []
1443
1441
        new_hit_indices = []
1460
1458
        self._indices = new_hit_indices + unhit_indices
1461
1459
        self._index_names = hit_names + unhit_names
1462
1460
        if 'index' in debug.debug_flags:
1463
 
            trace.mutter('CombinedGraphIndex reordered: %r', self._indices)
 
1461
            mutter('CombinedGraphIndex reordered: %r', self._indices)
1464
1462
        return hit_names
1465
1463
 
1466
1464
    def _move_to_front_by_name(self, hit_names):