(unknown)
From: Aneesh Kumar K.V <[email protected]>
topgit: Implement tg-import
This can be used to import a set of commits between range specified by range1..range2 This should help us to convert an already existing quilt, stgit branches to topgit managed one
Signed-off-by Aneesh Kumar K.V <[email protected]>
--- Makefile | 2 +- README | 7 ++++++ tg-create.sh | 22 ++++++++---------- tg-export.sh | 2 +- tg-import.sh | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 87 insertions(+), 14 deletions(-)
Makefile +1 -1
@@ -6,7 +6,7 @@ sharedir = $(PREFIX)/share/topgit hooksdir = $(cmddir)/hooks -commands_in = tg-create.sh tg-delete.sh tg-export.sh tg-info.sh tg-patch.sh tg-summary.sh tg-update.sh +commands_in = tg-create.sh tg-delete.sh tg-export.sh tg-info.sh tg-patch.sh tg-summary.sh tg-update.sh tg-import.sh hooks_in = hooks/pre-commit.sh commands_out = $(patsubst %.sh,%,$(commands_in))
README +7 -0
@@ -330,6 +330,13 @@ tg export TODO: Make stripping of [PATCH] and other prefixes configurable TODO: --mbox option for other mode of operation +tg import +~~~~~~~~ + Import the commits between the given revision range into + a topgit managed branch + + Usage: tg import rev1..rev2 + tg update ~~~~~~~~~ Update the current topic branch wrt. changes in the branches
tg-create.sh +10 -12
@@ -31,17 +31,18 @@ done deps="${deps# }" if [ -z "$deps" ]; then - if [ -z "$name" -a -s "$git_dir/top-name" -a -s "$git_dir/top-deps" -a -s "$git_dir/top-merge" ]; then - # We are setting up the base branch now; resume merge! - name="$(cat "$git_dir/top-name")" + head="$(git symbolic-ref HEAD)" + bname="${head#refs/top-bases/}" + if [ "$bname" != "$head" -a -s "$git_dir/top-deps" -a -s "$git_dir/top-merge" ]; then + # We are on a base branch now; resume merge! deps="$(cat "$git_dir/top-deps")" merge="$(cat "$git_dir/top-merge")" + name="$bname" restarted=1 info "Resuming $name setup..." else # The common case [ -z "$name" ] && die "no branch name given" - head="$(git symbolic-ref HEAD)" deps="${head#refs/heads/}" [ "$deps" != "$head" ] || die "refusing to auto-depend on non-head ref ($head)" info "Automatically marking dependency on $deps"
@@ -58,7 +59,7 @@ done die "branch '$name' already exists" # Clean up any stale stuff -rm -f "$git_dir/top-name" "$git_dir/top-deps" "$git_dir/top-merge" +rm -f "$git_dir/top-deps" "$git_dir/top-merge" ## Create base
@@ -68,8 +69,7 @@ if [ -n "$merge" ]; then branch="${merge%% *}" merge="${merge#* }" info "Creating $name base from $branch..." - # We create a detached head so that we can abort this operation - git checkout -q "$(git rev-parse "$branch")" + switch_to_base "$name" "$branch" fi
@@ -83,10 +83,9 @@ while [ -n "$merge" ]; do if ! git merge "$branch"; then info "Please commit merge resolution and call: tg create" - info "It is also safe to abort this operation using:" - info "git reset --hard some_branch" - info "(You are on a detached HEAD now.)" - echo "$name" >"$git_dir/top-name" + info "It is also safe to abort this operation using \`git reset --hard\`" + info "but please remember you are on the base branch now;" + info "you will want to switch to a different branch." echo "$deps" >"$git_dir/top-deps" echo "$merge" >"$git_dir/top-merge" exit 2
@@ -96,7 +95,6 @@ done ## Set up the topic branch -git update-ref "refs/top-bases/$name" "HEAD" "" git checkout -b "$name" echo "$deps" | sed 's/ /\n/g' >"$root_dir/.topdeps"
tg-export.sh +1 -1
@@ -190,7 +190,7 @@ recurse_deps driver "$name" if [ "$driver" = "collapse" ]; then - git update-ref "refs/heads/$output" "$(cat "$playground/$name")" "" + git update-ref "refs/heads/$output" "$(cat "$playground/$name")" depcount="$(cat "$playground/^ticker" | wc -l)" echo "Exported topic branch $name (total $depcount topics) to branch $output"
tg-import.sh new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
tg: (f27e693..) tp/topgit-Implement-tg-import (depends on: master)
Re: your mail
Quoted 12 lines · On Wed, Aug 13, 2008 at 08:24:28PM +0530, [email protected] wrote:
From: Aneesh Kumar K.V <[email protected]>
topgit: Implement tg-import
This can be used to import a set of commits between range specified by range1..range2 This should help us to convert an already existing quilt, stgit branches to topgit managed one
Signed-off-by Aneesh Kumar K.V <[email protected]>
Quoted 8 lines
--- Makefile | 2 +- README | 7 ++++++ tg-create.sh | 22 ++++++++---------- tg-export.sh | 2 +- tg-import.sh | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 87 insertions(+), 14 deletions(-)
tg-create.sh and tg-export.sh should not be part of this patch. I will send a new version.
-aneesh