/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 bzrlib/missing.py

  • Committer: John Arbash Meinel
  • Date: 2008-05-20 02:34:01 UTC
  • mto: This revision was merged to the branch mainline in revision 3441.
  • Revision ID: john@arbash-meinel.com-20080520023401-42mkw5g7dhq9f5bh
review feedback from Ian

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 
44
44
 
45
45
def find_unmerged(local_branch, remote_branch, restrict='all'):
 
46
    """Find revisions from each side that have not been merged.
 
47
 
 
48
    :param local_branch: Compare the history of local_branch
 
49
    :param remote_branch: versus the history of remote_branch, and determine
 
50
        mainline revisions which have not been merged.
 
51
    :param restrict: ('all', 'local', 'remote') If 'all', we will return the
 
52
        unique revisions from both sides. If 'local', we will return None
 
53
        for the remote revisions, similarly if 'remote' we will return None for
 
54
        the local revisions.
 
55
 
 
56
    :return: A list of [(revno, revision_id)] for the mainline revisions on
 
57
        each side.
 
58
    """
46
59
    local_branch.lock_read()
47
60
    try:
48
61
        remote_branch.lock_read()
61
74
    :param ancestry: A set of revisions that we care about
62
75
    :param graph: A Graph which lets us find the parents for a revision
63
76
    :param tip_revno: The revision number for the tip revision
64
 
    :param tip: The tip of mailine
 
77
    :param tip: The tip of mainline
65
78
    :return: [(revno, revision_id)] for all revisions in ancestry that
66
 
        left-hand parents from tip
 
79
        are left-hand parents from tip, or None if ancestry is None.
67
80
    """
68
81
    if ancestry is None:
69
82
        return None
90
103
 
91
104
 
92
105
def _find_unmerged(local_branch, remote_branch, restrict):
93
 
    """Find revisions from each side that have not been merged.
94
 
 
95
 
    Both branches should already be locked.
96
 
 
97
 
    :param local_branch: Compare the history of local_branch
98
 
    :param remote_branch: versus the history of remote_branch, and determine
99
 
        mainline revisions which have not been merged.
100
 
    :param restrict: ('all', 'local', 'remote') If 'all', we will return the
101
 
        unique revisions from both sides. If 'local', we will return None
102
 
        for the remote revisions, similarly if 'remote' we will return None for
103
 
        the local revisions.
104
 
 
105
 
    :return: A list of [(revno, revision_id)] for the mainline revisions on
106
 
        each side.
 
106
    """See find_unmerged.
 
107
 
 
108
    The branches should already be locked before entering.
107
109
    """
108
 
    graph = local_branch.repository.get_graph(
109
 
                remote_branch.repository)
110
110
    local_revno, local_revision_id = local_branch.last_revision_info()
111
111
    remote_revno, remote_revision_id = remote_branch.last_revision_info()
112
112
    if local_revno == remote_revno and local_revision_id == remote_revision_id:
113
113
        # A simple shortcut when the tips are at the same point
114
114
        return [], []
 
115
    graph = local_branch.repository.get_graph(
 
116
                remote_branch.repository)
115
117
    if restrict == 'remote':
116
118
        local_extra = None
117
119
        remote_extra = graph.find_unique_ancestors(