git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: git@vger.kernel.org
Cc: "martin f. krafft" <madduck@debian.org>, Petr Baudis <pasky@ucw.cz>
Subject: [PATCH TOPGIT] tg export (quilt): Implement numbering the patches
Date: Tue, 23 Dec 2008 15:32:24 +0100	[thread overview]
Message-ID: <1230042744-24675-3-git-send-email-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <1230042744-24675-2-git-send-email-u.kleine-koenig@pengutronix.de>

To ease sending patches, with -n each patch gets a number prefix similar
to git format-patch.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 tg-export.sh |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/tg-export.sh b/tg-export.sh
index 06b9c8d..7a7d87a 100644
--- a/tg-export.sh
+++ b/tg-export.sh
@@ -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
 }
-- 
1.5.6.5

  reply	other threads:[~2008-12-23 14:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-23 14:30 a few Topgit patches Uwe Kleine-König
2008-12-23 14:32 ` [PATCH TOPGIT] tg export: implement skipping empty patches for collapse driver Uwe Kleine-König
2008-12-23 14:32   ` [PATCH TOPGIT] tg export: Implement flattening patch paths for quilt mode Uwe Kleine-König
2008-12-23 14:32     ` Uwe Kleine-König [this message]
2008-12-25 14:58 ` a few Topgit patches martin f krafft
2008-12-26 17:03   ` Uwe Kleine-König
2009-01-04 13:05     ` Uwe Kleine-König
2009-01-05 15:49       ` martin f krafft

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1230042744-24675-3-git-send-email-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=git@vger.kernel.org \
    --cc=madduck@debian.org \
    --cc=pasky@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).