/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/missing.py

  • Committer: Jelmer Vernooij
  • Date: 2018-06-14 17:59:16 UTC
  • mto: This revision was merged to the branch mainline in revision 7065.
  • Revision ID: jelmer@jelmer.uk-20180614175916-a2e2xh5k533guq1x
Move breezy.plugins.git to breezy.git.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Display what revisions are missing in 'other' from 'this' and vice versa."""
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
from . import (
20
22
    errors,
21
23
    log,
22
24
    )
 
25
from . import revision as _mod_revision
23
26
 
24
27
 
25
28
def iter_log_revisions(revisions, revision_source, verbose, rev_tag_dict=None):
 
29
    last_tree = revision_source.revision_tree(_mod_revision.NULL_REVISION)
 
30
    last_rev_id = None
 
31
 
26
32
    if rev_tag_dict is None:
27
33
        rev_tag_dict = {}
28
34
    for revno, rev_id, merge_depth in revisions:
61
67
    """
62
68
    if include_merged is None:
63
69
        include_merged = False
64
 
    with local_branch.lock_read(), remote_branch.lock_read():
65
 
        return _find_unmerged(
66
 
            local_branch, remote_branch, restrict=restrict,
67
 
            include_merged=include_merged, backward=backward,
68
 
            local_revid_range=local_revid_range,
69
 
            remote_revid_range=remote_revid_range)
 
70
    local_branch.lock_read()
 
71
    try:
 
72
        remote_branch.lock_read()
 
73
        try:
 
74
            return _find_unmerged(
 
75
                local_branch, remote_branch, restrict=restrict,
 
76
                include_merged=include_merged, backward=backward,
 
77
                local_revid_range=local_revid_range,
 
78
                remote_revid_range=remote_revid_range)
 
79
        finally:
 
80
            remote_branch.unlock()
 
81
    finally:
 
82
        local_branch.unlock()
70
83
 
71
84
 
72
85
def _enumerate_mainline(ancestry, graph, tip_revno, tip, backward=True):
83
96
    """
84
97
    if ancestry is None:
85
98
        return None
86
 
    if not ancestry:  # Empty ancestry, no need to do any work
 
99
    if not ancestry: #Empty ancestry, no need to do any work
87
100
        return []
88
101
 
89
102
    # Optionally, we could make 1 call to graph.get_parent_map with all
97
110
        parent_map = graph.get_parent_map([cur])
98
111
        parents = parent_map.get(cur)
99
112
        if not parents:
100
 
            break  # Ghost, we are done
101
 
        mainline.append(
102
 
            (str(cur_revno) if cur_revno is not None else None, cur, 0))
 
113
            break # Ghost, we are done
 
114
        mainline.append((str(cur_revno) if cur_revno is not None else None, cur, 0))
103
115
        cur = parents[0]
104
116
        if cur_revno is not None:
105
117
            cur_revno -= 1
124
136
    """
125
137
    if ancestry is None:
126
138
        return None
127
 
    if not ancestry:  # Empty ancestry, no need to do any work
 
139
    if not ancestry: #Empty ancestry, no need to do any work
128
140
        return []
129
141
 
130
142
    merge_sorted_revisions = branch.iter_merge_sorted_revisions()
147
159
    if revid_range is None or revs is None:
148
160
        return revs
149
161
    return [rev for rev in revs
150
 
            if graph.is_between(rev[1], revid_range[0], revid_range[1])]
 
162
        if graph.is_between(rev[1], revid_range[0], revid_range[1])]
151
163
 
152
164
 
153
165
def _find_unmerged(local_branch, remote_branch, restrict,
200
212
                                     local_revision_id, backward)
201
213
        remotes = _enumerate_mainline(remote_extra, graph, remote_revno,
202
214
                                      remote_revision_id, backward)
203
 
    return _filter_revs(graph, locals, local_revid_range), _filter_revs(
204
 
        graph, remotes, remote_revid_range)
 
215
    return _filter_revs(graph, locals, local_revid_range), _filter_revs(graph,
 
216
        remotes, remote_revid_range)
205
217
 
206
218
 
207
219
def sorted_revisions(revisions, history_map):