I am looking for a tool that will split a file that has conflict markers into the two separate files. Is there anything out there that does this already?
xxdiff can do that:
xxdiff --unmerge myfile.txt
it also works if the conflict markers result from a 3-way diff
xxdiff --unmerge3 myfile.txt
The tool I work for (ECMerge) does that, primarily with the target of helping you to merge them visually of course. You could as well save the left/right/ancestor files with the built-in Javascript engine. ECMerge reads markers for most 'well-known' source code controls (CVS, git, mercurial, bazaar, SubVersion, Perforce, those compatible with the previously cited and of course its own markers!).
Winmerge does that, they call it "Resolve conflict files". It only works on Windows though.
As requested, my own solution to my question was to create the following Perl script.
http://github.com/quincy/Unmerge-Conflicts
Related
I am using Visual studio code for angular2 application. The requirement is to merge files, so, I want to differentiate changes in two files as it happens in Netbeans IDE. Is there, any extensions available to achieve the task in visual studio code.
For e.g - Merging Two files by differentiating changes like below:-
Please suggest some solution.
abc.component.ts (located in project1)
abc <-- text for understanding purpose
def
abc.component.ts ( located in project2)
abc
I want to differentiate two component files and push changes in another like it happens in Netbeans IDE? Is there, any solution available for Visual studio code?
First using vscode natively with the git toolset
(Make sure to look on the second title as it's a better native way!)
This way may be available on older version of vscode too! Still a good thing to know! (even we should always run on the latest version! And vscode is always keeping getting better and better).
A native powerful and cool way is to use the git toolset within vscode! It still not the most fluid way! But if you are in a setup where you don't have anything else or time or resources to use anything else! Also as a requirement you need to have a git repo initiated! Here we go:
First we will use the change and diffing capability of the git tool set. And the steps go as bellow:
Commit all the current changes
once done: copy past the other file to diff on the place of the current one. And save.
Cool now in the git pallet you can see the file in changes list! Click on it and the diffing editor will show!
Bingo this is it! You can compare and make direct changment! The diffing will keep happening in real time. Note the current state is in the right. And you make changement there.
Here an illustration of direct modification for instance the part in the left is missing from the current file
And here another illustration (current have in plus)
Well to sum up! Git tool and diffing in vscode is so powerful! And all that one need! The only problem is the extra step of committing and cleaning after if desired!
Here some tips! If you want to have the commit history cleaner! Or not have a merge separate! You can remove the last commits from history as much as you need: Without hard reset and commit again a cleaner one!
git reset --soft HEAD~1
You can check
How to cancel a local git commit
Otherwise it can be ok with atomic commit and merge mention!
Also if what you need is to be able to keep a lot from the current file! You can copy the current elsewhere! past the other file to compare! commit ! and then past again the old one! You'll have the old in the right and as current (Not as described on the above) In such a scenario this work well! (Hacky a bit but you may need it).
Native way (direct open of the compare editor)
(May require the newer version of vscode)
open a file that you gonna compare
open the command pallet
CTRL + SHIFT + P
type file: compare
You can see the different possible ways! For a file we can choose compare active file with.
Then you choose the file! The file need to be within the project directory.
And then you choose a file and the compare editor will open
The above was tested on my brother computer on a new vscode installation. I wasn't sure at first if it was part of the core! And i just confirmed that it is. That too remove the need to the method above involving git! And it's the best native way to go with.
Vscode extensions
Here two extensions i suggest the first:
https://marketplace.visualstudio.com/items?itemName=jinsihou.diff-tool
Easy and simple! It add two elements to the right click menu:
In current file right click -> Select as first file for diff, select one again to view the diff results
select to compare and compare with select no more simple then that !
Another extension to check:
https://marketplace.visualstudio.com/items?itemName=fabiospampinato.vscode-diff
I prefer the first! As this one compare a lot to the native way. And having the control in the contextual menu is just great.
Out of vscode! Using other tools
A quick google search and you'll find a lot of tools!
https://meldmerge.org/
meld merge is cross platform and open source and nice!
in linux and debian:
sudo apt install meld
Otherwise you can check the long list here:
https://www.jotform.com/blog/25-useful-document-and-file-comparison-tools/
https://stackify.com/code-merge-tools/
There is too winMerge to mention (an open source project for windows)
https://winmerge.org/
I don't feel very comfortable seeing the darcs changes in plain text format, so I've been looking for a tool to display a nice side-by-side comparison of the changes.
For the whatsnew I can just use meld, but when I need see the changes already recorded it does not work as easily. I've read that diffuse allows to compare different revisions, but I cannot get it to work.
I've tried
diffuse -r HEAD^1 -r HEAD^2 myfile.py
but it fails (I think that revision naming is specific to git), so does somebody know how to see the latest changes in darcs?
Suggestions for other tool that does the work (and does not require to set up a web server preferably) are welcome.
in fact you should write something like:
darcs diff --diff-command="diffuse %1 %2" myfile.txt
It works with ECMerge (the tool I work on), it should work seamlessly with diffuse. Darcs will call diffuse with temporary files as necessary (to compare the files from the repository). By the way, ECMerge can dig in Darcs configurations with its browser UI.
EDITED:
to diff tags or patches in the repository, use --from-tag= or --from-patch= and --to-tag= or --to-patch= notation. You should be able to do what you want, however note that from-patch means "from before patch" and --to-patch means "up to after patch". it was not really obvious for me...
(to know the last of changes use darcs changes)
I do not know how to integrate with darcs, but KDiff3 is a wonderful graphical diff/merge application available both for linux, macos and windows.
I'm trying to abandon Netbeans as my primary code editor. One thing I like about Netbeans is how it displays file changes - see screenshot. The colored bars give the same information as svn diff. Hovering on these bars gives the option to see the diff or revert this particular change (vs. the whole file).
What other OS X editors/IDEs have a similar feature?
Bonus question: does this feature have a particular name?
UPDATE for someone finding this question later:
With the help of phatfingers's answer, I did some further research myself to find out that Netbeans and Eclipse+Subclipse seem to be the only options offering what I was looking for.
Eclipse seems to call this Quick Diff. There's a preference to diff the current version against Pristine SVN Copy.
For the record, I'm moving to some other editor anyway. Subclipse is (still) horrible to configure on OS X, and Eclipse seems quite bloated for my purposes. Also, Eclipse's Quick Diff is no match for what is in Netbeans. Netbeans colors the diff blocks in the gutter quite more clearly, and you can revert each individual change with a click.
Although many editors provide "non-quick" svn diffs, I'll probably handle my svn diffing on the command line, with eg. svn diff | grcat conf.diff.
Or maybe I'll write a plugin for some other editor. :)
UPDATE 2: I wrote a quickdiff plugin to Komodo Edit / Komodo IDE.
The Eclipse IDE with the Subclipse plugin does a nice job of that, showing you which files changed, allowing you to compare prior versions to see changes over time, detecting which changes involve conflicts, and providing visual tools that allow you to hand-pick individual changes.
I think the class of application is called a "Merge Client" or more specifically a "Graphical Subversion Client" (as you mentioned SVN).
Update: Sublime Text has Vcs Gutter and Git Gutter, of which Vcs Gutter is a fork.
I'm looking for a tool that displays diff files (generated from mercurial, in my case) in some convinient manner. For example, the way bugzilla displays diff patches. Just to be clear, I'm not looking for something that compares/merges files, I already got the diff, just want a convinient way to inspect it.
I couldn't find anything that does that (diff syntax highlighters were the closest thing I got), anyone knows of anything?
Have you tried meld? (it works only in UNIX though..)
I would look into the following Atlassian product 'FishEye' http://www.atlassian.com/software/fisheye/
This allows you a lot of control over your version control system and code views/diffs/code reporting/visualisation etc.
I really like Beyond Compare and Araxis Merge (especially Araxis).
I had the same question -- basically a good syntax highlighter for diff output. I wanted something lightweight and free.
Now I'm using sdif and cdif together.
sdif does the syntax highlighting you want
cdif does word context diffs, so that on a modified line the words that have changed are highlighted differently
As #tomahawk suggested, if you point FishEye at your Hg repository you'll be able to diff between revision of a file, and view a changeset as a diff.
If you want to look at arbitrary patch files, you could buy Atlassian's Crucible, which allows you to create a code review by uploading a patch, which you can then view as a nice diff (and comment on collaboratively, but that is probably not of interest to you). A 5 user Crucible licence costs $10.
(Disclosure: I'm a Crucible developer at Atlassian)
It seems whenever I compare via the SVN Repository explorer (most recently after a merge) subclipse will show a few files in the compare window that have no differences whatsoever. Double clicking the file brings up the Java Source Compare window, but Subclipse highlights no sections and shows no differences. A manual inspection of the file shows they are identical. What causes this? Are there any ways to disable it, it can be quite confusing?
Your help is greatly appreciated!
Sounds like it could be whitespace-related. Maybe tortoise defaults to ignoring ws changes.
Seems to be Eclipse bug, which waits for solution...
https://bugs.eclipse.org/bugs/show_bug.cgi?id=318826
There may not be structural change, but only space related or formatting. Try clicking on "next difference".
I think the problem is that after merging the revision of the file is changed. So, although the content of files is the same, the compare view shows the change. It is very very bad... :(