~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revision.py

  • Committer: Aaron Bentley
  • Date: 2005-09-18 21:47:53 UTC
  • mto: (1185.1.29)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: aaron.bentley@utoronto.ca-20050918214753-129f45a74b8af9f2
Fixed merging with multiple roots, by using null as graph root.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import bzrlib.errors
19
19
from bzrlib.graph import node_distances, select_farthest, all_descendants
20
20
 
 
21
NULL_REVISION="!NULL!"
 
22
 
21
23
class RevisionReference(object):
22
24
    """
23
25
    Reference to a stored revision.
207
209
    while len(lines) > 0:
208
210
        new_lines = set()
209
211
        for line in lines:
210
 
            try:
211
 
                rev = revision_source.get_revision(line)
212
 
                parents = [p.revision_id for p in rev.parents]
213
 
                if len(parents) == 0:
214
 
                    root = line
215
 
            except bzrlib.errors.NoSuchRevision:
216
 
                if line == revision:
217
 
                    raise
218
 
                parents = None
 
212
            if line == NULL_REVISION:
 
213
                parents = []
 
214
                root = NULL_REVISION
 
215
            else:
 
216
                try:
 
217
                    rev = revision_source.get_revision(line)
 
218
                    parents = [p.revision_id for p in rev.parents]
 
219
                    if len(parents) == 0:
 
220
                        parents = [NULL_REVISION]
 
221
                except bzrlib.errors.NoSuchRevision:
 
222
                    if line == revision:
 
223
                        raise
 
224
                    parents = None
219
225
            if parents is not None:
220
226
                for parent in parents:
221
227
                    if parent not in ancestors:
260
266
        
261
267
    distances = node_distances (descendants, ancestors, root)
262
268
    farthest = select_farthest(distances, common)
263
 
    if farthest is None:
 
269
    if farthest is None or farthest == NULL_REVISION:
264
270
        raise bzrlib.errors.NoCommonAncestor(revision_a, revision_b)
265
271
    return farthest
266
272