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

Class TestRemoteSync

gitless/tests/test_core.py:937–970  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

935
936
937class TestRemoteSync(TestRemote):
938
939 def setUp(self):
940 super(TestRemoteSync, self).setUp()
941
942 utils_lib.write_file('foo', contents='foo')
943 git.add('foo')
944 git.commit('foo', m='msg')
945
946 self.repo.remotes.create('remote', self.remote_path)
947 self.remote = self.repo.remotes['remote']
948
949 def test_sync_changes(self):
950 master_head_before = self.remote.lookup_branch('master').head
951 remote_branch = self.remote.lookup_branch(REMOTE_BRANCH)
952 remote_branch_head_before = remote_branch.head
953
954 current_b = self.repo.current_branch
955 # It is not a ff so it should fail
956 self.assertRaises(core.GlError, current_b.publish, remote_branch)
957 # Get the changes
958 git.rebase(remote_branch)
959 # Retry (this time it should work)
960 current_b.publish(remote_branch)
961
962 self.assertItemsEqual(
963 ['master', REMOTE_BRANCH], self.remote.listall_branches())
964 self.assertEqual(
965 master_head_before.id, self.remote.lookup_branch('master').head.id)
966
967 self.assertNotEqual(
968 remote_branch_head_before.id,
969 remote_branch.head.id)
970 self.assertEqual(current_b.head.id, remote_branch.head.id)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected