92
94
/// of the command. Don't call this method twice on an instance.
94
96
/// <returns>the result of the merge</returns>
97
/// <exception cref="NGit.Api.Errors.GitAPIException"></exception>
95
98
/// <exception cref="NGit.Api.Errors.NoHeadException"></exception>
96
99
/// <exception cref="NGit.Api.Errors.ConcurrentRefUpdateException"></exception>
97
100
/// <exception cref="NGit.Api.Errors.CheckoutConflictException"></exception>
169
172
dco.SetFailOnConflict(true);
171
UpdateHead(refLogMessage, srcCommit, headId);
176
ObjectId @base = null;
177
MergeStatus mergeStatus = null;
180
UpdateHead(refLogMessage, srcCommit, headId);
181
newHead = @base = srcCommit;
182
mergeStatus = MergeStatus.FAST_FORWARD;
186
msg = JGitText.Get().squashCommitNotUpdatingHEAD;
187
newHead = @base = headId;
188
mergeStatus = MergeStatus.FAST_FORWARD_SQUASHED;
189
IList<RevCommit> squashedCommits = RevWalkUtils.Find(revWalk, srcCommit, headCommit
191
string squashMessage = new SquashMessageFormatter().Format(squashedCommits, head);
192
repo.WriteSquashCommitMsg(squashMessage);
172
194
SetCallable(false);
173
return new MergeCommandResult(srcCommit, srcCommit, new ObjectId[] { headCommit,
174
srcCommit }, MergeStatus.FAST_FORWARD, mergeStrategy, null, null);
195
return new MergeCommandResult(newHead, @base, new ObjectId[] { headCommit, srcCommit
196
}, mergeStatus, mergeStrategy, null, msg);
178
string mergeMessage = new MergeMessageFormatter().Format(commits, head);
179
repo.WriteMergeCommitMsg(mergeMessage);
180
repo.WriteMergeHeads(Arrays.AsList(@ref.GetObjectId()));
200
string mergeMessage = string.Empty;
203
mergeMessage = new MergeMessageFormatter().Format(commits, head);
204
repo.WriteMergeCommitMsg(mergeMessage);
205
repo.WriteMergeHeads(Arrays.AsList(@ref.GetObjectId()));
209
IList<RevCommit> squashedCommits = RevWalkUtils.Find(revWalk, srcCommit, headCommit
211
string squashMessage = new SquashMessageFormatter().Format(squashedCommits, head);
212
repo.WriteSquashCommitMsg(squashMessage);
181
214
Merger merger = mergeStrategy.NewMerger(repo);
183
216
IDictionary<string, MergeResult<NGit.Diff.Sequence>> lowLevelResults = null;
207
240
dco.SetFailOnConflict(true);
209
RevCommit newHead = new Git(GetRepository()).Commit().SetReflogComment(refLogMessage
243
RevCommit newHead = null;
244
MergeStatus mergeStatus = null;
247
newHead = new Git(GetRepository()).Commit().SetReflogComment(refLogMessage.ToString
249
mergeStatus = MergeStatus.MERGED;
253
msg = JGitText.Get().squashCommitNotUpdatingHEAD;
254
newHead = headCommit;
255
mergeStatus = MergeStatus.MERGED_SQUASHED;
211
257
return new MergeCommandResult(newHead.Id, null, new ObjectId[] { headCommit.Id, srcCommit
212
.Id }, MergeStatus.MERGED, mergeStrategy, null, null);
258
.Id }, mergeStatus, mergeStrategy, null, msg);
337
383
return Include(new ObjectIdRef.Unpeeled(RefStorage.LOOSE, name, commit.Copy()));
387
/// If <code>true</code>, will prepare the next commit in working tree and
388
/// index as if a real merge happened, but do not make the commit or move the
392
/// If <code>true</code>, will prepare the next commit in working tree and
393
/// index as if a real merge happened, but do not make the commit or move the
394
/// HEAD. Otherwise, perform the merge and commit the result.
396
/// In case the merge was successful but this flag was set to
397
/// <code>true</code> a
398
/// <see cref="MergeCommandResult">MergeCommandResult</see>
400
/// <see cref="MergeStatus.MERGED_SQUASHED">MergeStatus.MERGED_SQUASHED</see>
402
/// <see cref="MergeStatus.FAST_FORWARD_SQUASHED">MergeStatus.FAST_FORWARD_SQUASHED</see>
405
/// <param name="squash">whether to squash commits or not</param>
408
/// <code>this</code>
410
/// <since>2.0</since>
411
public virtual NGit.Api.MergeCommand SetSquash(bool squash)
414
this.squash = squash;