private void PollCommitments(GitSharp.Repository repo) { int i = 0; string name = string.Empty; string authorname = string.Empty; string authoremail = string.Empty; string message = string.Empty; System.DateTimeOffset commitdate; bool loopcontrol = true; while (loopcontrol) { if (i == 0) { name = "HEAD"; i++; } else { name = name + "^"; } var c1 = new GitSharp.Commit(repo, name); try { authorname = c1.Author.Name; authoremail = c1.Author.EmailAddress; message = c1.Message; commitdate = c1.CommitDate; //Load to Database } catch { loopcontrol = false; } } }
public Versioning(Data data, GitSharp.Repository repo) { GitDetails = null; InitializeComponent(); VersionControlData = data; _repo = repo; LoadFileStructure(); }
private static byte[] entry(GitSharp.FileMode mode, string name, ObjectId id) { var @out = new MemoryStream(); mode.CopyTo(@out); @out.WriteByte((byte)' '); var bytes = Constants.encode(name); @out.Write(bytes, 0, bytes.Length); @out.WriteByte((byte)0); id.copyRawTo(@out); return @out.ToArray(); }
public Versioning(Data data, GitSharp.Repository repo) { GitDetails = null; InitializeComponent(); ForeColor = ThemeColorTable.ForeColor; BackColor = ThemeColorTable.BackgroundColor; ThemeUpdateControls.UpdateControls(this); Icon = Resources.Icon_Vixen3; VersionControlData = data; _repo = repo; LoadFileStructure(); }
protected static string GetAllErrorsFromPatch(GitSharp.Core.Patch.Patch patch) { if (patch == null || patch.getErrors().Count == 0) { return string.Empty; } var sb = new StringBuilder(); foreach (FormatError formatError in patch.getErrors()) { sb.AppendLine(formatError.getMessage()); } return sb.ToString(); }
protected void showFetchResult(GitSharp.Core.Transport.Transport tn, FetchResult r) { bool shownURI = false; foreach (TrackingRefUpdate u in r.TrackingRefUpdates) { if (!verbose && u.Result == RefUpdate.RefUpdateResult.NoChange) continue; char type = shortTypeOf(u.Result); string longType = longTypeOf(u); string src = AbbreviateRef(u.RemoteName, false); string dst = AbbreviateRef(u.LocalName, true); if (!shownURI) { OutputStream.Write("From "); OutputStream.WriteLine(tn.Uri); shownURI = true; } OutputStream.WriteLine(" " + type + " " + longType + " " + src + " -> " + dst); } }
private void WriteInfoPacks(IEnumerable<string> packs, GitSharp.Core.Repository repository) { var w = new StringBuilder(); foreach (string pack in packs) { w.Append("P "); w.Append(pack); w.Append('\n'); } var infoPacksPath = Path.Combine(repository.ObjectsDirectory.FullName, "info/packs"); var encoded = Encoding.ASCII.GetBytes(w.ToString()); using (Stream fs = File.Create(infoPacksPath)) { fs.Write(encoded, 0, encoded.Length); } }
private IEnumerable<string> GetPackRefs(GitSharp.Core.Repository repository) { var packDir = repository.ObjectsDirectory.GetDirectories().SingleOrDefault(x => x.Name == "pack"); if(packDir == null) { return Enumerable.Empty<string>(); } return packDir.GetFiles("*.pack").Select(x => x.Name).ToList(); }
private static void AssertCorrectId(DirCache treeT, GitSharp.Core.TreeWalk.TreeWalk tw) { Assert.AreEqual(treeT.getEntry(tw.getPathString()).getObjectId(), tw.getObjectId(0)); }
/// <summary> /// Initializes a command for use including the repository and output support. /// </summary> /// <param name="repo">Specifies the repository to use.</param> /// <param name="path"></param> public void Init(GitSharp.Repository repo, string path) { try { //Initialize the output stream for all console-based messages. Git.DefaultOutputStream = new StreamWriter(Console.OpenStandardOutput()); Console.SetOut(Git.DefaultOutputStream); } catch (IOException) { throw die("cannot create output stream"); } // Initialize the repository in use. if (repo != null) { GitRepository = repo; GitDirectory = ((Core.Repository)repo).Directory.FullName; } else { GitRepository = null; GitDirectory = path; } }
private void doCheckout(GitSharp.Core.Ref branch) { if (branch == null) throw new ArgumentNullException("branch", "Cannot checkout; no HEAD advertised by remote"); var repo = Repository._internal_repo; if (!Constants.HEAD.Equals(branch.getName())) { RefUpdate u1 = repo.UpdateRef(Constants.HEAD); u1.disableRefLog(); u1.link(branch.getName()); } GitSharp.Core.Commit commit = repo.MapCommit(branch.ObjectId); RefUpdate u = repo.UpdateRef(Constants.HEAD); u.NewObjectId = commit.CommitId; u.forceUpdate(); GitIndex index = new GitIndex(repo); GitSharp.Core.Tree tree = commit.TreeEntry; WorkDirCheckout co = new WorkDirCheckout(repo, repo.WorkingDirectory, index, tree); co.checkout(); index.write(); }
public override bool include(GitSharp.RevWalk.RevWalk walker, RevCommit cmit) { bool remoteKnowsIsCommon = cmit.has(COMMON); if (cmit.has(ADVERTISED)) { cmit.add(COMMON); } return !remoteKnowsIsCommon; }
public override bool include(GitSharp.Core.RevWalk.RevWalk walker, RevCommit cmit) { bool remoteKnowsIsCommon = cmit.has(_common); if (cmit.has(_advertised)) { cmit.add(_common); } return !remoteKnowsIsCommon; }
private void doCheckout(GitSharp.Core.Ref branch) { if (branch == null) throw new ArgumentNullException("branch", "Cannot checkout; no HEAD advertised by remote"); if (!Constants.HEAD.Equals(branch.Name)) GitRepository.WriteSymref(Constants.HEAD, branch.Name); GitSharp.Core.Commit commit = GitRepository.MapCommit(branch.ObjectId); RefUpdate u = GitRepository.UpdateRef(Constants.HEAD); u.NewObjectId = commit.CommitId; u.ForceUpdate(); GitIndex index = new GitIndex(GitRepository); GitSharp.Core.Tree tree = commit.TreeEntry; WorkDirCheckout co = new WorkDirCheckout(GitRepository, GitRepository.WorkingDirectory, index, tree); co.checkout(); index.write(); }
private static void assertModes(string path, FileMode mode0, FileMode mode1, GitSharp.TreeWalk.TreeWalk tw) { Assert.IsTrue(tw.next(), "has " + path); Assert.AreEqual(path, tw.getPathString()); Assert.AreEqual(mode0, tw.getFileMode(0)); Assert.AreEqual(mode1, tw.getFileMode(1)); }
public override bool include(GitSharp.Core.RevWalk.RevWalk walker, RevCommit cmit) { return true; }
internal RepositoryStatus(GitSharp.Core.IndexDiff diff) { _diff = diff; AnyDifferences = _diff.Diff(); }
private void AssertCorrectId(DirCache treeT, GitSharp.TreeWalk.TreeWalk tw) { Assert.Equals(treeT.getEntry(tw.getPathString()).getObjectId(), tw.getObjectId(0)); }
private void PollCommitments(GitSharp.Repository repo, string RepositoryId) { int i = 0; string name = string.Empty; string hash = string.Empty; string authorname = string.Empty; string authoremail = string.Empty; string message = string.Empty; System.DateTimeOffset commitdate; bool loopcontrol = true; while (loopcontrol) { if (i == 0) { name = "HEAD"; i++; } else { name = name + "^"; } var c1 = new GitSharp.Commit(repo, name); try { hash = c1.Hash; authorname = c1.Author.Name; authoremail = c1.Author.EmailAddress; message = c1.Message; commitdate = c1.CommitDate; InsertCommit(RepositoryId,hash,authorname,authoremail,message,commitdate.DateTime.ToString()); } catch { loopcontrol = false; } } }
public SimpleRefWriter(GitSharp.Core.Repository db, IEnumerable<Ref> refs) : base(refs) { _db = db; }
public string CommitHash(GitSharp.Commit c) { if (c == null) return ""; return c.Hash.Substring(0, 8); }
public void Init(GitSharp.Repository repository) { configurationList.ItemsSource = repository.Config; }
public override bool include(GitSharp.Core.TreeWalk.TreeWalk walker) { return false; }
public GitStatus(GitSharp.Core.Repository repository) { _diff = new GitSharp.Core.IndexDiff(repository); if (_diff != null) HasChanges = _diff.Diff(); }