blob: 498c9ab60b7b724b28e79a979d7350902eee0ed5 [file] [log] [blame]
Joey Armstrong54fd7792024-01-18 09:12:30 -05001.. _coding-release-bugfix:
2
3Create a patch on a release branch
4==================================
5
Joey Armstrong54fd7792024-01-18 09:12:30 -05006.. code-block:: shell-session
Joey Armstrongad862102024-01-28 15:36:40 -05007 :caption: Clone repository
Joey Armstrong54fd7792024-01-18 09:12:30 -05008
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 Armstrongad862102024-01-28 15:36:40 -050015
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 Armstrongc32c3c32024-01-28 18:12:16 -050022 # -------------------------
23 # Display available options
24 # -------------------------
Joey Armstrongad862102024-01-28 15:36:40 -050025 % 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 Armstrongc32c3c32024-01-28 18:12:16 -050033 # ----------------------------------------------------------
34 # Create a dev branch anchored to release branch voltha-2.12
35 # ----------------------------------------------------------
Joey Armstrongad862102024-01-28 15:36:40 -050036 % git checkout -b dev-joey voltha-2.12
37
Joey Armstrongc32c3c32024-01-28 18:12:16 -050038
Joey Armstrongad862102024-01-28 15:36:40 -050039.. code-block:: shell-session
Joey Armstrongc32c3c32024-01-28 18:12:16 -050040 :caption: Sanity check tag & branch
Joey Armstrongad862102024-01-28 15:36:40 -050041
42 # ----------------------------------------------------------------------
Joey Armstrongc32c3c32024-01-28 18:12:16 -050043 # 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 Armstrongad862102024-01-28 15:36:40 -050047 # ----------------------------------------------------------------------
Joey Armstrongc32c3c32024-01-28 18:12:16 -050048 # 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 Armstrongad862102024-01-28 15:36:40 -050050 # ----------------------------------------------------------------------
51
Joey Armstrongc32c3c32024-01-28 18:12:16 -050052::
53
Joey Armstrongad862102024-01-28 15:36:40 -050054 % 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 Armstrongc32c3c32024-01-28 18:12:16 -050057::
58
Joey Armstrongad862102024-01-28 15:36:40 -050059 % 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
64HEAD will be attached to origin/voltha-2.12 and the latest release tag v7.5.3
65
66::
67
Joey Armstrongc32c3c32024-01-28 18:12:16 -050068 git log --graph --decorate --oneline {relpath}
Joey Armstrongad862102024-01-28 15:36:40 -050069
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 Armstrongc32c3c32024-01-28 18:12:16 -050082 # ------------------------------------------------------
83
Joey Armstrongad862102024-01-28 15:36:40 -050084 % cat VERSION
85
Joey Armstrongc32c3c32024-01-28 18:12:16 -050086 # ------------------------------------------------------
Joey Armstrongad862102024-01-28 15:36:40 -050087 # .gitreview - commit, rebase, merge will be applied to the release branch
Joey Armstrongc32c3c32024-01-28 18:12:16 -050088 # ------------------------------------------------------
89
Joey Armstrongad862102024-01-28 15:36:40 -050090 % grep -i branch .gitreview
Joey Armstrongfb8f3c82024-01-29 10:13:18 -050091 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 Armstrongad862102024-01-28 15:36:40 -050098 defaultbranch=master
Joey Armstrongfb8f3c82024-01-29 10:13:18 -050099 % git checkout dev-joey
100
Joey Armstrong54fd7792024-01-18 09:12:30 -0500101
Joey Armstrongc32c3c32024-01-28 18:12:16 -0500102.. code-block:: shell-session
103 :caption: Tag debugging
104
105 # ---------------------------------------------------------
106 # If something is amiss checkout by named tag for diagnosis
107 # ---------------------------------------------------------
Joey Armstrong54fd7792024-01-18 09:12:30 -0500108 % cat VERSION
109 % git checkout tags/v{VERSION-FILE-STRING}
110
111Command 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 Armstrong54fd7792024-01-18 09:12:30 -0500119Edit and commit
120---------------
121
Joey Armstrongfb8f3c82024-01-29 10:13:18 -0500122- :ref:`pull-request--commit-message`
123- :ref:`code--makefile-lint-targets`
124
Joey Armstrong54fd7792024-01-18 09:12:30 -0500125.. 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 Armstrongfb8f3c82024-01-29 10:13:18 -0500133 # ----------------------------------------------------------------
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 Armstrong54fd7792024-01-18 09:12:30 -0500144 % git commit -F ./commit-message
145
146
Joey Armstrongc32c3c32024-01-28 18:12:16 -0500147[Rebase|merge] against the release branch
148-----------------------------------------
Joey Armstrong54fd7792024-01-18 09:12:30 -0500149
150.. code-block:: shell-session
151 :caption: Rebase against release branch ``NOT branch=master``
152
Joey Armstrongc32c3c32024-01-28 18:12:16 -0500153 % git checkout "voltha-2.12"
154 % git pull --ff-only origin "voltha-2.12"
Joey Armstrongad862102024-01-28 15:36:40 -0500155 % git checkout dev-joey
156 % git rebase -i "origin/voltha-2.12"
Joey Armstrong54fd7792024-01-18 09:12:30 -0500157
158
159Code Review
160-----------
161
162.. code-block:: shell-session
163 :caption: Push to gerrit, code review
164
Joey Armstrongad862102024-01-28 15:36:40 -0500165 % git review --reviewers "foo@bar.org"
Joey Armstrong54fd7792024-01-18 09:12:30 -0500166
167
Joey Armstrongc32c3c32024-01-28 18:12:16 -0500168Verify Patch Creation
169---------------------
170
171.. code-block:: shell-session
172 :caption: Verify patch creation
173
Joey Armstrongfb8f3c82024-01-29 10:13:18 -0500174 % git review --reviewers "foo@bar.org" "bar@tans.org"
Joey Armstrongc32c3c32024-01-28 18:12:16 -0500175
176::
Joey Armstrong54fd7792024-01-18 09:12:30 -0500177
Joey Armstrongfb8f3c82024-01-29 10:13:18 -0500178 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.