~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/uncommit.py

  • Committer: Patch Queue Manager
  • Date: 2015-12-17 18:39:00 UTC
  • mfrom: (6606.1.2 fix-float)
  • Revision ID: pqm@pqm.ubuntu.com-20151217183900-0719du2uv1kwu3lc
(vila) Inline testtools private method to fix an issue in xenial (the
 private implementation has changed in an backward incompatible way).
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Remove the last revision from the history of the current branch."""
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
# TODO: make the guts of this methods on tree, branch.
20
22
 
21
23
from bzrlib import (
26
28
from bzrlib.errors import BoundBranchOutOfDate
27
29
 
28
30
 
29
 
def remove_tags(branch, graph, old_tip, new_tip):
 
31
def remove_tags(branch, graph, old_tip, parents):
30
32
    """Remove tags on revisions between old_tip and new_tip.
31
33
 
32
34
    :param branch: Branch to remove tags from
33
35
    :param graph: Graph object for branch repository
34
36
    :param old_tip: Old branch tip
35
 
    :param new_tip: New branch tip
 
37
    :param parents: New parents
36
38
    :return: Names of the removed tags
37
39
    """
38
40
    reverse_tags = branch.tags.get_reverse_tag_dict()
39
 
    ancestors = graph.find_unique_ancestors(old_tip, [new_tip])
 
41
    ancestors = graph.find_unique_ancestors(old_tip, parents)
40
42
    removed_tags = []
41
43
    for revid, tags in reverse_tags.iteritems():
42
44
        if not revid in ancestors:
128
130
                    hook_new_tip = None
129
131
                hook(hook_local, hook_master, old_revno, old_tip, new_revno,
130
132
                     hook_new_tip)
131
 
            if branch.supports_tags() and not keep_tags:
132
 
                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 = []
133
137
            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
138
                parents.extend(reversed(pending_merges))
139
139
                tree.set_parent_ids(parents)
 
140
            if branch.supports_tags() and not keep_tags:
 
141
                remove_tags(branch, graph, old_tip, parents)
140
142
    finally:
141
143
        for item in reversed(unlockable):
142
144
            item.unlock()