1

I found this question but from what I can tell SVN now has only one .svn folder and the solution doesn't work.

I'm trying to release a new version of my project - a WP plugin on the WP repo. I copy-paste the built files into trunk/ and then do svn add trunk/*. This is the error:

svn: warning: W150002: 'trunk/LICENSE.txt' is already under version control
svn: warning: W150002: 'trunk/README.txt' is already under version control
svn: warning: W150002: 'trunk/admin' is already under version control
svn: warning: W150002: 'trunk/includes' is already under version control
svn: warning: W150002: 'trunk/index.php' is already under version control
svn: warning: W150002: 'trunk/languages' is already under version control
svn: warning: W150002: 'trunk/plugin-name.php' is already under version control
svn: warning: W150002: 'trunk/public' is already under version control
svn: warning: W150002: 'trunk/uninstall.php' is already under version control

I tried to delete the trunk folder, even deleted the whole repo and checked out again. Please help!

Nikolay Dyankov
  • 6,491
  • 11
  • 58
  • 79
  • 1
    Why do you need to `svn add` files that are already under version control? Maybe you should be using `svn update`, `svn status`, `svn diff` and finally `svn commit` to commit the new version to the repository. – Richard Smith Feb 22 '20 at 10:12
  • Because that's what Wordpress tells you to do: https://developer.wordpress.org/plugins/wordpress-org/how-to-use-subversion/#starting-a-new-plugin – Lee Oct 13 '20 at 18:41

1 Answers1

0

You are adding stuff that already exists. The simple answer is to force it:

svn add * --force

--force will "ignore already versioned paths". It will also work recursively, meaning that all unversioned files will be added to your repository. You'll still need to svn commit when you are ready. If you get any warnings, that something has already been added, you can just ignore it.


Here's a more durable solution which I think will work better for you:

It looks like you have an external project and you are tracking the changes in releases. It looks like you want to replace everything with a pristine copy of the upstream release.

IFF that's true, follow these steps:

  1. From your working copy, delete all local content. This will wipe any local changes:
rm -rf *
  1. Extract the code you want to be in your repository, to your repository. If it's just another directory, then just copy it. I am extracting a tarball to the current directory.
tar -xf ../project-release_1.2.tar.gz --strip-components=1 .
  1. If you run svn status at this point, you will see some modified files (M), some new (unversioned) files: (?) and some deleted (missing) files (!). Before we commit, we need to add the new files (change ? to A ), and remove the deleted files (change ! to D).
svn delete $(svn status | sed -ne '/^!/p' | awk '{print $2}')
svn add $(svn status | sed -ne '/^?/p' | awk '{print $2}')
  1. Review the results with svn status, then commit it!
svn commit
Stewart
  • 4,356
  • 2
  • 27
  • 59