You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by David Faure <fa...@kde.org> on 2005/05/05 22:47:50 UTC

Can't check out single file from branch - svn client bug?

svn, version 1.2.0 (Release Candidate 2)
   compiled May  4 2005, 21:24:54

Please see the commands below: how does one "switch" to a single file from a branch, when
the file isn't in the current directory?

On a completely new repository, I create trunk, add a file, create a branch, add a file:

$ svn mkdir file:///mnt/big/svnroot/trunk
Committed revision 2.
$ svn co file:///mnt/big/svnroot/trunk
Checked out revision 2.
$ cd trunk
$ touch file.cc
$ svn add file.cc
A         file.cc
$ svn ci -m 'test'
Adding         file.cc
Transmitting file data .
Committed revision 3.

$ svn mkdir file:///mnt/big/svnroot/branches/mybranch
Committed revision 4.
$ svn switch file:///mnt/big/svnroot/branches/mybranch
D    file.cc
Updated to revision 4.
$ touch file-in-branch.txt
$ svn add file-in-branch.txt
A         file-in-branch.txt
$ svn ci
Adding         file-in-branch.txt
Transmitting file data .
Committed revision 5.

$ svn switch file:///mnt/big/svnroot/trunk
D    file-in-branch.txt
A    file.cc
Updated to revision 5.

Now, I want file.cc and file-in-branch.txt together in this directory. Surely svn
supports it, since it supports switching a single file, and remembering that
(with "S" in the svn status output).

But what's the command for achieving it? None of the commands below worked:

$ svn update file:///mnt/big/svnroot/branches/mybranch/file-in-branch.txt
Skipped 'file:///mnt/big/svnroot/branches/mybranch/file-in-branch.txt'
$ svn update file:///mnt/big/svnroot/branches/mybranch/file-in-branch.txt file-in-branch.txt
Skipped 'file:///mnt/big/svnroot/branches/mybranch/file-in-branch.txt'
At revision 5.
$ svn switch file:///mnt/big/svnroot/branches/mybranch/file-in-branch.txt file-in-branch.txt
svn: 'file-in-branch.txt' does not appear to be a working copy path
$ svn switch file:///mnt/big/svnroot/branches/mybranch/file-in-branch.txt
svn: Cannot replace a directory from within
$ svn co file:///mnt/big/svnroot/branches/mybranch/file-in-branch.txt file-in-branch.txt
svn: URL 'file:///mnt/big/svnroot/branches/mybranch/file-in-branch.txt' refers to a file, not a directory

If the file existed in both dirs, a simple svn switch would work... but why does it
require the file to exist in the trunk??

I believe this command should be the one that works:
$ svn switch file:///mnt/big/svnroot/branches/mybranch/file-in-branch.txt file-in-branch.txt
so the "'file-in-branch.txt' does not appear to be a working copy path" check is buggy?

-- 
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

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

Re: Can't check out single file from branch - svn client bug?

Posted by Dirk Schenkewitz <sc...@docomolab-euro.com>.
I just had a weird idea, so weird that I hardly dare to CC it to the list.

David Faure wrote:
> On Friday 06 May 2005 02:29, Ben Collins-Sussman wrote:
> 
>>On May 5, 2005, at 5:47 PM, David Faure wrote:
>>
>>
>>>Now, I want file.cc and file-in-branch.txt together in this directory.
>>
>>Sorry, not possible.
>>
>>A working copy must resemble a tree somewhere in the repository.  It's 
>>okay for parts of the tree to reflect disjoint sections of the 
>>repository, but you cannot invent arbitrary tree-structures, "merge" 
>>directory contents together, etc.
>>
>>That said, there's no reason we couldn't add this ability;  it probably 
>>wouldn't be too much of a stretch.  But honestly, nobody's ever asked 
>>for this feature before.  What you're trying to do is rather unusual:  
>>normally branches tend to have similar structures, so you just switch 
>>an existing chunk of working-copy structure to reflect some analogous 
>>structure on the branch.  In the rare case, say, where the branch has 
>>an extra directory that your working copy doesn't, you can always do an 
>>extra 'svn checkout" of that directory.  But you can't checkout a 
>>single file, hence you're stuck.
> 
> 
> I don't think there's anything so "unusual" there. Branches might have
> similar directory structure, they don't necessarily have the exact same 
> set of files.
> 
> In case you're wondering why I was looking for this feature:
> it was perfectly possible with CVS. This is how we handled the development
> for a customer who wanted additional features on top of an opensource
> project's stable branch. The rules of the project forbid new features in stable
> branches, so we had to branch it. But if we branched the whole project, then
> we would have to merge manually any bugfix done in the stable branch.
> Instead, by only branching the minimum set of files that we needed to change,
> we could benefit automatically from any bugfix in the stable branch. We still
> have to manually merge fixes made to the few files we branched, but
> that's much less work.
> So with CVS we simply had a script to "switch" a set of files (and sometimes
> directories). Porting this to SVN I realize that SVN doesn't allow me to do that...
> I guess I'll branch entire directories for now, but I don't see why future versions
> of the svn client shouldn't be able to do this :)

Would the following work, maybe? I did not try to do it:

Have the main development on the /trunk. Make a branch for the additional
features, say /branches/special. There, do 'svn delete' for all files
that you want to inherit from the /trunk, then (inside /branches/special)
create symbolic links, like 'ln -s ../../trunk/file1 file1' and so on.

Here I'm unsure:
Can SVN deal properly with relative symlinks? If yes, good.
Can it happen that this may checked out on windows (which doesn't know
about symbolic links)? If no, very good. Commit the replacing of regular
files by symlinks.
 From now on you don't have to worry about updates on trunk, you always see
the newest files via the symlinks. You only need to take care about all
regular files within /branches/special.
Disadvantage: Everybody needs to have /trunk and /branches/special together,
or the symbolic links become broken.

Still, this is probably a Bad Hack that works around the sense of SVN.

Anyway, have fun
   Dirk

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

Re: Can't check out single file from branch - svn client bug?

Posted by Mike Dewhirst <mi...@dewhirst.com.au>.
David Faure wrote:
> On Friday 06 May 2005 02:29, Ben Collins-Sussman wrote:
> 
>>On May 5, 2005, at 5:47 PM, David Faure wrote:
>>
>>
>>>Now, I want file.cc and file-in-branch.txt together in this directory.
>>
>>Sorry, not possible.
>>
>>A working copy must resemble a tree somewhere in the repository.  It's 
>>okay for parts of the tree to reflect disjoint sections of the 
>>repository, but you cannot invent arbitrary tree-structures, "merge" 
>>directory contents together, etc.

I recently started using svn and couldn't figure out how to deal with my 
perceived needs - not too dissimilar to David's if I am reading right. 
My approach has been to press on with it anyway and try to get a feel 
for what svn can do.

Listening to you guys discussing the finer points is educational in an 
eye-glazing way for me. Being Friday pm may I postulate something to see 
if I actually get it?

No objections? - OK here goes.

It has been oft repeated here that a tag is a branch is a directory ... 
and who cares - certainly not the software. There is no difference.

So my project A is progressing ordinarily as I add features and fix 
bugs. My other three parallel projects, B, C and D which share probably 
fifty percent of the code unchanged with A are just sitting there 
falling further behind.

This is my plan to bring them forward with a rush ...

I'll freeze development on A, tag it as a release and ship the updated 
software to the customers. Without touching the code I'll tag (or 
branch) three more times to correspond with B, C and D projects.

I'll have to be a bit careful here but I'll check out the B, C and D 
branches of A as working copies of projects B, C and D. As I said, being 
careful I'll copy the fallen-behind B, C and D project specific files 
over the top of the same-named checked out A-files (there are a number 
of these). I'll have to re-do the changes to these files anyway, a merge 
is out of the question. All they really share is their names so they can 
be called to do different things in their different projects.

THEN, I'll svn delete the A files which I don't want in those working 
copies from their respective B, C and D branches.

Penultimately, I'll (OS) copy the unique B, C and D files which I had 
saved previously into their new B, C and D working copies and svn-add 
them to their respective branches.

Finally in my fevered imagination I'll commit all that in three streams 
to the three branches and open a bottle of red to celebrate. It is 
Friday after all.

Thereafter, I'll carefully maintain four branches and tag them from time 
to time as they get released.

All the common stuff (50% of the code) will be developed in the A branch 
and I'll merge that into the B, C and D branches one at a time whenever 
I decide to freeze project A.

Does that sound reasonable? No trunk, just four branches but one more 
equal than the others.

Mike



>>That said, there's no reason we couldn't add this ability;  it probably 
>>wouldn't be too much of a stretch.  But honestly, nobody's ever asked 
>>for this feature before.  What you're trying to do is rather unusual:  
>>normally branches tend to have similar structures, so you just switch 
>>an existing chunk of working-copy structure to reflect some analogous 
>>structure on the branch.  In the rare case, say, where the branch has 
>>an extra directory that your working copy doesn't, you can always do an 
>>extra 'svn checkout" of that directory.  But you can't checkout a 
>>single file, hence you're stuck.
> 
> 
> I don't think there's anything so "unusual" there. Branches might have
> similar directory structure, they don't necessarily have the exact same set of files.
> 
> In case you're wondering why I was looking for this feature:
> it was perfectly possible with CVS. This is how we handled the development
> for a customer who wanted additional features on top of an opensource
> project's stable branch. The rules of the project forbid new features in stable
> branches, so we had to branch it. But if we branched the whole project, then
> we would have to merge manually any bugfix done in the stable branch.
> Instead, by only branching the minimum set of files that we needed to change,
> we could benefit automatically from any bugfix in the stable branch. We still
> have to manually merge fixes made to the few files we branched, but
> that's much less work.
> So with CVS we simply had a script to "switch" a set of files (and sometimes
> directories). Porting this to SVN I realize that SVN doesn't allow me to do that...
> I guess I'll branch entire directories for now, but I don't see why future versions
> of the svn client shouldn't be able to do this :)
> 


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

Re: Can't check out single file from branch - svn client bug?

Posted by Shridhar Daithankar <gh...@ghodechhap.net>.
David Faure wrote:
> I don't think there's anything so "unusual" there. Branches might have
> similar directory structure, they don't necessarily have the exact same set of files.
> 
> In case you're wondering why I was looking for this feature:
> it was perfectly possible with CVS. This is how we handled the development
> for a customer who wanted additional features on top of an opensource
> project's stable branch. The rules of the project forbid new features in stable
> branches, so we had to branch it. But if we branched the whole project, then
> we would have to merge manually any bugfix done in the stable branch.
> Instead, by only branching the minimum set of files that we needed to change,
> we could benefit automatically from any bugfix in the stable branch. We still
> have to manually merge fixes made to the few files we branched, but
> that's much less work.
> So with CVS we simply had a script to "switch" a set of files (and sometimes
> directories). Porting this to SVN I realize that SVN doesn't allow me to do that...
> I guess I'll branch entire directories for now, but I don't see why future versions
> of the svn client shouldn't be able to do this :)

I ran into a similar situation. What I do is, I have branched off, and 
periodically merge from stable branch and watch for few specific files in the 
branch.

  Shridhar

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

Re: Can't check out single file from branch - svn client bug?

Posted by David Faure <fa...@kde.org>.
On Friday 06 May 2005 02:29, Ben Collins-Sussman wrote:
> 
> On May 5, 2005, at 5:47 PM, David Faure wrote:
> 
> > Now, I want file.cc and file-in-branch.txt together in this directory.
> 
> Sorry, not possible.
> 
> A working copy must resemble a tree somewhere in the repository.  It's 
> okay for parts of the tree to reflect disjoint sections of the 
> repository, but you cannot invent arbitrary tree-structures, "merge" 
> directory contents together, etc.
> 
> That said, there's no reason we couldn't add this ability;  it probably 
> wouldn't be too much of a stretch.  But honestly, nobody's ever asked 
> for this feature before.  What you're trying to do is rather unusual:  
> normally branches tend to have similar structures, so you just switch 
> an existing chunk of working-copy structure to reflect some analogous 
> structure on the branch.  In the rare case, say, where the branch has 
> an extra directory that your working copy doesn't, you can always do an 
> extra 'svn checkout" of that directory.  But you can't checkout a 
> single file, hence you're stuck.

I don't think there's anything so "unusual" there. Branches might have
similar directory structure, they don't necessarily have the exact same set of files.

In case you're wondering why I was looking for this feature:
it was perfectly possible with CVS. This is how we handled the development
for a customer who wanted additional features on top of an opensource
project's stable branch. The rules of the project forbid new features in stable
branches, so we had to branch it. But if we branched the whole project, then
we would have to merge manually any bugfix done in the stable branch.
Instead, by only branching the minimum set of files that we needed to change,
we could benefit automatically from any bugfix in the stable branch. We still
have to manually merge fixes made to the few files we branched, but
that's much less work.
So with CVS we simply had a script to "switch" a set of files (and sometimes
directories). Porting this to SVN I realize that SVN doesn't allow me to do that...
I guess I'll branch entire directories for now, but I don't see why future versions
of the svn client shouldn't be able to do this :)

-- 
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

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

Re: Can't check out single file from branch - svn client bug?

Posted by Ben Collins-Sussman <su...@collab.net>.
On May 5, 2005, at 5:47 PM, David Faure wrote:

> Now, I want file.cc and file-in-branch.txt together in this directory.

Sorry, not possible.

A working copy must resemble a tree somewhere in the repository.  It's 
okay for parts of the tree to reflect disjoint sections of the 
repository, but you cannot invent arbitrary tree-structures, "merge" 
directory contents together, etc.

That said, there's no reason we couldn't add this ability;  it probably 
wouldn't be too much of a stretch.  But honestly, nobody's ever asked 
for this feature before.  What you're trying to do is rather unusual:  
normally branches tend to have similar structures, so you just switch 
an existing chunk of working-copy structure to reflect some analogous 
structure on the branch.  In the rare case, say, where the branch has 
an extra directory that your working copy doesn't, you can always do an 
extra 'svn checkout" of that directory.  But you can't checkout a 
single file, hence you're stuck.


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