MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / tryToFinishMerge

Function tryToFinishMerge

plugins/vcs/Algorithm.h:165–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165inline void tryToFinishMerge(const std::shared_ptr<Repository>& repository)
166{
167 auto mapPath = repository->getRepositoryRelativePath(GlobalMapModule().getMapName());
168
169 auto index = repository->getIndex();
170
171 if (index->hasConflicts())
172 {
173 // Remove the conflict state from the map
174 resolveMapFileConflictUsingOurs(repository);
175
176 // If the index still has conflicts, notify the user
177 if (index->hasConflicts())
178 {
179 wxutil::Messagebox::Show(_("Conflicts"),
180 _("There are still unresolved conflicts in the repository.\nPlease use your Git client to resolve them and try again."),
181 ::ui::IDialog::MessageType::MESSAGE_CONFIRM);
182 return;
183 }
184 }
185
186 auto head = repository->getHead();
187 if (!head) throw git::GitException("Cannot resolve repository HEAD");
188
189 auto upstream = head->getUpstream();
190 if (!upstream) throw git::GitException("Cannot resolve upstream ref from HEAD");
191
192 // We need the commit metadata to be valid
193 git::CommitMetadata metadata;
194
195 metadata.name = repository->getConfigValue("user.name");
196 metadata.email = repository->getConfigValue("user.email");
197 metadata.message = "Integrated remote changes from " + upstream->getShorthandName();
198
199 if (metadata.name.empty() || metadata.email.empty())
200 {
201 metadata = ui::CommitDialog::RunDialog(metadata);
202 }
203
204 if (metadata.isValid())
205 {
206 repository->createCommit(metadata, upstream);
207 repository->cleanupState();
208 }
209}
210
211inline void performFastForward(const std::shared_ptr<Repository>& repository)
212{

Callers 2

syncWithRemoteFunction · 0.85
onMapEventMethod · 0.85

Calls 15

GitExceptionClass · 0.85
hasConflictsMethod · 0.80
getHeadMethod · 0.80
getUpstreamMethod · 0.80
getConfigValueMethod · 0.80
getShorthandNameMethod · 0.80
createCommitMethod · 0.80
_Function · 0.50
getMapNameMethod · 0.45
getIndexMethod · 0.45

Tested by

no test coverage detected