private void printRefUpdateResult(URIish uri, OperationResult result, RemoteRefUpdate rru)
{
if (!shownUri)
{
shownUri = true;
OutputStream.WriteLine("To " + uri);
}
string remoteName = rru.RemoteName;
string srcRef = rru.IsDelete ? null : rru.SourceRef;
switch (rru.Status)
{
case RemoteRefUpdate.UpdateStatus.OK:
{
if (rru.IsDelete)
printUpdateLine('-', "[deleted]", null, remoteName, null);
else
{
GitSharp.Core.Ref oldRef = result.GetAdvertisedRef(remoteName);
if (oldRef == null)
{
string summary = remoteName.StartsWith(Constants.R_TAGS) ? "[new tag]" : "[new branch]";
printUpdateLine('*', summary, srcRef, remoteName, null);
}
else
{
bool fastForward = rru.FastForward;
char flag = fastForward ? ' ' : '+';
string summary = oldRef.ObjectId.Abbreviate(Repository._internal_repo).name() +
(fastForward ? ".." : "...") +
rru.NewObjectId.Abbreviate(Repository._internal_repo).name();
string message = fastForward ? null : "forced update";
printUpdateLine(flag, summary, srcRef, remoteName, message);
}
}
break;
}
case RemoteRefUpdate.UpdateStatus.NON_EXISTING:
printUpdateLine('X', "[no match]", null, remoteName, null);
break;
case RemoteRefUpdate.UpdateStatus.REJECTED_NODELETE:
printUpdateLine('!', "[rejected]", null, remoteName, "remote side does not support deleting refs");
break;
case RemoteRefUpdate.UpdateStatus.REJECTED_NONFASTFORWARD:
printUpdateLine('!', "[rejected]", srcRef, remoteName, "non-fast forward");
break;
case RemoteRefUpdate.UpdateStatus.REJECTED_REMOTE_CHANGED:
{
string message = "remote ref object changed - is not expected one " +
rru.ExpectedOldObjectId.Abbreviate(Repository._internal_repo).name();
printUpdateLine('!', "[rejected]", srcRef, remoteName, message);
break;
}
case RemoteRefUpdate.UpdateStatus.REJECTED_OTHER_REASON:
printUpdateLine('!', "[rejected]", srcRef, remoteName, rru.Message);
break;
case RemoteRefUpdate.UpdateStatus.UP_TO_DATE:
if (Verbose)
printUpdateLine('=', "[up to date]", srcRef, remoteName, null);
break;
case RemoteRefUpdate.UpdateStatus.NOT_ATTEMPTED:
case RemoteRefUpdate.UpdateStatus.AWAITING_REPORT:
printUpdateLine('?', "[unexpected push-process behavior]", srcRef, remoteName, rru.Message);
break;
}
}