コード例 #1
0
 def test_select_conflicts(self):
     tree = self.make_branch_and_tree('.')
     tree_conflicts = ConflictList(
         [ContentsConflict('foo'),
          ContentsConflict('bar')])
     self.assertEqual(
         (ConflictList([ContentsConflict('bar')
                        ]), ConflictList([ContentsConflict('foo')])),
         tree_conflicts.select_conflicts(tree, ['foo']))
     self.assertEqual((ConflictList(), tree_conflicts),
                      tree_conflicts.select_conflicts(tree, [''],
                                                      ignore_misses=True,
                                                      recurse=True))
     tree_conflicts = ConflictList(
         [ContentsConflict('foo/baz'),
          ContentsConflict('bar')])
     self.assertEqual(
         (ConflictList([ContentsConflict('bar')
                        ]), ConflictList([ContentsConflict('foo/baz')])),
         tree_conflicts.select_conflicts(tree, ['foo'],
                                         recurse=True,
                                         ignore_misses=True))
     tree_conflicts = ConflictList([PathConflict('qux', 'foo/baz')])
     self.assertEqual((ConflictList(), tree_conflicts),
                      tree_conflicts.select_conflicts(tree, ['foo'],
                                                      recurse=True,
                                                      ignore_misses=True))
     self.assertEqual((tree_conflicts, ConflictList()),
                      tree_conflicts.select_conflicts(tree, ['foo'],
                                                      ignore_misses=True))
コード例 #2
0
 def test_symlink_conflicts(self):
     if sys.platform != "win32":
         builder = MergeBuilder(getcwd())
         builder.add_symlink("2", builder.tree_root, "name2", "target1")
         builder.change_target("2", other="target4", base="text3")
         conflicts = builder.merge()
         self.assertEqual(conflicts,
                          [ContentsConflict('name2', file_id='2')])
         builder.cleanup()
コード例 #3
0
 def contents_test_conflicts(self, merge_factory):
     builder = MergeBuilder(getcwd())
     builder.add_file("1", builder.tree_root, "name1", "text1", True)
     builder.change_contents("1", other="text4", this="text3")
     builder.add_file("2", builder.tree_root, "name2", "text1", True)
     builder.change_contents("2", other="\x00", this="text3")
     builder.add_file("3", builder.tree_root, "name3", "text5", False)
     builder.change_perms("3", this=True)
     builder.change_contents('3', this='moretext')
     builder.remove_file('3', other=True)
     conflicts = builder.merge(merge_factory)
     self.assertEqual(conflicts, [
         TextConflict('name1', file_id='1'),
         ContentsConflict('name2', file_id='2'),
         ContentsConflict('name3', file_id='3')
     ])
     self.assertEqual(builder.this.get_file('2').read(), '\x00')
     builder.cleanup()
コード例 #4
0
 def test_add_conflicts(self):
     tree = self.make_branch_and_tree('tree')
     try:
         tree.add_conflicts([TextConflict('path_a')])
     except UnsupportedOperation:
         raise TestSkipped('unsupported operation')
     self.assertEqual(ConflictList([TextConflict('path_a')]),
                      tree.conflicts())
     tree.add_conflicts([TextConflict('path_a')])
     self.assertEqual(ConflictList([TextConflict('path_a')]),
                      tree.conflicts())
     tree.add_conflicts([ContentsConflict('path_a')])
     self.assertEqual(
         ConflictList([ContentsConflict('path_a'),
                       TextConflict('path_a')]), tree.conflicts())
     tree.add_conflicts([TextConflict('path_b')])
     self.assertEqual(
         ConflictList([
             ContentsConflict('path_a'),
             TextConflict('path_a'),
             TextConflict('path_b')
         ]), tree.conflicts())
コード例 #5
0
ファイル: test_merge.py プロジェクト: Techlord-RCE/cygwin
 def test_merge_kind_change(self):
     tree_a = self.make_branch_and_tree('tree_a')
     self.build_tree_contents([('tree_a/file', 'content_1')])
     tree_a.add('file', 'file-id')
     tree_a.commit('added file')
     tree_b = tree_a.bzrdir.sprout('tree_b').open_workingtree()
     os.unlink('tree_a/file')
     self.build_tree(['tree_a/file/'])
     tree_a.commit('changed file to directory')
     os.chdir('tree_b')
     self.run_bzr('merge ../tree_a')
     self.assertEqual('directory', file_kind('file'))
     tree_b.revert()
     self.assertEqual('file', file_kind('file'))
     self.build_tree_contents([('file', 'content_2')])
     tree_b.commit('content change')
     self.run_bzr('merge ../tree_a', retcode=1)
     self.assertEqual(tree_b.conflicts(),
                      [ContentsConflict('file', file_id='file-id')])
コード例 #6
0
    resolve,
    restore,
)
from bzrlib.errors import NotConflicted

# TODO: Test commit with some added, and added-but-missing files
# RBC 20060124 is that not tested in test_commit.py ?

# The order of 'path' here is important - do not let it
# be a sorted list.
# u'\xe5' == a with circle
# '\xc3\xae' == u'\xee' == i with hat
# So these are u'pathg' and 'idg' only with a circle and a hat. (shappo?)
example_conflicts = ConflictList([
    MissingParent('Not deleting', u'p\xe5thg', '\xc3\xaedg'),
    ContentsConflict(u'p\xe5tha', None, '\xc3\xaeda'),
    TextConflict(u'p\xe5tha'),
    PathConflict(u'p\xe5thb', u'p\xe5thc', '\xc3\xaedb'),
    DuplicateID('Unversioned existing file', u'p\xe5thc', u'p\xe5thc2',
                '\xc3\xaedc', '\xc3\xaedc'),
    DuplicateEntry('Moved existing file to', u'p\xe5thdd.moved', u'p\xe5thd',
                   '\xc3\xaedd', None),
    ParentLoop('Cancelled move', u'p\xe5the', u'p\xe5th2e', None,
               '\xc3\xaed2e'),
    UnversionedParent('Versioned directory', u'p\xe5thf', '\xc3\xaedf'),
    NonDirectoryParent('Created directory', u'p\xe5thg', '\xc3\xaedg'),
])


class TestConflicts(TestCaseWithTransport):
    def test_conflicts(self):