Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [TUT] cherry-picking
- 1) load Vanir's gerrit site (you can use others but we'll stick with Vanir for now)
- locations to look for cherry-picks (gerrit)(easiest cherry-pick)
- *note* gerrits are a site you submit commits to for review by your development team
- before they get put into the source on your github/gitweb remote that you repo sync
- from
- Vanir - http://vaniraosp.goo.im/#/q/status:open,n,z
- AOKP - http://gerrit.sudoservers.com/
- CM - http://review.cyanogenmod.org/
- 2) open a terminal
- 3) cd into the root of your source
- 4) in the web browser with the gerrit loaded: make sure you click on the all tab, and then open in the upper left before you start. notice the general layout of the gerrit. the commit description is under the subject heading and will describe what the commit does and the project is the repo that the commit is to be made to.
- 5) click on the commit labeled "test cherry-pick commit" and be sure to remember where the project is.
- From here get a feel for the general layout of a gerrit commit submitted for review
- Notice the files involved, description of link, reviews, download tabs, and comments
- 6) click on the file Android.mk to view the changes made to the source. You'll notice that green designates additions whereas red designates a deletion. You should always compare the changed files to your local source to verify that you don't already have the commit in your source tree.
- 7) Click back to return to the gerrit commit page.
- 8) under the download tabs, select the one labeled cherry-pick, and copy/paste the link it provides
- 9) enter your terminal, and CD into the repo for that cherry-pick (the project)
- 10) paste the link from the gerrit page into the terminal and run it
- 11) you have successfully completed a basic cherry-pick.
- [TUT] cherry-picking pt 2
- some cherry-picks are too complicated or come from a source that is too different for the cherry-pick to finish. You will need to manually edit the source to remove the merge markers and you will also need to correct the source/remove duplicate source.
- 1) in the event that a cherry-pick fails, it will list the files that failed in the cherry-pick and will generally insert merge markers to show you where the cherry-pick failed.
- keep track of the file names it provides you
- or from terminal type git status in the repo the cherry-pick was to be applied to
- 2) open a file browser and navigate to the folder that contains the file listed in the cherry-pick fail and open the file
- 3) search for <<< and >>> to find the merge markers. you will notice that there may be 2 copies of the same source separated by the merge markers. here is the general format of the merge markers.
- >>>
- original source that is conflicting with new
- ===
- source from cherry-pick
- >>>
- 4) from here you will need to decide what stays and what gets deleted. In more complicated cases, you will need to leave some of the code from the original source when copying the new source from the conflicting area. This depends on how your code differs from the original. A common example is when cherry-picking something that edits the strings.xml because there are a lot of changes to this file. Sometimes you will see it trying to replace huge chunks of strings that need to be there... or copy extra strings in that aren't needed. here is an example of what that may look like when trying to cherry-pick a wifi feature:
- <string name="something_for_lockscreen">Lockscreen feature</string>
- <<<
- <string name="something_for_navbar">This is for navbar</string>
- <string name="something_for_navbar">This is for navbar</string>
- <string name="something_for_navbar">This is for navbar</string>
- <string name="something_for_navbar">This is for navbar</string>
- ===
- <string name="something_for_wifi">This is for wifi</string>
- <<<
- In this example you will see that the wifi string (bottom is new) is trying to replace all of the navbar strings (source already in place). This could have happened because the wifi feature was commited and pushed to gerrit before the navbar feature was approved and submitted to the official source source.. and because the wifi commit was not rebased to accept the new changes yet. more on that later. Until you get the hang of it: if the cherry-pick is too complicated to figure out, you have a few options:
- git cherry-pick --abort (this will revert any changes made without making a new commit)
- git cherry-pick --skip (this may be useful for images that are already present but
- differ slightly)
- git cherry-pick --continue (use this after you edit a source and when it doesn't match
- the original or cherry-pick version)
- you can also git commit -a to show files that are untracked or require changes to be made.
- if your build fails, pay attention to the compiler warnings and it will probably list where you missed merge markers.
- [TUT] cherry-picking from github
- 1) to cherry-pick from github you must...
- 2) navigate to the repo in web browser and copy the SSH address for that git repo. it will look something like this: [email protected]:VanirAOSP/platform_manifest.git
- 3) find the commit you are looking for and open to view it. Make a note of what branch you are on because you will want to match the branch with your source properly (ie not making a gingerbread commit on jellybean). you will also notice a long commit number near the top.
- it will look something like this: 5d37c604b36eaee47ba8c6c49cc589d88272b5c6
- 4) open terminal and CD into the correct repo for the cherry-pick.
- 5) type the correct information in this general format:
- git fetch [email protected]:VanirAOSP/platform_manifest.git jb &&
- git cherry-pick 5d37c604b36eaee47ba8c6c49cc589d88272b5c6
- (do this as one line)
- 6) fix any necessary merge markers
Advertisement
Add Comment
Please, Sign In to add comment