~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/uncommit.py

(jelmer) Keep tags for pending merges while uncommitting (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
from bzrlib.errors import BoundBranchOutOfDate
29
29
 
30
30
 
31
 
def remove_tags(branch, graph, old_tip, new_tip):
 
31
def remove_tags(branch, graph, old_tip, parents):
32
32
    """Remove tags on revisions between old_tip and new_tip.
33
33
 
34
34
    :param branch: Branch to remove tags from
35
35
    :param graph: Graph object for branch repository
36
36
    :param old_tip: Old branch tip
37
 
    :param new_tip: New branch tip
 
37
    :param parents: New parents
38
38
    :return: Names of the removed tags
39
39
    """
40
40
    reverse_tags = branch.tags.get_reverse_tag_dict()
41
 
    ancestors = graph.find_unique_ancestors(old_tip, [new_tip])
 
41
    ancestors = graph.find_unique_ancestors(old_tip, parents)
42
42
    removed_tags = []
43
43
    for revid, tags in reverse_tags.iteritems():
44
44
        if not revid in ancestors:
130
130
                    hook_new_tip = None
131
131
                hook(hook_local, hook_master, old_revno, old_tip, new_revno,
132
132
                     hook_new_tip)
133
 
            if branch.supports_tags() and not keep_tags:
134
 
                remove_tags(branch, graph, old_tip, new_revision_id)
 
133
            if not _mod_revision.is_null(new_revision_id):
 
134
                parents = [new_revision_id]
 
135
            else:
 
136
                parents = []
135
137
            if tree is not None:
136
 
                if not _mod_revision.is_null(new_revision_id):
137
 
                    parents = [new_revision_id]
138
 
                else:
139
 
                    parents = []
140
138
                parents.extend(reversed(pending_merges))
141
139
                tree.set_parent_ids(parents)
 
140
            if branch.supports_tags() and not keep_tags:
 
141
                remove_tags(branch, graph, old_tip, parents)
142
142
    finally:
143
143
        for item in reversed(unlockable):
144
144
            item.unlock()