svn2git 2.2.5 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c4a9fc54bbab7715f45e042b64a8d43c7c45ba8
4
- data.tar.gz: 62f4f6a037614764a92279b050bf17bc924535c5
3
+ metadata.gz: 2b945b1a4df0af0d51a1c7d5662528c79975bf8c
4
+ data.tar.gz: 0ce18a7123508f6368250867884714cfa0589865
5
5
  SHA512:
6
- metadata.gz: 2148e941a74b9b9d1b7e57f9c0932f05f29f4b37b368ec80581b4174ebe835440443e53ec29ac74b303c4121317297a71c8c5485d5993a1537fdac575c3e1459
7
- data.tar.gz: 943712834f6d29603c17eb266f2327b6e892874e9a2ad4cfd65fb6d04e463c2213ba5b02543f796b15236605932376e4eefc530be6bacf063371c694544ed947
6
+ metadata.gz: 7262ee9fedddbdc47119bfba8e4aee8373bac52c6dec3ffccb50346697936ed6e2cc65a9a0d9b4aef16b0975dc1c545412d77b40dec750e85838bc2ce7980299
7
+ data.tar.gz: aa518ed21531bc16d70ab39f48af4d78b4e2e651e1c2271c7f3d0b2f395b94d33c9393ea2e0cdd26af35cf46f0be61b077c2b708b61d887730f3926e696f8c82
data/ChangeLog.markdown CHANGED
@@ -1,4 +1,13 @@
1
+ # 2.3.0 - 2014-05-14
2
+ This release passes STDIN through to the underlying git-svn process, allowing users to interact with the
3
+ git-svn prompt. Principally, it will allow users to choose what to do when prompted about unverified
4
+ SSL certificates.
5
+
6
+ * Pass STDIN through to the underlying git-svn process so users can respond to prompts.
7
+
1
8
  # 2.2.5 - 2014-03-09
9
+ This is a bugfix release. It improves handling of quotes in SVN commit messages.
10
+
2
11
 
3
12
  * Fixed an with single quote escaping (thanks aucl).
4
13
  * Escape double quotes (e.g., if they appear in a commit message) before passing to the shell (thanks aucl).
data/Rakefile CHANGED
@@ -11,6 +11,7 @@ begin
11
11
  spec.homepage = "https://github.com/nirvdrum/svn2git"
12
12
  spec.email = "nirvdrum@gmail.com"
13
13
  spec.add_development_dependency 'test-unit'
14
+ spec.add_dependency 'open4'
14
15
  end
15
16
  Jeweler::GemcutterTasks.new
16
17
 
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 2
3
- :minor: 2
4
- :patch: 5
3
+ :minor: 3
4
+ :patch: 0
5
5
  :build:
@@ -1,5 +1,7 @@
1
1
  require 'optparse'
2
2
  require 'pp'
3
+ require 'open4'
4
+ require 'timeout'
3
5
 
4
6
  module Svn2Git
5
7
  DEFAULT_AUTHORS_FILE = "~/.svn2git/authors"
@@ -340,23 +342,79 @@ module Svn2Git
340
342
  log "Running command: #{cmd}"
341
343
 
342
344
  ret = ''
345
+ @mutex ||= Mutex.new
346
+ @stdin_queue ||= Queue.new
347
+
348
+ # We need to fetch input from the user to pass through to the underlying sub-process. We'll constantly listen
349
+ # for input and place any received values on a queue for consumption by a pass-through thread that will forward
350
+ # the contents to the underlying sub-process's stdin pipe.
351
+ @stdin_thread ||= Thread.new do
352
+ loop { @stdin_queue << $stdin.gets.chomp }
353
+ end
343
354
 
344
- cmd = "2>&1 #{cmd}"
345
- IO.popen(cmd) do |stdout|
346
- if printout_output
347
- stdout.each_char do |character|
348
- $stdout.print character
349
- ret << character
350
- end
351
- else
355
+ # Open4 forks, which JRuby doesn't support. But JRuby added a popen4-compatible method on the IO class,
356
+ # so we can use that instead.
357
+ status = (defined?(JRUBY_VERSION) ? IO : Open4).popen4(cmd) do |pid, stdin, stdout, stderr|
358
+ threads = []
359
+
360
+ threads << Thread.new(stdout) do |stdout|
352
361
  stdout.each do |line|
353
- log line
354
- ret << line
362
+ @mutex.synchronize do
363
+ ret << line
364
+
365
+ if printout_output
366
+ $stdout.print line
367
+ else
368
+ log line
369
+ end
370
+ end
371
+ end
372
+ end
373
+
374
+ threads << Thread.new(stderr) do |stderr|
375
+ # git-svn seems to do all of its prompting for user input via STDERR. When it prompts for input, it will
376
+ # not terminate the line with a newline character, so we can't split the input up by newline. It will,
377
+ # however, use a space to separate the user input from the prompt. So we split on word boundaries here
378
+ # while draining STDERR.
379
+ stderr.each(' ') do |word|
380
+ @mutex.synchronize do
381
+ ret << word
382
+
383
+ if printout_output
384
+ $stdout.print word
385
+ else
386
+ log word
387
+ end
388
+ end
389
+ end
390
+ end
391
+
392
+ # Simple pass-through thread to take anything the user types via STDIN and passes it through to the
393
+ # sub-process's stdin pipe.
394
+ Thread.new(stdin) do |stdin|
395
+ loop do
396
+ user_reply = @stdin_queue.pop
397
+
398
+ # nil is our cue to stop looping (pun intended).
399
+ break if user_reply.nil?
400
+
401
+ stdin.puts user_reply
402
+ stdin.close
355
403
  end
356
404
  end
405
+
406
+ threads.each(&:join)
407
+
408
+ # Push nil to the stdin_queue to gracefully exit the STDIN pass-through thread.
409
+ @stdin_queue << nil
357
410
  end
358
411
 
359
- if exit_on_error && ($?.exitstatus != 0)
412
+ # JRuby's open4 doesn't return a Process::Status object when invoked with a block, but rather returns the
413
+ # block expression's value. The Process::Status is stored as $?, so we need to normalize the status
414
+ # object if on JRuby.
415
+ status = $? if defined?(JRUBY_VERSION)
416
+
417
+ if exit_on_error && (status.exitstatus != 0)
360
418
  $stderr.puts "command failed:\n#{cmd}"
361
419
  exit -1
362
420
  end
data/svn2git.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: svn2git 2.2.5 ruby lib
5
+ # stub: svn2git 2.3.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "svn2git"
9
- s.version = "2.2.5"
9
+ s.version = "2.3.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["James Coglan", "Kevin Menard"]
14
- s.date = "2014-03-10"
14
+ s.date = "2014-05-14"
15
15
  s.email = "nirvdrum@gmail.com"
16
16
  s.executables = ["svn2git"]
17
17
  s.extra_rdoc_files = [
@@ -40,11 +40,14 @@ Gem::Specification.new do |s|
40
40
 
41
41
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
42
42
  s.add_development_dependency(%q<test-unit>, [">= 0"])
43
+ s.add_runtime_dependency(%q<open4>, [">= 0"])
43
44
  else
44
45
  s.add_dependency(%q<test-unit>, [">= 0"])
46
+ s.add_dependency(%q<open4>, [">= 0"])
45
47
  end
46
48
  else
47
49
  s.add_dependency(%q<test-unit>, [">= 0"])
50
+ s.add_dependency(%q<open4>, [">= 0"])
48
51
  end
49
52
  end
50
53
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svn2git
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.5
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Coglan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-10 00:00:00.000000000 Z
12
+ date: 2014-05-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit
@@ -25,6 +25,20 @@ dependencies:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: open4
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
28
42
  description:
29
43
  email: nirvdrum@gmail.com
30
44
  executables: