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

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

            return(r.Status != MergeStatus.Conflicts);
        }
Exemplo 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;
        }
Exemplo n.º 4
0
 public void SetupMovingBranchLabel(BranchLabelModel m)
 {
     m.RenderTransform = NodeTransform;
     m.ForegroundPull();
     m.IsHitTestVisible           = false;
     CompositionTarget.Rendering += MoveCanvasToMouse;
     Stopwatch = Stopwatch.StartNew();
 }
Exemplo 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;
 }
Exemplo 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);
            }
        }
Exemplo n.º 7
0
 public void HighlightAsAggregationFocused(BranchLabelModel model)
 {
     if (AggregationFocused != null)
     {
         AggregationFocused.AggregationFocused = false;
     }
     AggregationFocused = model;
     if (model != null)
     {
         model.AggregationFocused = true;
     }
 }
Exemplo 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);
            }
        }
Exemplo n.º 9
0
 public void Aggregate(BranchLabelModel aggregating, BranchLabelModel aggregated)
 {
     Aggregating = aggregating;
     Aggregated  = aggregated;
     if (_conflict)
     {
         MainWindowModel.RaiseCantAggregateWhenConflict();
     }
     else
     {
         MainWindowModel.OpenAggregatingContextMenu();
     }
 }
Exemplo 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;
        }
Exemplo 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);
                }
            }
        }
Exemplo n.º 12
0
 public void AggregationFocus(BranchLabelModel m)
 {
     Graph.HighlightAsAggregationFocused(m);
 }
Exemplo n.º 13
0
 public void Commit(BranchLabelModel l, string message)
 {
     Signature s = GetCurrentSignature();
     Commit    c = Repository.Commit(message, s, s);
 }
Exemplo 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);
 }
Exemplo n.º 15
0
 public void RestoreBranchLabel(BranchLabelModel m)
 {
     m.Focused = false;
     Graph.RestoreBranchLabel(m);
 }
Exemplo n.º 16
0
 public void BranchLabelToMouse(BranchLabelModel branch, Point mouse)
 {
     Graph.BranchLabelToMouse(branch, mouse);
 }
Exemplo n.º 17
0
 public void SetupMovingBranchLabel(BranchLabelModel m)
 {
     Graph.SetupMovingBranchLabel(m);
 }
Exemplo n.º 18
0
 public void AggregationFocus(BranchLabelModel l)
 {
     AggregationFocused = l;
     CommitManager.AggregationFocus(l);
 }
Exemplo n.º 19
0
 public BranchLabelViewModel(BranchLabelModel model, BranchLabelView view) : base(model, view)
 {
     Panel.SetZIndex(view, 2);
     SubscribeViewEvents(view);
     InitializeLocation();
 }
Exemplo n.º 20
0
 Branch CreateBranch(string name, BranchLabelModel l)
 {
     return(Repository.CreateBranch(name, l.Branch.Tip));
 }