~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005-2010 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
498
498
    def make_branch_and_tree(self, relpath):
499
499
        source = self.make_branch(pathjoin('..', relpath))
500
500
        checkout = bzrdir.BzrDirMetaFormat1().initialize(relpath)
501
 
        bzrlib.branch.BranchReferenceFormat().initialize(checkout, source)
 
501
        bzrlib.branch.BranchReferenceFormat().initialize(checkout,
 
502
            target_branch=source)
502
503
        return checkout.create_workingtree()
503
504
 
504
505
 
595
596
        result2 = self.run_bzr("status -SV -r 0..")[0]
596
597
        self.assertEquals(result2, result)
597
598
 
598
 
    def assertStatusContains(self, pattern):
 
599
    def assertStatusContains(self, pattern, short=False):
599
600
        """Run status, and assert it contains the given pattern"""
600
 
        result = self.run_bzr("status --short")[0]
 
601
        if short:
 
602
            result = self.run_bzr("status --short")[0]
 
603
        else:
 
604
            result = self.run_bzr("status")[0]
601
605
        self.assertContainsRe(result, pattern)
602
606
 
 
607
    def test_kind_change_plain(self):
 
608
        tree = self.make_branch_and_tree('.')
 
609
        self.build_tree(['file'])
 
610
        tree.add('file')
 
611
        tree.commit('added file')
 
612
        unlink('file')
 
613
        self.build_tree(['file/'])
 
614
        self.assertStatusContains('kind changed:\n  file \(file => directory\)')
 
615
        tree.rename_one('file', 'directory')
 
616
        self.assertStatusContains('renamed:\n  file/ => directory/\n' \
 
617
                                  'modified:\n  directory/\n')
 
618
        rmdir('directory')
 
619
        self.assertStatusContains('removed:\n  file\n')
 
620
 
603
621
    def test_kind_change_short(self):
604
622
        tree = self.make_branch_and_tree('.')
605
623
        self.build_tree(['file'])
607
625
        tree.commit('added file')
608
626
        unlink('file')
609
627
        self.build_tree(['file/'])
610
 
        self.assertStatusContains('K  file => file/')
 
628
        self.assertStatusContains('K  file => file/',
 
629
                                   short=True)
611
630
        tree.rename_one('file', 'directory')
612
 
        self.assertStatusContains('RK  file => directory/')
 
631
        self.assertStatusContains('RK  file => directory/',
 
632
                                   short=True)
613
633
        rmdir('directory')
614
 
        self.assertStatusContains('RD  file => directory')
 
634
        self.assertStatusContains('RD  file => directory',
 
635
                                   short=True)
615
636
 
616
637
    def test_status_illegal_revision_specifiers(self):
617
638
        out, err = self.run_bzr('status -r 1..23..123', retcode=3)