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

Re: how to update a file's copy in another directory

From: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2003-10-17 17:00:20 CEST

pmarek@users.sourceforge.net writes:

> # how can I get dir2/file to be dir1/file revision 2?

> # svn up -r 2 dir2/file
> #> svn: Filesystem has no item
> #> svn: file not found: revision `2', path `/dir2'

This won't work, because 'svn up' only moves through revisions (time).

But its cousin, 'svn switch', moves through revisions (time) *and*
paths (space.)

So something like

    svn switch -r2 http://.../dir1/file dir2/file

Now you have a working copy with 'mixed' URLs. You've essentially
moved the one file to a different branch. This will give what you
want, at least temporarily.

Unfortunately, because it's an *old* version of the branch (r2), if
you run 'svn up' on the whole working copy, it will try to update
dir2/file to the latest revision of dir1/file (i.e. move it forward in
time, without changing the file's URL.) There's no way to make it
'sticky'.

>
> # svn cp -r 2 dir1/file dir2/file
> #> svn: Entry already exists
> #> svn: file `dir2/file' already exists.

Correct. 'svn cp' will never overwrite anything.

> # svn co -r2 file:///home/p107/test/svn/data.20548/repos/dir1/file dir2/
> #> svn: Obstructed update
> #> svn: 'dir2' is already a working copy for a different url

You can't checkout a foreign URL into a working copy of a different
URL.

> I believe that I can delete the file and cp another revision - but that's
> 2 new revisions instead of 1 :-)

That's the only solution. If you want the change to be *permanent*,
you have to "replace" the file (delete file, add new one). And it can
be done in a single commit:

 $ svn rm dir2/file
 $ svn cp -r2 http://.../dir1/file dir2/file
 $ svn status
 R + dir2/file # the 'R' is for (R)eplace

 $ svn commit

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Oct 17 17:02:56 2003

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.