/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/blackbox/test_versioning.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2007, 2009-2012, 2016 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2009-2012 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
22
22
 
23
23
import os
24
24
 
25
 
from breezy.branch import Branch
26
 
from breezy.osutils import pathjoin
27
 
from breezy.tests import TestCaseInTempDir, TestCaseWithTransport
28
 
from breezy.trace import mutter
29
 
from breezy.workingtree import WorkingTree
 
25
from bzrlib.branch import Branch
 
26
from bzrlib.osutils import pathjoin
 
27
from bzrlib.tests import TestCaseInTempDir, TestCaseWithTransport
 
28
from bzrlib.trace import mutter
 
29
from bzrlib.workingtree import WorkingTree
30
30
 
31
31
 
32
32
class TestMkdir(TestCaseWithTransport):
42
42
        self.assertPathDoesNotExist('abc')
43
43
 
44
44
    def test_mkdir(self):
45
 
        """Basic 'brz mkdir' operation"""
 
45
        """Basic 'bzr mkdir' operation"""
46
46
 
47
47
        self.make_branch_and_tree('.')
48
48
        self.run_bzr(['mkdir', 'foo'])
49
 
        self.assertTrue(os.path.isdir('foo'))
 
49
        self.assert_(os.path.isdir('foo'))
50
50
 
51
51
        self.run_bzr(['mkdir', 'foo'], retcode=3)
52
52
 
56
56
 
57
57
        self.log('delta.added = %r' % delta.added)
58
58
 
59
 
        self.assertEqual(len(delta.added), 1)
60
 
        self.assertEqual(delta.added[0][0], 'foo')
 
59
        self.assertEquals(len(delta.added), 1)
 
60
        self.assertEquals(delta.added[0][0], 'foo')
61
61
        self.assertFalse(delta.modified)
62
62
 
63
63
    def test_mkdir_in_subdir(self):
64
 
        """'brz mkdir' operation in subdirectory"""
 
64
        """'bzr mkdir' operation in subdirectory"""
65
65
 
66
66
        self.make_branch_and_tree('.')
67
67
        self.run_bzr(['mkdir', 'dir'])
68
 
        self.assertTrue(os.path.isdir('dir'))
 
68
        self.assert_(os.path.isdir('dir'))
69
69
 
70
70
        self.log('Run mkdir in subdir')
71
71
        self.run_bzr(['mkdir', 'subdir'], working_dir='dir')
72
 
        self.assertTrue(os.path.isdir('dir/subdir'))
 
72
        self.assert_(os.path.isdir('dir/subdir'))
73
73
 
74
74
        wt = WorkingTree.open('.')
75
75
 
77
77
 
78
78
        self.log('delta.added = %r' % delta.added)
79
79
 
80
 
        self.assertEqual(len(delta.added), 2)
81
 
        self.assertEqual(delta.added[0][0], 'dir')
82
 
        self.assertEqual(delta.added[1][0], pathjoin('dir', 'subdir'))
 
80
        self.assertEquals(len(delta.added), 2)
 
81
        self.assertEquals(delta.added[0][0], 'dir')
 
82
        self.assertEquals(delta.added[1][0], pathjoin('dir','subdir'))
83
83
        self.assertFalse(delta.modified)
84
84
 
85
85
    def test_mkdir_w_nested_trees(self):
86
 
        """'brz mkdir' with nested trees"""
 
86
        """'bzr mkdir' with nested trees"""
87
87
 
88
88
        self.make_branch_and_tree('.')
89
89
        self.make_branch_and_tree('a')
99
99
        wt_b = WorkingTree.open('a/b')
100
100
 
101
101
        delta = wt.changes_from(wt.basis_tree())
102
 
        self.assertEqual(len(delta.added), 1)
103
 
        self.assertEqual(delta.added[0][0], 'dir')
 
102
        self.assertEquals(len(delta.added), 1)
 
103
        self.assertEquals(delta.added[0][0], 'dir')
104
104
        self.assertFalse(delta.modified)
105
105
 
106
106
        delta = wt_a.changes_from(wt_a.basis_tree())
107
 
        self.assertEqual(len(delta.added), 1)
108
 
        self.assertEqual(delta.added[0][0], 'dir')
 
107
        self.assertEquals(len(delta.added), 1)
 
108
        self.assertEquals(delta.added[0][0], 'dir')
109
109
        self.assertFalse(delta.modified)
110
110
 
111
111
        delta = wt_b.changes_from(wt_b.basis_tree())
112
 
        self.assertEqual(len(delta.added), 1)
113
 
        self.assertEqual(delta.added[0][0], 'dir')
 
112
        self.assertEquals(len(delta.added), 1)
 
113
        self.assertEquals(delta.added[0][0], 'dir')
114
114
        self.assertFalse(delta.modified)
115
115
 
116
116
    def test_mkdir_quiet(self):
117
 
        """'brz mkdir --quiet' should not print a status message"""
 
117
        """'bzr mkdir --quiet' should not print a status message"""
118
118
 
119
119
        self.make_branch_and_tree('.')
120
120
        out, err = self.run_bzr(['mkdir', '--quiet', 'foo'])
121
 
        self.assertEqual('', err)
122
 
        self.assertEqual('', out)
 
121
        self.assertEquals('', err)
 
122
        self.assertEquals('', out)
123
123
 
124
124
 
125
125
class SubdirCommit(TestCaseWithTransport):
135
135
                ('b/two', contents),
136
136
                ('top', contents),
137
137
                ])
138
 
        set_contents(b'old contents')
 
138
        set_contents('old contents')
139
139
        tree.smart_add(['.'])
140
140
        tree.commit('first revision')
141
 
        set_contents(b'new contents')
 
141
        set_contents('new contents')
142
142
 
143
143
        mutter('start selective subdir commit')
144
144
        self.run_bzr(['commit', 'a', '-m', 'commit a only'])
147
147
        new.lock_read()
148
148
 
149
149
        def get_text_by_path(tree, path):
150
 
            return tree.get_file_text(path)
 
150
            return tree.get_file_text(tree.path2id(path), path)
151
151
 
152
152
        self.assertEqual(get_text_by_path(new, 'b/two'), 'old contents')
153
153
        self.assertEqual(get_text_by_path(new, 'top'), 'old contents')