~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revision.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-03-22 19:47:41 UTC
  • mfrom: (1607.1.12 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060322194741-02adb9a088203f30
Fix common_ancestor to still calculate a common ancestor when ghosts are present along all paths of ancestry - there are no 'import' revisions available.

Show diffs side-by-side

added added

removed removed

Lines of Context:
250
250
            for root in graph.roots:
251
251
                descendants[NULL_REVISION][root] = 1
252
252
                ancestors[root].append(NULL_REVISION)
253
 
            if len(graph.roots) == 0:
254
 
                # no reachable roots - not handled yet.
255
 
                raise bzrlib.errors.NoCommonAncestor(revision_a, revision_b)
 
253
            for ghost in graph.ghosts:
 
254
                # ghosts act as roots for the purpose of finding 
 
255
                # the longest paths from the root: any ghost *might*
 
256
                # be directly attached to the root, so we treat them
 
257
                # as being such.
 
258
                # ghost now descends from NULL
 
259
                descendants[NULL_REVISION][ghost] = 1
 
260
                # that is it has an ancestor of NULL
 
261
                ancestors[ghost] = [NULL_REVISION]
 
262
                # ghost is common if any of ghosts descendants are common:
 
263
                for ghost_descendant in descendants[ghost]:
 
264
                    if ghost_descendant in common:
 
265
                        common.add(ghost)
 
266
                
256
267
            root = NULL_REVISION
257
268
            common.add(NULL_REVISION)
258
269
        except bzrlib.errors.NoCommonRoot: