/// <exception cref="NGit.Transport.ServiceMayNotContinueException"></exception> public override void AdvertiseRefs(BaseReceivePack rp) { for (int i = 0; i < count; i++) { hooks[i].AdvertiseRefs(rp); } }
/// <exception cref="NGit.Transport.ServiceMayNotContinueException"></exception> public override void AdvertiseRefs(BaseReceivePack receivePack) { IDictionary<string, Ref> refs = GetAdvertisedRefs(receivePack.GetRepository(), receivePack .GetRevWalk()); ICollection<ObjectId> haves = GetAdvertisedHaves(receivePack.GetRepository(), receivePack .GetRevWalk()); receivePack.SetAdvertisedRefs(refs, haves); }
/// <exception cref="NGit.Transport.ServiceMayNotContinueException"></exception> public override void AdvertiseRefs(BaseReceivePack receivePack) { IDictionary <string, Ref> refs = GetAdvertisedRefs(receivePack.GetRepository(), receivePack .GetRevWalk()); ICollection <ObjectId> haves = GetAdvertisedHaves(receivePack.GetRepository(), receivePack .GetRevWalk()); receivePack.SetAdvertisedRefs(refs, haves); }
/// <summary>Execute this command during a receive-pack session.</summary> /// <remarks> /// Execute this command during a receive-pack session. /// <p> /// Sets the status of the command as a side effect. /// </remarks> /// <param name="rp">receive-pack session.</param> /// <since>2.0</since> public virtual void Execute(BaseReceivePack rp) { try { RefUpdate ru = rp.GetRepository().UpdateRef(GetRefName()); ru.SetRefLogIdent(rp.GetRefLogIdent()); switch (GetType()) { case ReceiveCommand.Type.DELETE: { if (!ObjectId.ZeroId.Equals(GetOldId())) { // We can only do a CAS style delete if the client // didn't bork its delete request by sending the // wrong zero id rather than the advertised one. // ru.SetExpectedOldObjectId(GetOldId()); } ru.SetForceUpdate(true); SetResult(ru.Delete(rp.GetRevWalk())); break; } case ReceiveCommand.Type.CREATE: case ReceiveCommand.Type.UPDATE: case ReceiveCommand.Type.UPDATE_NONFASTFORWARD: { ru.SetForceUpdate(rp.IsAllowNonFastForwards()); ru.SetExpectedOldObjectId(GetOldId()); ru.SetNewObjectId(GetNewId()); ru.SetRefLogMessage("push", true); SetResult(ru.Update(rp.GetRevWalk())); break; } } } catch (IOException err) { Reject(err); } }
/// <summary>Execute this command during a receive-pack session.</summary> /// <remarks> /// Execute this command during a receive-pack session. /// <p> /// Sets the status of the command as a side effect. /// </remarks> /// <param name="rp">receive-pack session.</param> /// <since>2.0</since> public virtual void Execute(BaseReceivePack rp) { try { RefUpdate ru = rp.GetRepository().UpdateRef(GetRefName()); ru.SetRefLogIdent(rp.GetRefLogIdent()); switch (GetType()) { case ReceiveCommand.Type.DELETE: { if (!ObjectId.ZeroId.Equals(GetOldId())) { // We can only do a CAS style delete if the client // didn't bork its delete request by sending the // wrong zero id rather than the advertised one. // ru.SetExpectedOldObjectId(GetOldId()); } ru.SetForceUpdate(true); SetResult(ru.Delete(rp.GetRevWalk())); break; } case ReceiveCommand.Type.CREATE: case ReceiveCommand.Type.UPDATE: case ReceiveCommand.Type.UPDATE_NONFASTFORWARD: { ru.SetForceUpdate(rp.IsAllowNonFastForwards()); ru.SetExpectedOldObjectId(GetOldId()); ru.SetNewObjectId(GetNewId()); ru.SetRefLogMessage("push", true); SetResult(ru.Update(rp.GetRevWalk())); break; } } } catch (IOException err) { Reject(err); } }
// Do nothing. public override void AdvertiseRefs(BaseReceivePack receivePack) { }
/// <summary>Advertise refs for receive-pack.</summary> /// <remarks>Advertise refs for receive-pack.</remarks> /// <param name="receivePack"> /// instance on which to call /// <see cref="BaseReceivePack.SetAdvertisedRefs(System.Collections.Generic.IDictionary{K, V}, System.Collections.Generic.ICollection{E}) /// ">BaseReceivePack.SetAdvertisedRefs(System.Collections.Generic.IDictionary<K, V>, System.Collections.Generic.ICollection<E>) /// </see> /// if necessary. /// </param> /// <exception cref="ServiceMayNotContinueException">abort; the message will be sent to the user. /// </exception> /// <exception cref="NGit.Transport.ServiceMayNotContinueException"></exception> public abstract void AdvertiseRefs(BaseReceivePack receivePack);
// Do nothing. public override void AdvertiseRefs(BaseReceivePack receivePack) { }
/// <summary>Advertise refs for receive-pack.</summary> /// <remarks>Advertise refs for receive-pack.</remarks> /// <param name="receivePack"> /// instance on which to call /// <see cref="BaseReceivePack.SetAdvertisedRefs(System.Collections.Generic.IDictionary{K, V}, System.Collections.Generic.ICollection{E}) /// ">BaseReceivePack.SetAdvertisedRefs(System.Collections.Generic.IDictionary<K, V>, System.Collections.Generic.ICollection<E>) /// </see> /// if necessary. /// </param> /// <exception cref="ServiceMayNotContinueException">abort; the message will be sent to the user. /// </exception> /// <exception cref="NGit.Transport.ServiceMayNotContinueException"></exception> public abstract void AdvertiseRefs(BaseReceivePack receivePack);