git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* a few Topgit patches
@ 2008-12-23 14:30 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-25 14:58 ` a few Topgit patches martin f krafft
  0 siblings, 2 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2008-12-23 14:30 UTC (permalink / raw)
  To: git; +Cc: martin f. krafft, Petr Baudis

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

-- 
Pengutronix e.K.                              | Uwe Kleine-König           |
Industrial Linux Solutions                    | http://www.pengutronix.de/ |

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH TOPGIT] tg export: implement skipping empty patches for collapse driver
  2008-12-23 14:30 a few Topgit patches Uwe Kleine-König
@ 2008-12-23 14:32 ` 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-25 14:58 ` a few Topgit patches martin f krafft
  1 sibling, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2008-12-23 14:32 UTC (permalink / raw)
  To: git; +Cc: martin f. krafft, Petr Baudis

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

diff --git a/README b/README
index c19985f..8be0d17 100644
--- a/README
+++ b/README
@@ -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
diff --git a/tg-export.sh b/tg-export.sh
index afb6f95..95aa346 100644
--- a/tg-export.sh
+++ b/tg-export.sh
@@ -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"
 }
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH TOPGIT] tg export: Implement flattening patch paths for quilt mode
  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
  2008-12-23 14:32     ` [PATCH TOPGIT] tg export (quilt): Implement numbering the patches Uwe Kleine-König
  0 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2008-12-23 14:32 UTC (permalink / raw)
  To: git; +Cc: martin f. krafft, Petr Baudis

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH TOPGIT] tg export (quilt): Implement numbering the patches
  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
  0 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2008-12-23 14:32 UTC (permalink / raw)
  To: git; +Cc: martin f. krafft, Petr Baudis

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: a few Topgit patches
  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-25 14:58 ` martin f krafft
  2008-12-26 17:03   ` Uwe Kleine-König
  1 sibling, 1 reply; 8+ messages in thread
From: martin f krafft @ 2008-12-25 14:58 UTC (permalink / raw)
  To: Uwe Kleine-König, git, Petr Baudis

[-- Attachment #1: Type: text/plain, Size: 1175 bytes --]

also sprach Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [2008.12.23.1530 +0100]:
> 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.

-- 
 .''`.   martin f. krafft <madduck@d.o>      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

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: a few Topgit patches
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2008-12-26 17:03 UTC (permalink / raw)
  To: martin f krafft; +Cc: git, Petr Baudis

Hi martin,

On Thu, Dec 25, 2008 at 03:58:34PM +0100, martin f krafft wrote:
> also sprach Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [2008.12.23.1530 +0100]:
> > 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.
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

-- 
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 |

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: a few Topgit patches
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2009-01-04 13:05 UTC (permalink / raw)
  To: martin f krafft; +Cc: git, Petr Baudis

Hi martin,

On Fri, Dec 26, 2008 at 06:03:34PM +0100, Uwe Kleine-König wrote:
> On Thu, Dec 25, 2008 at 03:58:34PM +0100, martin f krafft wrote:
> > also sprach Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [2008.12.23.1530 +0100]:
> > > 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.
> 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

-- 
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 |

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: a few Topgit patches
  2009-01-04 13:05     ` Uwe Kleine-König
@ 2009-01-05 15:49       ` martin f krafft
  0 siblings, 0 replies; 8+ messages in thread
From: martin f krafft @ 2009-01-05 15:49 UTC (permalink / raw)
  To: Uwe Kleine-König, git, Petr Baudis

[-- Attachment #1: Type: text/plain, Size: 836 bytes --]

also sprach Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [2009.01.04.1405 +0100]:
> 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

I pulled and pushed them. Thanks.

-- 
 .''`.   martin f. krafft <madduck@d.o>      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

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-01-05 15:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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     ` [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

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).