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

Diff does not work on a copied file

From: Alexander Sinyushkin <Alexander.Sinyushkin_at_svnkit.com>
Date: Wed, 07 Jan 2009 18:25:40 +0100

Hello community,

Today I have discussed this problem with Julian Foad and Mike Pilato on
the irc channel, below you can find the history of the discussion to get
the idea about the problem itself:

[15:36] <MsShu> hello

[15:47] <julianf> MsShu: hello!

[15:48] <MsShu> julianf: hi! I've got a question about diff behavior

[15:48] <MsShu> julianf: it deals with the case when on diffs a file
which was copied from another one

[15:49] <MsShu> julianf: *one

[15:49] <MsShu> julianf: if, let's say, there's a file /sdf in a
repository and we made a copy of it called /sdfCopy in revision 21

[15:50] <MsShu> julianf: then I try to diff it in the following way:
'svn diff -r21:20 file:///../sdfCopy_at_21'

[15:50] <MsShu> julianf: I get an error here

[15:51] <MsShu> julianf: though if I provide the right-hand revision as
one in which /sdf was really changed, it works!

[15:51] <julianf> MsShu: what do you mean by "really changed"? Can you
give the equivalent recipe?

[15:52] <MsShu> julianf: on the other hand, if I just diff the parent
dir where both sdf and sdfCopy live, it also works with the revision
range -r21:20

[15:52] <MsShu> julianf: I just meant that diff do not work in those
cases when the right-hand revision is a revision where /sdf was not ever
changed

[15:53] <MsShu> julianf: but if it was, it profuces an expected diff output

[15:53] <MsShu> julianf: in my test repository /sdf was changed in
revisions 17, 18, then in revisions 19 and 20 it was not changed

[15:54] <MsShu> julianf: in revision 21 the copy was performed

[15:55] <MsShu> julianf: so, whenever I specify 'svn diff -r21:[17, 18]
file:///path/to/sdfCopy', the command works

[15:55] <julianf> MsShu: Oh, I see what you mean now.

[15:55] <MsShu> julianf: but if I specify 'svn diff -r21:[19, 20]
file:///path/to/sdfCopy', it says

[15:55] <MsShu> svn: The location for
'file:///home/alex/workspace/tmp/exampleRepository/sdfCopy' for revision
19 does not exist in the repository or refers to an unrelated object

[15:55] <MsShu> julianf: it looks weird

[15:56] <MsShu> julianf: shouldn't it work properly in these cases as well?

[15:56] <julianf> Yes... That looks like a bug.

[15:57] <julianf> MsShu: what version of svn?

[15:57] <Bert> MsShu: Was the file replaced instead of just modified in
one of those revisions?

[15:58] <MsShu> julianf: I tried with a trunk version 34756

[15:58] <MsShu> Bert: let me see..

[15:59] <julianf> MsShu: Thanks, that's recent enough.

[16:00] <MsShu> Bert: no, sdf wah just modified in both 17 and 18

[16:00] <MsShu> Bert: *was

[16:41] <julianf> MsShu: are you able to write a reproduction script for
this bug (e.g. for Unix or Windows shell or in Python)? It would be very
helpful if you can.

[16:41] <MsShu> julianf: sure, I can

[16:42] <MsShu> julianf: then I shall post it to the mailing-list

[16:42] <julianf> Great. Yes, please. Then we can debug it, or you or we
can file an issue for it.

[16:42] <MsShu> julianf: ok

[16:43] <julianf> If you can write it as a Python test case in
subversion/tests/cmdline/diff_tests.py, that would be best, otherwise a
shell script is fine.

[16:49] <cmpilato> MsShu: how was the copy made? from what revision?

[16:50] <cmpilato> if the copyfrom-revision of the copy was prior to
r19, then the error you see is expected behaviour.

[16:51] <cmpilato> you will have created a "gap" in the history of the
object.

[16:52] <MsShu> cmpilato: sdfCopy was copied from /sdf in rev21

[16:52] <MsShu> cmpilato: from rev 20

[16:54] <cmpilato> if you reverse the revision range, does it work?

[16:55] <cmpilato> svn diff -r20:21 ...

[16:56] <MsShu> cmpilato: no

Below you'll find bash script and python tests attached.

----
Alexander Sinyushkin,
TMate Software,
http://svnkit.com/ - Java [Sub]Versioning Library!
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1010170

#!/bin/bash

SVNDIR=/home/alex/workspace/svn_trunk_latest

SVN=${SVNDIR}/subversion/svn/svn
SVNSERVE=${SVNDIR}/subversion/svnserve/svnserve
SVNADMIN=${SVNDIR}/subversion/svnadmin/svnadmin

URL=file://`pwd`/repos

rm -rf repos wc wc2 import-me

${SVNADMIN} create repos

echo "### Making a Greek Tree for import..."
mkdir import-me
mkdir import-me/trunk
mkdir import-me/tags
mkdir import-me/branches
mkdir import-me/trunk/A
mkdir import-me/trunk/A/B/
mkdir import-me/trunk/A/C/
mkdir import-me/trunk/A/D/
mkdir import-me/trunk/A/B/E/
mkdir import-me/trunk/A/B/F/
mkdir import-me/trunk/A/D/G/
mkdir import-me/trunk/A/D/H/
echo "This is the file 'iota'." > import-me/trunk/iota
echo "This is the file 'A/mu'." > import-me/trunk/A/mu
echo "This is the file 'A/B/lambda'." > import-me/trunk/A/B/lambda
echo "This is the file 'A/B/E/alpha'." > import-me/trunk/A/B/E/alpha
echo "This is the file 'A/B/E/beta'." > import-me/trunk/A/B/E/beta
echo "This is the file 'A/D/gamma'." > import-me/trunk/A/D/gamma
echo "This is the file 'A/D/G/pi'." > import-me/trunk/A/D/G/pi
echo "This is the file 'A/D/G/rho'." > import-me/trunk/A/D/G/rho
echo "This is the file 'A/D/G/tau'." > import-me/trunk/A/D/G/tau
echo "This is the file 'A/D/H/chi'." > import-me/trunk/A/D/H/chi
echo "This is the file 'A/D/H/omega'." > import-me/trunk/A/D/H/omega
echo "This is the file 'A/D/H/psi'." > import-me/trunk/A/D/H/psi

echo "### Done."
echo ""
echo "### Importing it..."
(cd import-me; ${SVN} import -q -m "Initial import." ${URL})
echo "### Done."
echo ""

echo "### Check out:"
${SVN} co -q ${URL}/trunk wc
echo "### Done."
echo ""

cd wc

echo "### Modify file iota"
echo "new file iota contents" > iota

echo "### Commit changes to iota"
${SVN} ci -m "changes to file iota"
echo "### Done."
echo ""

echo "### Modify file A/mu"
echo "new file mu contents" > A/mu

echo "### Commit changes to iota"
${SVN} ci -m "changes to file /trunk/A/mu"
echo "### Done."
echo ""

echo "### Copy iota to iota2"
${SVN} cp iota iota2
echo ""

echo "### Modify new file iota2"
echo "new file iota2 contents" > iota2
echo ""

echo "### Commit copy"
${SVN} ci -m "copied iota -> iota2"
echo "### Done."
echo ""

cd ..

echo "### Diff iota2 between r4 and r2"
${SVN} diff -r4:2 file://`pwd`/repos/trunk/iota2_at_4
echo ""

echo "### And now diff iota2 between r4 and r3:"
echo "### we know that iota in r3 is just the same as in r2, "
echo "### so the result must be the same as in the previous diff case."
echo "### However it's not..."
${SVN} diff -r4:3 file://`pwd`/repos/trunk/iota2_at_4

Received on 2009-01-07 18:26:19 CET

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.