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

Re: Problem in adding directory to svn

From: Mark Lundquist <lundquist.mark_at_gmail.com>
Date: 2007-02-22 04:39:13 CET

ying lcs wrote:

> When I try the command 'svn add canvas', it said 'it is under version
> control.
> But when I do a 'svn stat' at the parent directory of canvas which is
> 'content', it shows a "?"

Hi,

Directories in a Subversion working copy all contain a .svn/ directory,
which contains metadata that Subversion uses to manage the working copy.
The metadata refer to the filesystem objects, so that it has to match up
with the directory structure, and the Subversion move/copy/delete
operations always make sure that it does. But if you change the
directory structure within the working area "out from under" Subversion
(i.e., by using non-Subversion tools), it breaks the working area and
confuses Subversion.

I suspect that canvas/ was created by way of an uncontrolled copy or
move (e.g. "cp -R" or "mv" in the shell, or maybe using some file
manager GUI) of a directory that was already "under version control"
(i.e., checked out from the repo, or scheduled for addition to the repo).

The most efficient way to fix this sometimes depends on figuring out how
exactly it got to be that way. But without knowing the details... you
can try this

        find -name '.svn' -exec rm -rf {} \;

and it will make canvas/ forget that it ever had anything to do with
Subversion. Then it will be like a brand new uncontrolled directory
that you can "svn add" without any errors. Now, from the standpoint of
the repository that *may* not be the best thing... depending on where
canvas/ really came from, having the version history look like it just
sprang into existence from out of nowhere might not be the greatest, but
at least it gets you un-stuck. And there may be another part of the
story (like whatever canvas/ used to be when it was something else :-)
that may be fouled up and will also need to be fixed.

If want really want to "get it right", the best way is be to check out a
fresh working copy, make your changes again there — but this time, don't
do any uncontrolled deletes/moves/copies of controlled elements! When
you're done, you can just delete the old working copy.

BTW, it is safe to rename your "top level" working copy directory
(indeed "svn mv" won't work there). So you can do

        mv project project.broken
        svn co https://somewhere.com/svn/project/trunk project
        
then when you're done making the changes in 'project', just

        rm -rf project.broken

HTH,
—ml—

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Feb 22 04:40:17 2007

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.