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

ruby-changes:37556

From: nobu <ko1@a...>
Date: Wed, 18 Feb 2015 12:43:15 +0900 (JST)
Subject: [ruby-changes:37556] nobu:r49637 (trunk): vcs.rb: refactor

nobu	2015-02-18 12:43:01 +0900 (Wed, 18 Feb 2015)

  New Revision: 49637

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49637

  Log:
    vcs.rb: refactor
    
    * tool/vcs.rb (VCS::GIT.get_revisions): refactor git -C option.

  Modified files:
    trunk/tool/vcs.rb
Index: tool/vcs.rb
===================================================================
--- tool/vcs.rb	(revision 49636)
+++ tool/vcs.rb	(revision 49637)
@@ -254,8 +254,9 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L254
     register(".git")
 
     def self.get_revisions(path, srcdir = nil)
-      logcmd = %W[git log -n1 --date=iso]
-      logcmd[1, 0] = ["-C", srcdir] if srcdir
+      gitcmd = %W[git]
+      gitcmd.push("-C", srcdir) if srcdir
+      logcmd = gitcmd + %W[log -n1 --date=iso]
       logcmd << "--grep=^ *git-svn-id: .*@[0-9][0-9]*"
       idpat = /git-svn-id: .*?@(\d+) \S+\Z/
       log = IO.pread(logcmd)
@@ -269,10 +270,7 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L270
         changed = last
       end
       modified = log[/^Date:\s+(.*)/, 1]
-      cmd = %W[git]
-      cmd.push("-C", srcdir) if srcdir
-      cmd.push("symbolic-ref", "HEAD")
-      branch = IO.pread(cmd)[%r'\A(?:refs/heads/)?(.+)', 1]
+      branch = IO.pread(gitcmd + %W[symbolic-ref HEAD])[%r'\A(?:refs/heads/)?(.+)', 1]
       [last, changed, modified, branch]
     end
 

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

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