private PlotCommitList<PlotLane> GetAlltCommits()
        {
            var workingDirectoryPath = new Sharpen.FilePath(GitWorkingDirectory);
            var git = Git.Open(workingDirectoryPath);
            var repository = git.GetRepository();

            try
            {
                var plotWalk = new PlotWalk(repository);
                var refsByPeeledList = repository.GetAllRefsByPeeledObjectId();
                var revCommitList = refsByPeeledList
                                    .Keys
                                    .Select(id => plotWalk.ParseCommit(id))
                                    .ToList();

                plotWalk.MarkStart(revCommitList);

                var commits = new PlotCommitList<PlotLane>();
                commits.Source(plotWalk);
                commits.FillTo(int.MaxValue);

                return commits;
            }
            finally
            {
                git.GetRepository().Close();
                git.GetRepository().ObjectDatabase.Close();
            }
        }
        /*private bool IsCommit(GitSharp.Core.AnyObjectId id)
         * {
         *  try { m_revwalk.parseCommit(id); }
         *  catch { return false; }
         *  return true;
         * }*/

        public void Clear()
        {
            m_repo    = null;
            m_revwalk = null;
            this.lstCommits.ItemsSource = null;
            this.imgLegend.Source       = null;
            if (CommitClicked != null)
            {
                CommitClicked(null);
            }
        }
        public void Update(Repository repo)
        {
            m_repo = repo;
            var list = new PlotCommitList();

            m_revwalk = new PlotWalk(repo);
            m_revwalk.markStart(((GitSharp.Core.Repository)repo).getAllRefsByPeeledObjectId().Keys.Select(id => m_revwalk.parseCommit(id)));
            list.Source(m_revwalk);
            list.fillTo(1000);
            m_plot_renderer.Update(list);
        }
 public void Update(Repository repo)
 {
     m_repo = repo;
     var list = new PlotCommitList();
     m_revwalk = new PlotWalk(repo);
     m_revwalk.markStart(((Core.Repository)repo).getAllRefsByPeeledObjectId().Keys.Select(id => m_revwalk.parseCommit(id)));
     list.Source(m_revwalk);
     list.fillTo(1000);
     m_plot_renderer.Update(list);
     //var rw = new RevWalk(repo);
     //rw.RevSortStrategy.Add(RevSort.Strategy.COMMIT_TIME_DESC);
     //rw.RevSortStrategy.Add(RevSort.Strategy.TOPO);
     //rw.markStart(((Core.Repository)repo).getAllRefsByPeeledObjectId().Keys.Select(id => rw.parseCommit(id)));
     //m_renderer.Update(rw);
 }
Exemple #5
0
        public void Update(Repository repo)
        {
            m_repo = repo;
            var list = new PlotCommitList();

            m_revwalk = new PlotWalk(repo);
            m_revwalk.markStart(((Core.Repository)repo).getAllRefsByPeeledObjectId().Keys.Select(id => m_revwalk.parseCommit(id)));
            list.Source(m_revwalk);
            list.fillTo(1000);
            m_plot_renderer.Update(list);
            //var rw = new RevWalk(repo);
            //rw.RevSortStrategy.Add(RevSort.Strategy.COMMIT_TIME_DESC);
            //rw.RevSortStrategy.Add(RevSort.Strategy.TOPO);
            //rw.markStart(((Core.Repository)repo).getAllRefsByPeeledObjectId().Keys.Select(id => rw.parseCommit(id)));
            //m_renderer.Update(rw);
        }
        public void Update(Repository repo)
        {
            m_repo = repo;
            var list = new PlotCommitList();

            m_revwalk = new PlotWalk(repo);
            // if id is not commit, parseCommit() will throw [This should probably be handled better]
            //var CommitIds = ((Core.Repository)repo).getAllRefsByPeeledObjectId().Keys.Where(IsCommit);
            //m_revwalk.markStart(CommitIds.Select(id => m_revwalk.parseCommit(id)));
            m_revwalk.markStart(((Core.Repository)repo).getAllRefsByPeeledObjectId().Keys.Select(id => m_revwalk.parseCommit(id)));
            list.Source(m_revwalk);
            list.fillTo(1000);
            // link the commits
            this.lstCommits.ItemsSource = list;
            // link the jump lists
            try { this.lstBranches.ItemsSource = m_repo.Branches; }
            catch { this.lstBranches.ItemsSource = null; }
            try { this.lstRemotes.ItemsSource = m_repo.RemoteBranches; }
            catch { this.lstRemotes.ItemsSource = null; }
            try { this.lstTags.ItemsSource = m_repo.Tags; }
            catch { this.lstTags.ItemsSource = null; }
            UpdateLegend();                 // update refs legend
            this.lstCommits.UpdateLayout(); //fixes issue w/ ScrollIntoView when changing source
        }
Exemple #7
0
		public virtual void TestEgitHistory()
		{
			RevCommit merge_fix = Commit();
			RevCommit add_simple = Commit(merge_fix);
			RevCommit remove_unused = Commit(merge_fix);
			RevCommit merge_remove = Commit(add_simple, remove_unused);
			RevCommit resolve_handler = Commit(merge_fix);
			RevCommit clear_repositorycache = Commit(merge_remove);
			RevCommit add_Maven = Commit(clear_repositorycache);
			RevCommit use_remote = Commit(clear_repositorycache);
			RevCommit findToolBar_layout = Commit(clear_repositorycache);
			RevCommit merge_add_Maven = Commit(findToolBar_layout, add_Maven);
			RevCommit update_eclipse_iplog = Commit(merge_add_Maven);
			RevCommit changeset_implementation = Commit(clear_repositorycache);
			RevCommit merge_use_remote = Commit(update_eclipse_iplog, use_remote);
			RevCommit disable_source = Commit(merge_use_remote);
			RevCommit update_eclipse_iplog2 = Commit(merge_use_remote);
			RevCommit merge_disable_source = Commit(update_eclipse_iplog2, disable_source);
			RevCommit merge_changeset_implementation = Commit(merge_disable_source, changeset_implementation
				);
			RevCommit clone_operation = Commit(merge_disable_source, merge_changeset_implementation
				);
			RevCommit update_eclipse = Commit(add_Maven);
			RevCommit merge_resolve_handler = Commit(clone_operation, resolve_handler);
			RevCommit disable_comment = Commit(clone_operation);
			RevCommit merge_disable_comment = Commit(merge_resolve_handler, disable_comment);
			RevCommit fix_broken = Commit(merge_disable_comment);
			RevCommit add_a_clear = Commit(fix_broken);
			RevCommit merge_update_eclipse = Commit(add_a_clear, update_eclipse);
			RevCommit sort_roots = Commit(merge_update_eclipse);
			RevCommit fix_logged_npe = Commit(merge_changeset_implementation);
			RevCommit merge_fixed_logged_npe = Commit(sort_roots, fix_logged_npe);
			PlotWalk pw = new PlotWalk(db);
			pw.MarkStart(pw.LookupCommit(merge_fixed_logged_npe.Id));
			PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
			pcl.Source(pw);
			pcl.FillTo(int.MaxValue);
			PlotCommitListTest.CommitListAssert test = new PlotCommitListTest.CommitListAssert
				(this, pcl);
			test.Commit(merge_fixed_logged_npe).Parents(sort_roots, fix_logged_npe).LanePos(0
				);
			test.Commit(fix_logged_npe).Parents(merge_changeset_implementation).LanePos(0);
			test.Commit(sort_roots).Parents(merge_update_eclipse).LanePos(1);
			test.Commit(merge_update_eclipse).Parents(add_a_clear, update_eclipse).LanePos(1);
			test.Commit(add_a_clear).Parents(fix_broken).LanePos(1);
			test.Commit(fix_broken).Parents(merge_disable_comment).LanePos(1);
			test.Commit(merge_disable_comment).Parents(merge_resolve_handler, disable_comment
				).LanePos(1);
			test.Commit(disable_comment).Parents(clone_operation).LanePos(1);
			test.Commit(merge_resolve_handler).Parents(clone_operation, resolve_handler).LanePos
				(2);
			test.Commit(update_eclipse).Parents(add_Maven).LanePos(3);
			test.Commit(clone_operation).Parents(merge_disable_source, merge_changeset_implementation
				).LanePos(1);
			test.Commit(merge_changeset_implementation).Parents(merge_disable_source, changeset_implementation
				).LanePos(0);
			test.Commit(merge_disable_source).Parents(update_eclipse_iplog2, disable_source).
				LanePos(1);
			test.Commit(update_eclipse_iplog2).Parents(merge_use_remote).LanePos(0);
			test.Commit(disable_source).Parents(merge_use_remote).LanePos(1);
			test.Commit(merge_use_remote).Parents(update_eclipse_iplog, use_remote).LanePos(0
				);
			test.Commit(changeset_implementation).Parents(clear_repositorycache).LanePos(2);
			test.Commit(update_eclipse_iplog).Parents(merge_add_Maven).LanePos(0);
			test.Commit(merge_add_Maven).Parents(findToolBar_layout, add_Maven).LanePos(0);
			test.Commit(findToolBar_layout).Parents(clear_repositorycache).LanePos(0);
			test.Commit(use_remote).Parents(clear_repositorycache).LanePos(1);
			test.Commit(add_Maven).Parents(clear_repositorycache).LanePos(3);
			test.Commit(clear_repositorycache).Parents(merge_remove).LanePos(2);
			test.Commit(resolve_handler).Parents(merge_fix).LanePos(4);
			test.Commit(merge_remove).Parents(add_simple, remove_unused).LanePos(2);
			test.Commit(remove_unused).Parents(merge_fix).LanePos(0);
			test.Commit(add_simple).Parents(merge_fix).LanePos(1);
			test.Commit(merge_fix).Parents().LanePos(3);
			test.NoMoreCommits();
		}
Exemple #8
0
		public virtual void TestBug300282_1()
		{
			RevCommit a = Commit();
			RevCommit b = Commit(a);
			RevCommit c = Commit(a);
			RevCommit d = Commit(a);
			RevCommit e = Commit(a);
			RevCommit f = Commit(a);
			RevCommit g = Commit(f);
			PlotWalk pw = new PlotWalk(db);
			// TODO: when we add unnecessary commit's as tips (e.g. a commit which
			// is a parent of another tip) the walk will return those commits twice.
			// Find out why!
			// pw.markStart(pw.lookupCommit(a.getId()));
			pw.MarkStart(pw.LookupCommit(b.Id));
			pw.MarkStart(pw.LookupCommit(c.Id));
			pw.MarkStart(pw.LookupCommit(d.Id));
			pw.MarkStart(pw.LookupCommit(e.Id));
			// pw.markStart(pw.lookupCommit(f.getId()));
			pw.MarkStart(pw.LookupCommit(g.Id));
			PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
			pcl.Source(pw);
			pcl.FillTo(int.MaxValue);
			PlotCommitListTest.CommitListAssert test = new PlotCommitListTest.CommitListAssert
				(this, pcl);
			test.Commit(g).LanePos(0).Parents(f);
			test.Commit(f).LanePos(0).Parents(a);
			test.Commit(e).LanePos(1).Parents(a);
			test.Commit(d).LanePos(1).Parents(a);
			test.Commit(c).LanePos(1).Parents(a);
			test.Commit(b).LanePos(1).Parents(a);
			test.Commit(a).LanePos(0).Parents();
			test.NoMoreCommits();
		}
Exemple #9
0
		public virtual void Test2SideBranches()
		{
			RevCommit a = Commit();
			RevCommit b = Commit(a);
			RevCommit c = Commit(a);
			RevCommit d = Commit(a);
			PlotWalk pw = new PlotWalk(db);
			pw.MarkStart(pw.LookupCommit(b.Id));
			pw.MarkStart(pw.LookupCommit(c.Id));
			pw.MarkStart(pw.LookupCommit(d.Id));
			PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
			pcl.Source(pw);
			pcl.FillTo(int.MaxValue);
			PlotCommitListTest.CommitListAssert test = new PlotCommitListTest.CommitListAssert
				(this, pcl);
			test.Commit(d).LanePos(0).Parents(a);
			test.Commit(c).LanePos(1).Parents(a);
			test.Commit(b).LanePos(1).Parents(a);
			test.Commit(a).LanePos(0).Parents();
			test.NoMoreCommits();
		}
		public virtual void TestDuplicateParents()
		{
			RevCommit m1 = Commit();
			RevCommit m2 = Commit(m1);
			RevCommit m3 = Commit(m2, m2);
			RevCommit s1 = Commit(m2);
			RevCommit s2 = Commit(s1);
			PlotWalk pw = new PlotWalk(db);
			pw.MarkStart(pw.LookupCommit(m3));
			pw.MarkStart(pw.LookupCommit(s2));
			PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
			pcl.Source(pw);
			pcl.FillTo(int.MaxValue);
			PlotCommitListTest.CommitListAssert test = new PlotCommitListTest.CommitListAssert
				(this, pcl);
			test.Commit(s2).NrOfPassingLanes(0);
			test.Commit(s1).NrOfPassingLanes(0);
			test.Commit(m3).NrOfPassingLanes(1);
			test.Commit(m2).NrOfPassingLanes(0);
			test.Commit(m1).NrOfPassingLanes(0);
			test.NoMoreCommits();
		}