You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

158 lines
5.4 KiB

  1. // This file is part of the Doxygen Developer Manual
  2. /** @page patchguide Patch Guidelines
  3. @b NB! If you're behind a corporate wall with http only access to the
  4. world, you can still use these instructions!
  5. @b NB2! You can't send patches to the mailing list anymore at all. Nowadays
  6. you are expected to send patches to the OpenOCD Gerrit GIT server for a
  7. review.
  8. @section gerrit Submitting patches to the OpenOCD Gerrit server
  9. OpenOCD is to some extent a "self service" open source project, so to
  10. contribute, you must follow the standard procedures to have the best
  11. possible chance to get your changes accepted.
  12. The procedure to create a patch is essentially:
  13. - make the changes
  14. - create a commit
  15. - send the changes to the Gerrit server for review
  16. - correct the patch and re-send it according to review feedback
  17. Your patch (or commit) should be a "good patch": focus it on a single
  18. issue, and make it be easily reviewable. Don't make
  19. it so large that it's hard to review; split large
  20. patches into smaller ones. (That can also help
  21. track down bugs later on.) All patches should
  22. be "clean", which includes preserving the existing
  23. coding style and updating documentation as needed.
  24. Say in the commit message if it's a bugfix (describe the bug) or a new
  25. feature. Don't expect patches to merge immediately
  26. for the next release. Be ready to rework patches
  27. in response to feedback.
  28. Add yourself to the GPL copyright for non-trivial changes.
  29. @section stepbystep Step by step procedure
  30. -# Create a Gerrit account at: http://openocd.zylin.com
  31. - On subsequent sign ins, use the full URL prefaced with 'http://'
  32. For example: http://user_identifier.open_id_provider.com
  33. -# Add a username to your profile.
  34. After creating the Gerrit account and signing in, you will need to
  35. add a username to your profile. To do this, go to 'Settings', and
  36. add a username of your choice.
  37. Your username will be required in step 3 and substituted wherever
  38. the string 'USERNAME' is found.
  39. -# Add an SSH public key following the directions on github:
  40. https://help.github.com/articles/generating-ssh-keys
  41. -# Clone the git repository, rather than just download the source:
  42. @code
  43. git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd
  44. @endcode
  45. or if you have problems with the "git:" protocol, use
  46. the slower http protocol:
  47. @code
  48. git clone http://repo.or.cz/r/openocd.git
  49. @endcode
  50. -# Set up Gerrit with your local repository. All this does it
  51. to instruct git locally how to send off the changes.
  52. -# Add a new remote to git using Gerrit username:
  53. @code
  54. git remote add review ssh://USERNAME@openocd.zylin.com:29418/openocd.git
  55. git config remote.review.push HEAD:refs/publish/master
  56. @endcode
  57. Or with http only:
  58. @code
  59. git remote add review http://openocd.zylin.com/p/openocd.git
  60. git config remote.review.push HEAD:refs/publish/master
  61. @endcode
  62. -# You will need to install this hook, we will look into a better solution:
  63. @code
  64. scp -p -P 29418 USERNAME@openocd.zylin.com:hooks/commit-msg .git/hooks/
  65. @endcode
  66. Or with http only:
  67. @code
  68. wget http://openocd.zylin.com/tools/hooks/commit-msg
  69. mv commit-msg .git/hooks
  70. chmod +x .git/hooks/commit-msg
  71. @endcode
  72. @b NOTE A script exists to simplify the two items above. execute:
  73. @code
  74. tools/initial.sh <username>
  75. @endcode
  76. With @<username@> being your Gerrit username.
  77. -# Set up git with your name and email:
  78. @code
  79. git config --global user.name "John Smith"
  80. git config --global user.email "john@smith.org"
  81. @endcode
  82. -# Work on your patches. Split the work into
  83. multiple small patches that can be reviewed and
  84. applied seperately and safely to the OpenOCD
  85. repository.
  86. @code
  87. while(!done) {
  88. work - edit files using your favorite editor.
  89. run "git commit -s -a" to commit all changes.
  90. run tools/checkpatch.sh to verify your patch style is ok.
  91. }
  92. @endcode
  93. @b TIP! use "git add ." before commit to add new files.
  94. @code
  95. --- example comment, notice the short first line w/topic ---
  96. topic: short comment
  97. <blank line>
  98. longer comments over several
  99. lines...
  100. <blank line>
  101. Signed-off-by: ...
  102. -----
  103. @endcode
  104. -# Next you need to make sure that your patches
  105. are on top of the latest stuff on the server and
  106. that there are no conflicts:
  107. @code
  108. git pull --rebase origin master
  109. @endcode
  110. -# Send the patches to the Gerrit server for review:
  111. @code
  112. git push review
  113. @endcode
  114. -# Forgot something, want to add more? Just make the changes and do:
  115. @code
  116. git commit --amend
  117. git push review
  118. @endcode
  119. Further reading: http://www.coreboot.org/Git
  120. @section timeline When can I expect my contribution to be committed?
  121. The code review is intended to take as long as a week or two to allow
  122. maintainers and contributors who work on OpenOCD only in their spare
  123. time oportunity to perform a review and raise objections.
  124. With Gerrit much of the urgency of getting things committed has been
  125. removed as the work in progress is safely stored in Gerrit and
  126. available if someone needs to build on your work before it is
  127. submitted to the official repository.
  128. Another factor that contributes to the desire for longer cool-off
  129. times (the time a patch lies around without any further changes or
  130. comments), it means that the chances of quality regression on the
  131. master branch will be much reduced.
  132. If a contributor pushes a patch, it is considered good form if another
  133. contributor actually approves and submits that patch.
  134. @section browsing Browsing Patches
  135. All OpenOCD patches can be reviewed <a href="http://openocd.zylin.com/">here</a>.
  136. */
  137. /** @file
  138. This file contains the @ref patchguide page.
  139. */