~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/knitrepo.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-04-26 15:39:04 UTC
  • mfrom: (2456.2.6 rename_iter_changes_109993)
  • Revision ID: pqm@pqm.ubuntu.com-20070426153904-l91p9ybsqpxt2vyv
(John Arbash Meinel) Fix bug #109993 by fixing _iter_changes to not sync an on-disk file with an 'absent' dirblock record.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
from bzrlib import (
18
18
    bzrdir,
19
 
    deprecated_graph,
20
19
    errors,
 
20
    graph,
21
21
    knit,
22
22
    lockable_files,
23
23
    lockdir,
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 __repr__(self):
48
 
        return 'KnitParentsProvider(%r)' % self._knit
49
 
 
50
 
    def get_parents(self, revision_ids):
51
 
        parents_list = []
52
 
        for revision_id in revision_ids:
53
 
            if revision_id == _mod_revision.NULL_REVISION:
54
 
                parents = []
55
 
            else:
56
 
                try:
57
 
                    parents = self._knit.get_parents_with_ghosts(revision_id)
58
 
                except errors.RevisionNotPresent:
59
 
                    parents = None
60
 
                else:
61
 
                    if len(parents) == 0:
62
 
                        parents = [_mod_revision.NULL_REVISION]
63
 
            parents_list.append(parents)
64
 
        return parents_list
65
 
 
66
 
 
67
42
class KnitRepository(MetaDirRepository):
68
43
    """Knit format repository."""
69
44
 
111
86
        return self._fileid_involved_by_set(changed)
112
87
 
113
88
    @needs_read_lock
114
 
    def get_ancestry(self, revision_id, topo_sorted=True):
 
89
    def get_ancestry(self, revision_id):
115
90
        """Return a list of revision-ids integrated by a revision.
116
91
        
117
 
        This is topologically sorted, unless 'topo_sorted' is specified as
118
 
        False.
 
92
        This is topologically sorted.
119
93
        """
120
 
        if _mod_revision.is_null(revision_id):
 
94
        if revision_id is None:
121
95
            return [None]
122
96
        revision_id = osutils.safe_revision_id(revision_id)
123
97
        vf = self._get_revision_vf()
124
98
        try:
125
 
            return [None] + vf.get_ancestry(revision_id, topo_sorted)
 
99
            return [None] + vf.get_ancestry(revision_id)
126
100
        except errors.RevisionNotPresent:
127
101
            raise errors.NoSuchRevision(self, revision_id)
128
102
 
170
144
        :param revision_ids: an iterable of revisions to graph or None for all.
171
145
        :return: a Graph object with the graph reachable from revision_ids.
172
146
        """
173
 
        result = deprecated_graph.Graph()
 
147
        result = graph.Graph()
174
148
        vf = self._get_revision_vf()
175
149
        versions = set(vf.versions())
176
150
        if not revision_ids:
228
202
        revision_id = osutils.safe_revision_id(revision_id)
229
203
        return self._get_revision_vf().get_parents(revision_id)
230
204
 
231
 
    def _make_parents_provider(self):
232
 
        return _KnitParentsProvider(self._get_revision_vf())
233
 
 
234
205
 
235
206
class KnitRepository3(KnitRepository):
236
207