Project

General

Profile

Tagging » History » Version 22

Herbert Greenlee, 05/25/2017 06:28 PM

1 5 Herbert Greenlee
{{toc}}
2 2 Herbert Greenlee
3 14 Herbert Greenlee
h1. Preparing a release from the develop branch (git flow release method)
4 1 Herbert Greenlee
5 15 Herbert Greenlee
Make an mrb development area corresponding to the base release of larsoft you are using.
6 11 Herbert Greenlee
<pre>
7 11 Herbert Greenlee
export MRB_PROJECT=larsoft
8 11 Herbert Greenlee
mrb newDev -v v04_03_01 -q e7:prof ...
9 11 Herbert Greenlee
cd $MRB_TOP
10 11 Herbert Greenlee
source localProducts*/setup
11 11 Herbert Greenlee
</pre>
12 1 Herbert Greenlee
13 11 Herbert Greenlee
If necessary, check out uboonecode and dependent packages that are not part of larsoft (ubutil).
14 1 Herbert Greenlee
<pre>
15 11 Herbert Greenlee
cd $MRB_SOURCE
16 11 Herbert Greenlee
mrb g uboonecode
17 11 Herbert Greenlee
mrb g ubutil
18 21 Herbert Greenlee
mrb g uboonedata
19 11 Herbert Greenlee
</pre>
20 11 Herbert Greenlee
21 11 Herbert Greenlee
Make sure your local copies of develop and master branches up to date with the main repository.  Do this for each checked out package.
22 11 Herbert Greenlee
<pre>
23 2 Herbert Greenlee
cd $MRB_SOURCE/<package>
24 2 Herbert Greenlee
git checkout develop
25 2 Herbert Greenlee
git pull
26 1 Herbert Greenlee
git checkout master
27 1 Herbert Greenlee
git pull
28 2 Herbert Greenlee
</pre>
29 1 Herbert Greenlee
30 11 Herbert Greenlee
Use git flow to create a release branch in your local repository.  Git flow always creates the release branch from the head of develop.  
31 10 Herbert Greenlee
<pre>
32 15 Herbert Greenlee
git flow release start <version>
33 4 Herbert Greenlee
</pre>
34 4 Herbert Greenlee
35 16 Herbert Greenlee
This command creates a new branch off of the head of develop called @release/<version>@.  After this command, the newly created release branch will be the checked out branch.  At this point, you can make further changes to your release branch, including the version number of the package being tagged and version numbers of dependent products.  In particular, you may with to edit the following files.
36 2 Herbert Greenlee
37 2 Herbert Greenlee
* ups/product_deps
38 1 Herbert Greenlee
39 1 Herbert Greenlee
After making all updates, it is a good idea to do a full test build, including tests.
40 2 Herbert Greenlee
<pre>
41 1 Herbert Greenlee
cd $MRB_BUILDDIR
42 21 Herbert Greenlee
mrbsetenv
43 1 Herbert Greenlee
mrb i -j4
44 1 Herbert Greenlee
mrb t -j4
45 21 Herbert Greenlee
</pre>
46 22 Herbert Greenlee
47 21 Herbert Greenlee
Note that if you have uboonedata checked out, it may be necessary to remove uboonedata from the master CMakeLists.txt and reinitializing the build environment using @mrbsetenv@ before running @mrb t@.
48 21 Herbert Greenlee
49 11 Herbert Greenlee
When you are done updating the release branch, commit updates to your local repository for each package.
50 1 Herbert Greenlee
<pre>
51 1 Herbert Greenlee
cd $MRB_SOURCE/<package>
52 11 Herbert Greenlee
git commit -a
53 1 Herbert Greenlee
</pre>
54 1 Herbert Greenlee
55 11 Herbert Greenlee
Use git flow to "finish" the release branch.
56 11 Herbert Greenlee
57 1 Herbert Greenlee
<pre>
58 14 Herbert Greenlee
git flow release finish
59 1 Herbert Greenlee
</pre>
60 13 Herbert Greenlee
This git flow command does the following actions.
61 1 Herbert Greenlee
62 11 Herbert Greenlee
* Merges release branch to master.
63 11 Herbert Greenlee
* Merges release branch to develop.
64 11 Herbert Greenlee
* Creates a tag on the master branch.
65 11 Herbert Greenlee
* Deletes the release branch.
66 11 Herbert Greenlee
* Checks out the develop branch.
67 11 Herbert Greenlee
68 12 Herbert Greenlee
Note that when you merge the release branch into master, you are also merging any updates originally from develop into master.
69 12 Herbert Greenlee
70 11 Herbert Greenlee
Now push everything up to main repository.
71 1 Herbert Greenlee
<pre>
72 1 Herbert Greenlee
git push origin develop master
73 15 Herbert Greenlee
git push --tags
74 1 Herbert Greenlee
</pre>
75 1 Herbert Greenlee
76 1 Herbert Greenlee
h1. Preparing a hotfix release (git flow hotfix method)
77 1 Herbert Greenlee
78 18 Herbert Greenlee
Prepare your development area as in the previous section, up to the "@git flow release start@" command.  If you are patching a release that corresponds to the current head of the master branch (i.e. the most recent tag), start your hotfix branch using the following command.
79 15 Herbert Greenlee
<pre>
80 20 Herbert Greenlee
git flow hotfix start <new version>
81 18 Herbert Greenlee
</pre>
82 19 Herbert Greenlee
83 18 Herbert Greenlee
If you want to patch an older tag, you must first create a new branch off of that tag.
84 18 Herbert Greenlee
<pre>
85 20 Herbert Greenlee
git checkout -b <bug_fix_branch> <old version>
86 20 Herbert Greenlee
git flow hotfix start <new version> <bug_fix_branch>
87 1 Herbert Greenlee
</pre>
88 1 Herbert Greenlee
89 20 Herbert Greenlee
Either command creates a new branch called @hotfix/<new version>@.  Make updates and test your hotfix branch as in the previous section.  When you are done, use the following command to finish the hotfix.
90 16 Herbert Greenlee
<pre>
91 16 Herbert Greenlee
git flow hotfix finish
92 1 Herbert Greenlee
</pre>
93 1 Herbert Greenlee
94 19 Herbert Greenlee
This command merges the hotfix branch to master (or bug fix) and develop branches, and creates a new tag on the master or bug fix branch.  Then push your updates up to the main repository.
95 16 Herbert Greenlee
<pre>
96 19 Herbert Greenlee
git push origin develop [master|<bug_fix_branch>]
97 16 Herbert Greenlee
git push --tags
98 16 Herbert Greenlee
</pre>
99 16 Herbert Greenlee
100 20 Herbert Greenlee
The main difference between "@git flow release@" and "@git flow hotfix@" is that the former works off of develop, and the latter works off of master (or bug fix branch).
101 1 Herbert Greenlee
102 11 Herbert Greenlee
h1. Tagging a branch for release (manual method)
103 1 Herbert Greenlee
104 11 Herbert Greenlee
Releases are built from the @master@ branch.  This recipe shows how to create a tag on the @master@ branch of a git repository.
105 11 Herbert Greenlee
106 11 Herbert Greenlee
Make a new mrb development area corresponding to the base release of larsoft you are using.
107 5 Herbert Greenlee
<pre>
108 11 Herbert Greenlee
export MRB_PROJECT=larsoft
109 11 Herbert Greenlee
mrb newDev -v v04_03_01 -q e7:prof ...
110 11 Herbert Greenlee
cd $MRB_TOP
111 11 Herbert Greenlee
source localProducts*/setup
112 11 Herbert Greenlee
</pre>
113 11 Herbert Greenlee
114 11 Herbert Greenlee
If necessary, check out uboonecode and dependent packages that are not part of larsoft (ubutil).
115 11 Herbert Greenlee
<pre>
116 11 Herbert Greenlee
cd $MRB_SOURCE
117 11 Herbert Greenlee
mrb g uboonecode
118 1 Herbert Greenlee
mrb g ubutil
119 21 Herbert Greenlee
mrb g uboonedata
120 11 Herbert Greenlee
</pre>
121 11 Herbert Greenlee
122 11 Herbert Greenlee
Get your local copies of develop and master branches up to date with the main repository.
123 11 Herbert Greenlee
<pre>
124 5 Herbert Greenlee
cd $MRB_SOURCE/<package>
125 1 Herbert Greenlee
git checkout develop
126 1 Herbert Greenlee
git pull
127 1 Herbert Greenlee
git checkout master
128 1 Herbert Greenlee
git pull
129 1 Herbert Greenlee
</pre>
130 1 Herbert Greenlee
131 17 Herbert Greenlee
If desired, update the master branch with changes from develop.
132 5 Herbert Greenlee
<pre>
133 11 Herbert Greenlee
git merge develop
134 5 Herbert Greenlee
</pre>
135 5 Herbert Greenlee
136 11 Herbert Greenlee
At this point, you can make further changes to your master branch, including the version number of the package being tagged and version numbers of dependent products.  In particular, you may with to edit the following files.
137 5 Herbert Greenlee
138 5 Herbert Greenlee
* ups/product_deps
139 5 Herbert Greenlee
140 5 Herbert Greenlee
After making all updates, it is a good idea to do a full test build, including tests.
141 5 Herbert Greenlee
<pre>
142 1 Herbert Greenlee
cd $MRB_BUILDDIR
143 21 Herbert Greenlee
mrbsetenv
144 1 Herbert Greenlee
mrb i -j4
145 1 Herbert Greenlee
mrb t -j4
146 21 Herbert Greenlee
</pre>
147 22 Herbert Greenlee
148 21 Herbert Greenlee
Note that if you have uboonedata checked out, it may be necessary to remove uboonedata from the master CMakeLists.txt and reinitializing the build environment using @mrbsetenv@ before running @mrb t@.
149 21 Herbert Greenlee
150 11 Herbert Greenlee
When you are done updating master, commit and push your changes to the main repository.
151 6 Herbert Greenlee
<pre>
152 5 Herbert Greenlee
cd $MRB_SOURCE/<package>
153 11 Herbert Greenlee
git commit -a
154 11 Herbert Greenlee
git push origin master
155 1 Herbert Greenlee
</pre>
156 6 Herbert Greenlee
157 11 Herbert Greenlee
Now make the actual tag and push the tag to the main repository.
158 5 Herbert Greenlee
<pre>
159 11 Herbert Greenlee
git tag -a -m"v04_03_01" v04_03_01   # Annotated tag.
160 11 Herbert Greenlee
git push origin v04_03_01            # Or git push --tags
161 6 Herbert Greenlee
</pre>
162 11 Herbert Greenlee
If you want to move an existing tag, you need to add option @-f@ or @--force@ to the last two commands.
163 1 Herbert Greenlee
164 11 Herbert Greenlee
If you made changes directly on the master branch, like updating the version number in product_deps, you should merge these back into the develop branch.
165 1 Herbert Greenlee
<pre>
166 11 Herbert Greenlee
git checkout develop
167 11 Herbert Greenlee
git merge master
168 11 Herbert Greenlee
git push origin develop
169 1 Herbert Greenlee
</pre>