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.

tickets_using.mkd 6.9KB

Ticket tracker with patchset contributions A basic issue tracker styled as a hybrid of GitHub and BitBucket issues. You may attach commits to an existing ticket or you can push a single commit to create a *proposal* ticket. Tickets keep track of patchsets (one or more commits) and allow patchset rewriting (rebase, amend, squash) by detecing the non-fast-forward update and assigning a new patchset number to the new commits. Ticket tracker -------------- The ticket tracker stores tickets as an append-only journal of changes. The journals are deserialized and a ticket is built by applying the journal entries. Tickets are indexed using Apache Lucene and all queries and searches are executed against this Lucene index. There is one trade-off to this persistence design: user attributions are non-relational. What does that mean? Each journal entry stores the username of the author. If the username changes in the user service, the journal entry will not reflect that change because the values are hard-coded. Here are a few reasons/justifications for this design choice: 1. commit identifications (author, committer, tagger) are non-relational 2. maintains the KISS principle 3. your favorite text editor can still be your administration tool Persistence Choices ------------------- **FileTicketService**: stores journals on the filesystem **BranchTicketService**: stores journals on an orphan branch **RedisTicketService**: stores journals in a Redis key-value datastore It should be relatively straight-forward to develop other backends (MongoDB, etc) as long as the journal design is preserved. Pushing Commits --------------- Each push to a ticket is identified as a patchset revision. A patchset revision may add commits to the patchset (fast-forward) OR a patchset revision may rewrite history (rebase, squash, rebase+squash, or amend). Patchset authors should not be afraid to polish, revise, and rewrite their code before merging into the proposed branch. Gitblit will create one ref for each patchset. These refs are updated for fast-forward pushes or created for rewrites. They are formatted as `refs/tickets/{shard}/{id}/{patchset}`. The *shard* is the last two digits of the id. If the id < 10, prefix a 0. The *shard* is always two digits long. The shard's purpose is to ensure Gitblit doesn't exceed any filesystem directory limits for file creation. **Creating a Proposal Ticket** You may create a new change proposal ticket just by pushing a **single commit** to `refs/for/{branch}` where branch is the proposed integration branch OR `refs/for/new` or `refs/for/default` which both will use the default repository branch. git push origin HEAD:refs/for/new **Updating a Patchset** The safe way to update an existing patchset is to push to the patchset ref. git push origin HEAD:refs/heads/ticket/{id} This ensures you do not accidentally create a new patchset in the event that the patchset was updated after you last pulled. The not-so-safe way to update an existing patchset is to push using the magic ref. git push origin HEAD:refs/for/{id} This push ref will update an exisitng patchset OR create a new patchset if the update is non-fast-forward. **Rebasing, Squashing, Amending** Gitblit makes rebasing, squashing, and amending patchsets easy. Normally, pushing a non-fast-forward update would require rewind (RW+) repository permissions. Gitblit provides a magic ref which will allow ticket participants to rewrite a ticket patchset as long as the ticket is open. git push origin HEAD:refs/for/{id} Pushing changes to this ref allows the patchset authors to rebase, squash, or amend the patchset commits without requiring client-side use of the *--force* flag on push AND without requiring RW+ permission to the repository. Since each patchset is tracked with a ref it is easy to recover from accidental non-fast-forward updates. Features -------- - Ticket tracker with status changes and responsible assignments - Patchset revision scoring mechanism - Update/Rewrite patchset handling - Close-on-push detection - Server-side Merge button for simple merges - Comments with Markdown syntax support - Rich mail notifications - Voting - Mentions - Watch lists - Querying - Searches - Partial miletones support - Multiple backend options
10 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. ## Using Tickets
  2. *PREVIEW 1.4.0*
  3. ### Creating Standard Tickets
  4. Standard tickets can be created using the web ui. These ticket types include *Bug*, *Enhancement*, *task*, and *Question*.
  5. ### Creating a Proposal Ticket
  6. Proposal tickets are created by pushing a patchset to the magic ref. They can not be created from the web ui.
  7. *Why should I create a proposal ticket?*
  8. Because you are too lazy to create a ticket in the web ui first. The proposal ticket is a convenience mechanism. It allows you to propose changes using Git, not your browser.
  9. *Who can create a proposal ticket?*
  10. Any authenticated user who can clone your repository.
  11. git checkout -b mytopic
  12. ...add a single commit...
  13. git push origin HEAD:refs/for/new
  14. git branch --set-upstream-to={remote}/ticket/{id}
  15. ### Creating the first Patchset for an Existing Ticket
  16. If you have an existing ticket that does **not*** yet have a proposed patchset you can push using the magic ref.
  17. *Who can create the first patchset for an existing ticket?*
  18. Any authenticated user who can clone your repository.
  19. git checkout -b mytopic
  20. ...add one or more commits...
  21. git push origin HEAD:refs/for/{id}
  22. git branch --set-upstream-to={remote}/ticket/{id}
  23. ### Safely adding commits to a Patchset for an Existing Ticket
  24. *Who can add commits to an existing patchset?*
  25. 1. The author of the ticket
  26. 2. The author of the initial patchset
  27. 3. The person set as *responsible*
  28. 4. Any user with write (RW) permissions to the repository
  29. git checkout ticket/{id}
  30. ...add one or more commits...
  31. git push
  32. ### Rewriting a Patchset (amend, rebase, squash)
  33. *Who can rewrite a patchset?*
  34. See the above rules for who can add commits to a patchset. You do **not** need rewind (RW+) to the repository to push a non-fast-forward patchset. Gitblit will detect the non-fast-forward update and create a new patchset ref. This preserves the previous patchset.
  35. git checkout ticket/{id}
  36. ...amend, rebase, squash...
  37. git push origin HEAD:refs/for/{id}
  38. ### Ticket RefSpecs
  39. Gitblit supports two primary push ref specs: the magic ref and the patchset ref.
  40. #### to create a new proposal ticket
  41. | ref | description |
  42. | :------------------- | :------------------------------------------- |
  43. | refs/for/new | new proposal for the default branch |
  44. | refs/for/default | new proposal for the default branch |
  45. | refs/for/{branch} | new proposal for the specified branch |
  46. #### to add a proposal patchset (first patchset) to an existing ticket
  47. | ref | description |
  48. | :------------------- | :------------------------------------------- |
  49. | refs/for/{id} | add new patchset to an existing ticket |
  50. #### to add commits to an existing patchset
  51. | ref | description |
  52. | :--------------------------- | :----------------------------------- |
  53. | refs/heads/ticket/{id} | fast-forward an existing patchset |
  54. #### to rewrite a patchset (amend, rebase, squash)
  55. | magic ref | description |
  56. | :------------------- | :------------------------------------------- |
  57. | refs/for/{id} | add new patchset to an existing ticket |
  58. ### Ticket RefSpec Tricks
  59. Gitblit supports setting some ticket fields from the push refspec.
  60. refs/for/master%topic=bug/42,r=james,m=1.4.1,cc=dave,cc=mark
  61. | parameter | description |
  62. | :-------- | :-------------------------------------------------------------- |
  63. | t | assign a *topic* to the ticket (matched against bugtraq config) |
  64. | r | set the *responsible* user |
  65. | m | set the *milestone* for patchset integration |
  66. | cc | add this account to the *watch* list (multiple ccs allowed) |
  67. #### examples
  68. Create a new patchset for ticket *12*, add *james* and *mark* to the watch list, and set the topic to *issue-123* which will be regex-matched against the repository bugtraq configuration.
  69. git push origin HEAD:refs/for/12%cc=james,cc=mark,t=issue-123
  70. Add some commits to ticket *123* patchset *5*. Set the milestone to *1.4.1*.
  71. git push origin HEAD:refs/heads/ticket/123/5%m=1.4.1
  72. ### Merging Patchsets
  73. The Gitblit web ui offers a merge button which *should work* but is not fully tested. Gitblit does verify that you can cleanly merge a patchset to the integration branch.
  74. There are complicated merge scenarios for which it may be best to merge using your Git client. There are several ways to do this, here is a safe merge strategy which pulls into a new branch and then fast-forwards your integration branch, assuming you were happy with the pull (merge).
  75. git pull origin master
  76. git checkout -b ticket-{id} master
  77. git pull origin ticket/{id}
  78. git checkout master
  79. git merge ticket-{id}
  80. git push origin master
  81. ### Closing Tickets on Push with a Completely New Patchset
  82. Gitblit will look for patchset references on pushes to normal branches. If it finds a reference (like would be found in the previous merge instructions), the ticket is resolved as merged and everyone is notified.
  83. If you do not need to create a patchset for review, you can just push a commit to the integration branch that contains `fixes #1` or `closes #1` in the commit message. Gitblit will identify the ticket, create a new patchset with that commit as the tip, and resolve the ticket as merged. (And if the integration branch is not specified in the ticket - this is the case for a ticket without any existing patchsets - Gitblit will resolve the ticket as merged to the pushed branch).
  84. ### Reopening Tickets with Patchsets
  85. Gitblit allows you to reopen a Ticket with a merged patchset. Since Gitblit allows patchset rewrites and versions patchsets, this seems like a logical capability. There is no need to create another ticket for a feature request or bug report if the merged commits did not actually resolve the ticket.
  86. This allows you to continue the discussion and create a new patchset that hopefully resolves the need.
  87. **NOTE:** There is one caveat to this feature. You can not push patchsets to a closed ticket; Gitblit will reject the push. You must first reopen the ticket through the web ui before you may push your patchset update or new patchset.
  88. ### Reviews
  89. Gitblit includes a very simple review scoring mechanism.
  90. - +2, approved: patchset can be merged
  91. - +1, looks good: someone else must approve for merge
  92. - -1, needs improvement: please do not merge
  93. - -2, vetoed: patchset may not be merged
  94. Only users with write (RW) permissions to the repository can give a +2 and -2 score. Any other user is free to score +/-1.
  95. If the patchset is updated or rewritten, all reviews are reset; reviews apply to specific revisions of patchsets - they are not blanket approvals/disapprovals.