0

有人可以指出(或分享)JGit/NGit Push/Pull 输出结果的简单包装器吗?如何模仿 CGit 的输出?GUI 中应包含哪些信息?

到目前为止,这是我想出的(我使用的是 Mono/NGit):

using System;
using NGit;
using NGit.Api;
using NGit.Storage.File;
using NGit.Transport;
using Sharpen;

namespace RepoSync.Service
{
    class NGitPushResultAdapter : ICommandResponse
    {
        public NGitPushResultAdapter (Iterable<PushResult> pushResults)
        {
            foreach (var pushResult in pushResults) {
                var remoteUpdates = pushResult.GetRemoteUpdates ();
                foreach (var remoteUpdate in remoteUpdates) {
                                    // TODO: Which infos to include?
                    Msg += remoteUpdate.GetStatus ();
                }
            }
        }

        public string Msg { get; set; }
        public bool Success { get; set; }
        public GitCommandException Exception { get; set; }
    }
}
4

0 回答 0