1
# Copyright (C) 2005, 2006 Canonical Ltd
1
# Copyright (C) 2005-2010 Canonical Ltd
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()
595
596
result2 = self.run_bzr("status -SV -r 0..")[0]
596
597
self.assertEquals(result2, result)
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]
602
result = self.run_bzr("status --short")[0]
604
result = self.run_bzr("status")[0]
601
605
self.assertContainsRe(result, pattern)
607
def test_kind_change_plain(self):
608
tree = self.make_branch_and_tree('.')
609
self.build_tree(['file'])
611
tree.commit('added 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')
619
self.assertStatusContains('removed:\n file\n')
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')
609
627
self.build_tree(['file/'])
610
self.assertStatusContains('K file => file/')
628
self.assertStatusContains('K file => file/',
611
630
tree.rename_one('file', 'directory')
612
self.assertStatusContains('RK file => directory/')
631
self.assertStatusContains('RK file => directory/',
613
633
rmdir('directory')
614
self.assertStatusContains('RD file => directory')
634
self.assertStatusContains('RD file => directory',
616
637
def test_status_illegal_revision_specifiers(self):
617
638
out, err = self.run_bzr('status -r 1..23..123', retcode=3)