Skip to contentSkip to conversation

tg-graft: forge tip--base--<deps...> history for a subcommand

PATCH In review Thomas Rast 2 participants 3 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tg-graft: forge tip--base--<deps...> history for a subcommand

Adds a command 'tg graft <command>' that evaluates <command> with a special GIT_GRAFT_FILE: the parent of each patch head is its patch base, and the parents of the patch base are the dependencies of the patch.

Try, for example, 'tg graft "gitk --all"'.

---

Mainly sending this so someone can turn it into a useful feature, and maybe build a few subcommands on top of it (that might call gitk or 'git log --graph', for example).

The one big issue with the resulting history is that the commit messages at the tip aren't very interesting and may even be completely irrelevant (for a base merge). I don't see a good solution for that.

 Makefile    |    2 +-
 tg-graft.sh |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 1 deletions(-)
 create mode 100755 tg-graft.sh
Makefile +1 -1
index 6eade1e..57745c0 100644
@@ -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-graft.sh
 hooks_in = hooks/pre-commit.sh
 
 commands_out = $(patsubst %.sh,%,$(commands_in))
tg-graft.sh new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
1.6.0.rc2.53.gfa6b9
#1 lore raw
Quoted 28 lines · Thomas Rast

Adds a command 'tg graft <command>' that evaluates <command> with a special GIT_GRAFT_FILE: the parent of each patch head is its patch base, and the parents of the patch base are the dependencies of the patch.

Try, for example, 'tg graft "gitk --all"'.

---

Mainly sending this so someone can turn it into a useful feature, and maybe build a few subcommands on top of it (that might call gitk or 'git log --graph', for example).

The one big issue with the resulting history is that the commit messages at the tip aren't very interesting and may even be completely irrelevant (for a base merge). I don't see a good solution for that.

 Makefile    |    2 +-
 tg-graft.sh |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 1 deletions(-)
 create mode 100755 tg-graft.sh
Makefile +0 -0
index 6eade1e..57745c0 100644

Makefile sharedir = $(PREFIX)/share/topgit · line 9

Quoted 5 lines
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-graft.sh

Petr, maybe we should use a wildcard here, to prevent merge conflicts while adding new commands.

I will send a patch.

Quoted 10 lines
Makefile +0 -0
 hooks_in = hooks/pre-commit.sh
 
 commands_out = $(patsubst %.sh,%,$(commands_in))
tg-graft.sh new file +1 -0
new file mode 100755
index 0000000..b6d0458
@@ -0,0 +1,47 @@
+#!/bin/sh

tg-graft.sh line 11

Quoted 10 lines
tg-graft.sh new file +10 -0
+# TopGit - A different patch queue manager
+# (c) Petr Baudis <[email protected]>  2008
+# GPLv2
+
+if [ -z "$1" -o -n "$2" ]; then
+       echo "Usage: tg graft <command>" >&2
+       exit 1
+fi
+
+mkdir -p "$git_dir"/info

This shouldn't be needed, the info dir is created by git init.

#2 lore raw

PATCH 1/1 Makefile: Use $(wildcard) for commands_in

To prevent merge conflicts while adding new commands, use a wildcard for the command list.

---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
index 6eade1e..2c4a67c 100644
@@ -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 = $(wildcard tg-*.sh)
 hooks_in = hooks/pre-commit.sh
 
 commands_out = $(patsubst %.sh,%,$(commands_in))
Signature · 1 line
tg: (f27e693..) t/use-wildcard-for-commands_in (depends on: master)