bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
7490.139.8
by Jelmer Vernooij
Handle duplicate directories entries for git. |
1 |
# Copyright (C) 2020 Jelmer Vernooij <jelmer@jelmer.uk>
|
2 |
#
|
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16 |
||
17 |
"""Tests for tree transform."""
|
|
18 |
||
19 |
from __future__ import absolute_import |
|
20 |
||
21 |
import os |
|
22 |
||
23 |
from ...transform import ROOT_PARENT, conflict_pass, resolve_conflicts |
|
24 |
from . import TestCaseWithTransport |
|
25 |
||
26 |
||
27 |
class GitTransformTests(TestCaseWithTransport): |
|
28 |
||
29 |
def test_directory_exists(self): |
|
30 |
tree = self.make_branch_and_tree('.', format='git') |
|
31 |
tt = tree.transform() |
|
32 |
dir1 = tt.new_directory('dir', ROOT_PARENT) |
|
33 |
tt.new_file('name1', dir1, [b'content1']) |
|
34 |
dir2 = tt.new_directory('dir', ROOT_PARENT) |
|
35 |
tt.new_file('name2', dir2, [b'content2']) |
|
36 |
raw_conflicts = resolve_conflicts( |
|
37 |
tt, None, lambda t, c: conflict_pass(t, c)) |
|
38 |
conflicts = tt.cook_conflicts(raw_conflicts) |
|
39 |
self.assertEqual([], list(conflicts)) |
|
40 |
tt.apply() |
|
41 |
self.assertEqual(set(['name1', 'name2']), set(os.listdir('dir'))) |