~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: John Arbash Meinel
  • Date: 2008-02-25 22:41:36 UTC
  • mto: This revision was merged to the branch mainline in revision 3281.
  • Revision ID: john@arbash-meinel.com-20080225224136-g5dpjx3nzxcwbvvm
Change iter_ancestry to take a group instead of a single node,

Show diffs side-by-side

added added

removed removed

Lines of Context:
213
213
        last_revision = self.last_revision()
214
214
        g = self.repository.get_graph()
215
215
        ancestry = []
216
 
        null_parents = (_mod_revision.NULL_REVISION,)
217
 
        for revision_id, parents in g.iter_ancestry(last_revision):
218
 
            if parents == null_parents:
 
216
        NULL_REVISION = _mod_revision.NULL_REVISION
 
217
        # API FRICTION: get_parent_map() returns (NULL_REVISION,) for nodes
 
218
        #   rather than an empty list/tuple. (And thus so does iter_ancestry)
 
219
        #   However, that would make revno 1 == NULL_REVISION according to
 
220
        #   merge_sort, so we have to strip it out of the results.
 
221
        #   This wouldn't be terrible, except implementors of get_parent_map()
 
222
        #   generally are artificially introducing NULL_REVISION into their
 
223
        #   return values because of the api requirements.
 
224
        for revision_id, parents in g.iter_ancestry([last_revision]):
 
225
            if len(parents) == 1 and parents[0] == NULL_REVISION:
219
226
                ancestry.append((revision_id, ()))
220
 
            elif revision_id == _mod_revision.NULL_REVISION:
 
227
            elif revision_id == NULL_REVISION:
221
228
                continue
222
229
            else:
223
230
                ancestry.append((revision_id, parents))