~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/missing.py

  • Committer: Vincent Ladeuil
  • Date: 2010-12-07 10:16:53 UTC
  • mto: (5575.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 5576.
  • Revision ID: v.ladeuil+lp@free.fr-20101207101653-20iiufih26buvmy3
Use assertLength as it provides a better ouput to debug tests.

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