~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_uncommit.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-17 18:13:57 UTC
  • mfrom: (5268.7.29 transport-segments)
  • Revision ID: pqm@pqm.ubuntu.com-20110817181357-y5q5eth1hk8bl3om
(jelmer) Allow specifying the colocated branch to use in the branch URL,
 and retrieving the branch name using ControlDir._get_selected_branch.
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
        # If this tree isn't bound, local=True raises an exception
97
97
        self.assertRaises(errors.LocalRequiresBoundBranch,
98
98
            uncommit.uncommit, tree.branch, tree=tree, local=True)
99
 
 
100
 
    def test_uncommit_remove_tags(self):
101
 
        tree, history = self.make_linear_tree()
102
 
        self.assertEqual(history[1], tree.last_revision())
103
 
        self.assertEqual((2, history[1]), tree.branch.last_revision_info())
104
 
        tree.branch.tags.set_tag(u"pointsatexisting", history[0])
105
 
        tree.branch.tags.set_tag(u"pointsatremoved", history[1])
106
 
        uncommit.uncommit(tree.branch, tree=tree)
107
 
        self.assertEqual(history[0], tree.last_revision())
108
 
        self.assertEqual((1, history[0]), tree.branch.last_revision_info())
109
 
        self.assertEqual({
110
 
            "pointsatexisting": history[0]
111
 
            }, tree.branch.tags.get_tag_dict())
112
 
 
113
 
    def test_uncommit_remove_tags_keeps_pending_merges(self):
114
 
        tree, history = self.make_linear_tree()
115
 
        copy = tree.bzrdir.sprout('copyoftree').open_workingtree()
116
 
        copy.commit(message='merged', rev_id='merged')
117
 
        tree.merge_from_branch(copy.branch)
118
 
        tree.branch.tags.set_tag('pointsatmerged', 'merged')
119
 
        history.append(tree.commit('merge'))
120
 
        self.assertEquals('merged', tree.branch.tags.lookup_tag('pointsatmerged'))
121
 
        self.assertEqual(history[2], tree.last_revision())
122
 
        self.assertEqual((3, history[2]), tree.branch.last_revision_info())
123
 
        tree.branch.tags.set_tag(u"pointsatexisting", history[1])
124
 
        tree.branch.tags.set_tag(u"pointsatremoved", history[2])
125
 
        uncommit.uncommit(tree.branch, tree=tree)
126
 
        self.assertEqual(history[1], tree.last_revision())
127
 
        self.assertEqual((2, history[1]), tree.branch.last_revision_info())
128
 
        self.assertEquals([history[1], 'merged'], tree.get_parent_ids())
129
 
        self.assertEqual({
130
 
            "pointsatexisting": history[1],
131
 
            "pointsatmerged": 'merged',
132
 
            }, tree.branch.tags.get_tag_dict())
133
 
 
134
 
    def test_uncommit_keep_tags(self):
135
 
        tree, history = self.make_linear_tree()
136
 
        self.assertEqual(history[1], tree.last_revision())
137
 
        self.assertEqual((2, history[1]), tree.branch.last_revision_info())
138
 
        tree.branch.tags.set_tag(u"pointsatexisting", history[0])
139
 
        tree.branch.tags.set_tag(u"pointsatremoved", history[1])
140
 
        uncommit.uncommit(tree.branch, tree=tree, keep_tags=True)
141
 
        self.assertEqual(history[0], tree.last_revision())
142
 
        self.assertEqual((1, history[0]), tree.branch.last_revision_info())
143
 
        self.assertEqual({
144
 
            "pointsatexisting": history[0],
145
 
            "pointsatremoved": history[1],
146
 
            }, tree.branch.tags.get_tag_dict())