[前][次][番号順一覧][スレッド一覧]

ruby-changes:55688

From: Nobuyoshi <ko1@a...>
Date: Thu, 9 May 2019 10:02:04 +0900 (JST)
Subject: [ruby-changes:55688] Nobuyoshi Nakada: d802698d3e (trunk): Push the current (topic) branch to the remote upstream

https://git.ruby-lang.org/ruby.git/commit/?id=d802698d3e

From d802698d3e27a3cf091a56556df3562cc6ff996c Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Thu, 9 May 2019 10:01:31 +0900
Subject: Push the current (topic) branch to the remote upstream


diff --git a/tool/vcs.rb b/tool/vcs.rb
index 8e62276..9310629 100644
--- a/tool/vcs.rb
+++ b/tool/vcs.rb
@@ -510,6 +510,15 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L510
       dryrun = opts.fetch(:dryrun) {$DEBUG} if opts
       args = [COMMAND, "push"]
       args << "-n" if dryrun
+      (branch = cmd_read(%W"#{COMMAND} symbolic-ref --short HEAD")).chomp!
+      (upstream = cmd_read(%W"#{COMMAND} branch --list --format=%(upstream) #{branch}")).chomp!
+      while ref = upstream[%r"\Arefs/heads/(.*)", 1]
+        upstream = cmd_read(%W"#{COMMAND} branch --list --format=%(upstream) #{ref}")
+      end
+      unless %r"\Arefs/remotes/([^/]+)/(.*)" =~ upstream
+        raise "Upstream not found"
+      end
+      args << $1 << "HEAD:#$2"
       STDERR.puts(args.inspect) if dryrun
       system(*args) or return false
       true
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]