54
55
/// A command being processed by
55
/// <see cref="ReceivePack">ReceivePack</see>
56
/// <see cref="BaseReceivePack">BaseReceivePack</see>
58
59
/// This command instance roughly translates to the server side representation of
92
93
/// <param name="commands">commands to filter.</param>
93
94
/// <param name="want">desired status to filter by.</param>
95
/// a copy of the command list containing only those commands with the
96
/// a copy of the command list containing only those commands with
97
/// the desired status.
99
/// <since>2.0</since>
98
100
public static IList<NGit.Transport.ReceiveCommand> Filter(IList<NGit.Transport.ReceiveCommand
99
101
> commands, ReceiveCommand.Result want)
175
179
/// <param name="name">name of the ref being affected.</param>
176
180
/// <param name="type">type of the command.</param>
181
/// <since>2.0</since>
177
182
public ReceiveCommand(ObjectId oldId, ObjectId newId, string name, ReceiveCommand.Type
255
/// <summary>Update the type of this command by checking for fast-forward.</summary>
257
/// Update the type of this command by checking for fast-forward.
259
/// If the command's current type is UPDATE, a merge test will be performed
260
/// using the supplied RevWalk to determine if
261
/// <see cref="GetOldId()">GetOldId()</see>
264
/// <see cref="GetNewId()">GetNewId()</see>
265
/// . If some commits are not merged the
266
/// update type is changed to
267
/// <see cref="Type.UPDATE_NONFASTFORWARD">Type.UPDATE_NONFASTFORWARD</see>
270
/// <param name="walk">
271
/// an instance to perform the merge test with. The caller must
272
/// allocate and release this object.
274
/// <exception cref="System.IO.IOException">
275
/// either oldId or newId is not accessible in the repository
276
/// used by the RevWalk. This usually indicates data corruption,
277
/// and the command cannot be processed.
279
public virtual void UpdateType(RevWalk walk)
285
if (type == ReceiveCommand.Type.UPDATE && !AnyObjectId.Equals(oldId, newId))
287
RevObject o = walk.ParseAny(oldId);
288
RevObject n = walk.ParseAny(newId);
289
if (!(o is RevCommit) || !(n is RevCommit) || !walk.IsMergedInto((RevCommit)o, (RevCommit
292
SetType(ReceiveCommand.Type.UPDATE_NONFASTFORWARD);
295
typeIsCorrect = true;
250
298
/// <summary>Execute this command during a receive-pack session.</summary>
252
300
/// Execute this command during a receive-pack session.
310
private void SetResult(RefUpdate.Result r)
358
internal virtual void SetTypeFastForwardUpdate()
360
type = ReceiveCommand.Type.UPDATE;
361
typeIsCorrect = true;
364
/// <summary>Set the result of this command.</summary>
365
/// <remarks>Set the result of this command.</remarks>
366
/// <param name="r">the new result code for this command.</param>
367
public virtual void SetResult(RefUpdate.Result r)
414
internal virtual void Reject(IOException err)
416
SetResult(ReceiveCommand.Result.REJECTED_OTHER_REASON, MessageFormat.Format(JGitText
417
.Get().lockError, err.Message));
357
420
public override string ToString()
359
422
return GetType().ToString() + ": " + GetOldId().Name + " " + GetNewId().Name + " "