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

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

From
Yann Dirson <ydirson@altern.org>
Date
Mar 1, 2007, 23:04 UTC
Message-ID
<20070301230415.32459.45545.stgit@gandelf.nowhere.earth>
In-Reply-To
<20070301225651.32459.89156.stgit@gandelf.nowhere.earth>
Signed-off-by: Yann Dirson <ydirson@altern.org>
---
 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";
+}
Previous: Yann Dirson
Message 9 of 9 in “My set of stgit helper scripts (update)”
  1. 0/8 My set of stgit helper scripts (update)Yann Dirson, Mar 1, 2007
  2. 1/8 Add contrib/stg-whatchanged: look at what would be changed by refreshing.Yann Dirson, Mar 1, 2007
  3. 2/8 Add contrib/stg-show-old: show old version of a patch.Yann Dirson, Mar 1, 2007
  4. 3/8 Add contrib/stg-fold-files-from: pick selected changes from a patch above current oneYann Dirson, Mar 1, 2007
  5. 4/8 Add contrib/stg-swallow: completely merge an unapplied patch into current oneYann Dirson, Mar 1, 2007
  6. 5/8 Add contrib/stg-cvs: helper script to manage a mixed cvs/stgit working copyYann Dirson, Mar 1, 2007
  7. 6/8 Add contrib/stg-gitk: helper script to run gitkYann Dirson, Mar 1, 2007
  8. 7/8 Add contrib/stg-mdiff: display diffs of diffs.Yann Dirson, Mar 1, 2007
  9. 8/8 Add contrib/stg-sink: sink a patch to given location (mirrors float).Yann Dirson, Mar 1, 2007

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.