문제

I probably just haven't thought this through, or perhaps I'm simply unaware of an already existing option in Subversion (I'm certainly no expert).

I'm just wondering, if I've created a branch to start working on some new feature, if there's an easier way to keep the branch up to date with the trunk's most recent revisions without having to go through all the trouble of merging a range of revisions. I would like to be able to simply update and get all revisions from the trunk (and the branch, of course), while my committed changes only affect the branch. Is this possible? Does what I'm asking make sense?

I suppose this isn't really necessarily different from merging a range of revisions; it's just that I use AnkhSVN, which performs all these best-practice checks before allowing a merge, and sometimes it feels like it's a lot more complicated than it needs to be. The idea is that I want to keep my branch up-to-date with any commits other developers may be making to the trunk so that when I eventually do merge my branch into the trunk, everything goes (as) smoothly (as possible).

도움이 되었습니까?

해결책

Keeping your branch up to do date with the latest trunk check-ins is called a merge.

I know merging can be a royal nightmare sometimes, but this is precisely what merging is.

다른 팁

TL;DR; No you must merge, here's some instructions

It's not as bad as you think it is. I will outline the steps from the commandline that I use. I will be using vimidiff to manage the conflicts you can use Meld or someother diff tool that you like. Commands are preceded by the hash '#' mark

<in branch first time from copy>
# svn log --stop-on-copy | tail 
<read the revision that was the copy instruction in this case r229>
# cd ../../trunk
# svn up
<I make note of the latest rivision which is r334>
<now I go back to the branch>
# cd ../branches/branch 
# svn merge -r229:334 svn://url.to.svn.server/project/trunk
<a whole bunch of stuff happens>
< now I check for conflicts >
# svn status | grep ^C
<which outputs something like>
C       public/tools/Diagnostic.class.php
C       public/domain/Report_Setup_Parameter.class.php
C       public/modules/mReports.module.php
<I now revert all these and manually merge them>
# svn revert public/tools/Diagnostic.class.php
...
<revert done now manuall doinng the merge
# vimdiff public/tools/Diagnostic.class.php ../../trunk/public/tools/Diagnostic.class.php
...
<now all the changes are done>
# svn commit -m "Merging trunk into branch 'branch' r:229:334"
commited revision 335

Done, if you do it reguarly then there are not many changes. After the first merge you need to use the revision # of the last merge. Therefore some time in the future the command would look in the svn log to find when the revision of the last merge was, in this case 335. The merge command would look like thuse

# svn merge -r335:370 svn://url.to.svn.server/project/trunk

All other steps are the same.

The idea is that I want to keep my branch up-to-date with any commits other developers may be making to the trunk so that when I eventually do merge my branch into the trunk, everything goes (as) smoothly (as possible).

To achieve that you need to do range-revision merges from trunk. Actually, it is a good practice to do this kind of merge to a branch from time to time to be up-to-date with what is going on in the trunk.

I don't know about the tools for AnkhSVN, but 'pure' SVN has very good tools that make merge operations quite simple. TortoiseSVN is a great tool for Windows and if you like Netbeans there is a very nice graphical support for merge too.

I'm not familiar with AnkhSVN, but what you're describing is exactly what svn merge is for. So the answer to your question is no.

However, you might check out the --reintegrate option to see if that makes your life easier.

See these blog posts:

Subversion merge reintegrate
Subversion 1.5 merge-tracking in a nutshell

If you're using PHPStorm you can try using the GUI interface https://www.jetbrains.com/help/idea/2016.1/integrating-changes-to-from-feature-branches.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top