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: Implement flattening patch paths for quilt mode
Date: Tue, 23 Dec 2008 15:32:23 +0100	[thread overview]
Message-ID: <1230042744-24675-2-git-send-email-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <1230042744-24675-1-git-send-email-u.kleine-koenig@pengutronix.de>

The result of providing the new flag -f is that the exported patches are
all placed directly in the output directory, not in subdirectories.

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

diff --git a/tg-export.sh b/tg-export.sh
index 95aa346..06b9c8d 100644
--- a/tg-export.sh
+++ b/tg-export.sh
@@ -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
 }
 
-- 
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   ` Uwe Kleine-König [this message]
2008-12-23 14:32     ` [PATCH TOPGIT] tg export (quilt): Implement numbering the patches Uwe Kleine-König
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-2-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).