Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN how to resolve "local add, incoming add upon update" on a *folder*?

Here is my scenario:

Assume we have an SVN repo with the following content: myfolder myfolder\file.txt

Now I create two checkouts of this repo, co1 and co2.

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

  • svn delete myfolder
  • svn commit
  • Create a new folder named myfolder
  • svn add myfolder
  • svn commit

Now if I attempt an update in co1 I get a tree conflict:

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

I want to keep myfolder and the modified file, so I resolve the tree conflict:

svn resolve --accept working folder 

Now if I try to commit, I get "svn: Directory '/myfolder' is out of date". If I try to resolve this using svn up myfolder, I get a tree conflict again:

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

Okay, so we try svn resolve --accept working folder again. But we still can't commit, we get the same message that "svn: Directory '/myfolder' is out of date", if we do svn up myfolder, we get right back to the last tree conflict.

What is the correct procedure to resolve this type of conflict (when we wish to keep myfolder and its changes)?

EDIT: Windows cmd line script to illustrate:

rmdir /S /Q C:\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 output of running that script (note the commit failures at the end):

C:\>rmdir /S /Q C:\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 
like image 691
Ziphnor Avatar asked Oct 21 '10 08:10

Ziphnor


People also ask

How do I commit a folder in SVN?

Right-click in an empty area of the folder and select Refresh. You'll see “+” icons on the folders/files, now. Right-click an empty area in the folder once again and select SVN Commit. Add a message regarding what you are committing and click OK.

What does SVN resolve do?

svn resolve — Resolve conflicts on working copy files or directories.

How do I create a directory in SVN repository?

One way is to browse the repository to the place where you want to insert your new directory and right-click and select "Create Folder". Then right click the folder and check it out to the location where you want it. Then copy the directory of files you want to put into SVN into the folder created by the checkout.

How do I add a project to a SVN repository?

To import a project into the repository, right click the project you want to import and select Team > Share Project... from the context menu. This will begin the Share Project wizard. Select SVN as the repository type and click Next.


1 Answers

I figured out with

svn resolve --accept working  PATH_TO_FILE 

which should end up with:

Resolved conflicted state of 'PATH_TO_FILE'

like image 186
augusto Avatar answered Sep 21 '22 12:09

augusto