blob: 98679f70815ee2419ecf4d8e9e1ca64ca1d1f9f1 [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
91 defaultbranch=master
Joey Armstrong54fd7792024-01-18 09:12:30 -050092
Joey Armstrongc32c3c32024-01-28 18:12:16 -050093.. code-block:: shell-session
94 :caption: Tag debugging
95
96 # ---------------------------------------------------------
97 # If something is amiss checkout by named tag for diagnosis
98 # ---------------------------------------------------------
Joey Armstrong54fd7792024-01-18 09:12:30 -050099 % cat VERSION
100 % git checkout tags/v{VERSION-FILE-STRING}
101
102Command 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 Armstrong54fd7792024-01-18 09:12:30 -0500110Edit 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 Armstrongc32c3c32024-01-28 18:12:16 -0500125[Rebase|merge] against the release branch
126-----------------------------------------
Joey Armstrong54fd7792024-01-18 09:12:30 -0500127
128.. code-block:: shell-session
129 :caption: Rebase against release branch ``NOT branch=master``
130
131 # Run one of
Joey Armstrongc32c3c32024-01-28 18:12:16 -0500132 % git checkout "voltha-2.12"
133 % git pull --ff-only origin "voltha-2.12"
Joey Armstrongad862102024-01-28 15:36:40 -0500134 % git checkout dev-joey
135 % git rebase -i "origin/voltha-2.12"
Joey Armstrong54fd7792024-01-18 09:12:30 -0500136
137
138Code Review
139-----------
140
141.. code-block:: shell-session
142 :caption: Push to gerrit, code review
143
Joey Armstrongad862102024-01-28 15:36:40 -0500144 % git review --reviewers "foo@bar.org"
Joey Armstrong54fd7792024-01-18 09:12:30 -0500145
146
Joey Armstrongc32c3c32024-01-28 18:12:16 -0500147Verify 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 Armstrong54fd7792024-01-18 09:12:30 -0500156
157Now visit gerrit and verify your release bugfix is correctly decorated.
158In 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 Armstrongad862102024-01-28 15:36:40 -0500160listed abandon the patch, it will not be applied to the proper branch.