[PATCH 8/8] Add contrib/stg-sink: sink a patch to given location (mirrors float).

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

 





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

 contrib/stg-sink |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/contrib/stg-sink b/contrib/stg-sink
new file mode 100755
index 0000000..e63eb93
--- /dev/null
+++ b/contrib/stg-sink
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+sub _run {
+  print(' >> ', @_, "\n");# and 0;
+  system(@_);
+}
+
+my $dopush=1;
+my $pop='pop -a';
+while (@ARGV and $ARGV[0] =~ m/^-/) {
+  if ($ARGV[0] eq '-n') {
+    $dopush=0;
+    shift @ARGV;
+  }
+  if ($ARGV[0] eq '-t') {
+    shift @ARGV;
+    $pop = 'goto '.shift @ARGV;
+  }
+}
+
+# default: sink current patch
+if (@ARGV == 0) {
+  $ARGV[0] = `stg top`;
+}
+
+my @oldapplied=`stg applied`;
+chomp (@oldapplied);
+
+_run('stg '.$pop) &&
+  die "cannot pop all patches";
+_run('stg push ' . join (' ', @ARGV)) &&
+  die "error pushing patches";
+
+if ($dopush) {
+  my @newapplied=`stg applied`;
+  chomp (@newapplied);
+  my @remaining=grep { my $check=$_;
+		       not grep { $check eq $_ } @newapplied;
+		     } @oldapplied;
+  _run('stg push ' . join (' ', @remaining)) &&
+    die "error pushing remaining patches";
+}

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