~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/versioning.py

  • Committer: Robert Collins
  • Date: 2005-10-17 11:56:54 UTC
  • mfrom: (1185.16.59)
  • Revision ID: robertc@robertcollins.net-20051017115654-662239e1587524a8
mergeĀ fromĀ martin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    
35
35
    def test_mkdir(self): 
36
36
        """Basic 'bzr mkdir' operation"""
 
37
        from bzrlib.commands import run_bzr
37
38
 
38
 
        self.run_bzr('init')
39
 
        self.run_bzr('mkdir', 'foo')
 
39
        run_bzr(['init'])
 
40
        run_bzr(['mkdir', 'foo'])
40
41
        self.assert_(os.path.isdir('foo'))
41
42
 
42
 
        self.run_bzr('mkdir', 'foo', retcode=2)
 
43
        self.assertRaises(OSError, run_bzr, ['mkdir', 'foo'])
43
44
 
44
45
        from bzrlib.diff import compare_trees
45
46
        from bzrlib.branch import Branch
79
80
        "bzr add" should add the parent(s) as necessary.
80
81
        """
81
82
        from bzrlib.branch import Branch
 
83
        from bzrlib.commands import run_bzr
82
84
        eq = self.assertEqual
83
85
 
84
86
        b = Branch.initialize('.')
85
87
 
86
88
        self.build_tree(['inertiatic/', 'inertiatic/esp'])
87
89
        eq(list(b.unknowns()), ['inertiatic'])
88
 
        self.run_bzr('add', 'inertiatic/esp')
 
90
        run_bzr(['add', 'inertiatic/esp'])
89
91
        eq(list(b.unknowns()), [])
90
92
 
91
93
        # Multiple unversioned parents
92
94
        self.build_tree(['veil/', 'veil/cerpin/', 'veil/cerpin/taxt'])
93
95
        eq(list(b.unknowns()), ['veil'])
94
 
        self.run_bzr('add', 'veil/cerpin/taxt')
 
96
        run_bzr(['add', 'veil/cerpin/taxt'])
95
97
        eq(list(b.unknowns()), [])
96
98
 
97
99
        # Check whacky paths work
98
100
        self.build_tree(['cicatriz/', 'cicatriz/esp'])
99
101
        eq(list(b.unknowns()), ['cicatriz'])
100
 
        self.run_bzr('add', 'inertiatic/../cicatriz/esp')
 
102
        run_bzr(['add', 'inertiatic/../cicatriz/esp'])
101
103
        eq(list(b.unknowns()), [])
102
104
 
103
105
    def test_add_in_versioned(self):
106
108
        "bzr add" should do this happily.
107
109
        """
108
110
        from bzrlib.branch import Branch
 
111
        from bzrlib.commands import run_bzr
109
112
        eq = self.assertEqual
110
113
 
111
114
        b = Branch.initialize('.')
112
115
 
113
116
        self.build_tree(['inertiatic/', 'inertiatic/esp'])
114
117
        eq(list(b.unknowns()), ['inertiatic'])
115
 
        self.run_bzr('add', '--no-recurse', 'inertiatic')
 
118
        run_bzr(['add', '--no-recurse', 'inertiatic'])
116
119
        eq(list(b.unknowns()), ['inertiatic'+os.sep+'esp'])
117
 
        self.run_bzr('add', 'inertiatic/esp')
 
120
        run_bzr(['add', 'inertiatic/esp'])
118
121
        eq(list(b.unknowns()), [])
119
122
 
120
123
    def test_subdir_add(self):
121
124
        """Add in subdirectory should add only things from there down"""
122
125
        
123
126
        from bzrlib.branch import Branch
 
127
        from bzrlib.commands import run_bzr
124
128
        
125
129
        eq = self.assertEqual
126
130
        ass = self.assert_
132
136
        eq(sorted(b.unknowns()),
133
137
           ['README', 'src'])
134
138
        
135
 
        self.run_bzr('add', 'src')
 
139
        eq(run_bzr(['add', 'src']), 0)
136
140
        
137
141
        self.build_tree(['src/foo.c'])
138
142
        
139
143
        chdir('src')
140
 
        self.run_bzr('add')
 
144
        eq(run_bzr(['add']), 0)
141
145
        
142
146
        eq(sorted(b.unknowns()), 
143
147
           ['README'])
144
148
        eq(len(b.inventory), 3)
145
149
                
146
150
        chdir('..')
147
 
        self.run_bzr('add')
 
151
        eq(run_bzr(['add']), 0)
148
152
        eq(list(b.unknowns()), [])
149
153
 
150
154
        self.check_branch()