Anthony <
m.b...@gmail.com> wrote:
> I was thinking that it could just create a temporary branch like
> TMP_CHANGE_$id, fetch into it, cherry-pick, rebase, and upload --
> replace. The only other remaining difficulty is telling repo where to
> put it. Is there any clean way to do that part without modifying repo
> or using expect?
There isn't a way to know which branch the change is meant for
without looking at the web interface, or doing a JSON-RPC request
to get the change data. So the best you can do is guess, or have
the user give the name to you as an argument.
> # this is a bit hacky too...but easier than getting an ini parser in
> bash
> server=`cat .git/config | grep url | sed -e 's/.*ssh:\/\///' | sed -e
> 's/\/.*//'`
Yuck. Next time use git config and its many options.
> path=`pwd | sed -e 's#$ANDROID_BUILD_TOP/##'`
Oh, I see. You use this only to form the URL later. Don't.
> branch="TMP_CHANGE_$1"
> git branch -D $branch 2>/dev/null
> repo start $branch
>
> git fetch ssh://$server/$path $ref
> git fetch FETCH_HEAD
> git rebase m/<need something generic here .. maybe grab it out of
> manifest.xml>
> repo upload --replace .
Yuck. This might be a bit cleaner, since it also makes use of
the manifest metadata like repo would:
remote=`repo forall . -c echo \$REPO_REMOTE`
branch=`repo forall . -c echo \$REPO_RREV`
rebase=`repo forall . -c echo \$REPO_LREV`
git fetch $remote $ref
git checkout $rebase
git cherry-pick FETCH_HEAD
git push $remote HEAD:refs/for/$branch