~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/missing.py

  • Committer: Patch Queue Manager
  • Date: 2012-10-25 11:13:27 UTC
  • mfrom: (6570.1.6 rubberstamp)
  • Revision ID: pqm@pqm.ubuntu.com-20121025111327-p0ylql0nh9fla0rs
(gz) Set approved revision and vote "Approve" when using lp-propose
 --approve (Jonathan Lange)

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