def test_merge_into_subdir(self): project_wt, lib_wt = self.setup_two_branches() merge_into.merge_into_helper('lib1', 'dir/lib1', this_location='project') project_wt.lock_read() try: new_lib1_id = project_wt.path2id('dir/lib1') # The lib-1 revision should be merged into this one self.assertEqual(['project-1', 'lib-1'], project_wt.get_parent_ids()) files = [(path, ie.kind, ie.file_id) for path, ie in project_wt.iter_entries_by_dir()] exp_files = [ ('', 'directory', 'project-root-id'), ('README', 'file', 'readme-id'), ('dir', 'directory', 'dir-id'), ('dir/file.c', 'file', 'file.c-id'), ('dir/lib1', 'directory', new_lib1_id), ('dir/lib1/Makefile', 'file', 'makefile-lib-id'), ('dir/lib1/README', 'file', 'readme-lib-id'), ('dir/lib1/foo.c', 'file', 'foo.c-lib-id'), ] self.assertEqual(exp_files, files) finally: project_wt.unlock()
def test_merge_into_subdir(self): project_wt, lib_wt = self.setup_two_branches() merge_into.merge_into_helper('lib1', 'dir/lib1', this_location='project') project_wt.lock_read() try: new_lib1_id = project_wt.path2id('dir/lib1') # The lib-1 revision should be merged into this one self.assertEqual(['project-1', 'lib-1'], project_wt.get_parent_ids()) files = [(path, ie.kind, ie.file_id) for path, ie in project_wt.iter_entries_by_dir()] exp_files = [('', 'directory', 'project-root-id'), ('README', 'file', 'readme-id'), ('dir', 'directory', 'dir-id'), ('dir/file.c', 'file', 'file.c-id'), ('dir/lib1', 'directory', new_lib1_id), ('dir/lib1/Makefile', 'file', 'makefile-lib-id'), ('dir/lib1/README', 'file', 'readme-lib-id'), ('dir/lib1/foo.c', 'file', 'foo.c-lib-id'), ] self.assertEqual(exp_files, files) finally: project_wt.unlock()
def run(self, location, subdir=None): if not subdir: # default to same name as source dir import os subdir = os.path.basename(location) import merge_into conflicts = merge_into.merge_into_helper(location, subdir) if not conflicts: self.outf.write('merge-into successful\n') else: self.outf.write('merge-into conflicts: %s\n' % (conflicts,)) return 1
def run(self, location, subdir=None): if not subdir: # default to same name as source dir import os subdir = os.path.basename(location) import merge_into conflicts = merge_into.merge_into_helper(location, subdir) if not conflicts: self.outf.write('merge-into successful\n') else: self.outf.write('merge-into conflicts: %s\n' % (conflicts, )) return 1