~mwhudson/loggerhead/dont-hold-branches-open

« back to all changes in this revision

Viewing changes to loggerhead/graphcache.py

  • Committer: Michael Hudson
  • Date: 2008-07-01 00:01:47 UTC
  • Revision ID: michael.hudson@canonical.com-20080701000147-6zcs0d0rhsjzaknr
more style and dead code removal

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
import logging
4
4
import time
5
5
 
6
 
import bzrlib.revision
7
 
import bzrlib.tsort
 
6
from bzrlib.revision import is_null, NULL_REVISION
 
7
from bzrlib.tsort import merge_sort
8
8
 
9
9
 
10
10
def _strip_NULL_ghosts(revision_graph):
11
11
    """
12
 
    Copied over from bzrlib meant as a temporary workaround deprecated 
13
 
    methods.
 
12
    Copied over from bzrlib meant as a temporary workaround for
 
13
    deprecated methods.
14
14
    """
15
15
    # Filter ghosts, and null:
16
 
    if bzrlib.revision.NULL_REVISION in revision_graph:
17
 
        del revision_graph[bzrlib.revision.NULL_REVISION]
 
16
    if NULL_REVISION in revision_graph:
 
17
        del revision_graph[NULL_REVISION]
18
18
    for key, parents in revision_graph.items():
19
19
        revision_graph[key] = tuple(parent for parent in parents if parent
20
20
            in revision_graph)
36
36
    _full_history = []
37
37
    _revision_info = {}
38
38
    _revno_revid = {}
39
 
    if bzrlib.revision.is_null(last_revid):
 
39
    if is_null(last_revid):
40
40
        _merge_sort = []
41
41
    else:
42
 
        _merge_sort = bzrlib.tsort.merge_sort(
 
42
        _merge_sort = merge_sort(
43
43
            _revision_graph, last_revid, generate_revno=True)
44
44
 
45
45
    for (seq, revid, merge_depth, revno, end_of_merge) in _merge_sort:
49
49
        _revision_info[revid] = (
50
50
            seq, revid, merge_depth, revno_str, end_of_merge)
51
51
 
52
 
    # cache merge info
53
52
    _where_merged = {}
54
53
 
55
54
    for revid in _revision_graph.keys():