MCPcopy Create free account
hub / github.com/gitless-vcs/gitless / TestFileResolve

Class TestFileResolve

gitless/tests/test_core.py:706–746  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

704
705
706class TestFileResolve(TestFile):
707
708 def setUp(self):
709 super(TestFileResolve, self).setUp()
710
711 # Generate a conflict
712 git.checkout(b='branch')
713 utils_lib.write_file(FP_IN_CONFLICT, contents='branch')
714 utils_lib.write_file(DIR_FP_IN_CONFLICT, contents='branch')
715 git.add(FP_IN_CONFLICT, DIR_FP_IN_CONFLICT)
716 git.commit(FP_IN_CONFLICT, DIR_FP_IN_CONFLICT, m='branch')
717 git.checkout('master')
718 utils_lib.write_file(FP_IN_CONFLICT, contents='master')
719 utils_lib.write_file(DIR_FP_IN_CONFLICT, contents='master')
720 git.add(FP_IN_CONFLICT, DIR_FP_IN_CONFLICT)
721 git.commit(FP_IN_CONFLICT, DIR_FP_IN_CONFLICT, m='master')
722 git.merge('branch', _ok_code=[1])
723
724 @assert_no_side_effects(TRACKED_FP)
725 def test_resolve_fp_with_no_conflicts(self):
726 self.assertRaisesRegexp(
727 ValueError, 'no conflicts', self.curr_b.resolve_file, TRACKED_FP)
728
729 def __assert_resolve_fp(self, *fps):
730 for fp in fps:
731 self.curr_b.resolve_file(fp)
732 st = self.curr_b.status_file(fp)
733 self.assertFalse(st.in_conflict)
734
735 @assert_contents_unchanged(FP_IN_CONFLICT, DIR_FP_IN_CONFLICT)
736 def test_resolve_fp_with_conflicts(self):
737 self.__assert_resolve_fp(FP_IN_CONFLICT, DIR_FP_IN_CONFLICT)
738
739 def test_resolve_relative(self):
740 self.__assert_resolve_fp(DIR_FP_IN_CONFLICT)
741 os.chdir(DIR)
742 st = self.curr_b.status_file(DIR_FP_IN_CONFLICT)
743 self.assertFalse(st.in_conflict)
744 self.assertRaisesRegexp(
745 ValueError, 'no conflicts',
746 self.curr_b.resolve_file, DIR_FP_IN_CONFLICT)
747
748
749# Unit tests for branch related operations

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected