/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-05-06 11:48:54 UTC
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@jelmer.uk-20180506114854-h4qd9ojaqy8wxjsd
Move .mailmap to root.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from __future__ import absolute_import
20
20
 
21
21
from . import (
22
 
    errors,
23
22
    log,
24
23
    )
 
24
from . import revision as _mod_revision
25
25
 
26
26
 
27
27
def iter_log_revisions(revisions, revision_source, verbose, rev_tag_dict=None):
 
28
    last_tree = revision_source.revision_tree(_mod_revision.NULL_REVISION)
 
29
    last_rev_id = None
 
30
 
28
31
    if rev_tag_dict is None:
29
32
        rev_tag_dict = {}
30
33
    for revno, rev_id, merge_depth in revisions:
63
66
    """
64
67
    if include_merged is None:
65
68
        include_merged = False
66
 
    with local_branch.lock_read(), remote_branch.lock_read():
67
 
        return _find_unmerged(
68
 
            local_branch, remote_branch, restrict=restrict,
69
 
            include_merged=include_merged, backward=backward,
70
 
            local_revid_range=local_revid_range,
71
 
            remote_revid_range=remote_revid_range)
 
69
    local_branch.lock_read()
 
70
    try:
 
71
        remote_branch.lock_read()
 
72
        try:
 
73
            return _find_unmerged(
 
74
                local_branch, remote_branch, restrict=restrict,
 
75
                include_merged=include_merged, backward=backward,
 
76
                local_revid_range=local_revid_range,
 
77
                remote_revid_range=remote_revid_range)
 
78
        finally:
 
79
            remote_branch.unlock()
 
80
    finally:
 
81
        local_branch.unlock()
72
82
 
73
83
 
74
84
def _enumerate_mainline(ancestry, graph, tip_revno, tip, backward=True):
85
95
    """
86
96
    if ancestry is None:
87
97
        return None
88
 
    if not ancestry:  # Empty ancestry, no need to do any work
 
98
    if not ancestry: #Empty ancestry, no need to do any work
89
99
        return []
90
100
 
91
101
    # Optionally, we could make 1 call to graph.get_parent_map with all
99
109
        parent_map = graph.get_parent_map([cur])
100
110
        parents = parent_map.get(cur)
101
111
        if not parents:
102
 
            break  # Ghost, we are done
103
 
        mainline.append(
104
 
            (str(cur_revno) if cur_revno is not None else None, cur, 0))
 
112
            break # Ghost, we are done
 
113
        mainline.append((str(cur_revno), cur, 0))
105
114
        cur = parents[0]
106
 
        if cur_revno is not None:
107
 
            cur_revno -= 1
 
115
        cur_revno -= 1
108
116
    if not backward:
109
117
        mainline.reverse()
110
118
    return mainline
126
134
    """
127
135
    if ancestry is None:
128
136
        return None
129
 
    if not ancestry:  # Empty ancestry, no need to do any work
 
137
    if not ancestry: #Empty ancestry, no need to do any work
130
138
        return []
131
139
 
132
140
    merge_sorted_revisions = branch.iter_merge_sorted_revisions()
149
157
    if revid_range is None or revs is None:
150
158
        return revs
151
159
    return [rev for rev in revs
152
 
            if graph.is_between(rev[1], revid_range[0], revid_range[1])]
 
160
        if graph.is_between(rev[1], revid_range[0], revid_range[1])]
153
161
 
154
162
 
155
163
def _find_unmerged(local_branch, remote_branch, restrict,
159
167
 
160
168
    The branches should already be locked before entering.
161
169
    """
162
 
    try:
163
 
        local_revno, local_revision_id = local_branch.last_revision_info()
164
 
    except (errors.UnsupportedOperation, errors.GhostRevisionsHaveNoRevno):
165
 
        local_revno = None
166
 
        local_revision_id = local_branch.last_revision()
167
 
    try:
168
 
        remote_revno, remote_revision_id = remote_branch.last_revision_info()
169
 
    except (errors.UnsupportedOperation, errors.GhostRevisionsHaveNoRevno):
170
 
        remote_revision_id = remote_branch.last_revision()
171
 
        remote_revno = None
172
 
 
173
 
    if local_revision_id == remote_revision_id:
 
170
    local_revno, local_revision_id = local_branch.last_revision_info()
 
171
    remote_revno, remote_revision_id = remote_branch.last_revision_info()
 
172
    if local_revno == remote_revno and local_revision_id == remote_revision_id:
174
173
        # A simple shortcut when the tips are at the same point
175
174
        return [], []
176
175
    graph = local_branch.repository.get_graph(remote_branch.repository)
202
201
                                     local_revision_id, backward)
203
202
        remotes = _enumerate_mainline(remote_extra, graph, remote_revno,
204
203
                                      remote_revision_id, backward)
205
 
    return _filter_revs(graph, locals, local_revid_range), _filter_revs(
206
 
        graph, remotes, remote_revid_range)
 
204
    return _filter_revs(graph, locals, local_revid_range), _filter_revs(graph,
 
205
        remotes, remote_revid_range)
207
206
 
208
207
 
209
208
def sorted_revisions(revisions, history_map):