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

issue 1900 and "switch" leaving wc in a "funny" state

From: Eric Hanchrow <offby1_at_blarg.net>
Date: 2005-01-25 17:08:33 CET

This is one of those cases that's really hard to describe, but I'll
try ...

Issue 1900 (http://subversion.tigris.org/issues/show_bug.cgi?id=1900)
includes a script meant to reproduce a problem. As it happens, the
precise problem that the reporter reported has been fixed, but I
noticed that, after I run the script, the working copy is in a "funny"
state, which I've run into before. What do I mean by "funny"? Well,
here's the output of "svn st":

    ! .
    ! S a
    ! a/longer
    ? a/longer/path/file3
    ! a/longer/path
        S a/longer/path/file2
        S file1

So by "funny" I mean "`svn st' outputs lots of exclamation points and
`S's".

Now, I've gotten working copies into this sort of state a few times
before, and I'm never sure what I did, or how to recover. So my
questions are:

* when I find myself in this sort of state, what can I do to "get back
  to normal", short of deleting the entire working copy and starting
  over with a fresh checkout?

* how can I avoid getting into this state in the first place?

::

Here's a shell script (a modified version of the one attached to issue
1900) demonstrates something curious, and presumably related: the
output of ``svn info'' changes in a subtle (and to my eyes, buggy) way
after the switch:

    #!/bin/bash

    #set -e
    #
    # switch seems to break when you have local changes on a file exclusive
    # to a branch, but only if the file is deep within your wc
    #

    SVNROOT=file://`pwd`/repo

    # if TESTPATH=path, no breakage!
    TESTPATH=a/longer/path

    assert ()
    {
        echo assertion "$@"
        local expected="URL: $SVNROOT/branches/branch1/`dirname $TESTPATH`"
        local actual=$(svn info $(dirname $TESTPATH) | egrep '^URL')
        [ "$expected" == "$actual" ] || {
            echo "Expected $expected"
            echo "but instead got $actual"
            exit 1
        }
        echo ok
    }

    rm -rf repo wc

    svnadmin create repo
    svn mkdir $SVNROOT/trunk -m 'add trunk' # revision 1
    svn mkdir $SVNROOT/branches -m 'add branches' # revision 2
    svn checkout $SVNROOT/trunk wc

    cd wc
    echo file1 >file1
    mkdir -p $TESTPATH
    echo file2 >$TESTPATH/file2
    svn add *
    svn commit -m 'add contents' # revision 3

    svn cp $SVNROOT/trunk $SVNROOT/branches/branch1 -m 'branch trunk' # revision 4
    svn switch $SVNROOT/branches/branch1

    echo file3 >$TESTPATH/file3
    svn add $TESTPATH/file3
    svn commit -m 'add file3 on branch' # revision 5
    assert 1

    echo modify file3 >>$TESTPATH/file3
    svn switch $SVNROOT/trunk

    # This prevents the problems.
    #rm $TESTPATH/file3

    svn switch $SVNROOT/branches/branch1
    # Failed to add file 'a/longer/path/file3': object of the same name already exists
    assert 2

    echo Expect Lots of scary-looking \`!\' and \`S\'
    svn st

-- 
Governing the U.S. is like playing 200 simultaneous chess
matches (while whiny columnists second-guess every move on every
board).
        -- Nicholas Kristof, New York Times columnist
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Jan 25 17:11:09 2005

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