nirvdrum / svn2git

Ruby tool for importing existing svn projects into git.
MIT License
2.11k stars 443 forks source link

Error: undefined local variable or method `stdin' #283

Open chrispi68 opened 5 years ago

chrispi68 commented 5 years ago

Hello,

starting svn2git with

sudo svn2git http://192.168.2.161:8080/svn/erpsystem/ --username transfer --verbose

results in this error message:

> #<Thread:0x00005593c592b338@/var/lib/gems/2.5.0/gems/svn2git-2.4.0/lib/svn2git/migration.rb:431 run> terminated with exception (report_on_exception is true):
> Traceback (most recent call last):
>   2: from /var/lib/gems/2.5.0/gems/svn2git-2.4.0/lib/svn2git/migration.rb:432:in `block (2 levels) in run_command'
>   1: from /var/lib/gems/2.5.0/gems/svn2git-2.4.0/lib/svn2git/migration.rb:432:in `loop'
> /var/lib/gems/2.5.0/gems/svn2git-2.4.0/lib/svn2git/migration.rb:438:in `block (3 levels) in run_command': undefined local variable or method `stdin' for #<Svn2Git::Migration:0x00005593c572f7f0> (NameError)
> Did you mean?  String

I am running Ubuntu 18.04

svn checkout http://192.168.2.161:8080/svn/erpsystem/ --username transfer

works without any problems.

Any ideas?

Best regards Christoph

xrobert35 commented 5 years ago

Hello,

same probleme for me, ubuntu 18.04 ruby version is 2.5.0.

It worked for me 3-4 month ago on another computer but not anymore with fresh install. Perhaps ruby version is the cause ?

xrobert35 commented 5 years ago

Dont really know what I have done but it seem to work.

I installed "rvm" ruby version manager I installed ruby 2.4.0 with rvm and set it to be the default

Then I changed "sudo svn2git" by "rvmsudo svn2git"

jrbenito commented 5 years ago

same here, if I am local to the machine svn2git works because it pops password prompt graphically. When I am remote, ssh, it does not accept password from the command line same as above.

adrsr commented 4 years ago

Hello, I've had the very same issue. The password prompt may be the problem. This works for me : https://github.com/nirvdrum/svn2git/issues/237

yes <password> | svn2git <url> --username <usr> --authors ~/authors

belgoros commented 4 years ago

@adrsr it fails for me when running as you suggested: yes <password> | svn2git svn+ssh://<svn-url> --username <username> --authors ~/authors.txt with the below error:

#<Thread:0x00007febba3e4ee8 /Users/serguei/.rvm/gems/ruby-2.7.0/gems/svn2git-2.4.0/lib/svn2git/migration.rb:431 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
    2: from /Users/serguei/.rvm/gems/ruby-2.7.0/gems/svn2git-2.4.0/lib/svn2git/migration.rb:432:in `block (2 levels) in run_command'
    1: from /Users/serguei/.rvm/gems/ruby-2.7.0/gems/svn2git-2.4.0/lib/svn2git/migration.rb:432:in `loop'
/Users/serguei/.rvm/gems/ruby-2.7.0/gems/svn2git-2.4.0/lib/svn2git/migration.rb:438:in `block (3 levels) in run_command': undefined local variable or method `stdin' for #<Svn2Git::Migration:0x00007febba3d5dd0> (NameError)
Did you mean?  String
...

Run on macOS 10.15.6 Ruby ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]

adrsr commented 4 years ago

hello @belgoros

I'm afraid I can't help you. Maybe you can try with Debian OS. That's what I used for the migration.

Unfortunately, this project is no longer maintained and there are a lot of bugs.

th0ger commented 3 years ago

Hmmm, no longer maintained, but referenced in the official gitlab docs? https://docs.gitlab.com/ee/user/project/import/svn.html#cut-over-migration-with-svn2git

th0ger commented 3 years ago

Same error here.

$ lsb_release -a
Description:    Ubuntu 20.04.1 LTS
$ ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]
almdudler777 commented 3 years ago

For me it was a communication problem with svn2git and the git binary....

can you try (INSECURE, please check / remove your .gitconfig afterwards as it will include plain text passwords):

git config credential.helper store
git config --global user.name "your username"
git config --global user.password "your password"

then retry your svn2git command... everytime it fails it will tell you with what command it fails:

command failed:
git svn init --prefix=svn/ --username=**** --no-metadata --trunk=trunk --tags=tags --branches=branches https://*****

retry that command on the commandline to get more information from git itself... once i ironed out all the password requests from git .... svn2git worked without any problems...

hope it helps.

JSamir commented 3 years ago

This problem seems to be related to missing optional (perl?) packages for git.

On Archlinux I can see the optional dependencies with this command: pacman -Si git

Then I just installed all of them: sudo pacman -S perl-libwww perl-term-readkey perl-mime-tools perl-net-smtp-ssl perl-authen-sasl perl-mediawiki-api perl-datetime-format-iso8601 perl-lwp-protocol-https perl-cgi python subversion org.freedesktop.secrets libsecret tk

After that it worked.

ZcuBa commented 1 year ago

https://github.com/mazong1123/svn2gitnet

in case I forgot, this is a .net core version of the tool that @mazong made which does not suffer from this issue. switching to this adaptation solved it for me.

it has both fixed the "--password option not working" and the "stdin loop" issues

franke-biosaxs commented 1 year ago

Some comments for people equally late to the git train who run into this when following the instructions in the main README:

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=905832