Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
dev:branching [2009/08/26 04:07] michael |
dev:branching [2022/05/06 16:07] (current) |
======Working with branches====== | ======Working with branches====== |
| |
| **//OBSOLETE//** |
| |
| These instructions have been superseded by [[dev:Using git]]. |
| |
| **//OBSOLETE//** |
| |
| NOTE: The rosegarden svn URL on sourceforge has changed. This page has only been partially updated to reflect that. Usually it is simply a matter of replacing all |
| |
| https://<user>@rosegarden.svn.sourceforge.net/svnroot/rosegarden |
| |
| with |
| |
| svn+ssh://<user>@svn.code.sf.net/p/rosegarden/code |
| |
| Keep this in mind while reading this page... |
| |
| ===== When to branch? ===== |
To branch or not to branch? | To branch or not to branch? |
| |
| |
<code> | <code> |
patch -R -p0 < patch_my_branch | patch -R -p0 < <patch_my_branch> |
</code> | </code> |
| |
Create a new branch by copying trunk/. For example, for a branch called <my_branch>, do the following (as a single one-line command): | Create a new branch by copying trunk/. For example, for a branch called <my_branch>, do the following (as a single one-line command): |
<code> | <code> |
svn copy https://<user>@rosegarden.svn.sourceforge.net/svnroot/rosegarden/trunk/rosegarden \ | svn copy svn+ssh://<user>@svn.code.sf.net/p/rosegarden/code/trunk/rosegarden \ |
https://<user>@rosegarden.svn.sourceforge.net/svnroot/rosegarden/branches/<my_branch> | svn+ssh://<user>@svn.code.sf.net/p/rosegarden/code/branches/<my_branch> |
</code> | </code> |
You can see what branches already exist (so as to get ideas for a new name, perhaps) using | You can see what branches already exist (so as to get ideas for a new name, perhaps) using |
<code> | <code> |
svn ls https://<user>@rosegarden.svn.sourceforge.net/svnroot/rosegarden/branches/ | svn ls http://svn.code.sf.net/p/rosegarden/code/branches/ |
</code> | </code> |
| |
(Or you can browse the [[Online Subversion repository|http://rosegarden.svn.sourceforge.net/viewvc/rosegarden/branches/]]) | (Or you can browse the online Subversion repository at http://sourceforge.net/p/rosegarden/code/) |
| |
//Note//: Replace <user> with your SourceForge username and <my_branch> with your branch name. | //Note//: Replace <user> with your SourceForge username and <my_branch> with your branch name. |
| |
<code> | <code> |
svn co my_branch | svn co <my_branch> |
</code> | </code> |
| |
The full command to checkout my_branch using username is: | The full command to checkout my_branch using username is: |
<code> | <code> |
svn checkout https://<user>@rosegarden.svn.sourceforge.net/svnroot/rosegarden/branches/<my_branch> <my_branch> | svn checkout svn+ssh://<user>@svn.code.sf.net/p/rosegarden/code/branches/<my_branch> <my_branch> |
</code> | </code> |
//Note//: Replace <user> with your SourceForge username and <my_branch> with your branch name. | //Note//: Replace <user> with your SourceForge username and <my_branch> with your branch name. |
Working with branches is as easy as working with the trunk. Commit the changes from the root directory of the branch. | Working with branches is as easy as working with the trunk. Commit the changes from the root directory of the branch. |
<code> | <code> |
cd my_branch | cd <my_branch> |
svn commit -m "Text which describes the updates." | svn commit -m "Text which describes the updates." |
</code> | </code> |
=====Resolving conflicts===== | =====Resolving conflicts===== |
| |
In the case of a conflict, there will be 'C' in the place of the file which contained conflicts. | A conflict occurs when you try to update your working copy from a repository that has conflicting changes in it. This can happen during the normal course of development, when two different people happen to work in the same place. (One common circumstance is that developer C commits broken changes, and both developers A and B rush in with two slightly different, conflicting fixes.) |
| |
| During a merge, this happens when your branch changes some part of the code that also changed in trunk/, and Subversion cannot decide how to put all the pieces together. |
| |
| When you experience a conflict (such as the real conflict upon which I'm basing this example), recent versions of Subversion will prompt you what to do: |
<code> | <code> |
C foo.c | Conflict discovered in 'data/rc/rosegardenui.rc'. |
| Select: (p) postpone, (df) diff-full, (e) edit, |
| (h) help for more options: |
</code> | </code> |
Such a file will be split into several parts. | |
| Chris recommends that you just choose **p** to postpone conflict resolution. (For binary conflicts, you will also get **tf** and **mf** for "theirs full" and "mine full" respectively. Which to choose will depend entirely on the circumstances.) |
<code> | <code> |
foo.c | (h) help for more options: p |
foo.c.r8115 | --- Merging r10774 through r10874 into 'data/rc': |
foo.c.r8119 | C data/rc/rosegardenui.rc |
foo.c.working | |
</code> | </code> |
After you have resolved conflicts, remove the extra files and commit the changes. | |
| After the conflict, you wind up with several files, similar to these: |
| |
| | file | description | |
| |rosegardenui.rc | original file with alternatives written in | |
| |rosegardenui.rc.merge-left.r10773 | changes from the left revision (-r[left]:[right]) | |
| |rosegardenui.rc.merge-right.r10874 | changes from the right revision (-r[left]:[right]) | |
| |rosegardenui.rc.working | your previous working copy | |
| |
| Chris works with the plain .c file, which is the original file with the conflicts given in an "alternatives" diff-like form, such as this excerpt: |
<code> | <code> |
rm foo.c.* | <Action name="file_revert"/> |
svn commit -m "merge from trunk" | </enable> |
| </State> |
| |
| <<<<<<< .working |
| <State name="have_project_packager"> |
| <enable> |
| <Action name="file_import_project"/> |
| <Action name="file_export_project"/> |
| </enable> |
| </State> |
| |
| ======= |
| >>>>>>> .merge-right.r10874 |
| <State name="have_segments"> |
| <enable> |
| <Action name="move"/> |
</code> | </code> |
| |
| In this case, I apparently removed some code from part of the file that simultaneously changed in trunk/ and Subversion got confused. I can't remember what I did where, or who did what, so while Chris recommends working only with the plain .c file, I have found I can't figure out what I'm looking at in this case. |
| |
| I decided to have a look with Kompare. |
| |
| <code> |
| kompare rosegardenui.rc.merge-left.r10773 rosegardenui.rc.merge-right.r10874 |
| </code> |
| |
| {{:dev:kompare.jpeg|}} |
| |
| I find the visual presentation easier for getting a real sense of what's going on, although the particular example I happened to have chosen to present here (because it was the first one I had at hand) is not particularly good. This conflict is easy to resolve. |
| |
| In any case, once you have discovered what is going on to your satisfaction, edit the file until you're happy with it, then run |
| |
| <code> |
| svn resolved <filename> |
| </code> |
| |
| to tell Subversion that you have resolved the conflict. |
| |
| Test and commit. |
| |
=====Closing a branch===== | =====Closing a branch===== |
https://<user>@rosegarden.svn.sourceforge.net/svnroot/rosegarden/branches/obsolete/ | https://<user>@rosegarden.svn.sourceforge.net/svnroot/rosegarden/branches/obsolete/ |
</code> | </code> |
| |
| =====Example of a planned and focused branch ===== |
| |
| * [[dev:notation_toolbar_2|Notation Toolbar Branch]] |