From c6d8622c527ab58018928c617d03f747cef9a70b Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Wed, 7 Nov 2007 18:40:27 +0100 Subject: Completed rename to git-rebase-subtree --- Makefile.am | 2 +- NEWS | 2 +- configure.ac | 6 +- git-follow/Makefile-files | 13 --- git-follow/generate-patches.sh | 45 ---------- git-follow/git-rebase-subtree.in | 118 --------------------------- git-follow/git-rebase-subtree.man.in | 53 ------------ git-follow/rebase-all.sh | 16 ---- git-follow/upload-patches.sh | 7 -- git-rebase-subtree/Makefile-files | 13 +++ git-rebase-subtree/generate-patches.sh | 45 ++++++++++ git-rebase-subtree/git-rebase-subtree.in | 118 +++++++++++++++++++++++++++ git-rebase-subtree/git-rebase-subtree.man.in | 53 ++++++++++++ git-rebase-subtree/rebase-all.sh | 16 ++++ git-rebase-subtree/upload-patches.sh | 7 ++ 15 files changed, 257 insertions(+), 257 deletions(-) delete mode 100644 git-follow/Makefile-files delete mode 100644 git-follow/generate-patches.sh delete mode 100644 git-follow/git-rebase-subtree.in delete mode 100644 git-follow/git-rebase-subtree.man.in delete mode 100644 git-follow/rebase-all.sh delete mode 100644 git-follow/upload-patches.sh create mode 100644 git-rebase-subtree/Makefile-files create mode 100644 git-rebase-subtree/generate-patches.sh create mode 100644 git-rebase-subtree/git-rebase-subtree.in create mode 100644 git-rebase-subtree/git-rebase-subtree.man.in create mode 100644 git-rebase-subtree/rebase-all.sh create mode 100644 git-rebase-subtree/upload-patches.sh diff --git a/Makefile.am b/Makefile.am index 46f5ae9..8d31b0e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,7 +17,7 @@ include doc/Makefile-files include git-ndim-sh/Makefile-files include git-amb/Makefile-files include git-buildmsg/Makefile-files -include git-follow/Makefile-files +include git-rebase-subtree/Makefile-files if HAVE_NDIM_MAN2TXT .man.txt: diff --git a/NEWS b/NEWS index 2b14801..aa78576 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -ndim-git-utils 1.14.2 +ndim-git-utils 1.14.3 ndim-git-utils 1.14 diff --git a/configure.ac b/configure.ac index e9efe8d..e04298b 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ(2.61) AC_INIT([ndims git utilities], - [1.14.2], + [1.14.3], [hun@n-dimensional.de], [ndim-git-utils]) AC_CONFIG_AUX_DIR([auto-aux]) @@ -26,8 +26,8 @@ AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([git-amb/git-amb.man]) AC_CONFIG_FILES([git-amb/git-amb]) AC_CONFIG_FILES([git-buildmsg/git-buildmsg]) -AC_CONFIG_FILES([git-follow/git-follow]) -AC_CONFIG_FILES([git-follow/git-rebase-subtree.man]) +AC_CONFIG_FILES([git-rebase-subtree/git-rebase-subtree]) +AC_CONFIG_FILES([git-rebase-subtree/git-rebase-subtree.man]) AC_CONFIG_FILES([git-ndim-sh/git-ndim-sh]) AC_OUTPUT diff --git a/git-follow/Makefile-files b/git-follow/Makefile-files deleted file mode 100644 index 920db0e..0000000 --- a/git-follow/Makefile-files +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- -bin_SCRIPTS += git-rebase-subtree/git-follow -EXTRA_DIST += git-rebase-subtree/git-rebase-subtree.in -UPLOAD_FILES += git-rebase-subtree/git-rebase-subtree - -man1_MANS += git-rebase-subtree/git-rebase-subtree.man -EXTRA_DIST += git-rebase-subtree/git-rebase-subtree.man.in - -if HAVE_NDIM_MAN2TXT -dist_doc_DATA += git-rebase-subtree/git-rebase-subtree.txt -CLEANFILES += git-rebase-subtree/git-rebase-subtree.txt -UPLOAD_FILES += git-rebase-subtree/git-rebase-subtree.txt -endif diff --git a/git-follow/generate-patches.sh b/git-follow/generate-patches.sh deleted file mode 100644 index bf2c17a..0000000 --- a/git-follow/generate-patches.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -set -x - -repourl="http://radeonhd.lauft.net/xf86-video-radeonhd.git/" -sedhtml="s/&/\&/g; s/@/\@/g; s//\>/g;" - -rm -f "patches/"*/[0-9][0-9][0-9][0-9]-*.patch -rmdir "patches/"* - -while read start from to dir restofline -do - if echo "$start" | grep '^#' > /dev/null; then continue; fi - git format-patch -o "patches/$dir" --start-number "$start" "$from".."$to" - if test "x$to" = "x$dir"; then - { - echo "

${to} branch

" - echo "

git pull ${repourl} ${to}

" - } > "patches/$dir/HEADER.html" - echo "IndexIgnore .." > "patches/$dir/.htaccess" - { - sedcmds="" - for f in "patches/$dir/"[0-9]*.patch; do - b="$(basename "$f")" - commit="$(sed -n '1s/^From \([a-z0-9]\{1,\}\).*/\1/p' "$f")" - sedcmds="${sedcmds} s|\(${commit}\)|\1|;" - echo "AddDescription \"$(sed -n 's|^Subject: [PATCH[^\]*] \(.*\)|\1|p' "$f" | sed "${sedhtml}")\" ${b}" >> "patches/$dir/.htaccess" - done - echo "$commits" - echo "
"
-		git log --stat "${from}..${to}" | sed "${sedhtml}${sedcmds}"
-		echo "
" - } > "patches/$dir/README.html" - fi -done<" "$@" - gitk --all - "$@" -} - - -gf_init() { - echo "$self: Examining configuration" - git config follow.tree | while read from to restofline; do - if test "x#" = "x$(echo "$from" | sed -n '1s/^\(.\).*/\1/p')"; then continue; fi - echo "" - echo " From: $from" - echo " To: $to" - done -} - -gf_branch() { - branch="$1" - newbranch="follow-old/$branch" - if git-rev-parse --verify "$branch" > /dev/null 2>&1; then - # valid branch - if git-rev-parse --verify "$newbranch" > /dev/null 2>&1; then - : # branch already exists, do nothing - else - cmd git-branch "${newbranch}" "${branch}" - fi - else - echo "$self: gf_branch called with invalid branch \"$branch\"" >&2 - exit 1 - fi -} - - -gf_rmbranch() { - branch="$1" - newbranch="follow-old/$branch" - if git-rev-parse --verify "$branch" > /dev/null 2>&1; then - if git-rev-parse --verify "$newbranch" > /dev/null 2>&1; then - cmd git-branch -D "${newbranch}" - fi - fi -} - - -gf_rebase_tree() { - newroot="$1" - test "x$newroot" = "x" && die "Need parameter" - oldroot="$2" - test "x$oldroot" = "x" && die "Need parameter" - echo - echo "$self: Preparing subtree rebase" - git config follow.tree | while read from to restofline; do - if test "x#" = "x$(echo "$from" | sed -n '1s/^\(.\).*/\1/p')"; then continue; fi - gf_branch "$from" - gf_branch "$to" - done - gitk --all - echo - echo "$self: Executing subtree rebase" - git config follow.tree | while read from to restofline; do - if test "x#" = "x$(echo "$from" | sed -n '1s/^\(.\).*/\1/p')"; then continue; fi - cmd git-rebase --onto "$from" "follow-old/$from" "$to" - done - gitk --all - echo - echo "$self: Cleaning up after subtree rebase" - git config follow.tree | while read from to restofline; do - if test "x#" = "x$(echo "$from" | sed -n '1s/^\(.\).*/\1/p')"; then continue; fi - gf_rmbranch "$from" - gf_rmbranch "$to" - done - gitk --all -} - - -# The great command case -command="$1" -if shift; then - case "$command" in - rebase-subtree) - gf_init - gf_rebase_tree "$@" - ;; - *) - die "Invalid command line parameter: \"$command\"" - ;; - esac -else - gf_init -fi - -# End of file. diff --git a/git-follow/git-rebase-subtree.man.in b/git-follow/git-rebase-subtree.man.in deleted file mode 100644 index 9f51432..0000000 --- a/git-follow/git-rebase-subtree.man.in +++ /dev/null @@ -1,53 +0,0 @@ -.TH GIT-REBASE-SUBTREE 1 "@PACKAGE_TARNAME@ @PACKAGE_VERSION@" "2007\-11\-02" "@PACKAGE_NAME@ @PACKAGE_VERSION@" -.SH NAME -git\-rebase\-subtree \- rebase set of interdependant git branches -.SH SYNOPSIS -.B "git\-rebase\-subtree" -.I "" -.I "" -.SH DESCRIPTION -So you are tracking some upstream's git repo and maintain your own set -of interdependent feature branches ("branch subtree"). -.PP -And you want to keep that "branch subtree" up-to-date in relation to -upstream so it stays sweet, small, and clean, increasing the chances -that upstream will finally pick something up from it. -.PP -Initial situation: Local branch master tracks remote origin. -.PP -Note: Letters A\-Z are branch names, not revs. -.PP -Old tree: -.nf - *\-\-F - / - origin=master\-\-A\-\-B\-\-G - \\ - *\-\-D\-\-H - \\ - *\-\-*\-\-K -.fi -.PP -After "git\-fetch \-v": -.nf - *\-\-F - / - master\-\-\-A\-\-B\-\-G - \\ \\ - * *\-\-D\-\-H - \\ \\ - origin' *\-\-*\-\-K -.fi -.PP -After hypothetical "git\-rebase\-subtree origin master": -.nf - *'\-\-F' - / - origin'=master'\-\-A'\-\-B'\-\-G' - \\ - *'\-\-D'\-\-H' - \\ - *'\-\-*'\-\-K' -.fi -.SH "SEE ALSO" -git\-rebase(1). diff --git a/git-follow/rebase-all.sh b/git-follow/rebase-all.sh deleted file mode 100644 index 02676c7..0000000 --- a/git-follow/rebase-all.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -set -x -while read branch base restofline -do - git rebase "$base" "$branch" || exit "$?" -done< /dev/null; then continue; fi + git format-patch -o "patches/$dir" --start-number "$start" "$from".."$to" + if test "x$to" = "x$dir"; then + { + echo "

${to} branch

" + echo "

git pull ${repourl} ${to}

" + } > "patches/$dir/HEADER.html" + echo "IndexIgnore .." > "patches/$dir/.htaccess" + { + sedcmds="" + for f in "patches/$dir/"[0-9]*.patch; do + b="$(basename "$f")" + commit="$(sed -n '1s/^From \([a-z0-9]\{1,\}\).*/\1/p' "$f")" + sedcmds="${sedcmds} s|\(${commit}\)|\1|;" + echo "AddDescription \"$(sed -n 's|^Subject: [PATCH[^\]*] \(.*\)|\1|p' "$f" | sed "${sedhtml}")\" ${b}" >> "patches/$dir/.htaccess" + done + echo "$commits" + echo "
"
+		git log --stat "${from}..${to}" | sed "${sedhtml}${sedcmds}"
+		echo "
" + } > "patches/$dir/README.html" + fi +done<" "$@" + gitk --all + "$@" +} + + +gf_init() { + echo "$self: Examining configuration" + git config follow.tree | while read from to restofline; do + if test "x#" = "x$(echo "$from" | sed -n '1s/^\(.\).*/\1/p')"; then continue; fi + echo "" + echo " From: $from" + echo " To: $to" + done +} + +gf_branch() { + branch="$1" + newbranch="follow-old/$branch" + if git-rev-parse --verify "$branch" > /dev/null 2>&1; then + # valid branch + if git-rev-parse --verify "$newbranch" > /dev/null 2>&1; then + : # branch already exists, do nothing + else + cmd git-branch "${newbranch}" "${branch}" + fi + else + echo "$self: gf_branch called with invalid branch \"$branch\"" >&2 + exit 1 + fi +} + + +gf_rmbranch() { + branch="$1" + newbranch="follow-old/$branch" + if git-rev-parse --verify "$branch" > /dev/null 2>&1; then + if git-rev-parse --verify "$newbranch" > /dev/null 2>&1; then + cmd git-branch -D "${newbranch}" + fi + fi +} + + +gf_rebase_tree() { + newroot="$1" + test "x$newroot" = "x" && die "Need parameter" + oldroot="$2" + test "x$oldroot" = "x" && die "Need parameter" + echo + echo "$self: Preparing subtree rebase" + git config follow.tree | while read from to restofline; do + if test "x#" = "x$(echo "$from" | sed -n '1s/^\(.\).*/\1/p')"; then continue; fi + gf_branch "$from" + gf_branch "$to" + done + gitk --all + echo + echo "$self: Executing subtree rebase" + git config follow.tree | while read from to restofline; do + if test "x#" = "x$(echo "$from" | sed -n '1s/^\(.\).*/\1/p')"; then continue; fi + cmd git-rebase --onto "$from" "follow-old/$from" "$to" + done + gitk --all + echo + echo "$self: Cleaning up after subtree rebase" + git config follow.tree | while read from to restofline; do + if test "x#" = "x$(echo "$from" | sed -n '1s/^\(.\).*/\1/p')"; then continue; fi + gf_rmbranch "$from" + gf_rmbranch "$to" + done + gitk --all +} + + +# The great command case +command="$1" +if shift; then + case "$command" in + rebase-subtree) + gf_init + gf_rebase_tree "$@" + ;; + *) + die "Invalid command line parameter: \"$command\"" + ;; + esac +else + gf_init +fi + +# End of file. diff --git a/git-rebase-subtree/git-rebase-subtree.man.in b/git-rebase-subtree/git-rebase-subtree.man.in new file mode 100644 index 0000000..9f51432 --- /dev/null +++ b/git-rebase-subtree/git-rebase-subtree.man.in @@ -0,0 +1,53 @@ +.TH GIT-REBASE-SUBTREE 1 "@PACKAGE_TARNAME@ @PACKAGE_VERSION@" "2007\-11\-02" "@PACKAGE_NAME@ @PACKAGE_VERSION@" +.SH NAME +git\-rebase\-subtree \- rebase set of interdependant git branches +.SH SYNOPSIS +.B "git\-rebase\-subtree" +.I "" +.I "" +.SH DESCRIPTION +So you are tracking some upstream's git repo and maintain your own set +of interdependent feature branches ("branch subtree"). +.PP +And you want to keep that "branch subtree" up-to-date in relation to +upstream so it stays sweet, small, and clean, increasing the chances +that upstream will finally pick something up from it. +.PP +Initial situation: Local branch master tracks remote origin. +.PP +Note: Letters A\-Z are branch names, not revs. +.PP +Old tree: +.nf + *\-\-F + / + origin=master\-\-A\-\-B\-\-G + \\ + *\-\-D\-\-H + \\ + *\-\-*\-\-K +.fi +.PP +After "git\-fetch \-v": +.nf + *\-\-F + / + master\-\-\-A\-\-B\-\-G + \\ \\ + * *\-\-D\-\-H + \\ \\ + origin' *\-\-*\-\-K +.fi +.PP +After hypothetical "git\-rebase\-subtree origin master": +.nf + *'\-\-F' + / + origin'=master'\-\-A'\-\-B'\-\-G' + \\ + *'\-\-D'\-\-H' + \\ + *'\-\-*'\-\-K' +.fi +.SH "SEE ALSO" +git\-rebase(1). diff --git a/git-rebase-subtree/rebase-all.sh b/git-rebase-subtree/rebase-all.sh new file mode 100644 index 0000000..02676c7 --- /dev/null +++ b/git-rebase-subtree/rebase-all.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +set -x +while read branch base restofline +do + git rebase "$base" "$branch" || exit "$?" +done<