If you are merging/cherry-picking changes frequently between GIT branches it's very useful to know exactly what changes were already merged, what changes are waiting for merge and for wchich change there will be a conflict during merge.
This information should be available from "git log", but unfortunately I dif not get good results (even with --cherry-pick). Then some other solution must be prepared.
I decided to create a small script that will perform series of cherry-picks and prepare a report that shows integration status. Usage is pretty simple:
$ git-merge-status SHA1..SHA2
Note that due to internal GIT commit storage source branch selection is not necessary because pair of commit IDs will point exactly the codebase. Sample run:
$ git-merge-status 32e5886..568f4c0 + 32e5886 Dariusz Cieslak Version upgraded to 0.17 . e54772d T* S* (#2101) Preload two pages when switching pages . ea76457 R* S* Implement trickplay icon (#2050) . bb18d64 R* S* Force trickplay icon update (#2050) . f45efab R* S* Fix zapbanner hours played (#2159) . 73411c4 R* S* Inherit parent's VOD skin . 7446a00 D* S* red light on front display while recording (#1502) (cherry picked from commit 6e049cc2f81947621b17105869e312b559164ce9) . 983d4cc D* S* pvrservice: fromdos (only formatting!) (#2183) (cherry picked from commit db6de56171a90a9bd8eed681f4db7177819611a3) . 37ed65f A* R. C* (#1711) TSTVEnableDelay key in system.properties (cherry picked from commit c094431ac17fc910a55163b8680c8fb81913dad5) . 139f4a0 R* S* Display all movie icons in zapbanner . 5230758 R* S* Fix VOD movie length display (#2139) C b80a5fb Dariusz Cieslak Appman scripts placed in mw/config/etc/... (#1629) . 1c8ff68 D* M* (#2186) Fixed qt signals in PLTVHelper (...) already merged (.): 49 to be merged (+): 13 conflict during merge(C): 26
Script body:
#!/bin/sh git log --pretty=format:"%h %cn %s" --reverse $* | awk ' BEGIN { system("git reset --hard >/dev/null 2>&1") CMD="git log --decorate --pretty=oneline --abbrev-commit" while (CMD | getline result > 0) { history[substr(result, 0, 7)] = 1 if (result ~ /cherry picked from commit/) { CL2 = $0 sub(/.*commit /, "", CL2) CL2 = substr(CL2, 0, 7) if (CL2 in history) { revhistory[CL2] = 1 } } } close(CMD) } { CID=$0 gsub(/"/, " ", CID) CL=$3 if (CL in revhistory) { # already merged in opposite direction print ". " CID PREVIOUSLY_MERGED ++ next } if (/cherry picked from commit/) { CL2 = $0 sub(/.*commit /, "", CL2) CL2 = substr(CL2, 0, 7) if (CL2 in history) { print ". " CID PREVIOUSLY_MERGED ++ next } } CMD="git cherry-pick -x " $1 " 2>&1" buf = "" while (CMD | getline result > 0) { buf = buf result } close(CMD) if (buf ~ /files changed/) { # Just merged print "+ " CID JUST_MERGED ++ } else if (buf ~ /Automatic cherry-pick failed/) { # Conflict, skip print "C " CID system("git reset --hard >/dev/null 2>&1") CONFLICT ++ } else { # Already merged print ". " CID PREVIOUSLY_MERGED ++ } } END { print "" print "already merged (.): " PREVIOUSLY_MERGED print "to be merged (+): " JUST_MERGED print "conflict during merge(C): " CONFLICT } '