~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-06-18 05:22:35 UTC
  • mfrom: (1551.15.27 Aaron's mergeable stuff)
  • Revision ID: pqm@pqm.ubuntu.com-20070618052235-mvns8j28szyzscy0
Turn list-weave into list-versionedfile

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
import sys
29
29
from tempfile import TemporaryFile
30
30
 
31
 
from bzrlib import (
32
 
    bzrdir,
33
 
    conflicts,
34
 
    errors,
35
 
    )
 
31
from bzrlib import bzrdir, errors
36
32
import bzrlib.branch
37
33
from bzrlib.builtins import merge
38
34
from bzrlib.osutils import pathjoin
162
158
    def test_tree_status_ignores(self):
163
159
        """Tests branch status with ignores"""
164
160
        wt = self.make_branch_and_tree('.')
165
 
        self.run_bzr('ignore *~')
 
161
        self.run_bzr('ignore', '*~')
166
162
        wt.commit('commit .bzrignore')
167
163
        self.build_tree(['foo.c', 'foo.c~'])
168
164
        self.assertStatus([
231
227
        tof.seek(0)
232
228
        self.assertEquals(tof.readlines(), ['?   dir2/\n'])
233
229
 
234
 
    def test_specific_files_conflicts(self):
235
 
        tree = self.make_branch_and_tree('.')
236
 
        self.build_tree(['dir2/'])
237
 
        tree.add('dir2')
238
 
        tree.commit('added dir2')
239
 
        tree.set_conflicts(conflicts.ConflictList(
240
 
            [conflicts.ContentsConflict('foo')]))
241
 
        tof = StringIO()
242
 
        show_tree_status(tree, specific_files=['dir2'], to_file=tof)
243
 
        self.assertEqualDiff('', tof.getvalue())
244
 
        tree.set_conflicts(conflicts.ConflictList(
245
 
            [conflicts.ContentsConflict('dir2')]))
246
 
        tof = StringIO()
247
 
        show_tree_status(tree, specific_files=['dir2'], to_file=tof)
248
 
        self.assertEqualDiff('conflicts:\n  Contents conflict in dir2\n',
249
 
                             tof.getvalue())
250
 
 
251
 
        tree.set_conflicts(conflicts.ConflictList(
252
 
            [conflicts.ContentsConflict('dir2/file1')]))
253
 
        tof = StringIO()
254
 
        show_tree_status(tree, specific_files=['dir2'], to_file=tof)
255
 
        self.assertEqualDiff('conflicts:\n  Contents conflict in dir2/file1\n',
256
 
                             tof.getvalue())
257
 
 
258
230
    def test_status_nonexistent_file(self):
259
231
        # files that don't exist in either the basis tree or working tree
260
232
        # should give an error
261
233
        wt = self.make_branch_and_tree('.')
262
 
        out, err = self.run_bzr('status does-not-exist', retcode=3)
 
234
        out, err = self.run_bzr('status', 'does-not-exist', retcode=3)
263
235
        self.assertContainsRe(err, r'do not exist.*does-not-exist')
264
236
 
265
237
    def test_status_out_of_date(self):
303
275
        result = self.run_bzr("status")[0]
304
276
        self.assertContainsRe(result, "unknown:\n  hello.txt\n")
305
277
 
306
 
        self.run_bzr("add hello.txt")
 
278
        self.run_bzr("add", "hello.txt")
307
279
        result = self.run_bzr("status")[0]
308
280
        self.assertContainsRe(result, "added:\n  hello.txt\n")
309
281
 
310
 
        self.run_bzr("commit -m added")
311
 
        result = self.run_bzr("status -r 0..1")[0]
 
282
        self.run_bzr("commit", "-m", "added")
 
283
        result = self.run_bzr("status", "-r", "0..1")[0]
312
284
        self.assertContainsRe(result, "added:\n  hello.txt\n")
313
285
 
314
286
        self.build_tree(['world.txt'])
315
 
        result = self.run_bzr("status -r 0")[0]
 
287
        result = self.run_bzr("status", "-r", "0")[0]
316
288
        self.assertContainsRe(result, "added:\n  hello.txt\n" \
317
289
                                      "unknown:\n  world.txt\n")
318
 
        result2 = self.run_bzr("status -r 0..")[0]
 
290
        result2 = self.run_bzr("status", "-r", "0..")[0]
319
291
        self.assertEquals(result2, result)
320
292
 
321
293
    def test_status_short(self):
322
294
        self.run_bzr("init")
323
295
 
324
296
        self.build_tree(['hello.txt'])
325
 
        result = self.run_bzr("status --short")[0]
 
297
        result = self.run_bzr("status","--short")[0]
326
298
        self.assertContainsRe(result, "[?]   hello.txt\n")
327
299
 
328
 
        self.run_bzr("add hello.txt")
329
 
        result = self.run_bzr("status --short")[0]
 
300
        self.run_bzr("add", "hello.txt")
 
301
        result = self.run_bzr("status","--short")[0]
330
302
        self.assertContainsRe(result, "[+]N  hello.txt\n")
331
303
 
332
 
        self.run_bzr("commit -m added")
333
 
        result = self.run_bzr("status --short -r 0..1")[0]
 
304
        self.run_bzr("commit", "-m", "added")
 
305
        result = self.run_bzr("status", "--short", "-r", "0..1")[0]
334
306
        self.assertContainsRe(result, "[+]N  hello.txt\n")
335
307
 
336
308
        self.build_tree(['world.txt'])
337
 
        result = self.run_bzr("status --short -r 0")[0]
 
309
        result = self.run_bzr("status", "--short", "-r", "0")[0]
338
310
        self.assertContainsRe(result, "[+]N  hello.txt\n" \
339
311
                                      "[?]   world.txt\n")
340
 
        result2 = self.run_bzr("status --short -r 0..")[0]
 
312
        result2 = self.run_bzr("status", "--short", "-r", "0..")[0]
341
313
        self.assertEquals(result2, result)
342
314
 
343
315
    def test_status_versioned(self):
344
316
        self.run_bzr("init")
345
317
 
346
318
        self.build_tree(['hello.txt'])
347
 
        result = self.run_bzr("status --versioned")[0]
 
319
        result = self.run_bzr("status", "--versioned")[0]
348
320
        self.assertNotContainsRe(result, "unknown:\n  hello.txt\n")
349
321
 
350
 
        self.run_bzr("add hello.txt")
351
 
        result = self.run_bzr("status --versioned")[0]
 
322
        self.run_bzr("add", "hello.txt")
 
323
        result = self.run_bzr("status", "--versioned")[0]
352
324
        self.assertContainsRe(result, "added:\n  hello.txt\n")
353
325
 
354
 
        self.run_bzr("commit -m added")
355
 
        result = self.run_bzr("status --versioned -r 0..1")[0]
 
326
        self.run_bzr("commit", "-m", "added")
 
327
        result = self.run_bzr("status", "--versioned", "-r", "0..1")[0]
356
328
        self.assertContainsRe(result, "added:\n  hello.txt\n")
357
329
 
358
330
        self.build_tree(['world.txt'])
359
 
        result = self.run_bzr("status --versioned -r 0")[0]
 
331
        result = self.run_bzr("status", "--versioned", "-r", "0")[0]
360
332
        self.assertContainsRe(result, "added:\n  hello.txt\n")
361
333
        self.assertNotContainsRe(result, "unknown:\n  world.txt\n")
362
 
        result2 = self.run_bzr("status --versioned -r 0..")[0]
 
334
        result2 = self.run_bzr("status", "--versioned", "-r", "0..")[0]
363
335
        self.assertEquals(result2, result)
364
336
 
365
337
    def assertStatusContains(self, pattern):
366
338
        """Run status, and assert it contains the given pattern"""
367
 
        result = self.run_bzr("status --short")[0]
 
339
        result = self.run_bzr("status", "--short")[0]
368
340
        self.assertContainsRe(result, pattern)
369
341
 
370
342
    def test_kind_change_short(self):