bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
6829.4.1
by Jelmer Vernooij
Initial work on a 'brz cp'. |
1 |
# Copyright (C) 2017 The Breezy Developers
|
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 |
"""Test for 'brz mv'"""
|
|
18 |
||
19 |
import os |
|
20 |
||
21 |
import breezy.branch |
|
22 |
from breezy import ( |
|
23 |
osutils, |
|
24 |
workingtree, |
|
25 |
)
|
|
26 |
||
27 |
from breezy.tests import ( |
|
28 |
TestCaseWithTransport, |
|
29 |
)
|
|
30 |
from breezy.tests.features import ( |
|
31 |
CaseInsensitiveFilesystemFeature, |
|
32 |
SymlinkFeature, |
|
33 |
UnicodeFilenameFeature, |
|
34 |
)
|
|
35 |
||
36 |
||
37 |
class TestCopy(TestCaseWithTransport): |
|
38 |
||
39 |
def test_cp_unversioned(self): |
|
40 |
self.build_tree(['unversioned.txt']) |
|
41 |
self.run_bzr_error( |
|
|
7027.10.1
by Jelmer Vernooij
Various blackbox test fixes. |
42 |
["^brz: ERROR: Could not copy .*unversioned.txt => .*elsewhere." |
43 |
" .*unversioned.txt is not versioned\\.$"], |
|
|
6829.4.1
by Jelmer Vernooij
Initial work on a 'brz cp'. |
44 |
'cp unversioned.txt elsewhere') |
45 |
||
46 |
def test_cp_nonexisting(self): |
|
47 |
self.run_bzr_error( |
|
|
7027.10.1
by Jelmer Vernooij
Various blackbox test fixes. |
48 |
["^brz: ERROR: Could not copy .*doesnotexist => .*somewhereelse." |
49 |
" .*doesnotexist is not versioned\\.$"], |
|
|
6829.4.1
by Jelmer Vernooij
Initial work on a 'brz cp'. |
50 |
'cp doesnotexist somewhereelse') |
51 |
||
52 |
def test_cp_unqualified(self): |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
53 |
self.run_bzr_error(['^brz: ERROR: missing file argument$'], 'cp') |
|
6829.4.1
by Jelmer Vernooij
Initial work on a 'brz cp'. |
54 |
|
55 |
def test_cp_invalid(self): |
|
56 |
tree = self.make_branch_and_tree('.') |
|
57 |
self.build_tree(['test.txt', 'sub1/']) |
|
58 |
tree.add(['test.txt']) |
|
59 |
||
60 |
self.run_bzr_error( |
|
|
6829.4.2
by Jelmer Vernooij
Add basic cp implementation. |
61 |
["^brz: ERROR: Could not copy test.txt => sub1/test.txt: " |
62 |
"sub1 is not versioned\\.$"], |
|
|
6829.4.1
by Jelmer Vernooij
Initial work on a 'brz cp'. |
63 |
'cp test.txt sub1') |
64 |
||
65 |
self.run_bzr_error( |
|
66 |
["^brz: ERROR: Could not copy test.txt => .*hello.txt: " |
|
67 |
"sub1 is not versioned\\.$"], |
|
68 |
'cp test.txt sub1/hello.txt') |
|
69 |
||
70 |
def test_cp_dir(self): |
|
71 |
tree = self.make_branch_and_tree('.') |
|
72 |
self.build_tree(['hello.txt', 'sub1/']) |
|
73 |
tree.add(['hello.txt', 'sub1']) |
|
74 |
||
|
6829.4.2
by Jelmer Vernooij
Add basic cp implementation. |
75 |
self.run_bzr_error( |
76 |
["^brz: ERROR: Could not copy sub1 => sub2 . " |
|
77 |
"sub1 is a directory\\.$"], |
|
78 |
'cp sub1 sub2') |
|
79 |
||
80 |
def test_cp_file_into(self): |
|
81 |
tree = self.make_branch_and_tree('.') |
|
82 |
self.build_tree(['sub1/', 'sub1/hello.txt', 'sub2/']) |
|
83 |
tree.add(['sub1', 'sub1/hello.txt', 'sub2']) |
|
84 |
||
85 |
self.run_bzr('cp sub1/hello.txt sub2') |
|
|
6829.4.1
by Jelmer Vernooij
Initial work on a 'brz cp'. |
86 |
self.assertInWorkingTree('sub1') |
87 |
self.assertInWorkingTree('sub1/hello.txt') |
|
88 |
self.assertInWorkingTree('sub2') |
|
89 |
self.assertInWorkingTree('sub2/hello.txt') |
|
|
6829.4.2
by Jelmer Vernooij
Add basic cp implementation. |
90 |
|
91 |
def test_cp_file(self): |
|
92 |
tree = self.make_branch_and_tree('.') |
|
93 |
self.build_tree(['hello.txt']) |
|
94 |
tree.add(['hello.txt']) |
|
95 |
||
96 |
self.run_bzr('cp hello.txt hallo.txt') |
|
97 |
self.assertInWorkingTree('hello.txt') |
|
98 |
self.assertInWorkingTree('hallo.txt') |