(self, commits, op_cb=None)
| 1100 | self._fuse(commits, op_cb=op_cb) |
| 1101 | |
| 1102 | def _fuse(self, commits, op_cb=None): |
| 1103 | git_repo = self.gl_repo.git_repo |
| 1104 | committer = git_repo.default_signature |
| 1105 | |
| 1106 | for ci in commits: |
| 1107 | git_repo.cherrypick(ci.id) |
| 1108 | index = self._index |
| 1109 | if index.conflicts: |
| 1110 | if op_cb and op_cb.apply_err: |
| 1111 | op_cb.apply_err(ci) |
| 1112 | self._save_fuse_commits(commits) |
| 1113 | raise GlError('There are conflicts you need to resolve') |
| 1114 | |
| 1115 | if op_cb and op_cb.apply_ok: |
| 1116 | op_cb.apply_ok(ci) |
| 1117 | tree_oid = index.write_tree(git_repo) |
| 1118 | git_repo.create_commit( |
| 1119 | 'HEAD', # the name of the reference to update |
| 1120 | ci.author, committer, ci.message, tree_oid, |
| 1121 | [git_repo.head.target]) |
| 1122 | |
| 1123 | # We are done fusing => update original branch and re-attach head |
| 1124 | orig_branch_ref = git_repo.lookup_reference('GL_FUSE_ORIG_HEAD').resolve() |
| 1125 | orig_branch_ref.set_target(git_repo.head.target) |
| 1126 | git_repo.set_head(orig_branch_ref.name) |
| 1127 | self._state_cleanup() |
| 1128 | restore_fn = op_cb.restore_ok if op_cb else None |
| 1129 | self._safe_restore(_stash_msg_fuse, restore_fn=restore_fn) |
| 1130 | |
| 1131 | @property |
| 1132 | def fuse_in_progress(self): |
no test coverage detected