def test(self): repo.make_seven_commits(self) GIT.permute('01234', '-v', '-s', 'TEST') actual = GIT.log('--oneline') expected = ['bbd9e40 TEST', '043df1f 2', 'a03c0f8 1', 'c0d1dbb 0'] self.assertEqual(actual, expected)
def test_empty_squash(self): repo.make_seven_commits(self) GIT.permute('01234', '-v', '-s') actual = GIT.log('--oneline') expected = ['059f1ee 3', '043df1f 2', 'a03c0f8 1', 'c0d1dbb 0'] self.assertEqual(actual, expected)
def test_default(self): repo.make_seven_commits(self) GIT.reset('--soft', 'HEAD~') GIT.adjust('-v') actual = GIT.log('--oneline')[:4] expected = ['84e8ee1 6', '8a4a4e2 5', 'a7c7e8f 4', '9ab30c5 3'] self.assertEqual(expected, actual) self.assertEqual(['6', '7'], _files_in_commit())
def test_all_tracked(self): repo.make_seven_commits(self) repo.write_file('6', 'DELTA') GIT.adjust('-a', '-v') actual = GIT.log('--oneline')[:4] expected = ['067af20 7', 'e1e931a 6', '8a4a4e2 5', 'a7c7e8f 4'] self.assertEqual(expected, actual) self.assertEqual(['6', '7'], _files_in_commit())
def test_all(self): commit_id = self._test() status = _status() GIT.save('-a', '-v') self.assertEqual(commit_id, functions.commit_id()) self.assertEqual(status, _status()) GIT.reset('--hard', 'HEAD~') repo.make_seven_commits(self) GIT.save('pop', '-v') self.assertEqual(status, _status())
def test_message(self): repo.make_seven_commits(self) GIT.adjust('HEAD~3', '--commit=HEAD~', '-m', '4 and 6', '-v') actual = GIT.log('--oneline')[:4] expected = ['d43e4a8 7', 'e38207c 5', 'ac920db 4 and 6', '9ab30c5 3'] self.assertEqual(expected, actual) self.assertEqual(['7'], _files_in_commit()) self.assertEqual(['5'], _files_in_commit('HEAD~')) self.assertEqual(['4', '6'], _files_in_commit('HEAD~~'))
def test_commit(self): repo.make_seven_commits(self) GIT.adjust('HEAD~3', '--commit=HEAD~', '-v') actual = GIT.log('--oneline')[:4] expected = ['18f631a 7', '6c901a6 5', '9375333 4', '9ab30c5 3'] self.assertEqual(expected, actual) self.assertEqual(['7'], _files_in_commit()) self.assertEqual(['5'], _files_in_commit('HEAD~')) self.assertEqual(['4', '6'], _files_in_commit('HEAD~~'))
def test_simple(self): repo.make_seven_commits(self) GIT.reset('--soft', 'HEAD~') GIT.adjust('HEAD~', '-v') actual = GIT.log('--oneline')[:4] expected = ['0e103e7 6', '207bd13 5', 'a7c7e8f 4', '9ab30c5 3'] self.assertEqual(expected, actual) self.assertEqual(['6'], _files_in_commit()) self.assertEqual(['5', '7'], _files_in_commit('HEAD~'))
def _test_files(self): repo.make_seven_commits(self) GIT.permute('ebdg', '-v') files = [i for i in os.listdir() if not i.startswith('.')] self.assertEqual(sorted(files), ['0', '1', '3', '4', '6'])
def test_reverse(self): repo.make_seven_commits(self) GIT.permute('ba', '-v') actual = GIT.log('--oneline')[:4] expected = ['85af3d4 6', 'd9b4446 7', '8a4a4e2 5', 'a7c7e8f 4'] self.assertEqual(actual, expected)