/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/test_conflicts.py

  • Committer: John Arbash Meinel
  • Date: 2011-01-10 22:20:12 UTC
  • mfrom: (5582 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5599.
  • Revision ID: john@arbash-meinel.com-20110110222012-mtcqudkvmzwiufuc
Merge in the bzr.dev 5582

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
197
197
        self.run_script(self.preamble)
198
198
 
199
199
 
200
 
class TestResolveTextConflicts(TestResolveConflicts):
201
 
    # TBC
202
 
    pass
203
 
 
204
 
 
205
200
def mirror_scenarios(base_scenarios):
206
201
    """Return a list of mirrored scenarios.
207
202
 
372
367
        check_other()
373
368
 
374
369
 
 
370
class TestResolveTextConflicts(TestParametrizedResolveConflicts):
 
371
 
 
372
    _conflict_type = conflicts.TextConflict
 
373
 
 
374
    # Set by the scenarios
 
375
    # path and file-id for the file involved in the conflict
 
376
    _path = None
 
377
    _file_id = None
 
378
 
 
379
    scenarios = mirror_scenarios(
 
380
        [
 
381
            # File modified/deleted
 
382
            (dict(_base_actions='create_file',
 
383
                  _path='file', _file_id='file-id'),
 
384
             ('filed_modified_A',
 
385
              dict(actions='modify_file_A', check='file_has_content_A')),
 
386
             ('file_modified_B',
 
387
              dict(actions='modify_file_B', check='file_has_content_B')),),
 
388
            ])
 
389
 
 
390
    def do_create_file(self):
 
391
        return [('add', ('file', 'file-id', 'file', 'trunk content\n'))]
 
392
 
 
393
    def do_modify_file_A(self):
 
394
        return [('modify', ('file-id', 'trunk content\nfeature A\n'))]
 
395
 
 
396
    def do_modify_file_B(self):
 
397
        return [('modify', ('file-id', 'trunk content\nfeature B\n'))]
 
398
 
 
399
    def check_file_has_content_A(self):
 
400
        self.assertFileEqual('trunk content\nfeature A\n', 'branch/file')
 
401
 
 
402
    def check_file_has_content_B(self):
 
403
        self.assertFileEqual('trunk content\nfeature B\n', 'branch/file')
 
404
 
 
405
    def _get_resolve_path_arg(self, wt, action):
 
406
        return self._path
 
407
 
 
408
    def assertTextConflict(self, wt, c):
 
409
        self.assertEqual(self._file_id, c.file_id)
 
410
        self.assertEqual(self._path, c.path)
 
411
    _assert_conflict = assertTextConflict
 
412
 
 
413
 
375
414
class TestResolveContentsConflict(TestParametrizedResolveConflicts):
376
415
 
377
416
    _conflict_type = conflicts.ContentsConflict