git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH TOPGIT] tg export (quilt): Implement numbering the patches

From
Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date
Dec 23, 2008, 14:32 UTC
Message-ID
<1230042744-24675-3-git-send-email-u.kleine-koenig@pengutronix.de>
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
Previous: Uwe Kleine-KönigNext: martin f krafft
Message 4 of 8 in “a few Topgit patches”
  1. Uwe Kleine-KönigDec 23, 2008
  2. tg export: implement skipping empty patches for collapse driverUwe Kleine-König, Dec 23, 2008
  3. tg export: Implement flattening patch paths for quilt modeUwe Kleine-König, Dec 23, 2008
  4. tg export (quilt): Implement numbering the patchesUwe Kleine-König, Dec 23, 2008
  5. martin f krafftDec 25, 2008
  6. Uwe Kleine-KönigDec 26, 2008
  7. Uwe Kleine-KönigJan 4, 2009
  8. martin f krafftJan 5, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.