SVN, how to enable "local add, incoming add when updating" in * folder *?

Here is my scenario:

Suppose we have an SVN repo with the following contents: my folder my_folder \ file.txt

Now I am creating two checks for this repo, co1 and co2.

In co1 we modify file.txt. In co2 we have:

  • svn delete my folder
  • svn commit
  • Create a new folder called myfolder
  • svn add my folder
  • svn commit

Now, if I try to upgrade in co1, I get a tree conflict:

A + C myfolder > local edit, incoming delete upon update M + myfolder\file.txt 

I want to save my folder and modified file, so I resolve the tree conflict:

 svn resolve --accept working folder 

Now, if I try to commit, I get "svn: Directory" / myfolder "deprecated." If I try to resolve this using svn up myfolder, I will again get a tree conflict:

 A + C folder > local add, incoming add upon update M + myfolder\file.txt 

Ok, so we will try svn resolve --access working folder again. But we still cannot commit, we get the same message that "svn: Directory" / myfolder is "out of date", if we do svn up my folder, we return to the last conflict with the tree.

What is the correct procedure for resolving this type of conflict (when do we want to save my folder and its changes)?

EDIT: Windows cmd line script to illustrate:

 rmdir /S /QC:\svntest mkdir C:\svntest cd C:\svntest svnadmin create repo svn co file:///c:/svntest/repo co1 svn co file:///c:/svntest/repo co2 cd co1 mkdir folder echo content > folder\file.txt svn add folder svn commit folder -m "" cd C:\svntest\co2 svn up cd C:\svntest\co1 svn del folder svn commit -m "" mkdir folder svn add folder svn commit -m "" cd C:\svntest\co2 echo changed_content > folder\file.txt svn up svn resolve --accept working folder svn commit -m "" svn up folder svn resolve --accept working folder svn commit -m "" 

And here is the result of running the script (note the commit failures at the end):

 C:\>rmdir /S /QC:\svntest C:\>mkdir C:\svntest C:\>cd C:\svntest C:\svntest>svnadmin create repo C:\svntest>svn co file:///c:/svntest/repo co1 Checked out revision 0. C:\svntest>svn co file:///c:/svntest/repo co2 Checked out revision 0. C:\svntest>cd co1 C:\svntest\co1>mkdir folder C:\svntest\co1>echo content 1>folder\file.txt C:\svntest\co1>svn add folder A folder A folder\file.txt C:\svntest\co1>svn commit folder -m "" Adding folder Adding folder\file.txt Transmitting file data . Committed revision 1. C:\svntest\co1>cd C:\svntest\co2 C:\svntest\co2>svn up A folder A folder\file.txt Updated to revision 1. C:\svntest\co2>cd C:\svntest\co1 C:\svntest\co1>svn del folder D folder\file.txt D folder C:\svntest\co1>svn commit -m "" Deleting folder Committed revision 2. C:\svntest\co1>mkdir folder C:\svntest\co1>svn add folder A folder C:\svntest\co1>svn commit -m "" Adding folder Committed revision 3. C:\svntest\co1>cd C:\svntest\co2 C:\svntest\co2>echo changed_content 1>folder\file.txt C:\svntest\co2>svn up C folder At revision 3. Summary of conflicts: Tree conflicts: 1 C:\svntest\co2>svn resolve --accept working folder Resolved conflicted state of 'folder' C:\svntest\co2>svn commit -m "" Adding folder svn: Commit failed (details follow): svn: Directory '/folder' is out of date C:\svntest\co2>svn up folder C folder At revision 3. Summary of conflicts: Tree conflicts: 1 C:\svntest\co2>svn resolve --accept working folder Resolved conflicted state of 'folder' C:\svntest\co2>svn commit -m "" Adding folder svn: Commit failed (details follow): svn: Directory '/folder' is out of date 
+45
svn tree-conflict
Oct 21 '10 at 8:19
source share
5 answers

I understood with

 svn resolve --accept working PATH_TO_FILE 

which should end:

Conflict state 'PATH_TO_FILE' resolved

+33
Apr 16 '14 at 19:04
source share
β€” -

Tree conflicts gives a good overview of tree conflicts and their resolution. In some cases, svn revert may also help if you lose all your local modifications. In an extreme case, a new working copy with manual combination changes from β€œbroken”, which will return you to the right track. Definitely the dark side of subversion.

+15
Oct 21 '10 at 11:16
source share

Try

 C:\svntest\co2>move folder folder.SAVE C:\svntest\co2>svn revert folder C:\svntest\co2>svn update 

Then Svn should introduce a new version of the folder directory identical to the version with co1 . Then you can overwrite the contents from folder.SAVE .

+2
Sep 21 '12 at 7:27
source share

I can not reproduce what you mentioned. Here is what I have tried.

 test@test:/tmp$ cd /tmp/ test@test:/tmp$ svn co http://localhost:8080/svn/stackoverflow so --username=admin A so/trunk A so/branches A so/tags Checked out revision 1. test@test:/tmp$ cd so/trunk/ test@test:/tmp/so/trunk$ mkdir x test@test:/tmp/so/trunk$ ls /tmp > x/test.txt test@test:/tmp/so/trunk$ svn add x/ A x A x/test.txt test@test:/tmp/so/trunk$ svn ci -m "test" Adding trunk/x Adding trunk/x/test.txt Transmitting file data . Committed revision 2. test@test:/tmp/so/trunk$ cd /tmp/ test@test:/tmp$ svn co http://localhost:8080/svn/stackoverflow so1 --username=admin A so1/trunk A so1/trunk/x A so1/trunk/x/test.txt A so1/branches A so1/tags Checked out revision 2. test@test:/tmp$ cd /tmp/so1/trunk/ test@test:/tmp/so1/trunk$ svn remove x D x/test.txt D x test@test:/tmp/so1/trunk$ svn ci -m "" Deleting trunk/x Committed revision 3. test@test:/tmp/so1/trunk$ mkdir x test@test:/tmp/so1/trunk$ cp ../../so/trunk/x/test.txt x test@test:/tmp/so1/trunk$ ll /tmp > x/test.txt test@test:/tmp/so1/trunk$ svn add x/ A x A x/test.txt test@test:/tmp/so1/trunk$ svn ci -m "" Adding trunk/x Adding trunk/x/test.txt Transmitting file data . Committed revision 4. test@test:/tmp$ cd so/trunk/ test@test:/tmp/so/trunk$ svn up D x A x A x/test.txt Updated to revision 4. test@test:/tmp/so/trunk$ 

Apparently, I tried the same approach as you, and no longer ran into any problem. What version of svn are you using?

 export REPOPATH=/tmp/svntest test@test:/tmp/co2/trunk$ rm -rf $REPOPATH test@test:/tmp/co2/trunk$ mkdir $REPOPATH test@test:/tmp/co2/trunk$ svnadmin create $REPOPATH/repo test@test:/tmp/co2/trunk$ svn co file:///$REPOPATH/repo co1 svn: Repository UUID '2d803eb8-2030-4dd3-bb6f-34ab07c74813' doesn't match expected UUID '82764ae8-6410-4565-933f-9a420cb60013' test@test:/tmp/co2/trunk$ svn co file:///$REPOPATH/repo co2 svn: Repository UUID '2d803eb8-2030-4dd3-bb6f-34ab07c74813' doesn't match expected UUID '82764ae8-6410-4565-933f-9a420cb60013' test@test:/tmp/co2/trunk$ test@test:/tmp/co2/trunk$ cd $REPOPATH/co1 bash: cd: /tmp/svntest/co1: No such file or directory test@test:/tmp/co2/trunk$ mkdir folder mkdir: cannot create directory `folder': File exists test@test:/tmp/co2/trunk$ echo content > folder/file.txt test@test:/tmp/co2/trunk$ svn add folder svn: warning: 'folder' is already under version control test@test:/tmp/co2/trunk$ svn commit folder -m "" test@test:/tmp/co2/trunk$ test@test:/tmp/co2/trunk$ cd $REPOPATH/co2 bash: cd: /tmp/svntest/co2: No such file or directory test@test:/tmp/co2/trunk$ svn up At revision 10. test@test:/tmp/co2/trunk$ test@test:/tmp/co2/trunk$ cd $REPOPATH/co1 bash: cd: /tmp/svntest/co1: No such file or directory test@test:/tmp/co2/trunk$ svn del folder svn: Use --force to override this restriction svn: 'folder/file.txt' is not under version control test@test:/tmp/co2/trunk$ svn commit -m "" test@test:/tmp/co2/trunk$ mkdir folder mkdir: cannot create directory `folder': File exists test@test:/tmp/co2/trunk$ svn add folder svn: warning: 'folder' is already under version control test@test:/tmp/co2/trunk$ svn commit -m "" test@test:/tmp/co2/trunk$ test@test:/tmp/co2/trunk$ cd $REPOPATH/co2 bash: cd: /tmp/svntest/co2: No such file or directory test@test:/tmp/co2/trunk$ echo changed_content > folder\file.txt test@test:/tmp/co2/trunk$ svn up At revision 10. test@test:/tmp/co2/trunk$ svn --version svn, version 1.6.6 (r40053) compiled Dec 12 2009, 05:04:54 Copyright (C) 2000-2009 CollabNet. Subversion is open source software, see http://subversion.tigris.org/ This product includes software developed by CollabNet (http://www.Collab.Net/). The following repository access (RA) modules are available: * ra_neon : Module for accessing a repository via WebDAV protocol using Neon. - handles 'http' scheme - handles 'https' scheme * ra_svn : Module for accessing a repository using the svn network protocol. - with Cyrus SASL authentication - handles 'svn' scheme * ra_local : Module for accessing a repository on local disk. - handles 'file' scheme 
+1
Oct 21 '10 at 11:29
source share

In this particular case, I think you will have to manually apply local changes manually. That is, create a patch file (svn diff> mine.patch or copy the files to another location), revert your changes or allow their use, then apply the patch (or copy the files back). You may need to copy the base of your files back to the updated folder before making changes.

As zellus said, this is the dark side of subversion, and this is what the current implementation cannot handle. Again, deleting a folder and adding the same name back does not sound completely correct. What do you expect from subversion? What should I do if the file is not recreated in the folder? What if its contents are different?

Try to avoid the situation altogether without deleting the folder you want to save :)

0
Nov 03 '10 at 3:15
source share



All Articles