SVN commit failed: Directory out of date

SvnCommit

Svn Problem Overview


I have a problem that seems very simple but is hard to solve. I get the mentioned error after deleting a directory. I did not find a solution yet to solve the conflict. This is how it occurs:

svn add dir
svn add dir/file1
svn commit
svn add dir/file2
svn commit
svn delete dir
svn commit
--> commit failed
--> Directory '/dir' is out of date
The obvious solution 'svn update'does not work. After svn update a next commit fails with:
Commit failed
Directory '/dir' remains in conflict.
In the meanwhile I found a solution but it is a bit cumbersome:
svn resolve --accept working dir
svn commit --> still fails
svn update
svn commit --> still fails
svn resolve --accept working dir
svn commit --> NO PROBLEM!
Two questions:

  • can anyone explain this behaviour because I am very curious about it
  • this problem occurs in a perl script in a far more complex situation. Can anyone give me a simple solution with is 'doable' in the perl script?

Svn Solutions


Solution 1 - Svn

Just make a svn update and then your commit should work.

Solution 2 - Svn

If I understand subversion correctly, the problem is this:

Subversion tracks the current revision for each file and directory separately. Whenever a change on a file is committed, the revision of the parent directory changes in the repo, but you working copy still has the directory in its old revision.

So in your scenario after adding the file the parent directory in the repo has a higher revision than your working copy. When you try to delete the directory you working on an outdated version.

To resolve:

Do an svn update after adding the file, but before deleting the dir.

In general if you do not want to pull in anybody else's changes, you can restrict the update to the directory itself: svn up --depth empty dir.

Solution 3 - Svn

Make update, cleanup and then commit.

Solution 4 - Svn

I've figured out an easy way to solve the problem on Eclipse:

Right click on your project -> Team -> Update to HEAD

and then follow the same way for commiting.

Right click on your project -> Team -> Commit

Solution 5 - Svn

You just need to update and then commit

Solution 6 - Svn

Have you tried svn up dir before doing the final commit?

Solution 7 - Svn

To get around this problem I used 'svn revert

' then do the commit again, which should get rid of the contents in the then do 'svn delete ' and commit again. I got this problem trying to rename a directory but hopefully this will work.

Solution 8 - Svn

Similar problem I faced with fresh workspace:

$ svn delete dir/file
D         dir/file
$ svn ci -m "comment1"
Deleting       dir/file
$ svn delete dir/
D         dir
$ svn ci -m "comment2"
Deleting       dir
svn: Commit failed (details follow):
svn: Item 'dir' is out of date

To resolve the issue I re-updated the sources and used 'delete URL' command:

$ svn delete --force https://server/path.../dir
$ svn update

Solution 9 - Svn

This happens when you are going to commit a file and the same file is updated in the SVN as well. Then it is going to conflict.So what you have to do is just take a copy of your changes and revert the file. then again paste your code. Then you can commit without any issues.

Solution 10 - Svn

Try committing one test directory on the server. generally when you delete any repository from SVN and if contains multiple files, SVN note the changes but it's in on-hold state or changes will take time to reflect. No worries just wait for few minutes and it will start reflecting. try committing test directory. cheers.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJos GeertsView Question on Stackoverflow
Solution 1 - SvnkhmarbaiseView Answer on Stackoverflow
Solution 2 - SvnStephen FriedrichView Answer on Stackoverflow
Solution 3 - SvnArda Ç.View Answer on Stackoverflow
Solution 4 - SvnErcanView Answer on Stackoverflow
Solution 5 - SvnULyssesView Answer on Stackoverflow
Solution 6 - SvnTheJuiceView Answer on Stackoverflow
Solution 7 - SvnMarkView Answer on Stackoverflow
Solution 8 - SvnRuslanView Answer on Stackoverflow
Solution 9 - Svnchamzz.dotView Answer on Stackoverflow
Solution 10 - SvnAnshul JaiswalView Answer on Stackoverflow