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 |
Joey Armstrong | fb8f3c8 | 2024-01-29 10:13:18 -0500 | [diff] [blame] | 91 | defaultbranch=voltha-2.12 |
| 92 | |
| 93 | # ------------------------------------------------------- |
| 94 | # On branch=master, defaultbranch=master or will be unset |
| 95 | # ------------------------------------------------------- |
| 96 | % git checkout master |
| 97 | % grep -i branch .gitreview |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 98 | defaultbranch=master |
Joey Armstrong | fb8f3c8 | 2024-01-29 10:13:18 -0500 | [diff] [blame] | 99 | % git checkout dev-joey |
| 100 | |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 101 | |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame] | 102 | .. code-block:: shell-session |
| 103 | :caption: Tag debugging |
| 104 | |
| 105 | # --------------------------------------------------------- |
| 106 | # If something is amiss checkout by named tag for diagnosis |
| 107 | # --------------------------------------------------------- |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 108 | % cat VERSION |
| 109 | % git checkout tags/v{VERSION-FILE-STRING} |
| 110 | |
| 111 | Command output |
| 112 | |
| 113 | :: |
| 114 | % git checkout voltha-2.12 |
| 115 | Branch 'voltha-2.12' set up to track remote branch 'voltha-2.12' from 'origin'. |
| 116 | Switched to a new branch 'voltha-2.12' |
| 117 | |
| 118 | |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 119 | Edit and commit |
| 120 | --------------- |
| 121 | |
Joey Armstrong | fb8f3c8 | 2024-01-29 10:13:18 -0500 | [diff] [blame] | 122 | - :ref:`pull-request--commit-message` |
| 123 | - :ref:`code--makefile-lint-targets` |
| 124 | |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 125 | .. code-block:: shell-session |
| 126 | :caption: Edit, commit, rebase and review |
| 127 | |
| 128 | # ---------------------------------------------------------------- |
| 129 | # Edit sources to taste |
| 130 | # ---------------------------------------------------------------- |
| 131 | {emacs,vi,$EDITOR} ... |
| 132 | |
Joey Armstrong | fb8f3c8 | 2024-01-29 10:13:18 -0500 | [diff] [blame] | 133 | # ---------------------------------------------------------------- |
| 134 | # Sanity check for problems |
| 135 | # ---------------------------------------------------------------- |
| 136 | % make help | grep lint |
| 137 | % make lint LOCAL_FIX_PERMS=1 |
| 138 | % make build |
| 139 | % make test |
| 140 | |
| 141 | # ---------------------------------------------------------------- |
| 142 | # Create a patch for upload |
| 143 | # ---------------------------------------------------------------- |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 144 | % git commit -F ./commit-message |
| 145 | |
| 146 | |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame] | 147 | [Rebase|merge] against the release branch |
| 148 | ----------------------------------------- |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 149 | |
| 150 | .. code-block:: shell-session |
| 151 | :caption: Rebase against release branch ``NOT branch=master`` |
| 152 | |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame] | 153 | % git checkout "voltha-2.12" |
| 154 | % git pull --ff-only origin "voltha-2.12" |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 155 | % git checkout dev-joey |
| 156 | % git rebase -i "origin/voltha-2.12" |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 157 | |
| 158 | |
| 159 | Code Review |
| 160 | ----------- |
| 161 | |
| 162 | .. code-block:: shell-session |
| 163 | :caption: Push to gerrit, code review |
| 164 | |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame] | 165 | % git review --reviewers "foo@bar.org" |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 166 | |
| 167 | |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame] | 168 | Verify Patch Creation |
| 169 | --------------------- |
| 170 | |
| 171 | .. code-block:: shell-session |
| 172 | :caption: Verify patch creation |
| 173 | |
Joey Armstrong | fb8f3c8 | 2024-01-29 10:13:18 -0500 | [diff] [blame] | 174 | % git review --reviewers "foo@bar.org" "bar@tans.org" |
Joey Armstrong | c32c3c3 | 2024-01-28 18:12:16 -0500 | [diff] [blame] | 175 | |
| 176 | :: |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 177 | |
Joey Armstrong | fb8f3c8 | 2024-01-29 10:13:18 -0500 | [diff] [blame] | 178 | As a cross check visit gerrit and verify your release bugfix is correctly |
| 179 | decorated. In gerrit, review the 'Repo|Branch' item in the top left corner. |
| 180 | 'votlha-2.12' or the release tag will be visible. If branch 'master' is |
| 181 | listed abandon the patch, it will not be applied to the proper branch. |