def test_switch_to_new_branch_on_old_rev(self): """switch to previous rev in a standalone directory Inspired by: https://bugs.launchpad.net/brz/+bug/933362 """ self.script_runner = script.ScriptRunner() self.script_runner.run_script(self, ''' $ brz init Created a standalone tree (format: 2a) $ brz switch -b trunk 2>Tree is up to date at revision 0. 2>Switched to branch trunk $ brz commit -m 1 --unchanged 2>Committing to: ... 2>Committed revision 1. $ brz commit -m 2 --unchanged 2>Committing to: ... 2>Committed revision 2. $ brz switch -b blah -r1 2>Updated to revision 1. 2>Switched to branch blah $ brz branches * blah trunk $ brz st ''')
def test_remove_no_backup_unversioned_files(self): self.build_tree(files) tree = self.make_branch_and_tree('.') script.ScriptRunner().run_script(self, ''' $ brz remove --no-backup a b/ b/c d/ 2>deleted d 2>removed b/c (but kept a copy: b/c.~1~) 2>deleted b 2>deleted a ''') self.assertFilesDeleted(files)
def test_add_not_child(self): # https://bugs.launchpad.net/bzr/+bug/98735 sr = script.ScriptRunner() self.make_branch_and_tree('tree1') self.make_branch_and_tree('tree2') self.build_tree(['tree1/a', 'tree2/b']) sr.run_script( self, ''' $ brz add tree1/a tree2/b 2>brz: ERROR: Path "...tree2/b" is not a child of path "...tree1" ''')
def test_empty_tree_switch(self): """switch . on an empty tree gets infinite recursion Inspired by: https://bugs.launchpad.net/bzr/+bug/1018628 """ self.script_runner = script.ScriptRunner() self.script_runner.run_script(self, ''' $ brz init Created a standalone tree (format: 2a) $ brz switch . 2>brz: ERROR: switching would create a branch reference loop. Use the "bzr up" command to switch to a different revision. ''')
def setUp(self): """Set up a repository and branch ready for testing.""" super(TestSwitchParentLocationBase, self).setUp() self.script_runner = script.ScriptRunner() self.script_runner.run_script(self, ''' $ brz init-shared-repo --no-trees repo Shared repository... Location: shared repository: repo $ brz init repo/trunk Created a repository branch... Using shared repository: ... ''')
def test_switch_on_previous_rev(self): """switch to previous rev in a standalone directory Inspired by: https://bugs.launchpad.net/brz/+bug/1018628 """ self.script_runner = script.ScriptRunner() self.script_runner.run_script(self, ''' $ brz init Created a standalone tree (format: 2a) $ brz commit -m 1 --unchanged $ brz commit -m 2 --unchanged $ brz switch -r 1 2>brz: ERROR: switching would create a branch reference loop. Use the "bzr up" command to switch to a different revision.''', null_output_matches_anything=True)
def test_switch_create_colo_locks_repo_path(self): self.script_runner = script.ScriptRunner() self.script_runner.run_script(self, ''' $ mkdir mywork $ cd mywork $ brz init Created a standalone tree (format: 2a) $ echo A > a && brz add a && brz commit -m A $ brz switch -b br1 $ cd .. $ mv mywork mywork1 $ cd mywork1 $ brz branches br1 ''', null_output_matches_anything=True)
def test_dupe_move(self): self.script_runner = script.ScriptRunner() self.script_runner.run_script( self, ''' $ brz init brz-bug Created a standalone tree (format: 2a) $ cd brz-bug $ mkdir dir $ brz add adding dir $ echo text >> dir/test.txt $ brz add adding dir/test.txt $ brz ci -m "Add files" 2>Committing to: .../brz-bug/ 2>added dir 2>added dir/test.txt 2>Committed revision 1. $ mv dir dir2 $ mv dir2/test.txt dir2/test2.txt $ brz st removed: dir/ dir/test.txt unknown: dir2/ $ brz mv dir dir2 dir => dir2 $ brz st removed: dir/test.txt renamed: dir/ => dir2/ unknown: dir2/test2.txt $ brz mv dir/test.txt dir2/test2.txt dir/test.txt => dir2/test2.txt ''')