Difference between revisions of "Git branch creation"

From relax wiki
Jump to navigation Jump to search
Line 56: Line 56:
  
 
# To keep up to date, simply type
 
# To keep up to date, simply type
svnmerge.py merge
+
./svnmerge.py merge
 
</source>
 
</source>
  
Line 78: Line 78:
 
Then svnmerge.py can be utilised again. First initialise the merging process by typing, from within the checked out copy of the main line,
 
Then svnmerge.py can be utilised again. First initialise the merging process by typing, from within the checked out copy of the main line,
 
<source lang="bash">
 
<source lang="bash">
svnmerge.py init svn+ssh://$RUSER@svn.gna.org/svn/relax/branches/$BRANCH
+
./svnmerge.py init svn+ssh://$RUSER@svn.gna.org/svn/relax/branches/$BRANCH
 
#Then commit the change
 
#Then commit the change
 
svn ci -F svnmerge-commit-message.txt
 
svn ci -F svnmerge-commit-message.txt
Line 85: Line 85:
 
To merge the branch and commit the changes, type
 
To merge the branch and commit the changes, type
 
<source lang="bash">
 
<source lang="bash">
svnmerge.py merge -bidirectional
+
./svnmerge.py merge -bidirectional
 
svn ci -F svnmerge-commit-message.txt
 
svn ci -F svnmerge-commit-message.txt
 
</source>
 
</source>
Line 91: Line 91:
 
Finally the merge properties need to be removed
 
Finally the merge properties need to be removed
 
<source lang="bash">
 
<source lang="bash">
svnmerge.py uninit -S svn+ssh://$RUSER@svn.gna.org/svn/relax/branches/$BRANCH
+
./svnmerge.py uninit -S svn+ssh://$RUSER@svn.gna.org/svn/relax/branches/$BRANCH
 
# the changes committed
 
# the changes committed
 
svn ci -F svnmerge-commit-message.txt
 
svn ci -F svnmerge-commit-message.txt

Revision as of 18:52, 18 May 2014

Links

http://www.nmr-relax.com/manual/Branches.html

Branch creation

http://www.nmr-relax.com/manual/Branch_creation.html

If a change is likely to be disruptive or cause breakages in the program, the use of your own temporary branch is recommended. This private branch is a complete copy of one of the main development lines wherein you can make changes without disrupting the other developers. Although called a private branch every change is visible to all other developers and each commit will result in an automatic email to the relax-commits mailing list. Other developers are even able to check out your branch and make modifications to it. Private branches can also be used for testing ideas. If the idea does not work the branch can be deleted from the repository (in reality the branch will always exist between the revision numbers of its creation and deletion and can always be resurrected). For example to create a branch from the main development line, the `trunk', called molmol_macros whereby new Molmol macros are to be written, type

bash
RUSER=xxx
BRANCH=disp_speed

svn cp svn+ssh://$RUSER@svn.gna.org/svn/relax/trunk svn+ssh://$RUSER@svn.gna.org/svn/relax/branches/$BRANCH

Check out the branch

See also Git installation for tips and tricks.

# Catch which revision initiated the branch.
SVNLOG=`svn log --stop-on-copy svn+ssh://$RUSER@svn.gna.org/svn/relax/branches/$BRANCH`
REV=`echo $SVNLOG | cut -d" " -f2 | cut -d"r" -f2`; echo $REV

git svn clone -r $REV svn+ssh://$RUSER@svn.gna.org/svn/relax/branches/$BRANCH $BRANCH
# Copy .gitignore from relax_trunk and add relax_commit standard message.
cd $BRANCH
git config --add user.email $RUSER@nmr-relax.com
cp ../relax_trunk/.gitignore .
cp ../relax_trunk/relax_commit.txt .
git config --add commit.template "relax_commit.txt"
# Make an executable to this.
ln -s relax $HOME/bin/relax_${BRANCH}
# And build
scons

#Now check out the svn branch, which we will keep to perform certain svn commands.
cd ..
svn co svn+ssh://$RUSER@svn.gna.org/svn/relax/branches/$BRANCH ${BRANCH}_svn

For info about the commit template, see Format commit logs.

Keeping the branch up to date using svnmerge.py

As you develop your branch, changes will be occurring simultaneously within the main line. These changes should be merged into your branch on a regular basis to avoid large incompatible changes from forming between the two branches. To simplify this process, the svnmerge.py script located at http://www.orcaware.com/svn/wiki/Svnmerge.py can be used. It is best to download the trunk version from that page, unless that version is non-functional.

cd ${BRANCH}_svn
# Get the svnmerge script
curl http://svn.apache.org/repos/asf/subversion/trunk/contrib/client-side/svnmerge/svnmerge.py -o svnmerge.py

#Once you have this script, the merging from the main line to your private branch must be initialised by typing, from within the checked out copy of your branch
svnmerge.py init

#This then needs to be committed using the automatically generated log
svn ci -F svnmerge-commit-message.txt

# To keep up to date, simply type
./svnmerge.py merge


If conflicts have occurred please refer to the Subversion book at http://svnbook.red-bean.com/ for information on how to resolve the problem. Otherwise, or once fixed, the main line revisions merged into your branch can be committed using the automatically generated log file:

svn ci -F svnmerge-commit-message.txt

Merging the branch back into the main line

Once you have completed the modifications desired for your branch, all changes which have occurred in the main line have been merged using svnmerge.py, and the changes have been approved for merging back into the main line - then your branch can be merged. First check out a copy of the main line,

svn co svn+ssh://$RUSER@svn.gna.org/svn/relax/trunk relax-trunk
# or update a previously checked out version,
svn up


Then svnmerge.py can be utilised again. First initialise the merging process by typing, from within the checked out copy of the main line,

./svnmerge.py init svn+ssh://$RUSER@svn.gna.org/svn/relax/branches/$BRANCH
#Then commit the change
svn ci -F svnmerge-commit-message.txt

To merge the branch and commit the changes, type

./svnmerge.py merge -bidirectional
svn ci -F svnmerge-commit-message.txt

Finally the merge properties need to be removed

./svnmerge.py uninit -S svn+ssh://$RUSER@svn.gna.org/svn/relax/branches/$BRANCH
# the changes committed
svn ci -F svnmerge-commit-message.txt
# and your private branch deleted
svn rm svn+ssh://$RUSER@svn.gna.org/svn/relax/branches/$BRANCH

See also