Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 1 | .. _coding-release-bugfix: |
| 2 | |
| 3 | Create a patch on a release branch |
| 4 | ================================== |
| 5 | |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 6 | .. code-block:: shell-session |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 7 | :caption: Clone repository |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 8 | |
| 9 | # ------------------------------------------------ |
| 10 | # Clone a repostiory of interest (ex: votlha-lib-go) |
| 11 | # Checkout release branch voltha-2.12 for patching |
| 12 | # ------------------------------------------------ |
| 13 | % git clone "ssh://gerrit.opencord.org:29418/voltha-lib-go.git" |
| 14 | % cd voltha-lib-go |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 15 | |
| 16 | # Pull in all remote tags/branches |
| 17 | % git fetch --all |
| 18 | |
| 19 | .. code-block:: shell-session |
| 20 | :caption: Create a dev branch for the patch |
| 21 | |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame^] | 22 | # ------------------------- |
| 23 | # Display available options |
| 24 | # ------------------------- |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 25 | % git branch -a |
| 26 | |
| 27 | master |
| 28 | remotes/origin/HEAD -> origin/master |
| 29 | remotes/origin/master |
| 30 | remotes/origin/voltha-2.11 |
| 31 | remotes/origin/voltha-2.12 |
| 32 | |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame^] | 33 | # ---------------------------------------------------------- |
| 34 | # Create a dev branch anchored to release branch voltha-2.12 |
| 35 | # ---------------------------------------------------------- |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 36 | % git checkout -b dev-joey voltha-2.12 |
| 37 | |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame^] | 38 | |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 39 | .. code-block:: shell-session |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame^] | 40 | :caption: Sanity check tag & branch |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 41 | |
| 42 | # ---------------------------------------------------------------------- |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame^] | 43 | # Verify tag & branch for your checkout are correct: |
| 44 | # Your developer branch will be attached to branch=voltha-2.12 |
| 45 | # initial branch checkouts will also mention the 'v2.12.x' tag. |
| 46 | # (HEAD -> dev-joey, tag: v2.12.0, origin/voltha-2.12) |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 47 | # ---------------------------------------------------------------------- |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame^] | 48 | # When --graph shows your dev branch is attached to 'origin/master' as |
| 49 | # the ancestor, consider this to be a red flag that something is amiss. |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 50 | # ---------------------------------------------------------------------- |
| 51 | |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame^] | 52 | :: |
| 53 | |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 54 | % git log --graph --decorate --oneline $@ |
| 55 | * 653504fa (HEAD -> dev-joey, tag: v2.12.0, origin/voltha-2.12*) [VOL-5247] repo:voltha-go release patching prep |
| 56 | |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame^] | 57 | :: |
| 58 | |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 59 | % git branch -vv |
| 60 | * dev-joey 253fa01b [origin/voltha-2.12: ahead 1] repo:voltha-go Post tag & branch activity |
| 61 | help 253fa01b repo:voltha-go Post tag & branch activity |
| 62 | master 4e0e0347 [origin/master] [VOL-5247] repo:voltha-go release patching prep |
| 63 | |
| 64 | HEAD will be attached to origin/voltha-2.12 and the latest release tag v7.5.3 |
| 65 | |
| 66 | :: |
| 67 | |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame^] | 68 | git log --graph --decorate --oneline {relpath} |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 69 | |
| 70 | * aeb3c4f (HEAD -> voltha-2.12, tag: v7.5.3, origin/voltha-2.12) [VOL-5245] -- release patch |
| 71 | * ad265dd (tag: v7.5.2) [VOL-5245] - branch and release repo:voltha-lib-go |
| 72 | * 9cdee9f (tag: v7.5.1, tag: v2.12.0) [VOL-5245] branch and release repo:voltha-lib-go |
| 73 | |
| 74 | .. code-block:: shell-session |
| 75 | :caption: Sanity check dev sandbox attributes |
| 76 | |
| 77 | # ------------------------------------------------------ |
| 78 | # Sanity check your sanbox |
| 79 | # ------------------------------------------------------ |
| 80 | # 1) VERSION file: no conflicts (master > release) |
| 81 | # master=x.y.0 > release=x.{y-1}.z |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame^] | 82 | # ------------------------------------------------------ |
| 83 | |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 84 | % cat VERSION |
| 85 | |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame^] | 86 | # ------------------------------------------------------ |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 87 | # .gitreview - commit, rebase, merge will be applied to the release branch |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame^] | 88 | # ------------------------------------------------------ |
| 89 | |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 90 | % grep -i branch .gitreview |
| 91 | defaultbranch=master |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 92 | |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame^] | 93 | .. code-block:: shell-session |
| 94 | :caption: Tag debugging |
| 95 | |
| 96 | # --------------------------------------------------------- |
| 97 | # If something is amiss checkout by named tag for diagnosis |
| 98 | # --------------------------------------------------------- |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 99 | % cat VERSION |
| 100 | % git checkout tags/v{VERSION-FILE-STRING} |
| 101 | |
| 102 | Command output |
| 103 | |
| 104 | :: |
| 105 | % git checkout voltha-2.12 |
| 106 | Branch 'voltha-2.12' set up to track remote branch 'voltha-2.12' from 'origin'. |
| 107 | Switched to a new branch 'voltha-2.12' |
| 108 | |
| 109 | |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 110 | Edit and commit |
| 111 | --------------- |
| 112 | |
| 113 | .. code-block:: shell-session |
| 114 | :caption: Edit, commit, rebase and review |
| 115 | |
| 116 | # ---------------------------------------------------------------- |
| 117 | # Edit sources to taste |
| 118 | # ---------------------------------------------------------------- |
| 119 | {emacs,vi,$EDITOR} ... |
| 120 | |
| 121 | # :ref:`pull-request--commit-message` |
| 122 | % git commit -F ./commit-message |
| 123 | |
| 124 | |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame^] | 125 | [Rebase|merge] against the release branch |
| 126 | ----------------------------------------- |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 127 | |
| 128 | .. code-block:: shell-session |
| 129 | :caption: Rebase against release branch ``NOT branch=master`` |
| 130 | |
| 131 | # Run one of |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame^] | 132 | % git checkout "voltha-2.12" |
| 133 | % git pull --ff-only origin "voltha-2.12" |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 134 | % git checkout dev-joey |
| 135 | % git rebase -i "origin/voltha-2.12" |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 136 | |
| 137 | |
| 138 | Code Review |
| 139 | ----------- |
| 140 | |
| 141 | .. code-block:: shell-session |
| 142 | :caption: Push to gerrit, code review |
| 143 | |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 144 | % git review --reviewers "foo@bar.org" |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 145 | |
| 146 | |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame^] | 147 | Verify Patch Creation |
| 148 | --------------------- |
| 149 | |
| 150 | .. code-block:: shell-session |
| 151 | :caption: Verify patch creation |
| 152 | |
| 153 | % git review --reviewers "foo@bar.org" |
| 154 | |
| 155 | :: |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 156 | |
| 157 | Now visit gerrit and verify your release bugfix is correctly decorated. |
| 158 | In gerrit, review the 'Repo|Branch' item in the top left corner. |
| 159 | 'votlha-2.12' or the release tag will be visible. If branch 'master' is |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 160 | listed abandon the patch, it will not be applied to the proper branch. |