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?
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.
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.
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…
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.
Just make a svn update
and then your commit should work.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With