From 797dc152f1885e9eee2c8826a491a52ef2f61699 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Wed, 7 Nov 2007 18:35:37 +0100 Subject: Rename, part II --- git-follow/Makefile-files | 16 +++--- git-follow/git-follow.in | 118 --------------------------------------- git-follow/git-rebase-subtree.in | 118 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+), 126 deletions(-) delete mode 100644 git-follow/git-follow.in create mode 100644 git-follow/git-rebase-subtree.in diff --git a/git-follow/Makefile-files b/git-follow/Makefile-files index 8290654..920db0e 100644 --- a/git-follow/Makefile-files +++ b/git-follow/Makefile-files @@ -1,13 +1,13 @@ # -*- makefile -*- -bin_SCRIPTS += git-follow/git-follow -EXTRA_DIST += git-follow/git-follow.in -UPLOAD_FILES += git-follow/git-follow +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-follow/git-rebase-subtree.man -EXTRA_DIST += git-follow/git-rebase-subtree.man.in +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-follow/git-rebase-subtree.txt -CLEANFILES += git-follow/git-rebase-subtree.txt -UPLOAD_FILES += git-follow/git-rebase-subtree.txt +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/git-follow.in b/git-follow/git-follow.in deleted file mode 100644 index d2422ab..0000000 --- a/git-follow/git-follow.in +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/sh -# - -unset CDPATH -SED="${SED-sed}" - -self=`basename "$0"` -selfdir=`dirname "$0"` -selfdir=`cd "$selfdir" && pwd` -. "$selfdir/git-ndim-sh" - -SUBDIRECTORY_OK="yes" -USAGE=" [params...]" - -LONG_USAGE="\ -Let a local subtree of branches follow a remote origin without too much merging. -For more details, see the ${self}(1) man page." -. git-sh-setup - -require_work_tree - -# Abort on error -set -e - - -cmd() { - echo "CMD>" "$@" - 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.in b/git-follow/git-rebase-subtree.in new file mode 100644 index 0000000..d2422ab --- /dev/null +++ b/git-follow/git-rebase-subtree.in @@ -0,0 +1,118 @@ +#!/bin/sh +# + +unset CDPATH +SED="${SED-sed}" + +self=`basename "$0"` +selfdir=`dirname "$0"` +selfdir=`cd "$selfdir" && pwd` +. "$selfdir/git-ndim-sh" + +SUBDIRECTORY_OK="yes" +USAGE=" [params...]" + +LONG_USAGE="\ +Let a local subtree of branches follow a remote origin without too much merging. +For more details, see the ${self}(1) man page." +. git-sh-setup + +require_work_tree + +# Abort on error +set -e + + +cmd() { + echo "CMD>" "$@" + 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. -- cgit