public void ShouldReturnValueForAValidRef() { var result = new PushResult(); var r = new Core.Ref(null, "ref", ObjectId.ZeroId); result.AdvertisedRefs.Add("ref", r); Assert.AreEqual(r, result.GetAdvertisedRef("ref")); }
public void ShouldReturnValueForAValidRef() { var result = new PushResult(); var r = new Unpeeled(null, "ref", ObjectId.ZeroId); var refs = result.AdvertisedRefs; var advRefs = refs.ToDictionary(@ref => @ref.Name); advRefs.Add("ref", r); result.SetAdvertisedRefs(result.URI, advRefs); Assert.AreEqual(r, result.GetAdvertisedRef("ref")); }
private PushResult PrepareOperationResult() { var result = new PushResult(); result.SetAdvertisedRefs(_transport.Uri, _connection.RefsMap); result.SetRemoteUpdates(_toPush); foreach (RemoteRefUpdate rru in _toPush.Values) { TrackingRefUpdate tru = rru.TrackingRefUpdate; if (tru != null) { result.Add(tru); } } return(result); }
public override void Execute() { if (Force) { List<RefSpec> orig = new List<RefSpec>(RefSpecs); RefSpecs.Clear(); foreach (RefSpec spec in orig) RefSpecs.Add(spec.SetForce(true)); } List<Transport> transports = Transport.openAll(Repository._internal_repo, Remote); foreach (Transport transport in transports) { if (ReceivePack != null) { transport.OptionReceivePack = ReceivePack; } transport.DryRun = DryRun; transport.PushThin = Thin; URIish uri = transport.Uri; var toPush = transport.findRemoteRefUpdatesFor(RefSpecs); try { Result = transport.push(ProgressMonitor, toPush); } finally { transport.Dispose(); } printPushResult(uri, Result); } }
private void printPushResult(URIish uri, PushResult result) { shownUri = false; bool everythingUpToDate = true; foreach (RemoteRefUpdate rru in result.RemoteUpdates) { if (rru.Status == RemoteRefUpdate.UpdateStatus.UP_TO_DATE) { if (Verbose) printRefUpdateResult(uri, result, rru); } else { everythingUpToDate = false; } } foreach (RemoteRefUpdate rru in result.RemoteUpdates) { if (rru.Status == RemoteRefUpdate.UpdateStatus.OK) printRefUpdateResult(uri, result, rru); } foreach (RemoteRefUpdate rru in result.RemoteUpdates) { if (rru.Status != RemoteRefUpdate.UpdateStatus.OK && rru.Status != RemoteRefUpdate.UpdateStatus.UP_TO_DATE) printRefUpdateResult(uri, result, rru); } if (everythingUpToDate) OutputStream.WriteLine("Everything up-to-date"); }
private PushResult PrepareOperationResult() { var result = new PushResult(); result.SetAdvertisedRefs(_transport.Uri, _connection.RefsMap); result.SetRemoteUpdates(_toPush); foreach (RemoteRefUpdate rru in _toPush.Values) { TrackingRefUpdate tru = rru.TrackingRefUpdate; if (tru != null) { result.Add(tru); } } return result; }
public void ShouldReturnNullForAnInvalidRef() { var result = new PushResult(); Assert.IsNull(result.GetAdvertisedRef("invalid ref")); }