def test_dpush_wt_diff(self): b = self.make_dummy_builder('d').get_branch() dc = b.bzrdir.sprout('dc', force_new_repo=True) self.build_tree_contents([("dc/foofile", "blaaaa")]) dc_tree = dc.open_workingtree() dc_tree.add("foofile") newrevid = dc_tree.commit('msg') self.build_tree_contents([("dc/foofile", "blaaaal")]) script.run_script( self, ''' $ bzr dpush -d dc d --no-strict 2>Doing on-the-fly conversion from DummyForeignVcsRepositoryFormat() to RepositoryFormat2a(). 2>This may take some time. Upgrade the repositories to the same format for better performance. 2>Pushed up to revision 2. ''') self.assertFileEqual("blaaaal", "dc/foofile") # if the dummy vcs wasn't that dummy we could uncomment the line below # self.assertFileEqual("blaaaa", "d/foofile") script.run_script( self, ''' $ bzr status dc modified: foofile ''')
def test_dpush_wt_diff(self): b = self.make_dummy_builder("d").get_branch() dc = b.bzrdir.sprout("dc", force_new_repo=True) self.build_tree_contents([("dc/foofile", "blaaaa")]) dc_tree = dc.open_workingtree() dc_tree.add("foofile") newrevid = dc_tree.commit("msg") self.build_tree_contents([("dc/foofile", "blaaaal")]) script.run_script( self, """ $ bzr dpush -d dc d --no-strict 2>Doing on-the-fly conversion from DummyForeignVcsRepositoryFormat() to RepositoryFormat2a(). 2>This may take some time. Upgrade the repositories to the same format for better performance. 2>Pushed up to revision 2. """, ) self.assertFileEqual("blaaaal", "dc/foofile") # if the dummy vcs wasn't that dummy we could uncomment the line below # self.assertFileEqual("blaaaa", "d/foofile") script.run_script( self, """ $ bzr status dc modified: foofile """, )
def test_branch_config_forcing_branch(self): script.run_script(self, '''\ $ bzr config -d tree --scope branch hello=world $ bzr config -d tree --all hello branch: hello = world ''')
def test_registry_value_one(self): self.bazaar_config.set_user_option('bzr.transform.orphan_policy', u'move') script.run_script(self, '''\ $ bzr config -d tree bzr.transform.orphan_policy move ''')
def test_clean_tree_interactive(self): wt = self.make_branch_and_tree('.') self.touch('bar') self.touch('foo') run_script(self, """ $ bzr clean-tree bar foo 2>Are you sure you wish to delete these? ([y]es, [n]o): no <n Canceled """) self.assertPathExists('bar') self.assertPathExists('foo') run_script(self, """ $ bzr clean-tree bar foo 2>Are you sure you wish to delete these? ([y]es, [n]o): yes <y 2>deleting paths: 2> bar 2> foo """) self.assertPathDoesNotExist('bar') self.assertPathDoesNotExist('foo')
def test_branch_config_default(self): script.run_script(self, '''\ $ bzr config -d tree hello=world $ bzr config -d tree --all hello branch: hello = world ''')
def test_commit_in_heavyweight_checkout_copies_tags_to_master(self): master, child = self.make_master_and_checkout() fork = self.make_fork(master) fork.tags.set_tag('new-tag', fork.last_revision()) fork.tags.set_tag('non-ancestry-tag', 'fork-0') fork.tags.set_tag('absent-tag', 'absent-rev') script.run_script(self, """ $ cd child $ bzr merge ../fork $ bzr commit -m "Merge fork." 2>Committing to: .../master/ 2>Committed revision 2. """, null_output_matches_anything=True) # Merge copied the tag to child and commit propagated it to master expected_tag_dict = { 'new-tag': fork.last_revision(), 'non-ancestry-tag': 'fork-0', 'absent-tag': 'absent-rev', } self.assertEqual(expected_tag_dict, child.branch.tags.get_tag_dict()) self.assertEqual(expected_tag_dict, master.tags.get_tag_dict()) # Revisions not in ancestry but named in tags are present child.branch.repository.get_revision('fork-0') master.repository.get_revision('fork-0')
def test_clean_tree_interactive(self): wt = self.make_branch_and_tree('.') self.touch('bar') self.touch('foo') run_script( self, """ $ bzr clean-tree bar foo 2>Are you sure you wish to delete these? ([y]es, [n]o): no <n Canceled """) self.assertPathExists('bar') self.assertPathExists('foo') run_script( self, """ $ bzr clean-tree bar foo 2>Are you sure you wish to delete these? ([y]es, [n]o): yes <y 2>deleting paths: 2> bar 2> foo """) self.assertPathDoesNotExist('bar') self.assertPathDoesNotExist('foo')
def test_bazaar_config(self): self.bazaar_config.set_user_option('hello', 'world') script.run_script(self, '''\ $ bzr config -d tree bazaar: [DEFAULT] hello = world ''')
def test_mv_newname(self): wt = self._make_mixed_case_tree() run_script(self, """ $ bzr add -q $ bzr ci -qm message $ bzr mv camelcaseparent/camelcase camelcaseparent/NewCamelCase CamelCaseParent/CamelCase => CamelCaseParent/NewCamelCase """)
def test_list_value_one(self): config.option_registry.register(config.ListOption('list')) self.addCleanup(config.option_registry.remove, 'list') self.bazaar_config.set_user_option('list', [1, 'a', 'with, a comma']) script.run_script(self, '''\ $ bzr config -d tree list 1, a, "with, a comma" ''')
def test_active_in_branch(self): # We need to delete the locations definition that overrides the branch # one script.run_script(self, '''\ $ bzr config -d tree --scope locations --remove file $ bzr config -d tree file branch ''')
def test_bazaar_config_inside_branch(self): script.run_script(self, '''\ $ bzr config -d tree --scope bazaar hello=world $ bzr config -d tree --all hello bazaar: [DEFAULT] hello = world ''')
def test_locations_config_inside_branch(self): script.run_script(self, '''\ $ bzr config -d tree --scope locations hello=world $ bzr config -d tree --all hello locations: [.../work/tree] hello = world ''')
def test_mv_newname_root(self): wt = self._make_mixed_case_tree() self.run_bzr('add') self.run_bzr('ci -m message') run_script(self, """ $ bzr mv camelcaseparent NewCamelCaseParent CamelCaseParent => NewCamelCaseParent """)
def test_multiline_value_only(self): self.bazaar_config.set_user_option('multiline', '1\n2\n') # Fallout from bug 710410, the triple quotes have been toggled script.run_script(self, '''\ $ bzr config -d tree multiline """1 2 """ ''')
def test_mv_newname_root(self): wt = self._make_mixed_case_tree() self.run_bzr('add') self.run_bzr('ci -m message') run_script( self, """ $ bzr mv camelcaseparent NewCamelCaseParent CamelCaseParent => NewCamelCaseParent """)
def test_locations_config_outside_branch(self): self.bazaar_config.set_user_option('hello', 'world') self.locations_config.set_user_option('hello', 'world') script.run_script(self, '''\ $ bzr config bazaar: [DEFAULT] hello = world ''')
def test_break_lock_no_interaction(self): """With --force, the user isn't asked for confirmation""" self.master_branch.lock_write() run_script(self, """ $ bzr break-lock --force master-repo/master-branch Broke lock ...master-branch/.bzr/... """) # lock should now be dead self.assertRaises(errors.LockBroken, self.master_branch.unlock)
def test_mv_newname(self): wt = self._make_mixed_case_tree() run_script( self, """ $ bzr add -q $ bzr ci -qm message $ bzr mv camelcaseparent/camelcase camelcaseparent/NewCamelCase CamelCaseParent/CamelCase => CamelCaseParent/NewCamelCase """)
def test_add_simple(self): """Test add always uses the case of the filename reported by the os.""" wt = self.make_branch_and_tree('.') # create a file on disk with the mixed-case name self.build_tree(['CamelCase']) run_script(self, """ $ bzr add camelcase adding CamelCase """)
def test_mv_multiple(self): wt = self._make_mixed_case_tree() self.run_bzr('add') self.run_bzr('ci -m message') run_script(self, """ $ bzr mv LOWercaseparent/LOWercase LOWercaseparent/MIXEDCase camelcaseparent lowercaseparent/lowercase => CamelCaseParent/lowercase lowercaseparent/mixedCase => CamelCaseParent/mixedCase """)
def test_bazaar_config_inside_branch(self): script.run_script(self, '''\ $ bzr config -d tree --scope bazaar --remove file $ bzr config -d tree --all file locations: [.../work/tree] file = locations branch: file = branch ''')
def test_add_not_found(self): """Test add when the input file doesn't exist.""" wt = self.make_branch_and_tree('.') # create a file on disk with the mixed-case name self.build_tree(['MixedCaseParent/', 'MixedCaseParent/MixedCase']) expected_fname = pathjoin(wt.basedir, "MixedCaseParent", "notfound") run_script(self, """ $ bzr add mixedcaseparent/notfound 2>bzr: ERROR: No such file: %s """ % (repr(expected_fname),))
def test_locations_config_inside_branch(self): script.run_script(self, '''\ $ bzr config -d tree --scope locations --remove file $ bzr config -d tree --all file branch: file = branch bazaar: [DEFAULT] file = bazaar ''')
def test_cmd_line(self): self.bazaar_config.set_user_option('hello', 'world') script.run_script(self, '''\ $ bzr config -Ohello=bzr cmdline: hello = bzr bazaar: [DEFAULT] hello = world ''')
def test_add_simple(self): """Test add always uses the case of the filename reported by the os.""" wt = self.make_branch_and_tree('.') # create a file on disk with the mixed-case name self.build_tree(['CamelCase']) run_script( self, """ $ bzr add camelcase adding CamelCase """)
def test_add_subdir(self): """test_add_simple but with subdirectories tested too.""" wt = self.make_branch_and_tree('.') # create a file on disk with the mixed-case parent and base name self.build_tree(['CamelCaseParent/', 'CamelCaseParent/CamelCase']) run_script(self, """ $ bzr add camelcaseparent/camelcase adding CamelCaseParent adding CamelCaseParent/CamelCase """)
def test_add_implied(self): """test add with no args sees the correct names.""" wt = self.make_branch_and_tree('.') # create a file on disk with the mixed-case parent and base name self.build_tree(['CamelCaseParent/', 'CamelCaseParent/CamelCase']) run_script(self, """ $ bzr add adding CamelCaseParent adding CamelCaseParent/CamelCase """)
def test_mv_multiple(self): wt = self._make_mixed_case_tree() self.run_bzr('add') self.run_bzr('ci -m message') run_script( self, """ $ bzr mv LOWercaseparent/LOWercase LOWercaseparent/MIXEDCase camelcaseparent lowercaseparent/lowercase => CamelCaseParent/lowercase lowercaseparent/mixedCase => CamelCaseParent/mixedCase """)
def test_locations_config_for_branch(self): self.locations_config.set_user_option('hello', 'world') self.branch_config.set_user_option('hello', 'you') script.run_script(self, '''\ $ bzr config -d tree locations: [.../tree] hello = world branch: hello = you ''')
def test_add_subdir(self): """test_add_simple but with subdirectories tested too.""" wt = self.make_branch_and_tree('.') # create a file on disk with the mixed-case parent and base name self.build_tree(['CamelCaseParent/', 'CamelCaseParent/CamelCase']) run_script( self, """ $ bzr add camelcaseparent/camelcase adding CamelCaseParent adding CamelCaseParent/CamelCase """)
def test_add_implied(self): """test add with no args sees the correct names.""" wt = self.make_branch_and_tree('.') # create a file on disk with the mixed-case parent and base name self.build_tree(['CamelCaseParent/', 'CamelCaseParent/CamelCase']) run_script( self, """ $ bzr add adding CamelCaseParent adding CamelCaseParent/CamelCase """)
def test_mv_newname_after(self): wt = self._make_mixed_case_tree() # In this case we can specify the incorrect case for the destination, # as we use --after, so the file-system is sniffed. run_script(self, """ $ bzr add -q $ bzr ci -qm message $ mv CamelCaseParent/CamelCase CamelCaseParent/NewCamelCase $ bzr mv --after camelcaseparent/camelcase camelcaseparent/newcamelcase CamelCaseParent/CamelCase => CamelCaseParent/NewCamelCase """)
def test_mv_newname_exists(self): # test a mv, but when the target already exists with a name that # differs only by case. wt = self._make_mixed_case_tree() self.run_bzr('add') self.run_bzr('ci -m message') run_script(self, """ $ bzr mv camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE 2>bzr: ERROR: Could not move CamelCase => lowercase: \ lowercaseparent/lowercase is already versioned. """)
def test_mv_newname_root_after(self): wt = self._make_mixed_case_tree() self.run_bzr('add') self.run_bzr('ci -m message') # In this case we can specify the incorrect case for the destination, # as we use --after, so the file-system is sniffed. run_script(self, """ $ mv CamelCaseParent NewCamelCaseParent $ bzr mv --after camelcaseparent NewCamelCaseParent CamelCaseParent => NewCamelCaseParent """)
def test_status(self): wt = self._make_mixed_case_tree() self.run_bzr('add') run_script(self, """ $ bzr status camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE added: CamelCaseParent/ CamelCaseParent/CamelCase lowercaseparent/ lowercaseparent/lowercase """)
def test_add_not_found(self): """Test add when the input file doesn't exist.""" wt = self.make_branch_and_tree('.') # create a file on disk with the mixed-case name self.build_tree(['MixedCaseParent/', 'MixedCaseParent/MixedCase']) expected_fname = pathjoin(wt.basedir, "MixedCaseParent", "notfound") run_script( self, """ $ bzr add mixedcaseparent/notfound 2>bzr: ERROR: No such file: %s """ % (repr(expected_fname), ))
def test_deprecated_aliases(self): """bzr branch can be called clone or get, but those names are deprecated. See bug 506265. """ for command in ['clone', 'get']: run_script(self, """ $ bzr %(command)s A B 2>The command 'bzr %(command)s' has been deprecated in bzr 2.4. Please use 'bzr branch' instead. 2>bzr: ERROR: Not a branch... """ % locals())
def test_mv_newname_after(self): wt = self._make_mixed_case_tree() # In this case we can specify the incorrect case for the destination, # as we use --after, so the file-system is sniffed. run_script( self, """ $ bzr add -q $ bzr ci -qm message $ mv CamelCaseParent/CamelCase CamelCaseParent/NewCamelCase $ bzr mv --after camelcaseparent/camelcase camelcaseparent/newcamelcase CamelCaseParent/CamelCase => CamelCaseParent/NewCamelCase """)
def test_mv_newname_exists(self): # test a mv, but when the target already exists with a name that # differs only by case. wt = self._make_mixed_case_tree() self.run_bzr('add') self.run_bzr('ci -m message') run_script( self, """ $ bzr mv camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE 2>bzr: ERROR: Could not move CamelCase => lowercase: \ lowercaseparent/lowercase is already versioned. """)
def test_mv_newname_root_after(self): wt = self._make_mixed_case_tree() self.run_bzr('add') self.run_bzr('ci -m message') # In this case we can specify the incorrect case for the destination, # as we use --after, so the file-system is sniffed. run_script( self, """ $ mv CamelCaseParent NewCamelCaseParent $ bzr mv --after camelcaseparent NewCamelCaseParent CamelCaseParent => NewCamelCaseParent """)
def test_status(self): wt = self._make_mixed_case_tree() self.run_bzr('add') run_script( self, """ $ bzr status camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE added: CamelCaseParent/ CamelCaseParent/CamelCase lowercaseparent/ lowercaseparent/lowercase """)
def test_mv_newcase(self): wt = self._make_mixed_case_tree() self.run_bzr('add') self.run_bzr('ci -m message') # perform a mv to the new case - we expect bzr to accept the new # name, as specified, and rename the file on the file-system too. run_script(self, """ $ bzr mv camelcaseparent/camelcase camelcaseparent/camelCase CamelCaseParent/CamelCase => CamelCaseParent/camelCase """) self.failUnlessEqual(canonical_relpath(wt.basedir, 'camelcaseparent/camelcase'), 'CamelCaseParent/camelCase')