~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/uncommit.py

  • Committer: Jelmer Vernooij
  • Date: 2011-12-16 19:41:30 UTC
  • mto: This revision was merged to the branch mainline in revision 6433.
  • Revision ID: jelmer@samba.org-20111216194130-mp1js5unwj2e3nbz
Uncommit no longer removes tags if they are part of the working trees pending merges.

Show diffs side-by-side

added added

removed removed

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