[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Shouldn't I be able use "svn diff -r oldrev" after "svn copy"?

From: <PVM_at_capmon.dk>
Date: 2003-03-18 19:16:19 CET

Hi there,

(Please forgive if this is a repost - we've been having email trouble and
it didn't show up after 5 hours...)

"svn log" works beautifully with/after "svn copy". Shouldn't I be able use
"svn diff" across "svn copy" too? Or am I misunderstanding something?

After doing an "svn move" and then "svn ci" to rename a file I was
expecting to be able to see the difference between the new renamed file
and old revisions from before the file was renamed. But I couldn't using
the commands that were obvious to me. In fact I didn't succeed without
"svn cat -r oldrev
very_long_complete_repository_name_of_original_file_name > tmpfile ;
/usr/bin/diff tmpfile new_file_name".

For a file rename (copy + delete), that is moderately annoying. Then I
investigated how it works for branches...

When working on a branch, I _need_ to be able to see diffs between this
rev and revs before the branch point. I can't do this with 0.19.1, as far
as I can tell. Without the svn cat + /usr/bin/diff. Isn't that a
reasonable requirement?

Is this a dup of http://subversion.tigris.org/issues/show_bug.cgi?id=891 scheduled for a fix in Beta? It doesn't look that way to me, but some of
the other bugs that _were_ marked as dups fo 891 didn't look that way to
me either :-)

Looking at "svn log -v" and scripting for that isn't easy. Especially not
when the creation of a copy could have happened to any parent directory.
Without knowing the inner workings, it seems to me that since svn log can
show log messages for older revs from before the svn copy, it knows where
a file "came from", and svn diff should be able to obtain and use that
knowledge too. Or what?

Sincerely,

Peter

Here is my test scenario:

#!/bin/bash

# To trace whats going on in the output
set -x

rm -rf repos svn*
svnadmin create repos

svn co file://`pwd`/repos svndir
cd svndir/

svn mkdir dir
echo "Hello1" > dir/file1.txt
svn add dir/file1.txt

svn ci -m " Repository version #1 Creating dir and file1.txt containing
Hello1"

cd dir

# Do a rename
svn move file1.txt file2.txt
svn ci -m "#2: Renamed file1.txt to file2.txt"

# Diff across renames..
svn diff -r PREV file2.txt
# Returns:
# Index: file2.txt
# ===================================================================
# --- file2.txt (revision 1)
# +++ file2.txt (working copy)
# @@ -0,0 +1 @@
# +Hello1
#
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#!!! But no such empty file2.txt (revision 1) ever existed !!!
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

echo "Hello2" > file2.txt
svn ci -m "#3: Changed Hello1 to Hello2"

# Make another rev
echo "Hello3" > file2.txt
svn ci -m "#4: Changed Hello2 to Hello3"

cd ../..

# Make a branch
svn copy -m "#5: made a branch: branch" file://`pwd`/repos/dir
file://`pwd`/repos/branch

svn co file://`pwd`/repos/branch svnbranch
cd svnbranch/

echo "Hello4" > file2.txt
svn ci -m "#6: Changed Hello3 to Hello4"

# Diff across branches..
# This one works - they are both on the same branch.
svn diff -r PREV file2.txt
# Returns:
# Index: file2.txt
# ===================================================================
# --- file2.txt (revision 5)
# +++ file2.txt (working copy)
# @@ -1 +1 @@
# -Hello3
# +Hello4

# Shouldn't this one work too? It doesn't...
svn diff -r 3 file2.txt
# Returns:
# svn: Filesystem has no item
# svn: file not found: revision `3', path `/branch'

cd ..

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Mar 18 19:34:11 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.