Given: an SVN repository, a bin
directory inside it and a script.pl
inside this bin
. Some revisions ago, bin
and script.pl
has been added to the repository in one commit. Since then, some revisions has been applied to script.pl
.
Needed: a diff command which would return a complete diff for script.pl
from zero to HEAD, i.e. a diff with all lines added.
Background: this diff is needed for code review, for feeding to ReviewBoard
Problem: svn diff
with -r X:HEAD
(X
being the first revision of script.pl
) produces a diff between the first version and HEAD while -r X-1:HEAD
tell me the file script.pl
is unknown in the revision X-1
, which is actually correct. However, I can't find a proper solution which would include the diff from an empty file. I also can't diff the bin
directory, since it has been added in the same commit as script.pl
Solution: ?
Just hold down the Shift key while you right click on the file. Then select TortoiseSVN → Diff with URL. In the following dialog, specify the URL in the repository with which you want to compare your local file to.
Use just svn diff'to display local modifications in a working copy. Display the changes made to TARGET s as they are seen in REV between two revisions. TARGET s may be all working copy paths or all URL s.
If you want to compare two revisions in an item's history, for example revisions 100 and 200 of the same file, just use TortoiseSVN → Show Log to list the revision history for that file. Pick the two revisions you want to compare then use Context Menu → Compare Revisions.
If your working copy is up to date and there are no conflicts, you are ready to commit your changes. Select any file and/or folders you want to commit, then TortoiseSVN → Commit.... The commit dialog will show you every changed file, including added, deleted and unversioned files.
Without temp file:
echo "" | diff -u - script.pl
Some versions of SVN seems to let you do svn diff -r 0:HEAD file.txt
, but some don't. For those that don't, use the following:
svn diff --old=/path/to/root/of/repo@1 --new=/path/to/file.txt
Both of these work for any folder/file/files!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With