~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/missing.py

  • Committer: Marius Kruger
  • Date: 2009-01-01 11:06:37 UTC
  • mto: (3969.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 3970.
  • Revision ID: amanic@gmail.com-20090101110637-t6d0xytq2gyiquji
add support to filter on local and remote revisions

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
 
54
54
 
55
55
def find_unmerged(local_branch, remote_branch, restrict='all',
56
 
                  include_merges=False, backward=False, revid_range=None):
 
56
                  include_merges=False, backward=False,
 
57
                  local_revid_range=None, remote_revid_range=None):
57
58
    """Find revisions from each side that have not been merged.
58
59
 
59
60
    :param local_branch: Compare the history of local_branch
78
79
            return _find_unmerged(
79
80
                local_branch, remote_branch, restrict=restrict,
80
81
                include_merges=include_merges, backward=backward,
81
 
                revid_range=revid_range)
 
82
                local_revid_range=local_revid_range,
 
83
                remote_revid_range= remote_revid_range)
82
84
        finally:
83
85
            remote_branch.unlock()
84
86
    finally:
181
183
        revid1, revid2 = revid_range
182
184
    else:
183
185
        revid1 = revid2 = None
184
 
 
 
186
    print branch.nick, revid_range, branch.revision_id_to_revno(revision_id), revision_id 
185
187
    # check if older than lower bound
186
188
    if (revid1 is not None and graph.is_ancestor(revision_id, revid1)
187
189
        and revid1 in branch.revision_history()):
191
193
    if (revid2 is not None and graph.is_ancestor(revid2, revision_id)
192
194
        and revid2 in branch.revision_history()):
193
195
        revision_id = revid2
 
196
    print "--> ", branch.revision_id_to_revno(revision_id), revision_id 
194
197
    return branch.revision_id_to_revno(revision_id), revision_id
195
198
 
196
199
 
197
200
def _find_unmerged(local_branch, remote_branch, restrict,
198
 
                   include_merges, backward, revid_range=None):
 
201
                   include_merges, backward,
 
202
                   local_revid_range=None, remote_revid_range=None):
199
203
    """See find_unmerged.
200
204
 
201
205
    The branches should already be locked before entering.
208
212
    graph = local_branch.repository.get_graph(remote_branch.repository)
209
213
 
210
214
    local_revno, local_revision_id = _get_revid_in_range(local_branch,
211
 
        graph, revid_range, local_revision_id)
 
215
        graph, local_revid_range, local_revision_id)
212
216
    remote_revno, remote_revision_id = _get_revid_in_range(remote_branch,
213
 
        graph, revid_range, remote_revision_id)
 
217
        graph, remote_revid_range, remote_revision_id)
214
218
    if restrict == 'remote':
215
219
        local_extra = None
216
220
        remote_extra = graph.find_unique_ancestors(remote_revision_id,
225
229
                             ' "remote": %r' % (restrict,))
226
230
        local_extra, remote_extra = graph.find_difference(local_revision_id,
227
231
                                                          remote_revision_id)
 
232
    #Todo: filter extra revisions to be in the range  
228
233
    if include_merges:
229
234
        locals = _enumerate_with_merges(local_branch, local_extra,
230
235
                                        graph, local_revno,