0

I come across a strange problem when checking out project and trying to update existing files. I have several branches of my project in the svn repository. I use a single working project directory (say "proj") to check out the branch that I want to work on.

Suppose I have been working on "branch1" checked out in "proj" folder, now I want to work on "branch2". So I delete .svn in "proj", and check out "branch2" from the repository to "proj" (put all files in "branch2", branch2/*, directly under "proj" without creating folder "branch2"). The problem is that the svn checkout won't actually update the existing files, say if "file1" already exists (it is in both branch1 and branch2), it won't be updated to the version in "branch2", unless I delete the "file1", or checkout "branch2" to an empty folder. Even if I do svn update -r #rev file1, it won't update file1 actually, although the svn status file1 shows the correct #rev for file1. By the way, the output of svn checkout shows "E" for all files that already exist.

Is this what svn is supposed to behave? Do I have to delete the files so that they can be updated? I am unhappy with this behavior, since it is counter intuitive, and cause hassles to switch among branches. Would you please give some neat solutions? Thanks.

Zoe
  • 27,060
  • 21
  • 118
  • 148
Fashandge
  • 237
  • 1
  • 12
  • 1
    Why are you deleting the `.svn` folder? You're not required to do that at all. – Makoto Apr 27 '12 at 21:59
  • If I don't, it will prompt: svn: '.' is already a working copy for a different URL, because I check out "branch1", "branch2" folders separately, and put branchi/* directly under "proj" folder without creating branch1 or branch2 folders. – Fashandge Apr 27 '12 at 22:04

1 Answers1

2

You should use

svn switch <branch-repo path>

to switch to a different branch.

slowpoison
  • 586
  • 3
  • 20