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

diff error? url@rev against local mods -- was: Re: diff_repos_wc question

From: Neels J Hofmeyr <neels_at_elego.de>
Date: Sun, 05 Oct 2008 04:04:50 +0200

Karl Fogel wrote:
> "Neels J. Hofmeyr" <neels_at_elego.de> writes:
>> Let me rephrase that:
>>
>> Is it currently possible to do a diff between
>> URL_at_REV
>> and
>> an unrelated[1] working copy with local mods
>> , and if yes, how?
>> [1] unrelated, as in not of the same URL.
>
> $ cd svn_trunk_working_copy
> $ echo "This is a local mod." >> README
> $ svn diff --old=http://svn.collab.net/repos/svn/trunk/INSTALL@33019 --new=README
>
> -Karl

Ah, thanks for that. I was quite unlucky (cough) to have missed that
combination.

Alas, it looks like julianf and me found a case where `svn diff' reports
wrongly. (It is a crucial diff case for implementing directory comparison
for tree-conflicts.)

I've attached test scripts and an output screenshot when using current trunk.

"Create two similar trees, but leave some of the changes uncommitted in
the second tree. Then diff the url of the first to the working copy of
the second tree."

The second variant involves `svn copy' for creating the second tree,
producing the same wrong diff output.

When reading the "Results" in the output, note that

1) one of the local changes (the file modification to `bar') is picked up by
diff and thus not reported in the diff (correct), while

2) the other local change (the file addition of `baz') is sort of not seen
by diff and reported as if baz was missing in `--new' (wrong). This same
file diff *does* work correctly with one of the four commandlines, though!

3) Also, the diff is sort of ambiguous about reporting the file name:
Which is it, quux/baz or foo/baz?
"--- quux/baz (.../file:///arch/elego/svn/test/repos/foo/baz) (revision 2)"

Is this really an error or am I still missing something?

~Neels

-- 
Neels Hofmeyr -- elego Software Solutions GmbH
Gustav-Meyer-Allee 25 / Gebäude 12, 13355 Berlin, Germany
phone: +49 30 23458696  mobile: +49 177 2345869  fax: +49 30 23458695
http://www.elegosoft.com | Geschäftsführer: Olaf Wagner | Sitz: Berlin
Handelsreg: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194

#!/bin/sh

# The next line is the only line you should need to adjust.
SVNDIR=/arch/elego/svn/trunk

## GENERIC PREPARATIONS

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

# use my local way if my script is there (neels).
if [ -x /usr/local/bin/svnremake ]; then
  SVN=svn
  SVNSERVE=svnserve
  SVNADMIN=svnadmin
fi

${SVN} --version

# Select an access method. If svn://, the svnserve setup is
# handled automagically by this script; but if http://, then
# you'll have to configure it yourself first.
#
# URL=http://localhost/neels/repos
# URL=svn://localhost/repos
URL=file:///`pwd`/repos

rm -rf repos wc

${SVNADMIN} create repos

# These are for svnserve only.
echo "[general]" > repos/conf/svnserve.conf
echo "anon-access = write" >> repos/conf/svnserve.conf
echo "auth-access = write" >> repos/conf/svnserve.conf

# The server will only be contacted if $URL is svn://foo, of course.
${SVNSERVE} --pid-file svnserve-pid -d -r `pwd`
# And put the kill command in a file, in case need to run it manually.
echo "kill -9 `cat svnserve-pid`" > k
chmod a+rwx k

${SVN} co -q ${URL} wc

cd wc

## ACTUAL TEST

# create a file
echo "===== creating rev 1"
mkdir foo
echo "bar" > foo/bar
${SVN} add foo
${SVN} ci -m "rev 1"

# add another file and make a mod
echo "===== creating rev 2"
echo "more" >> foo/bar
echo "baz" > foo/baz
${SVN} add foo/baz
${SVN} ci -m "rev 2"

# create the same stuff again
echo "===== creating rev 3"
mkdir quux
echo "bar" > quux/bar
${SVN} add quux
${SVN} ci -m "rev 3"

# make the same changes to the branch without committing
echo "===== creating local changes"
echo "more" >> quux/bar
echo "baz" > quux/baz
${SVN} add quux/baz
${SVN} up

# let's see what diff has to say.
echo
echo "===== Results ====="
echo
echo "${SVN} diff --old=${URL}/foo --new=quux"
${SVN} diff --old=${URL}/foo_at_2 --new=quux
echo
echo "${SVN} diff --old=${URL}/foo/baz --new=quux/baz"

echo
echo "${SVN} diff --old=${URL}/foo_at_2 --new=quux"
${SVN} diff --old=${URL}/foo_at_2 --new=quux
echo
echo "${SVN} diff --old=${URL}/foo/baz_at_2 --new=quux/baz"
${SVN} diff --old=${URL}/foo/baz_at_2 --new=quux/baz

echo
echo "===== double check"
echo
echo "cat quux/baz"
cat quux/baz

echo
echo "${SVN} up -r 2 foo"
${SVN} up -r 2 foo
echo "cat foo/baz"
cat foo/baz
echo

## ACTUAL TEST ENDS
echo "====="
cd ..

# Put kill command in a file, in case need to run it manually.
echo "kill -9 `cat svnserve-pid`" > k
chmod a+rwx k
./k

svn, version 1.6.0 (dev build)
   compiled Oct 3 2008, 01:57:42

Copyright (C) 2000-2008 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository access (RA) modules are available:

* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
  - handles 'http' scheme
  - handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme

===== creating rev 1
A foo
A foo/bar
Adding foo
Adding foo/bar
Transmitting file data .
Committed revision 1.
===== creating rev 2
A foo/baz
Sending foo/bar
Adding foo/baz
Transmitting file data ..
Committed revision 2.
===== creating rev 3
A quux
A quux/bar
Adding quux
Adding quux/bar
Transmitting file data .
Committed revision 3.
===== creating local changes
A quux/baz
At revision 3.

===== Results =====

svn diff --old=file:////arch/elego/svn/test/repos/foo --new=quux
Index: quux/baz
===================================================================
--- quux/baz (.../file:///arch/elego/svn/test/repos/foo) (revision 2)
+++ quux/baz (.../quux) (working copy)
@@ -1 +0,0 @@
-baz

svn diff --old=file:////arch/elego/svn/test/repos/foo/baz --new=quux/baz

svn diff --old=file:////arch/elego/svn/test/repos/foo_at_2 --new=quux
Index: quux/baz
===================================================================
--- quux/baz (.../file:///arch/elego/svn/test/repos/foo) (revision 2)
+++ quux/baz (.../quux) (working copy)
@@ -1 +0,0 @@
-baz

svn diff --old=file:////arch/elego/svn/test/repos/foo/baz_at_2 --new=quux/baz
Index: quux/baz
===================================================================
--- quux/baz (.../file:///arch/elego/svn/test/repos/foo/baz) (revision 2)
+++ quux/baz (.../quux/baz) (working copy)
@@ -1 +0,0 @@
-baz

===== double check

cat quux/baz
baz

svn up -r 2 foo
At revision 2.
cat foo/baz
baz

=====

#!/bin/sh

# The next line is the only line you should need to adjust.
SVNDIR=/arch/elego/svn/trunk

## GENERIC PREPARATIONS

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

# use my local way if my script is there (neels).
if [ -x /usr/local/bin/svnremake ]; then
  SVN=svn
  SVNSERVE=svnserve
  SVNADMIN=svnadmin
fi

${SVN} --version

# Select an access method. If svn://, the svnserve setup is
# handled automagically by this script; but if http://, then
# you'll have to configure it yourself first.
#
# URL=http://localhost/neels/repos
# URL=svn://localhost/repos
URL=file:///`pwd`/repos

rm -rf repos wc

${SVNADMIN} create repos

# These are for svnserve only.
echo "[general]" > repos/conf/svnserve.conf
echo "anon-access = write" >> repos/conf/svnserve.conf
echo "auth-access = write" >> repos/conf/svnserve.conf

# The server will only be contacted if $URL is svn://foo, of course.
${SVNSERVE} --pid-file svnserve-pid -d -r `pwd`
# And put the kill command in a file, in case need to run it manually.
echo "kill -9 `cat svnserve-pid`" > k
chmod a+rwx k

${SVN} co -q ${URL} wc

cd wc

## ACTUAL TEST

# create a file
echo "===== creating rev 1"
mkdir foo
echo "bar" > foo/bar
${SVN} add foo
${SVN} ci -m "rev 1"

# add another file and make a mod
echo "===== creating rev 2"
echo "more" >> foo/bar
echo "baz" > foo/baz
${SVN} add foo/baz
${SVN} ci -m "rev 2"

# branch off rev 1
echo "===== creating rev 3"
${SVN} cp ${URL}/foo_at_1 ${URL}/quux -m "rev 3"
${SVN} up

# make the same file addition to the branch without committing
echo "===== creating local changes"
echo "more" >> quux/bar
echo "baz" > quux/baz
${SVN} add quux/baz

# let's see what diff has to say.
echo
echo "===== Results ====="
echo
echo "${SVN} diff --old=${URL}/foo --new=quux"
${SVN} diff --old=${URL}/foo_at_2 --new=quux
echo
echo "${SVN} diff --old=${URL}/foo/baz --new=quux/baz"

echo
echo "${SVN} diff --old=${URL}/foo_at_2 --new=quux"
${SVN} diff --old=${URL}/foo_at_2 --new=quux
echo
echo "${SVN} diff --old=${URL}/foo/baz_at_2 --new=quux/baz"
${SVN} diff --old=${URL}/foo/baz_at_2 --new=quux/baz

echo
echo "===== double check"
echo
echo "cat quux/baz"
cat quux/baz

echo
echo "${SVN} up -r 2 foo"
${SVN} up -r 2 foo
echo "cat foo/baz"
cat foo/baz
echo

## ACTUAL TEST ENDS
echo "====="
cd ..

# Put kill command in a file, in case need to run it manually.
echo "kill -9 `cat svnserve-pid`" > k
chmod a+rwx k
./k

Received on 2008-10-05 18:14:58 CEST

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.