/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/tests/branch_implementations/test_push.py

Merge with stacked-fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
153
153
        self.assertEqual(tree.branch.last_revision(),
154
154
                         to_branch.last_revision())
155
155
 
 
156
    def test_push_overwrite_of_non_tip_with_stop_revision(self):
 
157
        """Combining the stop_revision and overwrite options works.
 
158
        
 
159
        This was <https://bugs.launchpad.net/bzr/+bug/234229>.
 
160
        """
 
161
        source = self.make_branch_and_tree('source')
 
162
        target = self.make_branch('target')
 
163
 
 
164
        source.commit('1st commit')
 
165
        source.branch.push(target)
 
166
        source.commit('2nd commit', rev_id='rev-2')
 
167
        source.commit('3rd commit')
 
168
 
 
169
        source.branch.push(target, stop_revision='rev-2', overwrite=True)
 
170
        self.assertEqual('rev-2', target.last_revision())
 
171
 
156
172
 
157
173
class TestPushHook(TestCaseWithBranch):
158
174
 
182
198
    def test_post_push_empty_history(self):
183
199
        target = self.make_branch('target')
184
200
        source = self.make_branch('source')
185
 
        Branch.hooks.install_hook('post_push', self.capture_post_push_hook)
 
201
        Branch.hooks.install_named_hook('post_push',
 
202
                                        self.capture_post_push_hook, None)
186
203
        source.push(target)
187
204
        # with nothing there we should still get a notification, and
188
205
        # have both branches locked at the notification time.
210
227
            local = BzrDir.create_branch_convenience('local2')
211
228
            local.bind(target)
212
229
        source = self.make_branch('source')
213
 
        Branch.hooks.install_hook('post_push', self.capture_post_push_hook)
 
230
        Branch.hooks.install_named_hook('post_push',
 
231
                                        self.capture_post_push_hook, None)
214
232
        source.push(local)
215
233
        # with nothing there we should still get a notification, and
216
234
        # have both branches locked at the notification time.
229
247
        sourcedir = target.bzrdir.clone(self.get_url('source'))
230
248
        source = MemoryTree.create_on_branch(sourcedir.open_branch())
231
249
        rev2 = source.commit('rev 2')
232
 
        Branch.hooks.install_hook('post_push', self.capture_post_push_hook)
 
250
        Branch.hooks.install_named_hook('post_push',
 
251
                                        self.capture_post_push_hook, None)
233
252
        source.branch.push(target.branch)
234
253
        # with nothing there we should still get a notification, and
235
254
        # have both branches locked at the notification time.