Sha256: 60ece42549a8227e8094e678653d601258c1b9193a2a25acb90fa98305e705d3

Contents?: true

Size: 786 Bytes

Versions: 5

Compression:

Stored size: 786 Bytes

Contents

require 'time'

module RspecProfiling
  module VCS
    class GitSvn
      # returns nil if using `git svn`
      def version_control
        `[ -d .git/svn  ] && [ x != x"$(ls -A .git/svn/)" ]`
        RspecProfiling::VCS::Svn unless $CHILD_STATUS.success?
      end

      def branch
        nil
      end

      def sha
        if version_control.nil?
          `git svn info | grep "Revision" | cut -f2 -d' '`
        else
          `svn info -r 'HEAD' | grep "Revision" | cut -f2 -d' '`
        end
      end

      def time
        if version_control.nil?
          Time.parse `git svn info | grep "Last Changed Date" | cut -f4,5,6 -d' '`
        else
          Time.parse `svn info -r 'HEAD' | grep "Last Changed Date" | cut -f4,5,6 -d' '`
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rspec_profiling-0.0.9 lib/rspec_profiling/vcs/git_svn.rb
rspec_profiling-0.0.8 lib/rspec_profiling/vcs/git_svn.rb
rspec_profiling-0.0.7 lib/rspec_profiling/vcs/git_svn.rb
rspec_profiling-0.0.6 lib/rspec_profiling/vcs/git_svn.rb
rspec_profiling-0.0.5 lib/rspec_profiling/vcs/git_svn.rb