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

RE: Re: New User Confusions; Docs Ideas

From: Monks, Peter <peter.monks_at_vignette.com>
Date: 2004-11-29 20:28:38 CET

G'day Tom,

> However I wonder if it's fully true. For example it appears to me
> (perhaps I'm mistaken) that to add a new empty subdirectory to my
> working copy and have it under version control, I must create it
> first with mkdir, then do an svn add. If I do the svn add first,
> it gives a 'not found' error. But to rename a directory, I must do
> it with svn move and must not use mv (or ren on Windows). The same
> is true for files, I believe.

That's correct. Maybe it would help to think of all "write" operations
in the working copy as being one of three types:
1. creations
2. content modifications (ie. changing the contents of a file)
3. structural modifications (eg. renaming, moving or deleting a file
   or directory)

#1 and #2 are done using standard OS / application commands.

#3 must be done using SVN commands.

Obviously all of these commands need to be followed by (at least) a
commit in order for the repository to receive the change.

> The other thing I can't figure out is when changes take place in the
> working copy. For example, if I do an svn move on a path does it
> make the local change immediately, and update the repository on
> commit (that's what I'd expect)?

Yes that is exactly what happens.

Caveat: many Subversion commands can also be run against a repository
directly, in which case there is no reference to a working copy
whatsoever.

Speaking personally, I only use the "repository" form of the commands
for actions that don't make sense in a working copy (eg. copying the
entire source tree for the purpose of branching or tagging).

> Or does it not update the working copy until the commit?

AFAIK no Subversion commands work this way.

> Also, thinking of newbie errors here, what is the correct way to
> recover if you DO manipulate your working copy with standard file
> management commands? For example what if I remove a file or
> directory but forget to tell svn? I rename one? Copy one?

The short answer is "update your working copy" (ie. "svn update").
That'll recreate any files that were removed or renamed, however it
won't clean up any files that you created that aren't managed by SVN.

So for example if you accidentally renamed a file ("mv fu bar") and
wanted to reverse the action in order to do the rename properly (ie.
via the appropriate svn command), you'd have to:

1. update your working copy - "fu" will be recreated from the
   repository

2. manually delete the file "bar"

SVN doesn't automatically handle #2 since it will NEVER touch a file
that isn't managed by SVN. This is for the obvious reason that doing
so would be incredibly dangerous. The net result is that in some
cases (ie. where you accidentally created a file that is not managed
by SVN) you would have some manual clean up to do.

Cheers,
Peter
 
----------------------------------------------------------------------
Peter Monks http://www.sydneyclimbing.com/
pmonks_at_sydneyclimbing.com http://www.geocities.com/yosemite/4455/
----------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon Nov 29 20:34:30 2004

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.