~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_versioning.py

  • Committer: Andrew Bennetts
  • Date: 2010-07-29 11:17:57 UTC
  • mfrom: (5050.3.17 2.2)
  • mto: This revision was merged to the branch mainline in revision 5365.
  • Revision ID: andrew.bennetts@canonical.com-20100729111757-018h3pcefo7z0dnq
Merge lp:bzr/2.2 into lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
        # here locally.
40
40
        shared_repo = self.make_repository('.')
41
41
        self.run_bzr(['mkdir', 'abc'], retcode=3)
42
 
        self.assertPathDoesNotExist('abc')
 
42
        self.failIfExists('abc')
 
43
 
 
44
 
 
45
class TestVersioning(TestCaseInTempDir):
43
46
 
44
47
    def test_mkdir(self):
45
48
        """Basic 'bzr mkdir' operation"""
46
49
 
47
 
        self.make_branch_and_tree('.')
 
50
        self.run_bzr('init')
48
51
        self.run_bzr(['mkdir', 'foo'])
49
52
        self.assert_(os.path.isdir('foo'))
50
53
 
58
61
 
59
62
        self.assertEquals(len(delta.added), 1)
60
63
        self.assertEquals(delta.added[0][0], 'foo')
61
 
        self.assertFalse(delta.modified)
 
64
        self.failIf(delta.modified)
62
65
 
63
66
    def test_mkdir_in_subdir(self):
64
67
        """'bzr mkdir' operation in subdirectory"""
65
68
 
66
 
        self.make_branch_and_tree('.')
 
69
        self.run_bzr('init')
67
70
        self.run_bzr(['mkdir', 'dir'])
68
71
        self.assert_(os.path.isdir('dir'))
69
72
 
82
85
        self.assertEquals(len(delta.added), 2)
83
86
        self.assertEquals(delta.added[0][0], 'dir')
84
87
        self.assertEquals(delta.added[1][0], pathjoin('dir','subdir'))
85
 
        self.assertFalse(delta.modified)
 
88
        self.failIf(delta.modified)
86
89
 
87
90
    def test_mkdir_w_nested_trees(self):
88
91
        """'bzr mkdir' with nested trees"""
89
92
 
90
 
        self.make_branch_and_tree('.')
91
 
        self.make_branch_and_tree('a')
92
 
        self.make_branch_and_tree('a/b')
 
93
        self.run_bzr('init')
 
94
        os.mkdir('a')
 
95
        os.chdir('a')
 
96
        self.run_bzr('init')
 
97
        os.mkdir('b')
 
98
        os.chdir('b')
 
99
        self.run_bzr('init')
 
100
        os.chdir('../..')
93
101
 
94
102
        self.run_bzr(['mkdir', 'dir', 'a/dir', 'a/b/dir'])
95
 
        self.assertTrue(os.path.isdir('dir'))
96
 
        self.assertTrue(os.path.isdir('a/dir'))
97
 
        self.assertTrue(os.path.isdir('a/b/dir'))
 
103
        self.failUnless(os.path.isdir('dir'))
 
104
        self.failUnless(os.path.isdir('a/dir'))
 
105
        self.failUnless(os.path.isdir('a/b/dir'))
98
106
 
99
107
        wt = WorkingTree.open('.')
100
108
        wt_a = WorkingTree.open('a')
103
111
        delta = wt.changes_from(wt.basis_tree())
104
112
        self.assertEquals(len(delta.added), 1)
105
113
        self.assertEquals(delta.added[0][0], 'dir')
106
 
        self.assertFalse(delta.modified)
 
114
        self.failIf(delta.modified)
107
115
 
108
116
        delta = wt_a.changes_from(wt_a.basis_tree())
109
117
        self.assertEquals(len(delta.added), 1)
110
118
        self.assertEquals(delta.added[0][0], 'dir')
111
 
        self.assertFalse(delta.modified)
 
119
        self.failIf(delta.modified)
112
120
 
113
121
        delta = wt_b.changes_from(wt_b.basis_tree())
114
122
        self.assertEquals(len(delta.added), 1)
115
123
        self.assertEquals(delta.added[0][0], 'dir')
116
 
        self.assertFalse(delta.modified)
117
 
 
118
 
    def test_mkdir_quiet(self):
119
 
        """'bzr mkdir --quiet' should not print a status message"""
120
 
 
121
 
        self.make_branch_and_tree('.')
122
 
        out, err = self.run_bzr(['mkdir', '--quiet', 'foo'])
123
 
        self.assertEquals('', err)
124
 
        self.assertEquals('', out)
 
124
        self.failIf(delta.modified)
 
125
 
 
126
    def check_branch(self):
 
127
        """After all the above changes, run the check and upgrade commands.
 
128
 
 
129
        The upgrade should be a no-op."""
 
130
        b = Branch.open(u'.')
 
131
        mutter('branch has %d revisions', b.revno())
 
132
 
 
133
        mutter('check branch...')
 
134
        from bzrlib.check import check
 
135
        check(b, False)
125
136
 
126
137
 
127
138
class SubdirCommit(TestCaseWithTransport):