~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Robert Collins
  • Date: 2008-03-28 03:54:40 UTC
  • mto: This revision was merged to the branch mainline in revision 3313.
  • Revision ID: robertc@robertcollins.net-20080328035440-4cflvryqujresn2g
Reduce code duplication as per review.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3140
3140
                if correct_parents != knit_parents:
3141
3141
                    wrong_parents[revision_id] = (knit_parents, correct_parents)
3142
3142
        return wrong_parents, unused_versions
 
3143
 
 
3144
 
 
3145
def _old_get_graph(repository, revision_id):
 
3146
    """DO NOT USE. That is all. I'm serious."""
 
3147
    graph = repository.get_graph()
 
3148
    revision_graph = dict(((key, value) for key, value in
 
3149
        graph.iter_ancestry([revision_id]) if value is not None))
 
3150
    return _strip_NULL_ghosts(revision_graph)
 
3151
 
 
3152
 
 
3153
def _strip_NULL_ghosts(revision_graph):
 
3154
    """Also don't use this. more compatibility code for unmigrated clients."""
 
3155
    # Filter ghosts, and null:
 
3156
    if _mod_revision.NULL_REVISION in revision_graph:
 
3157
        del revision_graph[_mod_revision.NULL_REVISION]
 
3158
    for key, parents in revision_graph.items():
 
3159
        revision_graph[key] = tuple(parent for parent in parents if parent
 
3160
            in revision_graph)
 
3161
    return revision_graph