225

Recently our Subversion (SVN) server was changed and we did a svn switch.

Since the working copy had a huge amount of unversioned resources, the working copy got locked and we started switching folder by folder for all folders under SVN, which works perfectly fine.

But at the topmost level of the repository, when I try to update files, I get an error that says svn: Working copy '.' locked. Trying to do cleanup does not help either; it causes errors like svn: 'content' is not a working copy directory.

A fresh checkout is not an option at all. How else can I clean up and release the locks and complete the svn switch process?

1

25 Answers 25

133

If you get a "not a working copy" when doing a recursive svn cleanup, you likely have a subdirectory which should be a working copy (i.e. the .svn directory at the top level says so), but the subdirectory is missing its own .svn directory.

In that case, you could move or delete that directory and then do a local update. To delete the directory,

rm -rf content
svn checkout content

WARNING: rm -rf deletes the folder content permanently.

If you get a not a working copy error, it means that Subversion cannot find a proper .svn directory in the content subdirectory. Check to see if there is an .svn directory in content.

The ideal solution is a fresh checkout, if possible.

4
  • 1
    I agree, do a fresh checkout instead of trying to move your working copy with the repo.
    – Tigraine
    Dec 17, 2008 at 12:00
  • 2
    My problem is that I've migrated to a new server and restored my backups of the filesystem with work not yet committed, and used svnadmin to filter out old projects I no longer need. So my repository contains all the info I need, but has a new UUID. In this case, I'm just going to tar up the changed files, get a fresh checkout, and then untar.
    – Drarok
    Aug 28, 2009 at 15:21
  • Your suggestion in first paragraph does not work on my system (W7+Cygwin). Rather rm & svn update did it. May 2, 2012 at 12:54
  • 19
    WARNING: rm -rf deletes the folder content permanently. Take a backup before executing it. Mar 13, 2015 at 9:51
48

I got into a similar situation (svn: 'papers' is not a working copy directory) a different way, so I thought I'd post my battle story (simplified):

$ svn add papers
svn: Can't create directory 'papers/.svn': Permission denied

Oops! fix permissions... then:

$ svn add papers
svn: warning: 'papers' is already under version control
$ svn st
~     papers
$ svn cleanup
svn: 'papers' is not a working copy directory

And even moving papers out of the way and running svn up (which worked for the OP) didn't fix it. Here's what I did:

$ mv papers papers_
$ svn cleanup
$ svn revert papers
Reverted 'papers'
$ mv papers_/ papers
$ svn add papers

That worked.

0
6

I solved it by

  1. Copy a backup of the impacted folders
  2. SVN revert the impacted folders
  3. Paste the files back from the backup

In my case the problem was due to deleted .svn-files.

1
  • How to do it ? Please explain in brief Jun 29, 2015 at 6:49
5

Maybe you just copied tree of folder and trying to add lowest one.

SVN
|_
  |
  subfolder1
       |
       subfolder2   (here you get an error)

in that case you have to commit directory on the upper level.

3

If you created a file inside a new directory, instead of 'svn add newdir/newfile' use 'svn add newdir' because you need to add the directory. All the files inside the directory will be added by default.

3

Workaround:

Rename the directory which is not the 'working copy'. Check out/update/restore this directory again. Move files from the renamed directory to a new one. Commit changes.

Reason:

You made some changes to some files under the .svn directory, and this breaks the 'working copy'.

2
  • 1
    @peter-mortensen a passive-aggressive edit of 15-years old response, huh? thanks for the edit itself and for a link with the exact timing too. but it wasn't really necessary :-P Feb 3, 2023 at 22:20
  • 1
    Wow: he did it to almost every answer/comment here... Wikipedia hyperlinks etc. Reputation/point farming on 15 year old threads. Feb 22, 2023 at 12:06
1

I just got "not a working copy", and for me the reason was the Automouter on Unix. Just a fresh "cd /path/to/work/directory" did the trick.

2
  • Re "Automouter on Unix": Can you be more specific? What Unix and what desktop environment? Feb 2, 2023 at 21:32
  • OK, the OP has left the building: "Last seen more than 13 years ago" Feb 2, 2023 at 21:32
1

Same, I needed to update a 'contrib' folder:

  1. Moved the old folder out,
  2. Copied the new one
  3. Copied the .svn folders into each (only three in my case) new folder.

I my case too the problem was due to deleted .svn folders.

Solved.

1
  • Found this about 4 hours into SVN cleanup using the Eclipse plugin - good times! Working copy is locked - no it's not, come up with a better message Eclipse people, thanks.
    – Darth Jon
    May 20, 2015 at 20:29
1

I tried pasting the .svn folder from the sub folder to the root folder. It works!!!

1

This is what I did:

  1. rename trunk to trunk_
  2. create a new folder trunk
  3. Re-checkout and interrupt the process after few files are checked-out
  4. Move the files from trunk_ to trunk
  5. Do svn cleanup
  6. Do svn update. This will update the status of files and then all your files will be versioned.
1

I also met this problem in a svn diff operation. It was caused by an incorrect file path. You should add './' to indicate the current file directory.

1
  • Re "current file directory": Do you mean current working directory? Feb 2, 2023 at 21:52
1

I was facing the same error when trying to check out parts of sources from a large SVN project:

svn co --depth empty svn://tug.org/texlive/trunk/Build
cd Build
svn update --set-depth infinity --parents ./source/texk/web2c

Here the --parents is the key to make it a success.

0

I had this exact error. I noticed that I was in the wrong directory. Once I reverted to the SVN Trunk directory the issue was resolved.

0

svn: The repository at 'svn://repourl/reponame/foldername' has uuid 'm/reponame', but the WC has 'b5b39681-0ff6-784b-ad26-2846b9ea8e7d'

Every Subversion repository has a unique identifier (UUID). Subversion uses this to make sure that the repository is actually the same when doing things like switching. You should probably change the UUID on the server to be the same as before.

2
  • Changing uuid on the server - How to do this ?
    – Vijay Dev
    Dec 17, 2008 at 12:31
  • Honestly, I have no idea, I just assume that it can be done. Have you checked in the Subversion Book says anything about it?
    – JesperE
    Dec 17, 2008 at 19:26
0

It could be a working copy format mismatch. It changed between SVN 1.4 and 1.5 and newer tools automatically convert the format, but then the older ones no longer work with the converted copy.

0

You must have deleted a SVN - base file from your project (which are read-only files). Due to this you get this error.

Check out a fresh project again, merge the changes (if any) of your older SVN project with new one using WinMerge and commit the changes in your latest check out.

0

I had this same problem. It turns out we had SlikSVN 1.6.2 as well as TortoiseSVN on the same machine. Tortoise had been updated (and had updated the working copy), but SlikSVN had not, so Tortoise worked OK, but command lines failed with:

svn: '.' is not a working copy directory

Removing both TortoiseSVN and SlikSVN, and then reinstalling TortoiseSVN with command line tools enabled, fixed this for me.

0

Recently I was using another developer's Mac. I had the same situation. The problem was; first I needed to type get repository path in the terminal, but I didn't. Then it says what is your user name and password.

2
  • What exactly did you type? Can you provide an example? Feb 2, 2023 at 22:05
  • unfortunately so many times passed, I am not able to remember sorry
    – Samir
    Feb 3, 2023 at 8:24
0

Today I have found the same issue, /FILE_NAME/ is not a working copy, in the morning, and I have spent more than two hours to solve it. After a long of RND and Google I found some solution and that is Checkout.

  1. Checkout from Subversion to local as a new project.
  2. Change some of code in a Java file and Commit the project.
  3. It works for me.
0

For Mac: take a checkout from the server side and a new window will open to select the directory from your local machine. Then put all your code in the selected folder. Then open the SVN local side. Add and commit the project.

1
  • Re "take a checkout from the server side and a new window will open": What SVN client? Feb 2, 2023 at 22:06
0

I just ran into a case where the .svn directory is on an NFS server on a different machine, and the NFS client was not running the file locking service (lockd).

svn: E155007: '/mnt/svnworkdir' is not a working copy

This went away once lockd was started on the NFS client host.

It seems like Subversion could come up with a better error message when it has trouble locking files. This was Subversion 1.10.0

0

I made a new checkout from the same project to a different location, copied the .svn folder from it, and replaced it with my old .svn folder.

After that I called the svn update function and everything were synced properly up to date.

1
  • What do you mean by "called the svn update function"? On the command line? Or in some SVN client? Which one? Feb 2, 2023 at 22:10
0

I saw this error when I was performing mvn release:prepare on my code. In my case, I had migrated the project from SVN to GitHub, and had cloned the source code from GitHub. But in my pom.xml file, I missed to update the SCM location from SVN URL to GitHub URL, which caused the mismatch between the working directories.

Correcting URL to the GitHub location helped solve it for me.

1
0

JesperE mentions that you need to change the UUID. The following should help you achieve this.

On SVN 1.5+, you can do svnadmin setuuid; you can then check that it's been set correctly using svnlook uuid. On earlier versions of SVN, it's a harder process. See Managing Repository UUIDs.

Additionally the UUID of "m/reponame" looks suspicious. I believe it should be a hex-formatted number like the working copy's, so maybe this action will improve things all-around :-)

-1

Delete the .svn folder that is present in your local machine. Press the windows icon if it is a

windows machine

and type .svn, delete the entire folder. It worked for me.

1
  • Re "Press the windows icon": In what context? This question is not tagged with any particular platform or SVN client. Feb 2, 2023 at 22:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.