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

Re: svn switch to an incorrect branch deletes modified local files

From: Aaron Eppolito <aarone_at_apple.com>
Date: Thu, 24 Apr 2008 10:22:33 -0700

On Apr 24, 2008, at 3:09 AM, Stefan Sperling wrote:

> Well, to tell you what would happen when you do a switch,
> we need to do (or simulate, see below) the switch first.
> We can't magically predict what will happen when you switch
> some arbitrary working copy to some arbitrary directory in
> the repository without doing so and looking at the result.
>
> You can (and probably should) run switch with --dry-run first.

Yeah, I suppose I should get into the habit of this. I wouldn't have
run cvs up -j without doing cvs -n up -j first, so I suppose I
shouldn't try to do the same in svn.

> Making --dry-run mandatory would be needed to get the warnings
> you want by default, but if we did that, people would start
> complaining about performance :(

You're right. Making svn slower == bad!

> Yes, your particular case would trigger tree-conflict detection,
> but isn't the intended use case for it. You supplied a wrong
> argument to switch, that is the core of your problem. And svn should
> be able to cope with that. But how do you expect svn to be able
> to tell you which directory in the repository you want to switch
> to? This may be a weakness in our branching model, but it's arguably
> a trade-off, really -- svn as a tool gives you lots of flexibility,
> but at the price of potentially shooting yourself in the foot
> if the tool isn't used right. It's bit like the C programming
> language in this way :)

I guess. I suppose I prefer cvs's branching model where this sort of
thing can't happen. Everything has advantages and disadvantages.
Maybe I'll sneak in my side question: In cvs you can ask a file for
all its revisions, regardless of branch. Is there a way to do this in
svn?

Foo.cpp r1 -> Foo.cpp r2 -> branch -->
(head) --> Foo.cpp r3 -> Foo.cpp r5...
(branch) --> Foo.cpp r4 -> Foo.cpp r6...

[branch/] % svn log Foo.cpp
r1 | user | date | etc...
r2 | user | date | etc...
r4 | user | date | etc...
r6 | user | date | etc...

It'd be nice to see "[head] r3" and "[head] r5" somehow. In cvs,
since the branching is done in the file, you can see this info. In
svn, any changes made after the copy are no longer linked to the
original. Perhaps some property that says "I came from this file"
would allow something like "svn log --all-copies Foo.cpp".

> Unless you chose to ignore the problem and ran "svn resolved"
> on all items without thinking about the consequences, of course.
> But that would be your own problem, and *you* would have to explain
> this to your co-workers, not us :)

And they should summarily take me out into the parking lot and flog me
if I did that!

Thanks to everyone for the comments. I think the long story short is
that --dry-run is our friend. That plus your idea of showing *all*
conflicts seems to be a good one.

Thanks,
   -Aaron

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-04-24 21:05:43 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.