ruby-changes:56702
From: Nobuyoshi <ko1@a...>
Date: Tue, 30 Jul 2019 16:58:09 +0900 (JST)
Subject: [ruby-changes:56702] Nobuyoshi Nakada: 47144f91a1 (master): Separate VCS::GIT#upstream
https://git.ruby-lang.org/ruby.git/commit/?id=47144f91a1 From 47144f91a176f263f870e05347d5b426efc40293 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 30 Jul 2019 16:44:29 +0900 Subject: Separate VCS::GIT#upstream diff --git a/tool/lib/vcs.rb b/tool/lib/vcs.rb index dd6162c..2ecbfbe 100644 --- a/tool/lib/vcs.rb +++ b/tool/lib/vcs.rb @@ -578,9 +578,7 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/lib/vcs.rb#L578 IO.copy_stream(r, path) end - def commit(opts = {}) - args = [COMMAND, "push"] - args << "-n" if dryrun + def upstream (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] @@ -589,7 +587,14 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/lib/vcs.rb#L587 unless %r"\Arefs/remotes/([^/]+)/(.*)" =~ upstream raise "Upstream not found" end - args << $1 << "HEAD:#$2" + [$1, $2] + end + + def commit(opts = {}) + args = [COMMAND, "push"] + args << "-n" if dryrun + remote, branch = upstream + args << remote << "HEAD:#{branch}" if dryrun? STDERR.puts(args.inspect) return true -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/