Skip to content
This repository has been archived by the owner on Feb 25, 2020. It is now read-only.

[BUG] Merging via graph is broken #323

Open
liamtbrand opened this issue Apr 12, 2019 · 4 comments
Open

[BUG] Merging via graph is broken #323

liamtbrand opened this issue Apr 12, 2019 · 4 comments
Labels
Approved bug Something isn't working Small

Comments

@liamtbrand
Copy link
Collaborator

Describe the bug
As discussed in #298 the merging functionality is currently broken. The code for this is found in graphSetup.ts.

The current code fails to execute the merging when the branches have been dragged together. See the code snippet below.

network.on('dragStart', function(callback) {
  startP = callback.pointer.canvas;
});

network.on('dragEnd', function(cb) {
  fromNode = cb.nodes[0];
  network.moveNode(fromNode, startP.x, startP.y);
  secP = cb.pointer.DOM;
}, false);

network.on('animationFinished', function() {
  if (fromNode !== null && secP !== null) {
    const toNode = network.getNodeAt(secP);

    if (fromNode !== toNode && (nodes.get(fromNode)['shape'] === 'box') && (nodes.get(toNode)['shape'] === 'box')) {
      mergeCommits(nodes.get(fromNode)['title']);
    }
  }
  fromNode = null;
  secP = null;
});

Changing this to the below code snippet results in correctly calling the merge function, however while the console states that the merge is happening, it doesn't happen, and the state of the repository remains the same.

network.on('dragStart', function(callback) {
  startP = callback.pointer.canvas;
});

network.on('dragEnd', function(cb) {
  fromNode = cb.nodes[0];
  network.moveNode(fromNode, startP.x, startP.y);
  secP = cb.pointer.DOM;

  if (fromNode !== null && secP !== null) {
    const toNode = network.getNodeAt(secP);
    console.log("attempting to merge")
    if (fromNode !== toNode && (nodes.get(fromNode)['shape'] === 'box') && (nodes.get(toNode)['shape'] === 'box')) {
      console.log("doing merge")
      mergeCommits(nodes.get(fromNode)['title']);
    }
  }

  fromNode = null;
  secP = null;

}, false);

To reproduce
Steps to reproduce the behavior:

  1. Open VisualGit
  2. Open a repository containing multiple branches
  3. Drag branch labels together
  4. Observe the lack of merging
  5. Repeat steps 1 to 4 with the supplied code snippet replacement
  6. Observe merge messages but no merge

Expected behavior / Acceptance criteria
Dragging a branch label onto the current branch label should successfully merge the branch into the current branch.

Screenshots
Currently using the provided code snippet the branch attempts to merge but this fails.
See the console output in the screenshot provided below.
Screen Shot 2019-04-12 at 15 38 45

Machine Specifications
Screen Shot 2019-04-04 at 14 11 38

Additional context
See issue #298 for more context.

Related issues
Fixing this bug will allow us to do issue #320.

@liamtbrand liamtbrand added bug Something isn't working Small labels Apr 12, 2019
@liamtbrand
Copy link
Collaborator Author

Also see: http://visjs.org/docs/network/

@rmberriman
Copy link
Collaborator

Approved!

@SamuelZheng11
Copy link
Collaborator

Approved

@twchen97
Copy link
Collaborator

Approved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Approved bug Something isn't working Small
Projects
None yet
Development

No branches or pull requests

4 participants