Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External merge tool support #784

Merged
merged 6 commits into from
Sep 8, 2016

Conversation

Lochemage
Copy link
Contributor

@Lochemage Lochemage commented Sep 5, 2016

This is to address issue #783.

I have added a new configuration option "mergeTool". Its default value false means not to use this feature. Setting this to true will launch your default merge tool (as configured in your git config). Setting this to a string value will launch the merge tool configured under the given name.

Basically under the hood, it runs the git mergetool command and will only work if you have actually configured it properly. I've found this stackoverflow discussion that explains how to set up your mergetool. Basically you need to edit your ~/.gitconfig file or use the CLI.

Here are some more details on what I have added/changed:

  • Configuration option "mergeTool" as I have detailed above.
  • New URL POST route /launchmergetool added to the API.
  • Modified existing Staging component:
    • Renamed the "Resolve Conflicts" hover text to be "Mark as Resolved". This is to make things more clear when you see it aside the new button I have made (below).
    • Created a second button named "Launch Merge Tool" that will appear when hovering over the "Conflicts" label and only if you have the "mergeTool" config option enabled.

Known Issues:

  • Sometimes an external tool may take several seconds before it actually appears in view, during this time there is no 'loading' feedback presented to you on the front end. This may be fixable, but will require some experimentation.
  • Since the ungit interface can technically be accessible from a remote PC via the web address, if you launch the merge tool, it only launches on the machine that is actually running the server. This seems like an unlikely case, however.
  • I did not know how to write unit tests for this feature, especially since the merge tool has to be configured outside of ungit.

Please let me know what you think.

-- Jeff

P.S. I found it amusing that I checked in my ungit code changes using the modified version of ungit that I was working on 👍

@Lochemage
Copy link
Contributor Author

It seems my amended commit is failing the appveyor test. As far as I can tell, it is not related to my change:

  1 failing
  1) git-api status should list the renamed file:
     Error: expected 200 "OK", got 400 "Bad Request"
      at Test.assert (C:\projects\ungit\node_modules\supertest\lib\test.js:205:15)
      at Server.assert (C:\projects\ungit\node_modules\supertest\lib\test.js:132:12)
      at emitCloseNT (net.js:1542:8)
      at _combinedTickCallback (internal/process/next_tick.js:71:11)
      at process._tickDomainCallback (internal/process/next_tick.js:122:9)
Warning: Task "mochaTest:src" failed.� Use --force to continue.

@jung-kim
Copy link
Collaborator

jung-kim commented Sep 6, 2016

Yeah window build is bit dodge and we need to fix it.

Although I would like to have tests for this, it be tricky for this one... Will try it out later.

Thanks!

@Lochemage
Copy link
Contributor Author

Ah, I've only been using ungit for about a week now, and only on Windows. Are you saying that merge conflict resolution is handled differently on Linux?

@jung-kim
Copy link
Collaborator

jung-kim commented Sep 6, 2016

Oh no, I meant the automated test suite in Windows. Click test in windows is unstable right now for Ungit.

And this is mostly due to my inability to get a hands on windows machines to replicate the bug and test... :( If some body can fix them it would be super nice... Just saying... 👀

@jung-kim
Copy link
Collaborator

jung-kim commented Sep 7, 2016

FYI, just tried this and this is pretty cool!

Can you please update the doc that explain this feature along with a quick example? it would be super nice.

@Lochemage
Copy link
Contributor Author

Ah yes, when I run the unit tests locally on my machine, I get a lot of errors and they don't seem to be the same ones every time. I can't promise anything but I'll try and take a look.

As far as documentation, I don't mind adding more. What did you have in mind? I've put a small description in the source/config.js file explaining the new property. Is there some other documentation where you would want this or possibly more detailed info?

@jung-kim
Copy link
Collaborator

jung-kim commented Sep 7, 2016

If you add little description in README.md with an example with a helpful guide I be happy!

@Lochemage
Copy link
Contributor Author

It turned out to be a little more 'wordy' that I expected, so I have broken it into a MERGETOOL.md file and linked it from the README.

Please feel free to reformat it however you want.

@jung-kim
Copy link
Collaborator

jung-kim commented Sep 8, 2016

Lovely, thanks!

@jung-kim jung-kim merged commit 278e194 into FredrikNoren:master Sep 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants