git has all functionality for this:
git remote add
git fetch
git cherry-pick
..sorry, I'm not sure quite what to do with that...
I want to pull a patch for an alpha/beta feature that is available in OmniROM, and has also been ported to CM. I tried using the git fetch commands that are on the respective gerrit commit pages next to the "Download" title:
https://gerrit.omnirom.org/#/c/1510/
http://review.cyanogenmod.org/#/c/56080/
..but in both instances they run for abit, and then fail at ~82% recieved with an error that the remote host hung up:
[email protected]:~/android/git/omno_patch$ \
> git fetch
http://review.cyanogenmod.org/CyanogenMod/android_frameworks_base refs/changes/80/56080/2 && git format-patch -1 --stdout FETCH_HEAD
remote: Counting objects: 877185, done
remote: Finding sources: 100% (877185/877185)
fatal: The remote end hung up unexpectedly.00 GiB | 494.00 KiB/s
fatal: early EOF
fatal: index-pack failed
[email protected]:~/android/git/omno_patch$ git fetch
https://gerrit.omnirom.org/android_frameworks_base refs/changes/10/1510/14 && git format-patch -1 --stdout FETCH_HEAD
remote: Counting objects: 869728, done
remote: Finding sources: 100% (869728/869728)
fatal: The remote end hung up unexpectedly.00 GiB | 2.74 MiB/s
fatal: early EOF
fatal: index-pack failed
[email protected]:~/android/git/omno_patch$ git fetch
https://gerrit.omnirom.org/android_frameworks_base refs/changes/10/1510/14 && git cherry-pick FETCH_HEAD
remote: Counting objects: 869728, done
remote: Finding sources: 100% (869728/869728)
fatal: The remote end hung up unexpectedly.00 GiB | 3.86 MiB/s
fatal: early EOF
fatal: index-pack failed
[email protected]:~/android/git/omno_patch$
...I was running this from an initialized but empty git directory; should I be running it in my AOKP directory? Is the syntax above correct?
Also, would it be wrong of me to just hand copy/paste code into the files listed, and if I did, can I rebuild just those packages in a manner similar to the post above this one?
Thanks again.
.
.
EDIT: I think I may have found an answer to my own question about how to download a .patch file directly:
http://chem-bla-ics.blogspot.com/2011/01/github-tip-download-commits-as-patches.html
..for CM if I go to their github page, click on android_framework_base (..this is where the patch was to be applied), click on the link for latest commit, then remove the long ID number for that commit and replace it with the patch ID from the gerrit links above, followed by .patch, it gives me a patch file:
https://github.com/CyanogenMod/android_frameworks_base/commit/557222e8cdac87d60e5d318222089e6d5278c960.patch
..it looks like I could apply this .patch file from within the AOKP frameworks/base directory? Should I do this to a copy of this directory to preserve the original, or would resyncing restore the defualt files without having to re-download everything?
If I were to use the "git fetch" download method on the gerrit pages, which link (cherry-pick, patch, etc) would I use as the command, and would these also be run from the AOKP frameworks/base directory? Do I have to do anything before/after the command from the Download section of the gerrit page, or just rebuild?
Suggestions / critique of either and/or both plans is appreciated.
Thanks.
.
.
EDIT 2:
I made a copy of the target directory and ran a "dry run" patch attempt, and after replacing "cm_strings.xml" with "strings_custom.xml" (these appear to be equivilent files), the CM patch is partly successful:
### SUMMARY of FAILS ######
[email protected]:~/android/git/tmp-patch/aokp/frameworks/base$ patch -p1 -F2 --dry-run < ~/android/git/omno_patch/MultiWindow.patch |grep "out of"
1 out of 3 hunks FAILED
1 out of 1 hunk FAILED
3 out of 13 hunks FAILED
..with the
OMNI patch changed to use "strings_custom.xml", the results are a little better:
[email protected]:~/android/git/tmp-patch/aokp/frameworks/base$ patch -p1 -F2 --dry-run < ~/android/git/omno_patch/MultiWin-OMNI.patch \
|grep "out of"
1 out of 11 hunks FAILED
1 out of 4 hunks FAILED
[email protected]:~/android/git/tmp-patch/aokp/frameworks/base$ patch -p1 -F2 --dry-run < ~/android/git/omno_patch/MultiWin-OMNI.patch \
|grep -c "succeeded"
30
..It looks like this one should be easier to make "fit". ;D