I know you can code --diff file1 file2 to use the compare tool in VS code, but is it possible to compare two different svn revisions of a file?
I'd like to be able to combine svn diff -r 111:222 file1 with code --diff ....
Now svn diff would only give me a diff file so it's not enough to compare the whole files in VS code.
I guess I could checkout both revisions of that file and code --diff those, but ideally I'd like to do this without the checkout since I'd do this frequently.
I believe that the following command will help:
svn diff -r1000:1001 https://demo-server.visualsvn.com/asf/ --diff-cmd code -x "--wait --diff"
You may need to adjust the command line to your needs. Note that the URL is unnecessary if you run svn diff in a working copy. See the following pages for more information:
SVNBook | svn diff
SVNBook | Using External Differencing and Merge Tools
I've just tried the above command and it opens SVN diff in VSCode.
PS I see the following warning in the command-line output, but I'm unsure of its meaning:
Warning: 'L' is not in the list of known options, but still passed to
Electron/Chromium.
Related
Is there a way to do a tkdiff on two Perforce changelist versions of the same file? In my previous job, where svn was used, I could use -r with tkdiff to get revision numbers. For example:
tkdiff -r323262 -r314735 [filename]
That's not working in the Perforce environment. Is there some feature like that with Perforce?
Thanks everyone. What worked best for me was p4v. The Perforce Visual Client let me tkdiff between selectable versions of a file.
Just drop the hash '#n' in the perforce file rev number and pass it to '-r' of tkdiff.
e.g. tkdiff -r4 -r5 filepath will give you the diff between versions filename#4 and filename#5 .
Using p4v is the best way to diff between two files, either by doing 'Diff against Have Revision', or starting 'Revision Graph' on a file, then dragging and dropping between the two revisions you want to diff.
In P4V you can stiff use tkdiff, by going into Edit->Preferences, then changing the Diff program to tkdiff,
tkdiff will then be used for 'Diff against Have Revision' or diffing between revisions in the Revision Graph view.
I used tkdiff in preference to P4Merge for a long time, until I discovered Beyond Compare.
In Perforce, how can I create a patch file which has the changes that are in the file as currently saved, compared to the have revision? Instructions for either the GUI client or the CLI client would be great.
I can see how to get the diffs between two changelists, but not how to just get the difference between the last changelist and the current state of the files. Additionally, I can see that in the GUI client, I can right-click on a file and select "Diff Against Have Revision" from the contextual menu, which shows me what I'm looking for, but I can't figure out how to get that into a file.
I'm basically looking for the equivalent of what git diff <file> > patch.diff does in Git-land.
I think that p4 diff -du FILE > patch.diff should do what you want.
Single file
p4 diff -du file > file.patch.diff
Every file
p4 diff -du > patch.diff
The problem with p4 diff is that it doesn't take into account of new files. Also you can't get files that are only in a certain pending change list.
If there is a pending changelist, you can actually use an open source perforce patcher tool, which I have created for my project needs. You can directly download from this link of github.
In case you want to checkout the source, go to the github repo.
Documentation for the tool can be found here.
When merging files it will be helpful (as for me) to show an author of each line. Is there any diff or merge tool supporting that?
The bundled gitk tool is not really a merge tool, but it shows conflicted lines with red and blue and "+"'s in front, and you can Rightclick->"Show origin of this line" on any of them, to go to the commit which introduced the line:
You can run your mergetool, or just a text editor with diffmarks in parallel
So what you really want is a tool that can easily identify your changes
relative to other's changes in a merge conflict, rather actually identify
the author of each line (which would be a mean to achieve that), right?
If I understood you correctly, I have some relatively good news: It
can be done with git + kdiff3. For merging you can just use git mergetool
(which you can configure to use kdiff3). But it is not supported natively
if you get a merge conflict when doing interactive rebase, so for that
some manual scripting is required.
Instead of making up my own simple merge conflict example, I will use
http://www.gitguys.com/topics/merging-with-a-conflict-conflicts-and-resolutions/
as an basis. Follow that page to git merge test. From after the merge
command I diverge a bit from that example by running different commands
(but basically doing the same job). I'll do all the manuall steps first.
So we have a merge conflict and git has inserted content from both
contributing sources into the file in this <<<<<<<...>>>>>>> format,
which I really do not like at all and never consider even looking at it.
Instead I use my favourite merge tool, kdiff3.
First we need to find which versions that are involved.
$ git ls-files -u
100644 b0ed415d15862ac5582b51e4de65528e86934cd2 1 README
100644 56300e3ac4e4521c3500618a301bb2ab2d6a52f5 2 README
100644 9585db7d9c2d9ca05075f67a878f2554886d7b1a 3 README
$
Basted that information we can perform a three way merge:
$ git cat-file blob b0ed415d15862ac5582b51e4de65528e86934cd2 > v1
$ git cat-file blob 56300e3ac4e4521c3500618a301bb2ab2d6a52f5 > v2
$ git cat-file blob 9585db7d9c2d9ca05075f67a878f2554886d7b1a > v3
$ kdiff3 -o merge_result v1 v2 v3 &
[2] 18394
$
Which gives the following view where you can select from which ancestor
you want to merge from.
Afterwords (if you are satisfied with the merge result)
you need to
$ rm v1 v2 v3
$ mv merge_result README
$ git add README
All the manual steps above are done automatically with git mergetool.
So why showing all that then? Well, because if you get a corresponding
conflict during git rebase -i, then it has to be done that way (before running git rebase --continue).
In this small example there is only one conflict
line, so it does not show the more typical case where a lot of lines
are automatically resolved, leaving you to just manually resolve the
ones that was not done automatically.
A more real life example might look more like the following:
Notice that in the merge result you now clearly see the origin of the C lines that
were automatically resolved. I think this is sort of what you were asking for when asking for getting the author for each line, right?
That information is completely absent in the <<<<<<<...>>>>>>> text (and it is difficult/impossible to spot that you should update the printed string in the hello function).
I cannot recommend kdiff3 highly enough. Using a graphical merge tool like that compared to some lines from both sources mixed inline in the file is like using an excavator versus a spade.
No. And, I think, never will be - when we merge, we think about content, not authorship
I am looking for a perforce command to get the list of the files that have been modified locally and "not" checked-in to the repository.
I understand that I "should" get the list of modified files in Pending changelist, but there are scenarios when I don't get to see a modified file in that list. And then on "manually" checking out a file and doing a diff i realize the difference.
Is there any command that could check all the files in a given folder and provide me a list of files that are not same as there state in the repository?
I tried "p4 sync", but that did not work.
Thanks for your interest.
Try
p4 diff -f -sa
(see manual for further details)
I use "p4 revert -n ./..."
where
-n
List the files that would be reverted without actually performing the revert.
This lets you make sure the revert does what you think it does before actually reverting the files.
In the recent versions of Perforce, try "p4 reconcile -e"
see: http://www.perforce.com/perforce/r12.1/manuals/cmdref/reconcile.html
It certainly takes its time though (not very fast).
I think, the modified files are submitted locallay (Otherwise, p4 opened ./... will help to find)
If files are already submitted to local perforce and still want to know which all are modified..
p4 changes -m 5 ./... (Should give changes lists)
p4 integrate -n ./... //server/code/base/... (This should list the files to be integrated to mainline.
I am using cvs for a project. I check out a copy of the project from the repository using cvs checkout ... and then use cvs edit <file> for editing them. Now, consider the sample directory structure for my project below:
project/:
dir1/:
sample1.C
dir2/:
sample2.C
Now assume that I run the following commands:
cd ~/cvs/project/dir1/
cvs edit sample1.C
cd ../dir2
cvs edit sample2.C
cvs editors
My output will contain only sample2.C and no mention of sample1.C. If I cd into dir1 I can see only sample1.C as being edited. My questions are as follows:
Is there something wrong with my cvs settings? Or should I invoke the cvs edit command from a single place for whatever file I need to edit in order to see all the files being edited in one place.
Is there a command in cvs which I can use to see all the files being edited in cvs across projects?
P.S: Please let me know in case more details are needed.
cvs commands by default work on the current directory and below. So in your example, because you are in dir2, you are only see sample2.C. If you moved back up to the proect directory you would see both files.