]> git.ozlabs.org Git - next-scripts/commitdiff
create branches for each bit of akpm's tree
authorStephen Rothwell <sfr@canb.auug.org.au>
Wed, 20 Mar 2013 05:01:54 +0000 (16:01 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 15 Apr 2013 03:17:19 +0000 (13:17 +1000)
import-akpm

index be33c6634f0cad62cfab099594ffa06631457c98..d206e7a60e7d6634e3d35669254d3c4a2e0e7838 100755 (executable)
@@ -14,52 +14,77 @@ execute()
        [ ${PIPESTATUS[0]} -eq 0 ] || $SHELL -i || exit 1
 }
 
-name="akpm"
 mmotm="../../mmotm/text"
 sfile="$mmotm/series"
 cpwd=$(pwd)
 
 base=$(sed -n '1s/^GIT *\([^ ]*\).*$/\1/p' "$mmotm/broken-out/origin.patch")
 nbase=$(sed -n '1s/^GIT *\([^ ]*\).*$/\1/p' "$mmotm/broken-out/linux-next.patch")
-log "Importing $name based on $base/$nbase"
 git rev-parse --verify "$base" >/dev/null || {
-       log "Unknown origin BASE"
+       log "Unknown origin BASE $base"
        exit 1
 }
 git rev-parse --verify "$nbase" >/dev/null || {
-       log "Unknown linux-next BASE"
+       log "Unknown linux-next BASE $nbase"
        exit 1
 }
+db=$(git describe "$base")
+dnb=$(git describe --contains "$nbase")
+log "Importing akpm based on $db/$dnb"
 
 [ -d "../quilt-tmp" ] ||
        execute git clone -s -l -n -q . ../quilt-tmp
 
 log '$' cd ../quilt-tmp
 cd ../quilt-tmp
-execute git reset --hard "$base"
-git branch current-base
+execute git checkout -b akpm/master "$db"
+git branch akpm/current-base
 
-sed_exp='/NEXT_PATCHES_START/,/NEXT_PATCHES_END/{s/[ \t]*#.*$//;/^[ \t]*$/!p;};/^linux-next.patch/p'
+sed_exp='
+/NEXT_PATCHES_START/,/NEXT_PATCHES_END/{
+       s/[ \t]*#.*NEXT_PATCHES_START[ \t]*\([^ \t]*\).*$/>\1/
+       s/[ \t]*#.*NEXT_PATCHES_END.*$/</
+       s/[ \t]*#.*$//
+       /^[ \t]*$/!p
+}
+/^linux-next.patch/p'
 patches=$(sed -n "$sed_exp" "$sfile")
 
 for f in $patches; do
-       [ "$f" = "origin.patch" ] && continue
-       [ "$f" = "linux-next.patch" ] && {
-               git branch current
-               execute git merge --no-edit --no-stat "$nbase"
-               git branch master-base
-               continue
-       }
-       execute git am --patch-format=mbox "$mmotm/broken-out/$f"
+       case "$f" in
+       origin.patch)
+               ;;
+       linux-next.patch)
+               git branch akpm/current
+               execute git merge --no-edit --no-stat "$dnb"
+               git branch akpm/master-base
+               ;;
+       \>*)
+               cbranch="${f#>}"
+               [ "$cbranch" ] &&
+                       cref="$(git rev-parse --verify HEAD)"
+               ;;
+       \<)
+               [ "$cbranch" ] && {
+                       [ "$cref" != "$(git rev-parse --verify HEAD)" ] &&
+                               git branch -f "akpm/$cbranch"
+                       cbranch=""
+               }
+               ;;
+       *)
+               execute git am --patch-format=mbox "$mmotm/broken-out/$f"
+               ;;
+       esac
 done
 
+[ "$cbranch" ] &&
+       [ "$cref" != "$(git rev-parse --verify HEAD)" ] &&
+               git branch -f "akpm/$cbranch"
+
 log '$' cd $cpwd
 cd $cpwd
 
-execute git fetch -f ../quilt-tmp current:"$name/current"
-execute git fetch -f ../quilt-tmp current-base:"$name/current-base"
-execute git fetch -f ../quilt-tmp master:"$name/master"
-execute git fetch -f ../quilt-tmp master-base:"$name/master-base"
+execute git fetch akpm
 
 rm -rf ../quilt-tmp