~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/knitrepo.py

  • Committer: Aaron Bentley
  • Date: 2007-06-08 15:03:32 UTC
  • mto: This revision was merged to the branch mainline in revision 2534.
  • Revision ID: abentley@panoramicfeedback.com-20070608150332-jxt1yx9hy7dmhxhv
Update distinct -> lowest, refactor, add ParentsProvider concept

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
from bzrlib.trace import mutter, note, warning
40
40
 
41
41
 
 
42
class _KnitParentsProvider(object):
 
43
 
 
44
    def __init__(self, knit):
 
45
        self._knit = knit
 
46
 
 
47
    def get_parents(self, revision_ids):
 
48
        parents_list = []
 
49
        for revision_id in revision_ids:
 
50
            if revision_id == _mod_revision.NULL_REVISION:
 
51
                parents = []
 
52
            else:
 
53
                try:
 
54
                    parents = self._knit.get_parents_with_ghosts(revision_id)
 
55
                except errors.RevisionNotPresent:
 
56
                    parents = None
 
57
                else:
 
58
                    if len(parents) == 0:
 
59
                        parents = [_mod_revision.NULL_REVISION]
 
60
            parents_list.append(parents)
 
61
        return parents_list
 
62
 
 
63
 
42
64
class KnitRepository(MetaDirRepository):
43
65
    """Knit format repository."""
44
66
 
202
224
        revision_id = osutils.safe_revision_id(revision_id)
203
225
        return self._get_revision_vf().get_parents(revision_id)
204
226
 
 
227
    def _make_parents_provider(self):
 
228
        return _KnitParentsProvider(self._get_revision_vf())
 
229
 
205
230
 
206
231
class KnitRepository3(KnitRepository):
207
232