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

Re: Import some files in a repository

From: Matthieu Moy <Matthieu.Moy_at_imag.fr>
Date: 2007-11-16 13:26:16 CET

Benjamin Watine <watine@cines.fr> writes:

> OK, I did what you said, and it works perfectly. But I don't know why
> my "svn del + svn add" didn't work, even if it was not necessary.

I don't know svn's internal well enough to give more details, but
"delete + add" is not necessarily an no-op.

In subversion, in each revision, a given file knows what is it's
content, and where it comes from, i.e. whether is was added here, or
comes from another file in another revision. A file can have multiple
descendants (copy), but one or zero ancestor.

If you modify a file, svn knows it's the same file, with
modifications. "svn log" will follow its history, "svn blame" too.
Someone else doing "svn update" will get the file updated, ...

If you delete a file, and re-add it, even in the same revision, it's a
new file, with the same name as the old. "svn log" and "svn blame"
will not follow history through this delete+add, they consider the
file was created here.

Just try:

$ echo content > foo
$ svn add foo
A foo
$ svn commit -m "init"
Adding foo
Transmitting file data .
Committed revision 1.
$ echo other-content >> foo
$ svn commit -m "second"
Sending foo
Transmitting file data .
Committed revision 2.
$ svn log foo
r2 | moy | 2007-11-16 13:23:41 +0100 (Fri, 16 Nov 2007) | 1 line

r1 | moy | 2007-11-16 13:23:21 +0100 (Fri, 16 Nov 2007) | 1 line

$ x=$(cat foo)
$ svn rm foo
D foo
$ echo "$x" > foo
$ svn add foo
A foo
$ svn status
R foo # <---- "R" for "Replaced", i.e. delete+add
$ svn commit -m "replace foo"
Replacing foo
Transmitting file data .
Committed revision 3.
$ svn log foo
r3 | moy | 2007-11-16 13:24:20 +0100 (Fri, 16 Nov 2007) | 1 line

replace foo
$ svn blame foo
     3 moy content
     3 moy other-content

Now, I don't even want to imagine the mess if you also add+delete-ed
directories ;-).

(note: that's a design decision of svn, but not all VCS do this. Git
doesn't have a notion of "delete+add" for example)

To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Nov 16 13:26:49 2007

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

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