[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 single file to HEAD revision?

From: Ryan Schmidt <subversion-2006Q1_at_ryandesign.com>
Date: 2006-01-26 12:25:39 CET

On Jan 26, 2006, at 11:04, Ganssauge, Gottfried wrote:

> I'm trying to update a single file in a sandbox checked out from a
> branch to the current HEAD revision.
> In CVS I would have done "cvs update -A file".
> In Subversion I'm trying to use "svn update -rHEAD" but to no avail.
> "svn update -r<numeric head revision>" doesn't work either.

"svn update -rHEAD file" does what you want. Since "-rHEAD" is
implied, so does "svn update file".

> So what's wrong?

There's probably a conceptual difficulty between the way CVS handles
tags and branches (as properties of files) and the way Subversion
handles them (as plain old directories).

> To illustrate my point please consider the following sequence of
> actions:
> svn co $testrepurl/branches/BRANCH_1/x BRANCH
> cat > 1 << EOF
> 1
> 2
> 4
> svn commit -m "Change last line to 4 in Branch" 1
> cd ..
> cd TRUNK
> cat > 1 << EOF
> 1
> 2
> 5
> svn commit -m "Change last line to 5 in Head" 1
> cd ..

Your commit comments here show part of the misunderstanding.
Revisions are a property of the repository in Subversion, not of
individual files as it was in CVS. The repository has a HEAD. So the
previous two commit messages are more-correctly written "Change last
line to 4 in HEAD of branch_1" and "Change last line to 5 in HEAD of
trunk". Since you cannot change anything other than the HEAD, saying
so is probably superfluous.

> svn update -rHEAD 1
> diff ../TRUNK/1 1
> 3c3
> < 5
> ---
>> 4
> I would have expected to see no difference between the file
> generated by
> "svn update -rHEAD" in the BRANCH directory and the file in TRUNK.

Why shouldn't they be different? You've made them different. In the
repository directory "trunk" you have one version of the file, and in
the repository directory "branches/branch_1" you have a different
version of the file. Diff shows that.

Remember that, to Subversion, branches and tags are absolutely
nothing more than directories. There is nothing special about them at
all. Any meaning the words "branch," "tag" and "trunk" have are
purely in your (and our) heads. Subversion assigns no special meaning
to them, and does no special additional processing on them.

Have you read the book, specifically the appendix for CVS users?


Especially the part about branches and tags?


(I haven't, because I never used CVS, but I'm hoping they explain the
situation sufficiently.)

To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Jan 26 12:27:48 2006

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.