What's the best way to export changes between 2 SVN revisions and save the changes (files/folders) locally?
Possibly through the command-line?
Thanks
How about this
svn checkout -r {2006-02-17}
http://svnbook.red-bean.com/en/1.4/svn.tour.revs.specifiers.html
esssentially you would "checkout" two folders based on dates.
EDIT: A simple folder compare at that point would give you what files changed, and what changed in the files.
EDIT2: Perhaps something along the lines of :
svn diff -r BASE:HEAD foo.c
or
svn diff -r HEAD
Not sure if you can do something like
svn diff -r BASE:HEAD
where you can update base to a number and head to a number.
My suspicion is that since this works:
svn diff -r BASE:14 foo.c
you should be able to replace base and head with numbers and just compare all the files.
I'm really not sure though.
Related
I have git installed on my Mac. I am trying to make a diff between files in two different folders.
diff -rq PATH_Folder1/ PATH_Folder2/ > Desktop/DIFF.txt
The results include .git files.
Example:
Files PATH1/abi/cpp/.git/index and PATH2/abi/cpp/.git/index differ.
How can I avoid comparing .git files. I don't require comparing git indices.
You can use the -x option to exclude file patterns. So for this case it would be:
diff -rq -x .git PATH_Folder1/ PATH_Folder2/ > Desktop/DIFF.txt
You could use git diff rather than simple diff, which should know to avoid .git files and the like. Here is the reference for the git diff command.
Even better would be using a graphical diff tool with
$ git difftool -t meld
or
$ git difftool -t kdiff3
Several guides and howtos exist out there. This is a good example.
I have no local copies of any files from the SVN repository. I do have a full path URL to some file in SVN. How can I see the difference between revision 1234 of that file, and it's previous revision, whatever it may be?
svn diff -c 1234 $URL
Assuming you are using a version of Subversion newer than 1.4 when -c was added. Otherwise you need to do:
svn diff -r 1233:1234 $URL
If you want to see a diff including changes across multiple revisions you can just expand the revision numbers you provide to -r.
You can see detailed documentation of the diff subcommand in the SVN Book.
Does anybody know way to change mtime to repo commit time (or any other, but depends on commit metadata) for added/updated files?
We have some logic, which tests files mtime, but backend servers have different mtime on files which were changed, because of this we have some bugs.
Assuming you are getting updating/adding files when you do a git fetch, you can create a git-rebase-and-touch script file that does the rebase for you along with touching all files/directories in each new revision.
The script would look like:
#!/bin/bash
saveIFS=${IFS}
IFS=$'\n'
startrev=$(git rev-parse HEAD)
git rebase
for rev in $(git rev-list --reverse ${startrev}..HEAD); do
stamp=$(git log --pretty="%aD" ${rev}~..${rev})
IFS=$'\n'
for filename in $(git diff --name-only ${rev}~..${rev}); do
file=""
IFS='/'
for part in ${filename}; do
file=${file}/${part}
file=${file#/}
touch -c --date="${stamp}" "${file}"
done
done
done
IFS=${saveIFS}
If you currently use git pull now, use git fetch instead.
It's bloody dangerous tweaking file timestamps, and it's even more dangerous to assume, as you're doing here, that a timestamp means something other than what it ordinarily means. With anything, not just timestamps, doing that hurts reliability and maintainability, it makes comprehension and auditing difficult. The files changed for a legitimate reason, and your system broke.
The timestamps you want to check are recorded in commit metadata, and getting to them isn't efficient enough. Switch to extracting the timestamps to an index file or some such and check them there. Otherwise you're reduced to telling people learning your setup that "not everything is what it seems to be".
So I want to compare this folder http://cloudobserver.googlecode.com/svn/branches/v0.4/Boost.Extension.Tutorial/libs/boost/extension/ with this http://svn.boost.org/svn/boost/sandbox/boost/extension/. I want to get a diff file as a result. These folders are under svn control but I'd prefer git styled diff file (like one shown here) I tried git diff but it seems not to work that way for web folders. So how to do the same thing with one command on Linux?
Update:
So we had a great answer. But it works strangely - it seems to me it shows that all files (same files) have all theire contents replaced with very same contents (while I know for sure that there were only like 3-4 code lines changed at all)...
Update 2:
To achieve what I really needed (dif file with only really changed lines, with git styling, on Linux) do:
$ svn export http://cloudobserver.googlecode.com/svn/branches/v0.4/Boost.Extension.Tutorial/libs/boost/extension/ repos2 --native-eol CRLF
$ svn export http://svn.boost.org/svn/boost/sandbox/boost/extension/ repos --native-eol CRLF
$ git diff repos repos2 > fileWithReadableDiff.diff
Once you have the source trees, e.g.
diff -ENwbur repos1/ repos2/
Even better
diff -ENwbur repos1/ repos2/ | kompare -o -
and have a crack at it in a good gui tool :)
-Ewb ignore the bulk of whitespace changes
-N detect new files
-u unified
-r recurse
You urls are not in the same repository, so you can't do it with the svn diff command.
svn: 'http://svn.boost.org/svn/boost/sandbox/boost/extension' isn't in the same repository as 'http://cloudobserver.googlecode.com/svn'
Another way you could do it, is export each repos using svn export, and then use the diff command to compare the 2 directories you exported.
// Export repositories
svn export http://svn.boost.org/svn/boost/sandbox/boost/extension/ repos1
svn export http://cloudobserver.googlecode.com/svn/branches/v0.4/Boost.Extension.Tutorial/libs/boost/extension/ repos2
// Compare exported directories
diff repos1 repos2 > file.diff
On Linux, I need to know which files were added/modified/moved/deleted after compiling and installing an application from source code, ie. the command-line, Linux equivalent to the venerale InCtrl5.
Is there a utility that does this, or a set of commands that I could run and would show me the changes?
Thank you.
Edit: The following commands are sort of OK, but I don't need to know the line numbers on which changes occured or that "./.." were updated:
# ls -aR /tmp > b4.txt
# touch /tmp/test.txt
# ls -aR /tmp > after.txt
# diff -u b4.txt after.txt
If you only need to know which files were touched, then you can use find for this:
touch /tmp/MARK
# install application here
find / -newercm /tmp/MARK
This will show you all files whose contents or metadata have changed since you touched /tmp/MARK (including newly added files).
I would personally use something like Mercurial (version control) to do this.
The main reason, is that it is not only effective but it is also clean, since it will only add a hidden directory to the top of the tree where you want to check these changes.
Let's say that you need to know what files changed in /etc/. So before installation (you need to have mercurial installed) you add the directory to mercurial:
cd /etc
hg init
hg add
hg ci -m "adding all files in /etc/ to track them down"
The above will effectively "add" all the files to track them. To verify nothing has changed:
hg st
Should return no files.
If you (or the installation) modifies a file, you should see something like this:
hg st
M foo.sh
The "M" before the file states the given file was modified.
For new files you would see a ? before the file like:
? bar.sh
After you are done and no longer want Mercurial, simple remove the hidden directory:
cd /etc
rm -rf .hg