MCPcopy
hub / github.com/gitless-vcs/gitless / merge

Method merge

gitless/core.py:957–981  ·  view source on GitHub ↗

Merges the divergent changes of the src branch onto this one.

(self, src, op_cb=None)

Source from the content-addressed store, hash-verified

955 # Merge-related methods
956
957 def merge(self, src, op_cb=None):
958 """Merges the divergent changes of the src branch onto this one."""
959 self._check_is_current()
960 self._check_op_not_in_progress()
961
962 result, unused_ff_conf = self.gl_repo.git_repo.merge_analysis(src.target)
963 if result & pygit2.GIT_MERGE_ANALYSIS_UP_TO_DATE:
964 raise GlError('No commits to merge')
965 try:
966 git.merge(src, '--no-ff')
967 except ErrorReturnCode as e:
968 err = stderr(e)
969 if not 'stash' in err:
970 raise GlError(stdout(e) + err)
971 if op_cb and op_cb.save:
972 op_cb.save()
973 git.stash.save('--', _stash_msg_merge(self))
974 try:
975 git.merge(src, '--no-ff')
976 except ErrorReturnCode as e:
977 raise GlError(stdout(e) + stderr(e))
978
979 self._state_cleanup()
980 restore_fn = op_cb.restore_ok if op_cb else None
981 self._safe_restore(_stash_msg_merge, restore_fn=restore_fn)
982
983 def merge_continue(self, op_cb=None):
984 if not self.merge_in_progress:

Callers 5

abort_mergeMethod · 0.80
mainFunction · 0.80
setUpMethod · 0.80

Calls 9

_check_is_currentMethod · 0.95
_state_cleanupMethod · 0.95
_safe_restoreMethod · 0.95
GlErrorClass · 0.85
_stash_msg_mergeFunction · 0.85
saveMethod · 0.80
stderrFunction · 0.70
stdoutFunction · 0.70

Tested by 3

setUpMethod · 0.64