def setUp(self): # Include branch_K, branch_L to make sure that ABCDEFG all get the # same commit hashes as self.repo. Otherwise they get committed with the # wrong timestamps, due to commit ordering. # TODO(iannucci): Make commit timestamps deterministic in left to right, top # to bottom order, not in lexi-topographical order. origin_schema = git_test_utils.GitRepoSchema( """ A B C D 😋 F G M N O B H I J K J L """, self.getRepoContent) self.origin = origin_schema.reify() self.origin.git('checkout', 'main') self.origin.git('branch', '-d', *['branch_' + l for l in 'KLG']) self.repo.git('remote', 'add', 'origin', self.origin.repo_path) self.repo.git('config', '--add', 'remote.origin.fetch', '+refs/tags/*:refs/tags/*') self.repo.git('update-ref', 'refs/remotes/origin/main', 'tag_E') self.repo.git('branch', '--set-upstream-to', 'branch_G', 'branch_K') self.repo.git('branch', '--set-upstream-to', 'branch_K', 'branch_L') self.repo.git('fetch', 'origin') mock.patch('git_map.RESET', '').start() mock.patch('git_map.BLUE_BACK', '').start() mock.patch('git_map.BRIGHT_RED', '').start() mock.patch('git_map.CYAN', '').start() mock.patch('git_map.GREEN', '').start() mock.patch('git_map.MAGENTA', '').start() mock.patch('git_map.RED', '').start() mock.patch('git_map.WHITE', '').start() mock.patch('git_map.YELLOW', '').start() self.addCleanup(mock.patch.stopall)
def setUp(self): super(GitRebaseUpdateTest, self).setUp() # Include branch_K, branch_L to make sure that ABCDEFG all get the # same commit hashes as self.repo. Otherwise they get committed with the # wrong timestamps, due to commit ordering. # TODO(iannucci): Make commit timestamps deterministic in left to right, top # to bottom order, not in lexi-topographical order. origin_schema = git_test_utils.GitRepoSchema(""" A B C D E F G M N O B H I J K J L """, self.getRepoContent) self.origin = origin_schema.reify() self.origin.git('checkout', 'master') self.origin.git('branch', '-d', *['branch_'+l for l in 'KLG']) self.repo.git('remote', 'add', 'origin', self.origin.repo_path) self.repo.git('config', '--add', 'remote.origin.fetch', '+refs/tags/*:refs/tags/*') self.repo.git('update-ref', 'refs/remotes/origin/master', 'tag_E') self.repo.git('branch', '--set-upstream-to', 'branch_G', 'branch_K') self.repo.git('branch', '--set-upstream-to', 'branch_K', 'branch_L') self.repo.git('branch', '--set-upstream-to', 'origin/master', 'branch_G') self.repo.to_schema_refs += ['origin/master']
def testRoot(self): origin_schema = git_test_utils.GitRepoSchema(""" A B C B D """, self.getRepoContent) origin = origin_schema.reify() # Set the default branch to branch_D instead of master. origin.git('checkout', 'branch_D') self.repo.git('remote', 'add', 'origin', origin.repo_path) self.repo.git('fetch', 'origin') self.repo.git('remote', 'set-head', 'origin', '-a') self.assertEqual('origin/branch_D', self.repo.run(self.gc.root))