Ejemplo n.º 1
0
        public void SetBranchLabel(BranchLabelModel b)
        {
            CommitManager m = CommitManager.GetInstance();

            m.SetupMovingBranchLabel(b);
            _moved = false;
        }
Ejemplo n.º 2
0
        public bool Merge(BranchLabelModel merged)
        {
            Signature   s = GetCurrentSignature();
            MergeResult r = Repository.Merge(merged.Branch, s);

            return(r.Status != MergeStatus.Conflicts);
        }
Ejemplo n.º 3
0
        void DeployBranchNodes()
        {
            List <BranchLabelModel> branchModels = new List <BranchLabelModel>();

            ZoomAndPanCanvasModel.Branches?.ToList().ForEach(b => UnsubscribeEvents(b));
            Dictionary <Commit, CommitNodeModel> pairs        = ZoomAndPanCanvasModel.Commits.ToDictionary(x => x.Commit);
            List <IGrouping <Commit, Branch> >   branchGroups = LibGitService.GetInstance().Branches.GroupBy(b => b.Tip).ToList();

            foreach (var branchGroup in branchGroups)
            {
                int y = 1;
                List <BranchLabelModel> mg = branchGroup.ToList().Select(b =>
                {
                    CommitNodeModel tipNode = pairs[b.Tip];
                    tipNode.PlusButton      = false;
                    Point cl           = tipNode.Location;
                    BranchLabelModel m = new BranchLabelModel()
                    {
                        Location = new Point(cl.X, cl.Y - 10 - 32 * (y++)), Branch = b
                    };
                    branchModels.Add(m);
                    return(m);
                }).ToList();
                mg.First().Arrow     = true;
                mg.Last().PlusButton = true;
            }
            branchModels.ForEach(b => SubscribeEvents(b));
            ZoomAndPanCanvasModel.Branches = branchModels;
        }
Ejemplo n.º 4
0
 public void SetupMovingBranchLabel(BranchLabelModel m)
 {
     m.RenderTransform = NodeTransform;
     m.ForegroundPull();
     m.IsHitTestVisible           = false;
     CompositionTarget.Rendering += MoveCanvasToMouse;
     Stopwatch = Stopwatch.StartNew();
 }
Ejemplo n.º 5
0
 public void RestoreBranchLabel(BranchLabelModel m)
 {
     m.RenderTransform  = null;
     m.IsHitTestVisible = true;
     m.BackgroundPush();
     Stopwatch.Stop();
     NodeTransform.Matrix         = Matrix.Identity;
     CompositionTarget.Rendering -= MoveCanvasToMouse;
 }
Ejemplo n.º 6
0
        public void Rebase(BranchLabelModel rebasing, BranchLabelModel rebased)
        {
            GraphItemModel checkouted = Graph.Checkouted;

            Checkout(rebasing);
            bool succes = LibGitService.Merge(rebased);

            if (succes)
            {
                Checkout(rebased);
            }
        }
Ejemplo n.º 7
0
 public void HighlightAsAggregationFocused(BranchLabelModel model)
 {
     if (AggregationFocused != null)
     {
         AggregationFocused.AggregationFocused = false;
     }
     AggregationFocused = model;
     if (model != null)
     {
         model.AggregationFocused = true;
     }
 }
Ejemplo n.º 8
0
        public void Merge(BranchLabelModel merging, BranchLabelModel merged)
        {
            GraphItemModel checkouted = Graph.Checkouted;

            Checkout(merging);
            bool succes = LibGitService.Merge(merged);

            if (succes)
            {
                Checkout(checkouted);
            }
        }
Ejemplo n.º 9
0
 public void Aggregate(BranchLabelModel aggregating, BranchLabelModel aggregated)
 {
     Aggregating = aggregating;
     Aggregated  = aggregated;
     if (_conflict)
     {
         MainWindowModel.RaiseCantAggregateWhenConflict();
     }
     else
     {
         MainWindowModel.OpenAggregatingContextMenu();
     }
 }
Ejemplo n.º 10
0
        public void BranchLabelToMouse(BranchLabelModel branch, Point mouse)
        {
            Vector mouseRelativeToGraph = new Vector(mouse.X, mouse.Y) - new Vector(Position.X, Position.Y);
            Matrix mat = ZoomAndPanCanvasModel.TransformMatrix;
            Matrix inv = mat;

            inv.Invert();
            Point          loc   = branch.Location;
            Point          tloc  = mat.Transform(NodeTransform.Transform(loc));
            Point          diff  = new Point(mouseRelativeToGraph.X - tloc.X, mouseRelativeToGraph.Y - tloc.Y);
            ScaleTransform scale = new ScaleTransform(inv.M11, inv.M22);

            diff = scale.Transform(diff);
            Matrix m = NodeTransform.Matrix;

            m.Translate(diff.X, diff.Y);
            NodeTransform.Matrix = m;
        }
Ejemplo n.º 11
0
        void UpdateCheckouted()
        {
            Branch           head             = LibGitService.GetInstance().Head;
            BranchLabelModel checkoutedBranch = ZoomAndPanCanvasModel.Branches.Find(b => b.Branch.CanonicalName == head.CanonicalName);

            if (checkoutedBranch != null)
            {
                HighlightAsCheckouted(checkoutedBranch);
            }
            else
            {
                CommitNodeModel checkoutedCommit = ZoomAndPanCanvasModel.Commits.Find(c => c.Sha == head.Reference.TargetIdentifier);
                if (checkoutedCommit != null)
                {
                    HighlightAsCheckouted(checkoutedCommit);
                }
            }
        }
Ejemplo n.º 12
0
 public void AggregationFocus(BranchLabelModel m)
 {
     Graph.HighlightAsAggregationFocused(m);
 }
Ejemplo n.º 13
0
 public void Commit(BranchLabelModel l, string message)
 {
     Signature s = GetCurrentSignature();
     Commit    c = Repository.Commit(message, s, s);
 }
Ejemplo n.º 14
0
 public void Commit(BranchLabelModel l, string message, IEnumerable <string> stagedFiles, IEnumerable <string> unstagedFiles)
 {
     LibGitService.GetInstance().Add(stagedFiles, unstagedFiles);
     LibGitService.Commit(l, message);
 }
Ejemplo n.º 15
0
 public void RestoreBranchLabel(BranchLabelModel m)
 {
     m.Focused = false;
     Graph.RestoreBranchLabel(m);
 }
Ejemplo n.º 16
0
 public void BranchLabelToMouse(BranchLabelModel branch, Point mouse)
 {
     Graph.BranchLabelToMouse(branch, mouse);
 }
Ejemplo n.º 17
0
 public void SetupMovingBranchLabel(BranchLabelModel m)
 {
     Graph.SetupMovingBranchLabel(m);
 }
Ejemplo n.º 18
0
 public void AggregationFocus(BranchLabelModel l)
 {
     AggregationFocused = l;
     CommitManager.AggregationFocus(l);
 }
Ejemplo n.º 19
0
 public BranchLabelViewModel(BranchLabelModel model, BranchLabelView view) : base(model, view)
 {
     Panel.SetZIndex(view, 2);
     SubscribeViewEvents(view);
     InitializeLocation();
 }
Ejemplo n.º 20
0
 Branch CreateBranch(string name, BranchLabelModel l)
 {
     return(Repository.CreateBranch(name, l.Branch.Tip));
 }