public Models.Repository GetIncomingChanges(Models.Repository repository) { try { NGit.Api.Git git = NGit.Api.Git.Open(repository.Path); Repository repo = git.GetRepository(); repo.GetIndexFile(); //Repository repo = new FileRepository(new Sharpen.FilePath(path)); //NGit.Api.Git git = new NGit.Api.Git(repo); //TODO: Find out how git works really, and fix this. FetchCommand fc = git.Fetch(); FetchResult fr = fc.Call(); LogCommand lc = git.Log(); Iterable <RevCommit> lr = lc.Call(); if (git != null && repo != null && fr != null && lr != null) { List <Watchtower.Models.Changeset> commits = new List <Watchtower.Models.Changeset>(); foreach (RevCommit rc in lr) { //TODO: Find out if these values are right. Watchtower.Models.Changeset c = new Watchtower.Models.Changeset(rc.GetParent(0).GetHashCode().ToString(), rc.GetHashCode().ToString(), rc.GetCommitterIdent().GetEmailAddress(), rc.GetCommitterIdent().GetWhen(), rc.GetCommitterIdent().GetName(), rc.GetFullMessage()); commits.Add(c); } repository.IncomingChangesets = commits; } } catch { } return(repository); }
public virtual void ProcessFetchCommand(FetchCommand cmd) { this.Session.AppendResponse( new ServerStatusResponse(cmd.Tag, ServerStatusResponseType.NO, "FETCH State Error") ); }
public override void ProcessFetchCommand(FetchCommand cmd) { List <MailMessage> mails = GetMailMessagesFromCmd(cmd); foreach (var mail in mails) { this.Session.AppendResponse(Fetch(mail, cmd.fetchData)); } this.Session.AppendResponse( new ServerStatusResponse(cmd.Tag, ServerStatusResponseType.OK, "FETCH completed") ); }