private void UpdateCommand(RemoteRefUpdate u) { try { dest.WriteRef(u.GetRemoteName(), u.GetNewObjectId()); newRefs.Put(u.GetRemoteName(), new ObjectIdRef.Unpeeled(RefStorage.LOOSE, u.GetRemoteName (), u.GetNewObjectId())); u.SetStatus(RemoteRefUpdate.Status.OK); } catch (IOException e) { u.SetStatus(RemoteRefUpdate.Status.REJECTED_OTHER_REASON); u.SetMessage(e.Message); } }
// Ignore the deletion failure. We probably are // already failing and were just trying to pick // up after ourselves. private void DeleteCommand(RemoteRefUpdate u) { Ref r = Sharpen.Collections.Remove(newRefs, u.GetRemoteName()); if (r == null) { // Already gone. // u.SetStatus(RemoteRefUpdate.Status.OK); return; } if (r.GetStorage().IsPacked()) { packedRefUpdates.AddItem(u); } if (r.GetStorage().IsLoose()) { try { dest.DeleteRef(u.GetRemoteName()); u.SetStatus(RemoteRefUpdate.Status.OK); } catch (IOException e) { u.SetStatus(RemoteRefUpdate.Status.REJECTED_OTHER_REASON); u.SetMessage(e.Message); } } try { dest.DeleteRefLog(u.GetRemoteName()); } catch (IOException e) { u.SetStatus(RemoteRefUpdate.Status.REJECTED_OTHER_REASON); u.SetMessage(e.Message); } }
public virtual void TestFindRemoteRefUpdatesNoWildcardNoTracking() { transport = NGit.Transport.Transport.Open(db, remoteConfig); ICollection <RemoteRefUpdate> result = transport.FindRemoteRefUpdatesFor(Collections .NCopies(1, new RefSpec("refs/heads/master:refs/heads/x"))); NUnit.Framework.Assert.AreEqual(1, result.Count); RemoteRefUpdate rru = result.Iterator().Next(); NUnit.Framework.Assert.IsNull(rru.GetExpectedOldObjectId()); NUnit.Framework.Assert.IsFalse(rru.IsForceUpdate()); NUnit.Framework.Assert.AreEqual("refs/heads/master", rru.GetSrcRef()); NUnit.Framework.Assert.AreEqual(db.Resolve("refs/heads/master"), rru.GetNewObjectId ()); NUnit.Framework.Assert.AreEqual("refs/heads/x", rru.GetRemoteName()); }
private void UpdateCommand(RemoteRefUpdate u) { try { dest.WriteRef(u.GetRemoteName(), u.GetNewObjectId()); newRefs.Put(u.GetRemoteName(), new ObjectIdRef.Unpeeled(RefStorage.LOOSE, u.GetRemoteName (), u.GetNewObjectId())); u.SetStatus(RemoteRefUpdate.Status.OK); } catch (IOException e) { u.SetStatus(RemoteRefUpdate.Status.REJECTED_OTHER_REASON); u.SetMessage(e.Message); } }
// Ignore the deletion failure. We probably are // already failing and were just trying to pick // up after ourselves. private void DeleteCommand(RemoteRefUpdate u) { Ref r = Sharpen.Collections.Remove(newRefs, u.GetRemoteName()); if (r == null) { // Already gone. // u.SetStatus(RemoteRefUpdate.Status.OK); return; } if (r.GetStorage().IsPacked()) { packedRefUpdates.AddItem(u); } if (r.GetStorage().IsLoose()) { try { dest.DeleteRef(u.GetRemoteName()); u.SetStatus(RemoteRefUpdate.Status.OK); } catch (IOException e) { u.SetStatus(RemoteRefUpdate.Status.REJECTED_OTHER_REASON); u.SetMessage(e.Message); } } try { dest.DeleteRefLog(u.GetRemoteName()); } catch (IOException e) { u.SetStatus(RemoteRefUpdate.Status.REJECTED_OTHER_REASON); u.SetMessage(e.Message); } }