a few Topgit patches
Hello,
I hacked using topgit for some time now, and found the following changes to topgit useful:
Uwe Kleine-König (3):
tg export: implement skipping empty patches for collapse driver tg export: Implement flattening patch paths for quilt mode tg export (quilt): Implement numbering the patches
README | 1 - tg-export.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 9 deletions(-)
You can fetch or pull these from
git://git.pengutronix.de/git/ukl/topgit.git master
or browse them using the following URL:
http://git.pengutronix.de/?p=ukl/topgit.git
For review I send the patches as a reply to this mail.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 1/1 tg export: implement skipping empty patches for collapse driver
--- README | 1 - tg-export.sh | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-)
README +0 -1
@@ -414,7 +414,6 @@ tg export TODO: Make stripping of non-essential headers configurable TODO: Make stripping of [PATCH] and other prefixes configurable TODO: --mbox option for other mode of operation - TODO: prevent exporting of empty patches by the collapse driver TODO: -a option to export all branches TODO: For quilt exporting, use a temporary branch and remove it when done - this would allow producing conflict-less series
tg-export.sh +7 -3
@@ -91,9 +91,13 @@ collapsed_commit() $(for p in $parent; do echo -p $p; done))" fi - (printf '%s\n\n' "$SUBJECT"; cat "$playground/^msg") | - git stripspace | - git commit-tree "$(pretty_tree "$name")" -p "$parent" + if branch_empty "$name"; then + echo "$parent"; + else + (printf '%s\n\n' "$SUBJECT"; cat "$playground/^msg") | + git stripspace | + git commit-tree "$(pretty_tree "$name")" -p "$parent" + fi; echo "$name" >>"$playground/^ticker" }
Signature · 1 line
1.5.6.5
PATCH 1/1 tg export: Implement flattening patch paths for quilt mode
The result of providing the new flag -f is that the exported patches are all placed directly in the output directory, not in subdirectories.
--- tg-export.sh | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-)
tg-export.sh +20 -3
@@ -7,6 +7,7 @@ name= branches= output= driver=collapse +flatten=false ## Parse options
@@ -16,6 +17,8 @@ while [ -n "$1" ]; do case "$arg" in -b) branches="$1"; shift;; + -f) + flatten=true;; --quilt) driver=quilt;; --collapse)
@@ -34,6 +37,9 @@ done [ -z "$branches" -o "$driver" = "quilt" ] || die "-b works only with the quilt driver" +[ "$driver" = "quilt" ] || ! "$flatten" || + die "-f works only with the quilt driver" + if [ -z "$branches" ]; then # this check is only needed when no branches have been passed name="$(git symbolic-ref HEAD | sed 's#^refs/heads/##')"
@@ -138,7 +144,18 @@ quilt() return fi - filename="$output/$_dep.diff" + if "$flatten"; then + bn="$(echo "$_dep.diff" | sed -e 's#_#__#g' -e 's#/#_#g')"; + dn=""; + else + bn="$(basename "$_dep.diff")"; + dn="$(dirname "$_dep.diff")/"; + if [ "x$dn" = "x./" ]; then + dn=""; + fi; + fi; + + filename="$output/$dn$bn"; if [ -e "$filename" ]; then # We've already seen this dep return
@@ -148,9 +165,9 @@ quilt() echo "Skip empty patch $_dep"; else echo "Exporting $_dep" - mkdir -p "$(dirname "$filename")" + mkdir -p "$output/$dn"; $tg patch "$_dep" >"$filename" - echo "$_dep.diff -p1" >>"$output/series" + echo "$dn$bn -p1" >>"$output/series" fi }
Signature · 1 line
1.5.6.5
PATCH 1/1 tg export (quilt): Implement numbering the patches
To ease sending patches, with -n each patch gets a number prefix similar to git format-patch.
--- tg-export.sh | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-)
tg-export.sh +18 -3
@@ -8,6 +8,7 @@ branches= output= driver=collapse flatten=false +numbered=false ## Parse options
@@ -19,6 +20,9 @@ while [ -n "$1" ]; do branches="$1"; shift;; -f) flatten=true;; + -n) + flatten=true; + numbered=true;; --quilt) driver=quilt;; --collapse)
@@ -37,6 +41,9 @@ done [ -z "$branches" -o "$driver" = "quilt" ] || die "-b works only with the quilt driver" +[ "$driver" = "quilt" ] || ! "$numbered" || + die "-n works only with the quilt driver"; + [ "$driver" = "quilt" ] || ! "$flatten" || die "-f works only with the quilt driver"
@@ -155,18 +162,26 @@ quilt() fi; fi; - filename="$output/$dn$bn"; - if [ -e "$filename" ]; then + if [ -e "$playground/$_dep" ]; then # We've already seen this dep return fi + mkdir -p "$playground/$(dirname "$_dep")"; + touch "$playground/$_dep"; + if branch_empty "$_dep"; then echo "Skip empty patch $_dep"; else + if "$numbered"; then + number="$(printf "%04u" $(($(cat "$playground/^number" 2>/dev/null) + 1)))"; + bn="$number-$bn"; + echo "$number" >"$playground/^number"; + fi; + echo "Exporting $_dep" mkdir -p "$output/$dn"; - $tg patch "$_dep" >"$filename" + $tg patch "$_dep" >"$output/$dn$bn" echo "$dn$bn -p1" >>"$output/series" fi }
Signature · 1 line
1.5.6.5
also sprach Uwe Kleine-König <[email protected]> [2008.12.23.1530 +0100]:
Quoted 7 lines
I hacked using topgit for some time now, and found the following changes to topgit useful:
Uwe Kleine-König (3):
tg export: implement skipping empty patches for collapse driver tg export: Implement flattening patch paths for quilt mode tg export (quilt): Implement numbering the patches
They all look good. I am a bit concerned about the use of single-letter options at this stage. tg-export is bound to grow, and using them all up now might mean breaking compatibility later, when a more common option needs e.g. -f, which has already been taken.
Signature · 10 lines
.''`. martin f. krafft <[email protected]> Related projects: : :' : proud Debian developer http://debiansystem.info `. `'` http://people.debian.org/~madduck http://vcs-pkg.org `- Debian - when you have better things to do than fixing systems "oh what a tangled web we weave, when first we practice to deceive. but my how we improve the score, as we practice more and more." -- sir walter scott
Hi martin,
Quoted 9 lines · martin f krafft
also sprach Uwe Kleine-König <[email protected]> [2008.12.23.1530 +0100]:
Quoted 7 lines
I hacked using topgit for some time now, and found the following changes to topgit useful:
Uwe Kleine-König (3):
tg export: implement skipping empty patches for collapse driver tg export: Implement flattening patch paths for quilt mode tg export (quilt): Implement numbering the patches
Quoted 4 lines
They all look good. I am a bit concerned about the use of single-letter options at this stage. tg-export is bound to grow, and using them all up now might mean breaking compatibility later, when a more common option needs e.g. -f, which has already been taken.
I updated my tree to make '-f' '--flatten'. IMHO -n is nice for getting numbered patches, but if you prefer, I will make this --numbered.
Oh, and I just noticed that documentation is missing. I will fix this when I sent this mail.
Best regards
Uwe
Signature · 4 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Strasse 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Hi martin,
Quoted 14 lines · Uwe Kleine-König
Quoted 9 lines · martin f krafft
also sprach Uwe Kleine-König <[email protected]> [2008.12.23.1530 +0100]:
Quoted 7 lines
I hacked using topgit for some time now, and found the following changes to topgit useful:
Uwe Kleine-König (3):
tg export: implement skipping empty patches for collapse driver tg export: Implement flattening patch paths for quilt mode tg export (quilt): Implement numbering the patchesQuoted 4 lines
They all look good. I am a bit concerned about the use of single-letter options at this stage. tg-export is bound to grow, and using them all up now might mean breaking compatibility later, when a more common option needs e.g. -f, which has already been taken.
Quoted 5 lines
I updated my tree to make '-f' '--flatten'. IMHO -n is nice for getting numbered patches, but if you prefer, I will make this --numbered.
Oh, and I just noticed that documentation is missing. I will fix this when I sent this mail.
This is done. Now I even changed '-n' to '--numbered' and changed the commit log accordingly. Are there still concerns about my patches? Should I resend the current version?
The patches are still available in my topgit repo at
git://git.pengutronix.de/git/ukl/topgit.git master
Best regards
Uwe
Signature · 4 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Strasse 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
also sprach Uwe Kleine-König <[email protected]> [2009.01.04.1405 +0100]:
Quoted 7 lines
This is done. Now I even changed '-n' to '--numbered' and changed the commit log accordingly. Are there still concerns about my patches? Should I resend the current version?
The patches are still available in my topgit repo at
git://git.pengutronix.de/git/ukl/topgit.gitmaster
I pulled and pushed them. Thanks.
Signature · 9 lines
.''`. martin f. krafft <[email protected]> Related projects: : :' : proud Debian developer http://debiansystem.info `. `'` http://people.debian.org/~madduck http://vcs-pkg.org `- Debian - when you have better things to do than fixing systems sed -e '/^[when][coders]/!d' \ -e '/^...[discover].$/d' \ -e '/^..[real].[code]$/!d' \ /usr/share/dict/words