~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_merger.py

  • Committer: Vincent Ladeuil
  • Date: 2010-01-20 16:05:28 UTC
  • mto: (4973.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4975.
  • Revision ID: v.ladeuil+lp@free.fr-20100120160528-5yo3fbggdp07eovc
Finish the patch based on reviews.

* bzrlib/tests/per_merger.py:
Fix line too long and spurious spaces.

* bzrlib/plugins/news_merge/tests/test_news_merge.py:
(TestFilenameMatchesConfig): Ensure that the params get updated.

* bzrlib/plugins/news_merge/__init__.py:
(filename_matches_config): Save the relevant config variable in
the hook params.
(install_hook): Wrap the hook installation so we can reuse it for
tests.

* bzrlib/plugins/news_merge/README: 
Update the instructions by pointing to the plugin help.

* bzrlib/merge.py:
(MergeHookParams): Delete spurious spaces.

* bzrlib/decorators.py:
(use_pretty_decorators): Mention that we get clearance to copy
launchpad code here (since canonical has copyrights on both code
bases).

Show diffs side-by-side

added added

removed removed

Lines of Context:
142
142
        this_tree = branch.bzrdir.create_workingtree()
143
143
        this_tree.lock_write()
144
144
        self.addCleanup(this_tree.unlock)
145
 
        other_tree = this_tree.bzrdir.sprout('other', 'OTHER-id').open_workingtree()
 
145
        other_tree = this_tree.bzrdir.sprout('other',
 
146
                                             'OTHER-id').open_workingtree()
146
147
        self.do_merge(this_tree, other_tree)
147
148
        if self.merge_type is _mod_merge.LCAMerger:
148
149
            self.expectFailure("lca merge doesn't track deleted lines",
174
175
        deletiondir = transform._deletiondir
175
176
        transform.finalize()
176
177
        return (limbodir, deletiondir)
177
 
    
 
178
 
178
179
    def test_merge_with_existing_limbo(self):
179
180
        wt = self.make_branch_and_tree('this')
180
181
        (limbodir, deletiondir) =  self.get_limbodir_deletiondir(wt)
196
197
    def setUp(self):
197
198
        TestCaseWithTransport.setUp(self)
198
199
        self.hook_log = []
199
 
        
 
200
 
200
201
    def install_hook_noop(self):
201
202
        def hook_na(merge_params):
202
203
            # This hook unconditionally does nothing.
213
214
            return 'not_applicable', None
214
215
        _mod_merge.Merger.hooks.install_named_hook(
215
216
            'merge_file_content', hook_success, 'test hook (success)')
216
 
        
 
217
 
217
218
    def install_hook_conflict(self):
218
219
        def hook_conflict(merge_params):
219
220
            self.hook_log.append(('conflict',))
222
223
            return 'not_applicable', None
223
224
        _mod_merge.Merger.hooks.install_named_hook(
224
225
            'merge_file_content', hook_conflict, 'test hook (delete)')
225
 
        
 
226
 
226
227
    def install_hook_delete(self):
227
228
        def hook_delete(merge_params):
228
229
            self.hook_log.append(('delete',))
231
232
            return 'not_applicable', None
232
233
        _mod_merge.Merger.hooks.install_named_hook(
233
234
            'merge_file_content', hook_delete, 'test hook (delete)')
234
 
        
 
235
 
235
236
    def install_hook_log_lines(self):
236
237
        """Install a hook that saves the get_lines for the this, base and other
237
238
        versions of the file.
255
256
    def create_file_needing_contents_merge(self, builder, file_id):
256
257
        builder.add_file(file_id, builder.tree_root, "name1", "text1", True)
257
258
        builder.change_contents(file_id, other="text4", this="text3")
258
 
        
 
259
 
259
260
    def test_change_vs_change(self):
260
261
        """Hook is used for (changed, changed)"""
261
262
        self.install_hook_success()