/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 breezy/tests/blackbox/test_cp.py

  • Committer: Jelmer Vernooij
  • Date: 2020-04-05 19:11:34 UTC
  • mto: (7490.7.16 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200405191134-0aebh8ikiwygxma5
Populate the .gitignore file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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(
 
42
            ["^brz: ERROR: Could not copy .*unversioned.txt => .*elsewhere."
 
43
             " .*unversioned.txt is not versioned\\.$"],
 
44
            'cp unversioned.txt elsewhere')
 
45
 
 
46
    def test_cp_nonexisting(self):
 
47
        self.run_bzr_error(
 
48
            ["^brz: ERROR: Could not copy .*doesnotexist => .*somewhereelse."
 
49
             " .*doesnotexist is not versioned\\.$"],
 
50
            'cp doesnotexist somewhereelse')
 
51
 
 
52
    def test_cp_unqualified(self):
 
53
        self.run_bzr_error(['^brz: ERROR: missing file argument$'], '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(
 
61
            ["^brz: ERROR: Could not copy test.txt => sub1/test.txt: "
 
62
                "sub1 is not versioned\\.$"],
 
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
 
 
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')
 
86
        self.assertInWorkingTree('sub1')
 
87
        self.assertInWorkingTree('sub1/hello.txt')
 
88
        self.assertInWorkingTree('sub2')
 
89
        self.assertInWorkingTree('sub2/hello.txt')
 
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')