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

no-op-copy -- was: Re: Defining atomic "replace"

From: Neels Janosch Hofmeyr <neels_at_elego.de>
Date: Wed, 12 Aug 2009 20:58:52 +0200

Julian Foad wrote:
> So the result is: file_at_10 is copied from file_at_9. I don't know if a
> Subversion repository can tell the difference between that and a no-op
> (or a simple content modification). I would be interested to know
> whether it can.

With Subversion 1.6.4, the attached script shows that this no-op is allowed.
I get this output:

[[[
[...]
+ cd wc
+ echo one
+ svn add file
A file
+ svn ci -m add
Adding file
Transmitting file data .
Committed revision 1.
+ svn rm file
D file
+ svn cp '^/file_at_1' file
A file
+ svn st
R + file
+ svn ci -m noop
Replacing file

Committed revision 2.
+ svn log file
------------------------------------------------------------------------
r2 | neels | 2009-08-12 20:43:07 +0200 (Wed, 12 Aug 2009) | 1 line

noop
------------------------------------------------------------------------
r1 | neels | 2009-08-12 20:43:05 +0200 (Wed, 12 Aug 2009) | 1 line

add
------------------------------------------------------------------------
+ svn diff -c 2
[no diff output]
]]]

So yes, svn currently permits this no-op.
But I don't really understand the question. What do you mean by "can svn
tell the difference"?

Does anyone think this case is worth the trouble testing for? It would make
an awful lot of sense to cancel this to void, but in practice ... the manual
says "revert" anyway, right?

~Neels

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2382983

#!/bin/bash

## CONFIGURE THIS:
## The next line is the only line you should need to adjust.
## (and uncomment all four lines)
#SVNDIR=/my/svn/trunk
#alias svn=${SVNDIR}/subversion/svn/svn
#alias svnserve=${SVNDIR}/subversion/svnserve/svnserve
#alias svnadmin=${SVNDIR}/subversion/svnadmin/svnadmin

svn --version
URL=file:///`pwd`/repos
rm -rf repos wc
svnadmin create repos
svn co -q ${URL} wc

set -x
cd wc

## ACTUAL TEST

echo 'one' > file
svn add file
svn ci -m add

svn rm file
svn cp ^/file_at_1 file
svn st
svn ci -m noop

svn log file

svn diff -c 2

Received on 2009-08-12 21:01:13 CEST

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