Project

General

Profile

Actions

Patch #5117

closed

mercurial_adapter should ensure the right LANG environment variable

Added by Alessio Caiazza over 14 years ago. Updated about 14 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
SCM
Target version:
Start date:
2010-03-18
Due date:
% Done:

100%

Estimated time:

Description

http://www.redmine.org/projects/redmine/repository/revisions/3506/entry/trunk/lib/redmine/scm/adapters/mercurial_adapter.rb#L47 matches with a regular expression which may not work on some locales.

$ locale | grep LANG
LANG="it_IT.UTF-8" 
$ hg --version
Mercurial SCM Distribuito (versione 1.5+20100307)

To ensure the correct behaviour you may set LANG='C' before calling hg.

rake test error snippets

  2) Error:
test_annotate(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:75:in `default_branch'
    app/controllers/repositories_controller.rb:205:in `find_repository'
    /test/functional/repositories_mercurial_controller_test.rb:125:in `test_annotate'

  3) Error:
test_changes(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:75:in `default_branch'
    app/controllers/repositories_controller.rb:205:in `find_repository'
    /test/functional/repositories_mercurial_controller_test.rb:79:in `test_changes'

  4) Error:
test_diff(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:87:in `diff'
    app/controllers/repositories_controller.rb:167:in `diff'
    /test/functional/repositories_mercurial_controller_test.rb:113:in `test_diff'

  5) Error:
test_directory_entry(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:75:in `default_branch'
    app/controllers/repositories_controller.rb:205:in `find_repository'
    /test/functional/repositories_mercurial_controller_test.rb:104:in `test_directory_entry'

  6) Error:
test_entry_download(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:75:in `default_branch'
    app/controllers/repositories_controller.rb:205:in `find_repository'
    /test/functional/repositories_mercurial_controller_test.rb:97:in `test_entry_download'

  7) Error:
test_entry_show(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:75:in `default_branch'
    app/controllers/repositories_controller.rb:205:in `find_repository'
    /test/functional/repositories_mercurial_controller_test.rb:86:in `test_entry_show'

  8) Error:
test_show(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:75:in `default_branch'
    app/controllers/repositories_controller.rb:205:in `find_repository'
    /test/functional/repositories_mercurial_controller_test.rb:40:in `test_show'

  9) Error:
test_show_at_given_revision(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository/mercurial.rb:33:in `entries'
    app/controllers/repositories_controller.rb:72:in `show'
    /test/functional/repositories_mercurial_controller_test.rb:71:in `test_show_at_given_revision'

 10) Error:
test_show_directory(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:75:in `default_branch'
    app/controllers/repositories_controller.rb:205:in `find_repository'
    /test/functional/repositories_mercurial_controller_test.rb:59:in `test_show_directory'

 11) Error:
test_show_root(RepositoriesMercurialControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `hgversion_from_command_line'
    lib/redmine/scm/adapters/mercurial_adapter.rb:40:in `hgversion'
    lib/redmine/scm/adapters/mercurial_adapter.rb:33:in `client_version'
    lib/redmine/scm/adapters/mercurial_adapter.rb:51:in `template_path'
    lib/redmine/scm/adapters/mercurial_adapter.rb:108:in `revisions'
    lib/redmine/scm/adapters/mercurial_adapter.rb:72:in `info'
    lib/redmine/scm/adapters/abstract_adapter.rb:162:in `retrieve_root_url'
    lib/redmine/scm/adapters/abstract_adapter.rb:54:in `initialize'
    app/models/repository.rb:41:in `new'
    app/models/repository.rb:41:in `scm'
    app/models/repository.rb:75:in `default_branch'
    app/controllers/repositories_controller.rb:205:in `find_repository'
    /test/functional/repositories_mercurial_controller_test.rb:48:in `test_show_root'

This patch applies on redmine 0.9.3

$ script/about
About your application's environment
Ruby version              1.8.7 (universal-darwin10.0)
RubyGems version          1.3.6
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5
Application root          /Users/nolith/Documents/Projects/redmine-hg
Environment               development
Database adapter          sqlite3
Database schema version   20100222000000


Files

fix_mercurial_localization_issue.diff (627 Bytes) fix_mercurial_localization_issue.diff Alessio Caiazza, 2010-03-18 12:12
windows-lang-c.png (17 KB) windows-lang-c.png Toshi MARUYAMA, 2010-03-18 13:46
hg-lang-c.patch (1.22 KB) hg-lang-c.patch Toshi MARUYAMA, 2010-03-18 18:23
fix_mercurial_localization_issue.diff (1002 Bytes) fix_mercurial_localization_issue.diff Alessio Caiazza, 2010-03-19 11:01
hg-version-20100929.diff (5.01 KB) hg-version-20100929.diff Toshi MARUYAMA, 2010-09-29 14:30
hg-version-yuya-mq-c5a47a5f63.diff (5.11 KB) hg-version-yuya-mq-c5a47a5f63.diff Toshi MARUYAMA, 2010-09-30 16:15
hg-version-20101114.diff (5.43 KB) hg-version-20101114.diff Toshi MARUYAMA, 2010-11-14 13:19
hg-version-2010-11-15.patch (5.11 KB) hg-version-2010-11-15.patch Yuya Nishihara, 2010-11-14 17:29
hg-version-minimal-2010-11-15.patch (2.24 KB) hg-version-minimal-2010-11-15.patch Yuya Nishihara, 2010-11-14 17:29
hg-version-2010-11-20.patch (5.05 KB) hg-version-2010-11-20.patch Toshi MARUYAMA, 2010-11-20 17:23
mercurial_adapter_each_line.patch (482 Bytes) mercurial_adapter_each_line.patch Yuya Nishihara, 2010-11-20 17:26
mercurial_adapter_1.8.6fix.patch (1.45 KB) mercurial_adapter_1.8.6fix.patch Yuya Nishihara, 2010-11-20 19:34
hg-version-2010-11-21.diff (2.5 KB) hg-version-2010-11-21.diff Toshi MARUYAMA, 2010-11-21 02:28

Related issues

Has duplicate Redmine - Defect #7059: Error on the implementation issues Repository.fetch_changesetsClosed2010-12-07

Actions
Actions

Also available in: Atom PDF