Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN commit failed: Directory out of date

Tags:

commit

svn

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?

like image 281
Jos Geerts Avatar asked Jul 21 '10 10:07

Jos Geerts


People also ask

Is out of date svn commit failed?

An svn commit of the file will fail with an “out-of-date” error. The file should be updated first; an svn update command will attempt to merge the public changes with the local changes. If Subversion can't complete the merge in a plausible way automatically, it leaves it to the user to resolve the conflict.

What is svn revert?

Reverts any local changes to a file or directory and resolves any conflicted states. svn revert will not only revert the contents of an item in your working copy, but also any property changes.

How do I delete a file from svn?

To remove a file from a Subversion repository, change to the directory with its working copy and run the following command: svn delete file… Similarly, to remove a directory and all files that are in it, type: svn delete directory…

What does svn update do?

svn update brings changes from the repository into your working copy. If no revision is given, it brings your working copy up-to-date with the HEAD revision. Otherwise, it synchronizes the working copy to the revision given by the --revision option.


2 Answers

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

like image 68
khmarbaise Avatar answered Sep 23 '22 01:09

khmarbaise


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.

like image 29
Stephen Friedrich Avatar answered Sep 24 '22 01:09

Stephen Friedrich