[StGIT PATCH 2/6] New contrib scripts: stg-dispatch and stg-show.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Yann Dirson <yann.dirson@xxxxxxxxx>

Signed-off-by: Yann Dirson <ydirson@xxxxxxxxxx>
---

 contrib/stg-dispatch |   34 ++++++++++++++++++++++++++++++++++
 contrib/stg-show     |   27 +++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/contrib/stg-dispatch b/contrib/stg-dispatch
new file mode 100755
index 0000000..8911946
--- /dev/null
+++ b/contrib/stg-dispatch
@@ -0,0 +1,34 @@
+#!/bin/sh
+set -e
+
+# stg-dispatch - percollates files matching a pattern down to another patch.
+# It does the same job as stg-fold-files-from (and makes use of it to
+# do so), but from the patch containing the changes to migrate,
+# instead of doing so from the target patch.
+
+# usage: stg-dispatch <topatch> [-#<n>[-<n>][,<n>]...] <file-pattern>
+
+# Copyright (c) 2007 Yann Dirson <ydirson@xxxxxxxxxx>
+# Subject to the GNU GPL, version 2.
+
+die()
+{
+    echo >&2 "$(basename $0) error: $*"
+    exit 1
+}
+
+TOPATCH="$1"
+shift
+
+stg applied | grep "^$TOPATCH\$" >/dev/null ||
+    die "cannot dispatch to unapplied patch '$TOPATCH'"
+
+CURRENTPATCH=$(stg top)
+
+[ "x$TOPATCH" != "x$CURRENTPATCH" ] ||
+    die "dispatching to current patch ($CURRENTPATCH) makes no sense"
+
+stg goto "$TOPATCH"
+stg-fold-files-from "$CURRENTPATCH" "$@"
+stg refresh
+stg goto "$CURRENTPATCH"
diff --git a/contrib/stg-show b/contrib/stg-show
new file mode 100755
index 0000000..8c61540
--- /dev/null
+++ b/contrib/stg-show
@@ -0,0 +1,27 @@
+#!/bin/bash
+set -e
+
+# stg-show - unlike "stg show", just "git show" with knowledge of stg refs
+
+# Ex:
+# stg-show --color-words -- files
+
+# Copyright (c) 2007 Yann Dirson <ydirson@xxxxxxxxxx>
+# Subject to the GNU GPL, version 2.
+
+command=(git show)
+
+# subsitute git id's for stg ones until --
+endofpatches=0
+while [ "$#" -gt 0 ]; do
+    case "$1" in
+	--) endofpatches=1; break ;;
+	-*) command+=("$1"); shift ;;
+	*) command+=( $(stg id "$1" 2>/dev/null || echo "$1") ); shift ;;
+    esac
+done
+
+# append remaining args
+command+=("$@")
+
+eval "${command[@]}"

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux