You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by "Andreas J. Koenig" <an...@anima.de> on 2002/11/22 09:35:57 UTC

Switch issue

I couldn't find a related problem in the issue tracker. Please let me
know if I should file this as an issue:

Starting with an empty repository "perl".

% svn co http://localhost/svn/perl perl-wc
k's password: 

Checked out revision 0.
% cd perl-wc 
% mkdir trunk branches
% svn add trunk branches 
A         trunk
A         branches
% svn commit -m 'Initial directory setup' .
Adding         branches
Adding         trunk

Committed revision 1.
% svn switch http://localhost/svn/perl/trunk
subversion/libsvn_subr/io.c:649: (apr_err=2, src_err=0)
svn: No such file or directory
svn: svn_io_set_file_read_write: failed to set file '.svn/log' read-write
zsh: exit 1     svn switch http://localhost/svn/perl/trunk



-- 
andreas

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

Re: Switch issue

Posted by Peter Davis <pe...@pdavis.cx>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Friday 22 November 2002 02:54, you wrote:
> apparently some serious switch bugs were fixed recently.

This particular bug fix was probably a side effect of some major switch 
overhaul that was done in just the past couple of days (Issues 988 and 1000 
come to mind).

- -- 
Peter Davis
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE93g+jhDAgUT1yirARAig0AKCFQ+AtZjns4IqTsRuSjFtjkEmwmgCfW2sG
Rf9q++INX2RBbgFHTrAoAa8=
=oZqn
-----END PGP SIGNATURE-----


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

Re: Switch issue

Posted by Rafael Garcia-Suarez <ra...@hexaflux.com>.
Peter Davis <pe...@pdavis.cx> wrote:
> > > > You can't create a branch in a subdirectory of the copied directory.
> 
> Ah, I see now.  The good ol' infinite recursion.  Although, Subversion only 
> makes copies of specific revisions, and the subdirectory doesn't exist in the 
> copied revision, then there would be no recursion.  Anyway, you're right that 
> it doesn't make branches as subdirectories.

Yes but what if you merge after that ?

hypothetical session : (if I understand correctly, I use more
tags than branches)

$ svn cp foo foo/bar
$ svn commit -m "branch foo/bar"
$ svn merge http://..../foo/ http:/..../foo/bar/ bar
A bar/bar

Each merge will create a new nested branch. BenoƮt Mandelbrot would enjoy
this, but I guess that's why cp to a subdir is forbidden.

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

Re: Switch issue

Posted by Peter Davis <pe...@pdavis.cx>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Friday 22 November 2002 02:28, Rafael Garcia-Suarez wrote:
> > > You can't create a branch in a subdirectory of the copied directory.

Ah, I see now.  The good ol' infinite recursion.  Although, Subversion only 
makes copies of specific revisions, and the subdirectory doesn't exist in the 
copied revision, then there would be no recursion.  Anyway, you're right that 
it doesn't make branches as subdirectories.

That still doesn't mean though that switch shouldn't be able to switch any two 
directories, regardless of nesting.  But never mind, since I just saw Andreas 
say that the latest revisions don't have this problem :)

- -- 
Peter Davis
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE93gwLhDAgUT1yirARAhc/AJ9UKe+x63LpvYFCLi9J1UaX8oyABACeMaTA
T40SGYmPe6/67C9d9gZmAyk=
=QSXR
-----END PGP SIGNATURE-----


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

Re: Switch issue

Posted by Rafael Garcia-Suarez <ra...@hexaflux.com>.
Peter Davis <pe...@pdavis.cx> wrote:
> On Friday 22 November 2002 01:55, Rafael Garcia-Suarez wrote:
> > switch is intended to switch a wc dir between branches. Here you're
> > trying to replace a wc that contains /perl/ by a wc that contains
> > /perl/trunk/. But /perl/trunk is not a branch of /perl/. You can't
> > create a branch in a subdirectory of the copied directory.
> 
> You are right about the intention, but it was my understanding that switch 
> should be able to switch any two directories on the server.  Of course I've 
> never really used switch, but I remember discussions about this.  Switch 
> isn't restricted to switch directories that are copies of each other.

I know that, but my phrasing was unclear.
I meant that switching to a subdir isn't intended in the normal use of switch,
and that this operation is better achieved by a couple of mv/rm. This last
approach has also the advantage to preserve local changes and revision levels.

The issue I see there is that switch could detect this case and
reject the operation, instead of corrupting the working copy. I feel
that fixing it completely may be a lot of effort for a little result.

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

Re: Switch issue

Posted by "Andreas J. Koenig" <an...@anima.de>.
>>>>> On Fri, 22 Nov 2002 02:13:09 -0800, Peter Davis <pe...@pdavis.cx> said:

  > On Friday 22 November 2002 01:55, Rafael Garcia-Suarez wrote:
 >> switch is intended to switch a wc dir between branches. Here you're
 >> trying to replace a wc that contains /perl/ by a wc that contains
 >> /perl/trunk/. But /perl/trunk is not a branch of /perl/. You can't
 >> create a branch in a subdirectory of the copied directory.

  > You are right about the intention, but it was my understanding that switch 
  > should be able to switch any two directories on the server.  Of course I've 
  > never really used switch, but I remember discussions about this.  Switch 
  > isn't restricted to switch directories that are copies of each other.

  > In fact, if that were the case, then you'd be able to switch to a branch but 
  > wouldn't be able to switch back, because while the branch is a copy of the 
  > trunk, the trunk is not a copy of the branch.

That's my understanding too and in fact current svn gets that right.
The alternative approach that Rafael posted did fail later, but now
works as it should too, so apparently some serious switch bugs were
fixed recently.

-- 
andreas

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

Re: Switch issue

Posted by Peter Davis <pe...@pdavis.cx>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Friday 22 November 2002 01:55, Rafael Garcia-Suarez wrote:
> switch is intended to switch a wc dir between branches. Here you're
> trying to replace a wc that contains /perl/ by a wc that contains
> /perl/trunk/. But /perl/trunk is not a branch of /perl/. You can't
> create a branch in a subdirectory of the copied directory.

You are right about the intention, but it was my understanding that switch 
should be able to switch any two directories on the server.  Of course I've 
never really used switch, but I remember discussions about this.  Switch 
isn't restricted to switch directories that are copies of each other.

In fact, if that were the case, then you'd be able to switch to a branch but 
wouldn't be able to switch back, because while the branch is a copy of the 
trunk, the trunk is not a copy of the branch.

- -- 
Peter Davis
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE93gM4hDAgUT1yirARAjWgAJ9tL6awUa4FTiJgZeKH9r0wJSEVSACfQJ5C
Sy9pIyPMA6pZdRZZQXWPhjI=
=XDJH
-----END PGP SIGNATURE-----


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

Re: Switch issue

Posted by Rafael Garcia-Suarez <ra...@hexaflux.com>.
andreas.koenig@anima.de (Andreas J. Koenig) wrote:
> I couldn't find a related problem in the issue tracker. Please let me
> know if I should file this as an issue:
> 
> Starting with an empty repository "perl".
> 
> % svn co http://localhost/svn/perl perl-wc
> k's password: 
> 
> Checked out revision 0.
> % cd perl-wc 
> % mkdir trunk branches
> % svn add trunk branches 
> A         trunk
> A         branches
> % svn commit -m 'Initial directory setup' .
> Adding         branches
> Adding         trunk
> 
> Committed revision 1.
> % svn switch http://localhost/svn/perl/trunk
> subversion/libsvn_subr/io.c:649: (apr_err=2, src_err=0)
> svn: No such file or directory
> svn: svn_io_set_file_read_write: failed to set file '.svn/log' read-write
> zsh: exit 1     svn switch http://localhost/svn/perl/trunk

Not really an issue IMHO. Although I don't understand the error message.
switch is intended to switch a wc dir between branches. Here you're
trying to replace a wc that contains /perl/ by a wc that contains
/perl/trunk/. But /perl/trunk is not a branch of /perl/. You can't
create a branch in a subdirectory of the copied directory.

What you want apparently is more like
	mv perl-wc perl-wc.old
	mv perl-wc.old/trunk perl-wc
	rm -rf perl-wc.old

Then you can create branches with
	svn cp http://localhost/svn/perl/trunk http://localhost/svn/perl/branches/5.8.0 -m '...'
and switch your working copy
	cd perl-wc
	svn switch http://localhost/svn/perl/branches/5.8.0

The Book explains switch quite well. Think of it as an update
that moves between branches instead of moving between revision
(i.e through space instead of through time).

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

Re: Switch issue

Posted by "Andreas J. Koenig" <an...@anima.de>.
>>>>> On Fri, 22 Nov 2002 10:35:57 +0100, andreas.koenig@anima.de (Andreas J. Koenig) said:

  > I couldn't find a related problem in the issue tracker. Please let me
  > know if I should file this as an issue:

Sorry, folks, I should have updated Subversion before posting.

I just did so (#3850) and now the switch command works as I expected.

-- 
andreas

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