📜 ⬆️ ⬇️

Work with branches in SVN. Changes in version 1.5.

Continuation of this article

For a long time in the branches of SVN was one major drawback. The system did not remember Mergey, and the programmer had to take care of himself that would save the revision number when copying changes from the trunk occurred. The problem was partially solved by adding comments to the log, but still it was fraught with errors, and it was entirely on the programmer’s conscience.
In version 1.5, finally, Subversion programmers fulfilled their long-held promise, and added some useful features for working with branches.
So, in version 1.5, the merge team acquired two new options: --record-only and --reintegrate .
Now the responsibility for controlling the copying of changes falls entirely on the shoulders of SVN (merge tracking), and the programmer can easily, and without fear carry out the merge as often as if it were an update command.

Now you absolutely do not need to worry about saving the revision number of the last merge. SVN has become smarter so much that he himself copies only those changes that you do not already have. If earlier you had to specify a revision range using the -r switch, then now you just need to execute the command

#svn merge svn://svnserver/var/bump/trunk

And SVN itself will understand everything:
')
--- Merging r154 through r155 into '.':
U app/view/blogs/view.tpl.html


The second useful change is related to copying your changes to the trunk. Again, SVN generously takes care of us, and itself copies only those changes that are not in the trunk.

svn merge --reintegrate svn://svnserver/var/bump/branches/my-branch

This command will merge your branch with a trunk. Again, no unnecessary movements, everything is very simple.

The option --record-only is used to mark a range of revisions as merged. That is, the next time svn will not attempt to copy the changes from these revisions to your branch.

#svn merge -r155:157 --record-only svn://svnserver/var/bump/trunk

Now all changes from revision range 155: 157 will be ignored.

Added additional option for svn log and svn blame commands
svn log --use-merge-history --limit 3
------------------------------------------------------------------------
r155 | rvk | 2008-11-24 15:22:04 +0300 (, 24 2008) | 1 line
Merged via: r156

fixed small bug
------------------------------------------------------------------------
r154 | rvk | 2008-11-24 14:15:29 +0300 (, 24 2008) | 1 line

new branch named new_design
------------------------------------------------------------------------

And one more useful option svn mergeinfo, with which you can see which revisions are already complete:

#svn mergeinfo svn://svnserver/var/bump/trunk

Or what changes can still be copied from the trunk:

#svn mergeinfo svn://svnserver/var/bump/trunk --show-revs eligible

As always, in more detail, you can read in svnbook

Source: https://habr.com/ru/post/45222/


All Articles