You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Benjamin Watine <wa...@cines.fr> on 2007/11/15 16:40:30 UTC

Import some files in a repository

Hi all

I'm a beginner using subversion, so please forgive my lack of knowledge.

I've set up a repository for the sources of a project. A developper of 
our team didn't use the repository, and did a lot of work ; he have 
modified around 100 files.

Now, I have to import those files into our repository, but I don't know 
how to do that... It seem's like an svn import, but I don't want to 
rebuild the entire repository.

I've tried this :
make a temp local repos with svn co
delete the modified files in this new local repos (svn del, rm)
import the new modified file in the local repos (cp, svn add)
trying to commit (svn commit), then it give me an error :

% svn commit
Ajout          src/pac
svn: Échec de la propagation (commit), détails :
svn: MKCOL de 
'/svn/PAC/!svn/wrk/f6ffd53b-2753-47c0-b180-0248fed975ea/trunk/src/pac': 
405 Method Not Allowed (http://----------.fr)
svn: Le message de propagation a été laissé dans un fichier temporaire :
svn:    '/-----------------------/trunk/svn-commit.tmp'

I don't know what I did wrong. Is there is a good way to import those 
files in my repository without rebuilding it entirely ?

Thank you !

Ben

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Import some files in a repository

Posted by Benjamin Watine <wa...@cines.fr>.
Matthieu Moy a écrit :
> Benjamin Watine <wa...@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
> 
> second
> ------------------------------------------------------------------------
> r1 | moy | 2007-11-16 13:23:21 +0100 (Fri, 16 Nov 2007) | 1 line
> 
> init
> ------------------------------------------------------------------------
> $ 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)
> 

Yes, you're true, I will have loose the history with svn add + del. I 
think I have to practice to understand all the subversion concepts.
Thank you for your precisions.

Regards

Ben

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Import some files in a repository

Posted by Matthieu Moy <Ma...@imag.fr>.
Benjamin Watine <wa...@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

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

init
------------------------------------------------------------------------
$ 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)

-- 
Matthieu

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Import some files in a repository

Posted by Benjamin Watine <wa...@cines.fr>.
Matthieu Moy a écrit :
> Benjamin Watine <wa...@cines.fr> writes:
> 
>> I've set up a repository for the sources of a project. A developper of
>> our team didn't use the repository, and did a lot of work ; he have
>> modified around 100 files.
> 
> Did he rename any file?
> 
>> I've tried this :
>> make a temp local repos with svn co
> 
> You have to be carefull to "svn co" the revision the work is based on.
> If other developers commited since he started working, you have to
> merge their work with his.
> 
>> delete the modified files in this new local repos (svn del, rm)
>> import the new modified file in the local repos (cp, svn add)
> 
> Why "svn delele + svn add"? If they are the same files, the file is
> not deleted and re-added, it's just modified. Modify your local copy,
> check with status/diff, and commit.
> 
> More precisely, if no renaming is involved, I'd do
> 
> $ svn co -r <base revision for developer's work> ... dir/
> $ cd dir/
> $ cp -r /path/to/other/dev/work/* ./
> $ svn update
> $ svn status
> $ svn diff
> $ svn commit
> 
> If files need to be renamed, you need to do that manually with "svn
> mv". If the developer added or deleted files, you need to say that
> explicitely too.
> 

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.

Thank you for your help !

Ben

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Import some files in a repository

Posted by Matthieu Moy <Ma...@imag.fr>.
Benjamin Watine <wa...@cines.fr> writes:

> I've set up a repository for the sources of a project. A developper of
> our team didn't use the repository, and did a lot of work ; he have
> modified around 100 files.

Did he rename any file?

> I've tried this :
> make a temp local repos with svn co

You have to be carefull to "svn co" the revision the work is based on.
If other developers commited since he started working, you have to
merge their work with his.

> delete the modified files in this new local repos (svn del, rm)
> import the new modified file in the local repos (cp, svn add)

Why "svn delele + svn add"? If they are the same files, the file is
not deleted and re-added, it's just modified. Modify your local copy,
check with status/diff, and commit.

More precisely, if no renaming is involved, I'd do

$ svn co -r <base revision for developer's work> ... dir/
$ cd dir/
$ cp -r /path/to/other/dev/work/* ./
$ svn update
$ svn status
$ svn diff
$ svn commit

If files need to be renamed, you need to do that manually with "svn
mv". If the developer added or deleted files, you need to say that
explicitely too.

-- 
Matthieu

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Import some files in a repository

Posted by Andy Levy <an...@gmail.com>.
On Nov 15, 2007 11:40 AM, Benjamin Watine <wa...@cines.fr> wrote:
> Hi all
>
> I'm a beginner using subversion, so please forgive my lack of knowledge.
>
> I've set up a repository for the sources of a project. A developper of
> our team didn't use the repository, and did a lot of work ; he have
> modified around 100 files.
>
> Now, I have to import those files into our repository, but I don't know
> how to do that... It seem's like an svn import, but I don't want to
> rebuild the entire repository.
>
> I've tried this :
> make a temp local repos with svn co
> delete the modified files in this new local repos (svn del, rm)
> import the new modified file in the local repos (cp, svn add)
> trying to commit (svn commit), then it give me an error :

Try using svn_load_dirs.pl instead of manually working out what's been
added and removed.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org