1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
|
ACE/TAO
==================
See [Douglas C. Schmidt website](http://www.dre.vanderbilt.edu/~schmidt) for more information about ACE/TAO
The quality of ACE/TAO is monitored through our distributed [scoreboard](http://www.dre.vanderbilt.edu/scoreboard/)
Travis-CI status
================
master: [![Build Status](https://travis-ci.org/DOCGroup/ACE_TAO.svg?branch=master)](https://travis-ci.org/DOCGroup/ACE_TAO)
Snap-CI status
================
master: [![Build Status](https://snap-ci.com/DOCGroup/ACE_TAO/branch/master/build_image)](https://snap-ci.com/DOCGroup/ACE_TAO/branch/master)
AppVeyor status
================
master: [![Build Status](https://ci.appveyor.com/api/projects/status/umif8ghl2fg8rtx6/branch/master?svg=true)](https://ci.appveyor.com/project/jwillemsen/ace-tao)
Coverity Scan status
====================
master: [![Coverity Scan Build Status](https://scan.coverity.com/projects/1/badge.svg)](https://scan.coverity.com/projects/1)
<!---
GitHub does not support styles on HTML: https://github.com/github/markup/issues/57 so just
use icons from...
http://p.yusukekamiyamane.com/
http://www.iconarchive.com/show/fugue-icons-by-yusuke-kamiyamane.html
--->
[tip]: http://icons.iconarchive.com/icons/yusuke-kamiyamane/fugue/16/tick-circle-frame-icon.png "Tip"
[warn]: http://icons.iconarchive.com/icons/yusuke-kamiyamane/fugue/16/exclamation-icon.png "Warning"
[err]: http://icons.iconarchive.com/icons/yusuke-kamiyamane/fugue/16/minus-circle-icon.png "Error"
# ACE/TAO #
[ACE](http://www.dre.vanderbilt.edu/~schmidt/ACE.html) is a C++ framework for implementing distributed and
networked applications, [TAO](http://www.dre.vanderbilt.edu/~schmidt/TAO.html) is a C++
implementation of the OMG's [CORBA](http://www.omg.org/spec/CORBA/) standard. The main home page
is [here](http://www.dre.vanderbilt.edu/~schmidt/). Mailing lists are
available [here](http://www.dre.vanderbilt.edu/~schmidt/ACE-mail.html) and the
Bugzilla for issues is [here](http://bugzilla.dre.vanderbilt.edu/).
## Contributing Via GitHub ##
These guidelines are for all developers, whether occasional or regular. They have been sourced from various 'best practice' documents but primarily [here](https://github.com/JacORB/JacORB).
![Warning][warn] As a convention, <i>upstream</i> is used as the name of the <a href="http://github.com/DOCGroup/ACE_TAO">http://github.com/DOCGroup/ACE_TAO</a> repository. This repository is the canonical repository for ATCD. We usually name <i>origin</i> the fork on github of each contributor. So the exact meaning of <i>origin</i> is relative to the developer: you could think of <i>origin</i> as your own fork.
## Pre-requisites
This document assumes some working knowledge of git. We recommend Scott Chacon's excellent [Pro Git](http://progit.org) a a valuable piece of background reading. The book is released under the Creative Commons license and can be downloaded in electronic form for free. At very least, we recommend that [Chapter 2](http://progit.org/book/ch2-0.html), [Chapter 3](http://progit.org/book/ch3-0.html) and [Chapter 5](http://progit.org/book/ch5-0.html) of Pro Git are read before proceeding.
## Repositories
ACE/TAO uses [http://github.com/DOCGroup/ACE_TAO](http://github.com/DOCGroup/ACE_TAO) as its
canonical repository, and this repository contains the stable code on master.
Typically, only _Project Admins_ would be able to push to this repo while all else may clone or fork this repo.
## Roles
The project assumes one of 3 _roles_ an individual may assume when interacting with the ATCD codebase. The three roles here are:
* _Project Admin_
* _Frequent Contributor_
* _Occasional Contributor_
![Warning][warn] Typically, someone may be in more than one role at any given time, and puts on a different "hats" based on the task at hand
### Occasional Contributor
This role defines a user who browses through the source code of the project and occasionally submits patches.
An occasional contributor will only submit patches via a pull requests. The pull request will be submitted via GitHub.
Occasional contributors should *always* fork the upstream project on GitHub and work off a clone of this fork
#### Creating a pull request on GitHub
![Git Workflow 2](https://docs.jboss.org/author/download/attachments/4784485/git_wf_2.png)
In this workflow, the contributor forks the ACE/TAO upstream repository on GitHub, clones their fork, and makes changes to this private fork. When changes have been tested and are ready to be contributed back to the project, a *pull request* is issued via GitHub so that one of the Project Administrators can pull in the change.
![Warning][warn] It is desirable to work off a <i>topic branch</i>, even when using your own, forked repository. A topic branch is created for every feature or bug fix you do. Typically you would create one topic branch per issue, but if several patches are related it's acceptable to have several commits in the same branch; however different changes should always be identified by different commits.
Before you push your work onto your fork of the repository, it is often a good idea to review your commits. Consolidating them (squashing) or breaking them up as necessary and cleaning up commit messages should all be done while still working off your local clone. Also, prior to issuing a pull request, you should make sure you rebase your branch against the upstream branch you expect it to be merged into. Also, only submit pull requests for your branch - not for your master!
The section on *Public Small Project* in [Chapter 5, Section 2](http://progit.org/book/ch5-2.html) of Pro Git has more information on this style of workflow.
##### A worked example
1. Make sure your master is synced up with upstream. See [this section](#if-you-have-forked-upstream) for how to do this
2. Create new branch for your topic and switch to it. For the example issue, BZ-1234:
```
git checkout -b BZ-12345 master
```
3. Do your work. Test. Repeat
4. Commit your work on your topic branch
5. Push your topic branch to GitHub. For example:
```
git push origin BZ-12345
```
6. Issue a pull request using the [GitHub pull request system](http://help.github.com/send-pull-requests)
7. Once your pull request has been applied upstream, delete the topic branch both locally and on your fork. For example:
```
git branch -d BZ-12345 && git push origin :BZ-12345
```
8. Sync with upstream again so that your changes now appear in your master branch
If your topic branch has been open for a while and you are afraid changes upstream may clash with your changes, it makes sense to rebase your topic branch before you issue a pull request. To do this:
1. Sync your master branch with upstream
```
git checkout master
git pull upstream master
```
2. Switch to your topic branch. For example:
```
git checkout BZ-12345
```
3. Rebase your topic branch against master:
```
git rebase master
```
4. During the rebase process you might need to fix conflicts;
5. when you're done test your code again.
6. Push your rebased topic branch to your repo on GitHub (you will likely need to force this with the _-f_ option).
```
git push -f origin BZ-12345
```
7. Continue your work on your topic branch.
![Warning][warn] If you are sharing your forked ACE/TAO repo with others, then do not rebase! Use a merge instead.
#### Multi-step coordination between developers using forked repositories
Sometimes a feature/task is rather complex to implement and requires competence from multiple areas of the projects. In such occasions it is not uncommon for developers to coordinate feature implementation using personal forks of ACE/TAO prior to finally issuing request to integrate into ACE/TAO main repository on GitHub.
For example, developer A using his personal ACE/TAO fork creates a topic branch T and completes as much work as he/she can before requesting for assistance from developer B. Developer A pushes topic T to his personal ACE/TAO fork where developer B picks it up and brings it down to his local repo. Developer B then in turn completes necessary work, commits his/her changes on branch T, and finally pushes back T to his own personal fork. After issuing request for pull to developer A, developer B waits for notification that developer A integrated his changes. This exchange can be repeated as much as it is necessary and can involve multiple developers.
##### A worked example
This example assumes that developer A and B have added each others ACE/TAO forked repositories with the *git add remote* command. For example, developer B would add developer A's personal ACE/TAO fork repository with the command
```
git remote add devA https://github.com/developerA/ATCD.git
```
1. Developer A starts implementing feature BZ-244 and works on a local topic branch `bz244`
Developer A pushes `bz244` to personal ATCD fork. For example:
```
git push origin bz244
```
2. Developer B fetches branch `bz244` to local repository. For example:
```
git fetch devA bz244:my_bz244
```
3. Developer B works on local branch `my_bz244`
4. Developer B commits changes, pushes `my_bz244` to own fork.
```
git push origin my_bz244
```
5. Developer B sends pull request to developer A to integrate changes from `my_bz244` to `bz244`
### Frequent Contributor
A frequent contributor will only ever submit patches via a pull requests. The pull request will be submitted via GitHub.
Frequent contributors should *always* fork the upstream project on GitHub and work off a clone of this fork. This is very similar to [Creating a pull request on GitHub](#creating-a-pull-request-on-github) workflow used by a [#Occasional Contributor](#occasional-contributor).
![Warning][warn] All ACE/TAO core developers are considered frequent contributors and work off personal forks of the upstream repository. This allows for complex features to be developed in parallel without tripping up over one another. This process is certainly not restricted to just ACE/TAO core developers; any contributor is welcome to also participate in this manner.
### Project Admin
Project Admins have a very limited role. Only Project Admins are allowed to push to upstream, and Project Admins _never_ write any code directly on the upstream repository. All Project Admins do is pull in and merge changes from contributors (even if the "contributor" happens to be themselves) into upstream, perform code reviews and either commit or reject such changes.
![Warning][warn] All Contributors who are also Project Admins are encouraged to not merge their own changes, to ensure that all changes are reviewed.
This approach ensures ACE/TAO maintains quality on the main code source tree, and allows for important code reviews to take place again ensuring quality. Further, it ensures clean and easily traceable code history and makes sure that more than one person knows about the changes being performed.
#### Handling pull requests
![Git Workflow 4](https://docs.jboss.org/author/download/attachments/4784485/git_wf_4.png)
Project Admins are also responsible for responding to pull requests. The process is similar to applying a patch directly, except that when pulling in changes from a forked repository, more than a single commit may be pulled in. Again, this should be done on a newly created working branch, code reviewed, tested and cleaned up as necessary.
If commits need to be altered - e.g., rebasing to squash or split commits, or to alter commit messages - it is often better to contact the Contributor and ask the Contributor to do so and re-issue the pull request, since doing so on the upstream repo could cause update issues for contributors later on. If commits were altered or three-way merge was performed during a merge instead of fast-forward, it's also a good idea to check the log to make sure that the resulting repository history looks OK:
```
$ git log --pretty=oneline --graph --abbrev-commit # History messed up due to a bad merge
* 3005020 Merge branch 'BZ-786' of git://github.com/rnc/ATCD
|\
| * e757265 BZ-786 Make dependency to foobar optional <-- Same with cb4e5d6 - unnecessary
* | cb4e5d6 BZ-786 Make dependency to foobar optional <-- Cherry-picked commit by other admin
|/
* ...
$ git reset cb4e5d6 # revert the bad merge
```
It is therefore __strongly recommended__ that you use the [handle_pull_request](https://github.com/maniksurtani/githelpers/blob/master/project_admins/handle_pull_request) script that ensures a clean merge. If you _still_ wish to do this manually, please consider reading through the script first to get an idea of what needs to happen.
More information on pulling changes from remote, forked repos can be found in [Chapter 5, Section 3](http://progit.org/book/ch5-3.html) of Pro Git, under *Checking Out Remote Branches* .
##### Possible trouble handling pull requests
* If you have warnings about "Merge made by recursive" you have to fix it rebasing.
* If you have warnings about "non-fast-forward" you have to rebase.
* If you see "non-fast-forward updates were rejected" you shall never use "force" on upstream! It means that another patch was merged before you and you have to update your master again, and rebase again.
* "force" is allowed only in special maintenance circumstances. If you find you're needing it to handle a pull request, then you're doing it wrong, and the mistake might be a dangerous one! It's like the good rule of never commit when you're drunk (coding is allowed).
![Error][err] __Never use force on git push__ Using _-f_ while pushing on a shared repository such as _upstream_ you could effectively erase other committed patches. No-one shall ever use this option unless unanimously approved on the public mailing list: the most dangerous aspect of it is that nobody gets any notification if this happens, and we might think issues are solved but you silently removed the fix and it's history from the repository.
#### Cutting releases
Releases can only be cut by Project Admins, and must be done off a recently updated (git fetch and git pull origin) clone of the upstream repo.
## Committing your work
### Release branches
ACE/TAO currently has a primary release branch of master. In future further release branches may be created. (e.g. for maintenance purposes). Work should never be committed directly to a release branch; topic branches should always be used for work, and these topic branches should be merged in.
### Topic branches
Some of the biggest features of git are speed and efficiency of branching, and accuracy of merging. As a result, best practices involve making frequent use of branches. Creating several topic branches a day, even, should not be considered excessive, and working on several topic branches simultaneously again should be commonplace.
[Chapter 3, Section 4](http://progit.org/book/ch3-4.html) of Pro Git has a detailed discussion of topic branches. For ACE/TAO, it makes sense to create a topic branch and name it after the Bugzilla it corresponds to. (if it doesn't correspond to a Bugzilla, a simple but descriptive name should be used).
#### Topic Branches Affecting More Than One Release Branch
Most topic branches will only affect the a single release branch, so a topic branch should be created based off master. It may be that fixes apply to multiple branches. In this case, the following workflow should apply:
* Create topic branch off maintenance branch e.g. 6.3.1. For example:
```git checkout -b <topic>_ACE+TAO+CIAO-6_3_1 ACE+TAO+CIAO-6_3_1```
* Create topic branch off master. For example:
```git checkout -b <topic>_master master```
* Do your work on `<topic>_master`, test and commit your fixes
* Switch to `<topic>_ACE+TAO+CIAO-6_3_1`. For example:
```git checkout <topic>_ACE+TAO+CIAO-6_3_1```
* Cherry-pick your commit on `<topic>_master` onto `<topic>_ACE+TAO+CIAO-6_3_1`. For example:
```git cherry-pick <commit_id>```
* Test `<topic>_ACE+TAO+CIAO-6_3_1` for correctness, modify as necessary
* Issue pull requests for both topic branches
### Comments
It is __extremely important__ that comments for each commit are clear and follow certain conventions. This allows for proper parsing of logs by git tools. Read [this article](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) on how to format comments for git and adhere to them. Further to the recommendations in the article, the short summary of the commit message should be in the following format:
BZ-XXX Subject line of the Bugzilla in question
This can optionally be followed by a detailed explanation of the commit. Why it was done, how much of it was completed, etc. You may wish to express this as a list, for example:
```
* Add a unit test
* Add more unit tests
* Fix regressions
* Solve major NP-Complete problems
```
Make sure however to split separate concerns - especially if they are unrelated - in separate commits.
### Commits
Sometimes work on your topic branch may include several commits. For example, committing a test. Then committing another test. Then perhaps committing a fix. And perhaps fixing your own fix in the next commit... Before issuing a pull request for this topic branch, consider cleaning up these commits. Interactive rebasing helps you squash several commits into a single commit, which is often more coherent to deal with for others merging in your work. [Chapter 6, Section 4](http://progit.org/book/ch6-4.html) of Pro Git has details on how to squash commits and generally, clean up a series of commits before sharing this work with others. Note that you can also easily reorder them, just change the order of lines during the interactive rebase process.
Also, it is important to make sure you don't accidentally commit files for which no real changes have happened, but rather, whitespace has been modified. This often happens with some IDEs. `git diff --check` should be run before you issue such a pull request, which will check for such "noise" commits and warn you accordingly. Such files should be reverted and not be committed to the branch.
Adhering to [ACE/TAO's code style](http://htmlpreview.github.io/?https://github.com/DOCGroup/ACE_TAO/blob/master/ACE/docs/ACE-guidelines.html) guidelines will help minimise "noise" commits. Project Admins are going to ask contributors to reformat their code if necessary.
## Keeping your repo in sync with upstream
### If you have cloned upstream
If you have a clone of the upstream, you may want to update it from time to time. Running:
```
$ git fetch origin
$ git fetch origin --tags
```
will often do the trick. You could then pull the specific branches you would need to update:
```
$ git checkout master
$ git pull origin master
$ git checkout ACE+TAO+CIAO-6_3_1
$ git pull origin ACE+TAO+CIAO-6_3_1
```
#### Updating topic branches
You should rebase your topic branches at this point so that they are up-to-date and when pulled by upstream, upstream can fast-forward the release branches:
```
$ git checkout <topic>_master
$ git rebase master
```
and/or
```
$ git checkout topic_ACE+TAO+CIAO-6_3_1
$ git rebase ACE+TAO+CIAO-6_3_1
```
### If you have forked upstream
If you have a fork of upstream, you should probably define upstream as one of your remotes:
```
$ git remote add upstream git://github.com/DOCGroup/ACE_TAO.git
```
You should now be able to fetch and pull changes from upstream into your local repository, though you should make sure you have no uncommitted changes. (You *do* use topic branches, right?)
```
$ git fetch upstream
$ git fetch upstream --tags
$ git checkout master
$ git pull upstream master
$ git push origin master
$ git checkout ACE+TAO+CIAO-6_3_1
$ git pull upstream ACE+TAO+CIAO-6_3_1
$ git push origin ACE+TAO+CIAO-6_3_1
```
A script can do this for you - have a look at [sync_with_upstream](https://github.com/maniksurtani/githelpers/blob/master/contributors/sync_with_upstream).
#### Updating topic branches
Again, you should rebase your topic branches at this point so that they are up-to-date and when pulled by upstream, upstream can fast-forward the release branches:
```
$ git checkout topic_master
$ git rebase master
```
and/or
```
$ git checkout topic_ACE+TAO+CIAO-6_3_1
$ git rebase ACE+TAO+CIAO-6_3_1
```
The sync_with_upstream script can do this for you if your topic branch naming conventions match the script.
## GIT Enhancements
There are many ways git usage may be enhanced:
* Autocompletion on the command line via Bash or ZSH
* Custom shell prompts to display GIT repository information (again, available in Bash & ZSH)
* Coloring GIT Terminal output
* Visual tools such as gitk, qgit, Eclipse integration, etc.
* etc.
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<footer>
<p><i>Some icons by <a href="http://p.yusukekamiyamane.com">Yusuke Kamiyamane</a></i></p>
</footer>
|