~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/missing.py

  • Committer: Patch Queue Manager
  • Date: 2016-04-21 05:06:57 UTC
  • mfrom: (6603.4.1 bzr)
  • Revision ID: pqm@pqm.ubuntu.com-20160421050657-ygnzfybewvudf1j9
(richard-wilbur) Use initial_comment as commit_message for lp_propose.(Shawn
 Wang) (Shawn Wang)

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 bzrlib import (
20
22
    log,
21
 
    repository as _mod_repository,
22
 
    tsort,
 
23
    symbol_versioning,
23
24
    )
24
25
import bzrlib.revision as _mod_revision
25
26
 
26
27
 
27
 
def iter_log_revisions(revisions, revision_source, verbose):
 
28
def iter_log_revisions(revisions, revision_source, verbose, rev_tag_dict=None):
28
29
    last_tree = revision_source.revision_tree(_mod_revision.NULL_REVISION)
29
30
    last_rev_id = None
 
31
 
 
32
    if rev_tag_dict is None:
 
33
        rev_tag_dict = {}
30
34
    for rev in revisions:
31
35
        # We need the following for backward compatibilty (hopefully
32
36
        # this will be deprecated soon :-/) -- vila 080911
40
44
            delta = revision_source.get_revision_delta(rev_id)
41
45
        else:
42
46
            delta = None
43
 
        yield log.LogRevision(rev, revno, merge_depth, delta=delta)
 
47
        yield log.LogRevision(rev, revno, merge_depth, delta=delta,
 
48
                              tags=rev_tag_dict.get(rev_id))
44
49
 
45
50
 
46
51
def find_unmerged(local_branch, remote_branch, restrict='all',
47
 
                  include_merges=False, backward=False,
48
 
                  local_revid_range=None, remote_revid_range=None):
 
52
                  include_merged=None, backward=False,
 
53
                  local_revid_range=None, remote_revid_range=None,
 
54
                  include_merges=symbol_versioning.DEPRECATED_PARAMETER):
49
55
    """Find revisions from each side that have not been merged.
50
56
 
51
57
    :param local_branch: Compare the history of local_branch
55
61
        unique revisions from both sides. If 'local', we will return None
56
62
        for the remote revisions, similarly if 'remote' we will return None for
57
63
        the local revisions.
58
 
    :param include_merges: Show mainline revisions only if False,
 
64
    :param include_merged: Show mainline revisions only if False,
59
65
        all revisions otherwise.
60
66
    :param backward: Show oldest versions first when True, newest versions
61
67
        first when False.
63
69
        revisions (lower bound, upper bound)
64
70
    :param remote_revid_range: Revision-id range for filtering remote_branch
65
71
        revisions (lower bound, upper bound)
 
72
    :param include_merges: Deprecated historical alias for include_merged
66
73
 
67
74
    :return: A list of [(revno, revision_id)] for the mainline revisions on
68
75
        each side.
69
76
    """
 
77
    if symbol_versioning.deprecated_passed(include_merges):
 
78
        symbol_versioning.warn(
 
79
            'include_merges was deprecated in 2.5.'
 
80
            ' Use include_merged instead.',
 
81
            DeprecationWarning, stacklevel=2)
 
82
        if include_merged is None:
 
83
            include_merged = include_merges
 
84
    if include_merged is None:
 
85
        include_merged = False
70
86
    local_branch.lock_read()
71
87
    try:
72
88
        remote_branch.lock_read()
73
89
        try:
74
90
            return _find_unmerged(
75
91
                local_branch, remote_branch, restrict=restrict,
76
 
                include_merges=include_merges, backward=backward,
 
92
                include_merged=include_merged, backward=backward,
77
93
                local_revid_range=local_revid_range,
78
94
                remote_revid_range=remote_revid_range)
79
95
        finally:
162
178
 
163
179
 
164
180
def _find_unmerged(local_branch, remote_branch, restrict,
165
 
                   include_merges, backward,
 
181
                   include_merged, backward,
166
182
                   local_revid_range=None, remote_revid_range=None):
167
183
    """See find_unmerged.
168
184
 
188
204
                             ' "remote": %r' % (restrict,))
189
205
        local_extra, remote_extra = graph.find_difference(local_revision_id,
190
206
                                                          remote_revision_id)
191
 
    if include_merges:
 
207
    if include_merged:
192
208
        locals = _enumerate_with_merges(local_branch, local_extra,
193
209
                                        graph, local_revno,
194
210
                                        local_revision_id, backward)