Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

committing only the svn merge info

We are merging changes from the trunk to the branch. While we do this, the merge info gets recorded.

Since there might be other changes in the branch, is there a safe way to commit only the files affected due to the merge (assuming no other changes are there) along with the merge properties/info ?

" Lets say i want to merge revision 'r1' from trunk to branch. I do a merge from trunk to branch for 'r1'. Now for 'r1', in the branch folder, the merge information is recorded. If I do a svn diff in branch, it shows the '.' has modified, and shows that 'r1' is part of the merge properties. Now how do i commit the files modified due to 'r1' being merged only, along with the merge properties which says 'r1'. "

like image 483
Abhilash L L Avatar asked Oct 21 '22 13:10

Abhilash L L


2 Answers

If you are using SVN clients like TortoiseSVN, in a normal merge the mergeinfo will be updated as a folder property of the root folder automatically and it will list the folder with a property change during the commit listing of files.

If this is not coming automatically for your commit, then you can even do this even manually by following steps if you are using TortoiseSVN client (with the assumption root as parent, mytask as current task branch, subtask as an already merged back branch from current branch and programs as your code folder in each brach):

  1. Right click the programs folder on your workign copy of the branch mytask and select the option TortoiseSVN-->Properties.
  2. In the new window if you already have previous mergeinfo recorded then it will list the property svn:mergeinfo with the values similar to the values below:

    root/programs:1-489

    root/task/mytask/task/subtask/programs:380-410

    Then you can do the following steps:

    a) Select the option Edit-->Advanced in the window by selecting svn:mergeinfo item and update the mergeinfo you want to commit click 'OK'.

  3. In the new window, if you don't have any previous mergeinfo, then you can go for following steps:

    a) Select the option New-->Advanced.

    b) Select svn:mergeinfo from the dropdown list, add appropriate mergeinfo in the value textbox and save the same.

  4. Do SVN Commmit by clicking the programs folder and it will list programs folder in files to commit with only property change and you can commit it.

On the otherhand

If you want to commit only the merged files during your merge from the parent to the working copy and keep the locally modified other files uncommitted, then, there is no direct way to achieve this. The indirect way is to keep two seperate working copies (let us say copy1 and copy2) of your task branch (mytask) and perform the following steps:

  1. copy1 is having all the local changes and you can keep that aside for a while
  2. SVN checkout a new working copy copy2 of your branch.
  3. Merge the changes from your parent to copy2 and commit that. This ensures that you are commiting only the merged changes to the server with all the mergeinfo you want.
  4. Then go to your copy1, do an SVN update and it will get the new merged changes from server to this working copy. (If there are some files which are updated during merge and changed by you during local changes as well, then it will conflict during this SVN update). Resolve the conflicts and you can continue with your local changes then.
like image 117
RinoTom Avatar answered Oct 27 '22 07:10

RinoTom


This is an old topic but, since I also needed something similar and didn't find anything on stackoverflow, here's my take: Use 'svn commit --depth=empty folder_with_mergeinfo merged_files'.

In my case I was merging two branches and if I try to 'svn ci branch' it will try to commit everything modified under that branch. Using --depth=empty ensures only the folder merge info and the files you want are committed.

like image 42
fencekicker Avatar answered Oct 27 '22 08:10

fencekicker