public override string CherryPick(string revisionId) { var result = _git.CherryPick().Include(ObjectId.FromString(revisionId)).Call(); _git.Push().Call(); BatchingProgressMonitor.ShutdownNow(); return(result.GetCherryPickedRefs().Select(x => x.GetName()).First()); }
protected override void OnTestRepositoryDeployed() { base.OnTestRepositoryDeployed(); EnsureUserHomePathForSystemUser(); _git = NGit.Api.Git.CloneRepository() .SetURI(LocalRepositoryPath) .SetDirectory(ClonedRepoFolder).Call(); BatchingProgressMonitor.ShutdownNow(); }
public override void CheckoutBranch(string branch) { var fullBranchName = "refs/heads/" + branch; var list = _git.BranchList().Call(); var branchExists = list.Any(x => x.GetName() == fullBranchName); if (!branchExists) { var remoteBranchName = "refs/remotes/origin/" + branch; _git.BranchCreate().SetStartPoint(remoteBranchName).SetName(branch).Call(); } _git.Checkout().SetName(branch).Call(); BatchingProgressMonitor.ShutdownNow(); }
public override string Commit(string filePath, string changedContent, string commitComment) { using (var file = File.OpenWrite(Path.Combine(ClonedRepoFolder, filePath))) { var changes = new UTF8Encoding(true).GetBytes(changedContent); file.Write(changes, 0, changes.Length); } _git.Add().AddFilepattern(filePath).Call(); var commit = _git.Commit().SetMessage(commitComment).SetAuthor(Login, "*****@*****.**").Call(); _git.Push().Call(); BatchingProgressMonitor.ShutdownNow(); return(commit.Id.Name); }
public static void Main(string[] args) { Git myrepo = Git.Init().SetDirectory(@"/tmp/myrepo.git").SetBare(true).Call(); { var fetchResult = myrepo.Fetch() .SetProgressMonitor(new TextProgressMonitor()) .SetRemote(@"/tmp/initial") .SetRefSpecs(new RefSpec("refs/heads/master:refs/heads/master")) .Call(); // // Some other work... // myrepo.GetRepository().Close(); } System.GC.Collect(); #if false System.Console.WriteLine("Killing"); BatchingProgressMonitor.ShutdownNow(); #endif System.Console.WriteLine("Done"); }