https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292010-03-18T12:46:37ZRedmineRedmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=152492010-03-18T12:46:37ZToshi MARUYAMA
<ul><li><strong>File</strong> <a href="/attachments/3393">windows-lang-c.png</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/3393/windows-lang-c.png">windows-lang-c.png</a> added</li></ul><p>This patch does not work on windows.</p> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=152512010-03-18T14:32:49ZToshi MARUYAMA
<ul></ul><pre>
$ hg diff
diff -r 8152d1bdeac5 lib/redmine/scm/adapters/mercurial_adapter.rb
--- a/lib/redmine/scm/adapters/mercurial_adapter.rb Sun Feb 28 22:12:54 2010 +0900
+++ b/lib/redmine/scm/adapters/mercurial_adapter.rb Thu Mar 18 23:30:34 2010 +0900
@@ -23,7 +23,8 @@
class MercurialAdapter < AbstractAdapter
# Mercurial executable name
- HG_BIN = "hg"
+ # HG_BIN = "hg"
+ HG_BIN = "env LANG=C hg"
TEMPLATES_DIR = File.dirname(__FILE__) + "/mercurial"
TEMPLATE_NAME = "hg-template"
TEMPLATE_EXTENSION = "tmpl"
</pre>
<pre>
$ env LANG=ja_JP.UTF-8 hg --version
Mercurial - 分散構成管理ツール(バージョン 1.5+99-bedef1c228d3)
</pre> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=152542010-03-18T15:18:28ZToshi MARUYAMA
<ul></ul><p>MSysGit has env.exe in "C:\Program Files\Git\bin".<br />But TortoiseHg does not have env.exe in "C:\Program Files\TortoiseHg".<br />This is not solution.</p> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=152562010-03-18T15:28:41ZAlessio Caiazza
<ul></ul><p>Toshi Maruyama wrote:</p>
<blockquote>
<p>MSysGit has env.exe in "C:Program FilesGitin".<br />But TortoiseHg does not have env.exe in "C:Program FilesTortoiseHg".<br />This is not solution.</p>
</blockquote>
<p>Does it install python?<br /><pre>
# HG changeset patch
# Parent 0dc60afda5722afecf6f7fc5c13552d3f008bdf2
sets LANG variable before calling hg
diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb
--- a/lib/redmine/scm/adapters/mercurial_adapter.rb
+++ b/lib/redmine/scm/adapters/mercurial_adapter.rb
@@ -45,6 +45,12 @@
def hgversion_from_command_line
%x{#{HG_BIN} --version}.match(/\(version (.*)\)/)[1]
+ rescue NoMethodError
+ hgversion_from_python
+ end
+
+ def hgversion_from_python
+ %x{python -c "from mercurial import util; print util.version()"}.strip
end
def template_path
</pre></p> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=152572010-03-18T16:02:10ZAlessio Caiazza
<ul></ul><p>TortoiseHG didn't install python, it compiles hg.<br />Not a solution.</p> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=152602010-03-18T17:23:01ZToshi MARUYAMA
<ul><li><strong>File</strong> <a href="/attachments/3397">hg-lang-c.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/3397/hg-lang-c.patch">hg-lang-c.patch</a> added</li></ul><p>I create patch and finish test on Windows.<br />This patch for Redmine 0.9.3.</p> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=152752010-03-18T20:21:29ZJean-Philippe Langjp_lang@yahoo.fr
<ul></ul><p>IMHO, it would be simplier to assume that the version number is of the first line of the output.<br />Just like we do for other SCM:</p>
<pre>
if m = io.gets.to_s.match(%r{((\d+\.)+\d+)})
version = m[0].scan(%r{\d+}).collect(&:to_i)
end
</pre> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=152902010-03-19T10:01:12ZAlessio Caiazza
<ul><li><strong>File</strong> <a href="/attachments/3403">fix_mercurial_localization_issue.diff</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/3403/fix_mercurial_localization_issue.diff">fix_mercurial_localization_issue.diff</a> added</li></ul><p>Patch based on Jean's advice.</p> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=208322010-09-29T12:30:40ZToshi MARUYAMA
<ul><li><strong>File</strong> <a href="/attachments/4591">hg-version-20100929.diff</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/4591/hg-version-20100929.diff">hg-version-20100929.diff</a> added</li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>I fixed Yuya's <a href="http://bitbucket.org/yuja/redmine-mq-issue4455/src/02e56cb49ed0/hg/version.diff" class="external">MQ</a> which fails <a class="source" href="https://www.redmine.org/projects/redmine/repository/svn/entry/tags/1.0.2/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb">source:tags/1.0.2/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb</a> and added new test.</p> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=208342010-09-29T13:10:48ZToshi MARUYAMA
<ul></ul><p>I pushed <a class="attachment" href="https://www.redmine.org/attachments/4591">hg-version-20100929.diff</a> to my github.</p>
<ul>
<li><a class="external" href="http://github.com/marutosi/redmine/commit/hg-version">http://github.com/marutosi/redmine/commit/hg-version</a></li>
<li><a class="external" href="http://github.com/marutosi/redmine/commit/8fcc83da4dd29c6f96cf7a9db445df604882e0aa">http://github.com/marutosi/redmine/commit/8fcc83da4dd29c6f96cf7a9db445df604882e0aa</a></li>
</ul> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=208842010-09-30T14:15:02ZToshi MARUYAMA
<ul><li><strong>File</strong> <a href="/attachments/4603">hg-version-yuya-mq-c5a47a5f63.diff</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/4603/hg-version-yuya-mq-c5a47a5f63.diff">hg-version-yuya-mq-c5a47a5f63.diff</a> added</li></ul><p>Yuya reviewed and updated my previous patch and imported to his MQ.</p>
<ul>
<li><a class="external" href="http://bitbucket.org/yuja/redmine-mq-issue4455/issue/7/request-for-refreshing-hg-versiondiff">http://bitbucket.org/yuja/redmine-mq-issue4455/issue/7/request-for-refreshing-hg-versiondiff</a></li>
<li><a class="external" href="http://bitbucket.org/yuja/redmine-mq-issue4455/changeset/c5a47a5f63f5">http://bitbucket.org/yuja/redmine-mq-issue4455/changeset/c5a47a5f63f5</a></li>
</ul>
<p>I attach new patch and pushed my github.</p>
<ul>
<li><a class="external" href="http://github.com/marutosi/redmine/commits/hg-version-yuya-mq-c5a47a5f63">http://github.com/marutosi/redmine/commits/hg-version-yuya-mq-c5a47a5f63</a></li>
<li><a class="external" href="http://github.com/marutosi/redmine/commits/e2334dcb4b85976a1224">http://github.com/marutosi/redmine/commits/e2334dcb4b85976a1224</a></li>
</ul>
<p>I wish to set target of this issue to next stable 1.0.3.</p> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=223992010-11-14T12:19:49ZToshi MARUYAMA
<ul><li><strong>File</strong> <a href="/attachments/4830">hg-version-20101114.diff</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/4830/hg-version-20101114.diff">hg-version-20101114.diff</a> added</li></ul><p>I update the patch referring of <a href="http://www.redmine.org/issues/6860#note-13" class="external">note-13</a> of <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Defect: svn: Write error: Broken pipe when browsing repository (Closed)" href="https://www.redmine.org/issues/6860">#6860</a>.</p>
<ul>
<li>change io.gets to io.read</li>
<li>update regular expression for multi lines </li>
<li>update test for multi lines</li>
</ul>
<p>Please set this issue target next stable 1.0.4.</p> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=224102010-11-14T16:29:05ZYuya Nishihara
<ul><li><strong>File</strong> <a href="/attachments/4831">hg-version-2010-11-15.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/4831/hg-version-2010-11-15.patch">hg-version-2010-11-15.patch</a> added</li><li><strong>File</strong> <a href="/attachments/4832">hg-version-minimal-2010-11-15.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/4832/hg-version-minimal-2010-11-15.patch">hg-version-minimal-2010-11-15.patch</a> added</li></ul><p>Toshi MARUYAMA wrote:</p>
<blockquote>
<p><a class="attachment" href="https://www.redmine.org/attachments/4830">hg-version-20101114.diff</a></p>
</blockquote>
<p>Hi, I think your patch is overengineerd. Here's a patch to fix this issue with minimal changes: <a class="attachment" href="https://www.redmine.org/attachments/4832">hg-version-minimal-2010-11-15.patch</a></p>
<p>I have another one to fix this, <a class="attachment" href="https://www.redmine.org/attachments/4831">hg-version-2010-11-15.patch</a>, but it contains more changes to simplify the codes.</p> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=225892010-11-20T13:59:43ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li><li><strong>Target version</strong> set to <i>1.0.4</i></li></ul><p>I've committed hg-version-minimal-2010-11-15.patch in trunk and 1.0-stable as it solves the reported error.<br />Thanks.</p> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=225922010-11-20T15:55:53ZToshi MARUYAMA
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Reopened</i></li></ul><p>Unit test fails.</p>
<pre>
$ LANG=C ruby test/unit/repository_mercurial_test.rb
./test/unit/../test_helper.rb:405: warning: don't put space before argument parentheses
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
Loaded suite test/unit/repository_mercurial_test
Started
.EEEEE
Finished in 2.508805 seconds.
1) Error:
test_cat(RepositoryMercurialTest):
NoMethodError: undefined method `lines' for #<String:0x7fa9541f9a28>
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'
test/unit/repository_mercurial_test.rb:67:in `test_cat'
</pre> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=225932010-11-20T16:23:26ZToshi MARUYAMA
<ul><li><strong>File</strong> <a href="/attachments/4865">hg-version-2010-11-20.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/4865/hg-version-2010-11-20.patch">hg-version-2010-11-20.patch</a> added</li></ul><p>I refresh a patch for SVN trunk based on Yuya's hg-version-2010-11-15.patch.</p> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=225942010-11-20T16:26:19ZYuya Nishihara
<ul><li><strong>File</strong> <a href="/attachments/4866">mercurial_adapter_each_line.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/4866/mercurial_adapter_each_line.patch">mercurial_adapter_each_line.patch</a> added</li></ul><p>Toshi MARUYAMA wrote:</p>
<blockquote>
<p>Unit test fails.</p>
</blockquote>
<p>Gee, Ruby 1.8.6 doesn't seem to have String#lines method, sorry. Could you test the attached patch? <a class="attachment" href="https://www.redmine.org/attachments/4866">mercurial_adapter_each_line.patch</a></p> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=225952010-11-20T17:50:57ZToshi MARUYAMA
<ul></ul><p>Yuya Nishihara wrote:</p>
<blockquote>
<p>Toshi MARUYAMA wrote:</p>
<blockquote>
<p>Unit test fails.</p>
</blockquote>
<p>Gee, Ruby 1.8.6 doesn't seem to have String#lines method, sorry. Could you test the attached patch? <a class="attachment" href="https://www.redmine.org/attachments/4866">mercurial_adapter_each_line.patch</a></p>
</blockquote>
<p>It fails.<br /><pre>
$ ruby test/unit/repository_mercurial_test.rb
./test/unit/../test_helper.rb:405: warning: don't put space before argument parentheses
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
Loaded suite test/unit/repository_mercurial_test
Started
.EEEEE
Finished in 3.546667 seconds.
1) Error:
test_cat(RepositoryMercurialTest):
LocalJumpError: no block given
lib/redmine/scm/adapters/mercurial_adapter.rb:47:in `each_line'
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'
test/unit/repository_mercurial_test.rb:67:in `test_cat'
</pre></p>
<pre>
$ ruby --version
ruby 1.8.6 (2010-02-05 patchlevel 399) [x86_64-linux]
</pre>
<pre>
$ LANG=C rpm -qi ruby
Name : ruby Relocations: (not relocatable)
Version : 1.8.6.399 Vendor: Fedora Project
Release : 6.fc13 Build Date: Mon Aug 23 02:56:25 2010
Install Date: Wed Sep 1 10:42:01 2010 Build Host: x86-14.phx2.fedoraproject.org
Group : Development/Languages Source RPM: ruby-1.8.6.399-6.fc13.src.rpm
Size : 1740271 License: Ruby or GPLv2
Signature : RSA/SHA256, Tue Aug 24 02:03:58 2010, Key ID 7edc6ad6e8e40fde
Packager : Fedora Project
URL : http://www.ruby-lang.org/
Summary : An interpreter of object-oriented scripting language
Description :
Ruby is the interpreted scripting language for quick and easy
object-oriented programming. It has many features to process text
files and to do system management tasks (as in Perl). It is simple,
straight-forward, and extensible.
</pre> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=225962010-11-20T18:34:49ZYuya Nishihara
<ul><li><strong>File</strong> <a href="/attachments/4868">mercurial_adapter_1.8.6fix.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/4868/mercurial_adapter_1.8.6fix.patch">mercurial_adapter_1.8.6fix.patch</a> added</li></ul><p>Toshi MARUYAMA wrote:</p>
<blockquote><blockquote>
<p><a class="attachment" href="https://www.redmine.org/attachments/4866">mercurial_adapter_each_line.patch</a></p>
</blockquote>
<p>It fails.</p>
</blockquote>
<p>Hmm, <code>#each_line => Enumerator</code> seems also introduced in 1.8.7, according to string.c:rb_str_each_line().<br />I changed #hgversion_from_command_line to return whole lines and updated the test case accordingly:</p>
<p><a class="attachment" href="https://www.redmine.org/attachments/4868">mercurial_adapter_1.8.6fix.patch</a></p>
<p>This should fix the problem on Ruby 1.8.6.<br />We could use String#to_a (only for 1.8.x) or String#split("\n"), but I think it's simple just not to eliminate trailing lines.</p> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=226002010-11-21T01:28:18ZToshi MARUYAMA
<ul><li><strong>File</strong> <a href="/attachments/4869">hg-version-2010-11-21.diff</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/4869/hg-version-2010-11-21.diff">hg-version-2010-11-21.diff</a> added</li></ul><p>I update the patch for SVN trunk referring JPL's implementation of <a class="changeset" title="Fixed: Broken pipe error when browsing subversion repository (#6860)." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/4419">r4419</a>(<a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Defect: svn: Write error: Broken pipe when browsing repository (Closed)" href="https://www.redmine.org/issues/6860">#6860</a>) which uses io.read and '\A' regular expression.</p> Redmine - Patch #5117: mercurial_adapter should ensure the right LANG environment variablehttps://www.redmine.org/issues/5117?journal_id=226042010-11-21T14:18:48ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Status</strong> changed from <i>Reopened</i> to <i>Closed</i></li></ul><p>Toshi MARUYAMA wrote:</p>
<blockquote>
<p>I update the patch for SVN trunk referring JPL's implementation of <a class="changeset" title="Fixed: Broken pipe error when browsing subversion repository (#6860)." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/4419">r4419</a>(<a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Defect: svn: Write error: Broken pipe when browsing repository (Closed)" href="https://www.redmine.org/issues/6860">#6860</a>) which uses io.read and '\A' regular expression.</p>
</blockquote>
<p>Fix for 1.8.6 committed in <a class="changeset" title="Fixed: r4417 breaks MercurialAdapter with ruby 1.8.6 (#5117)." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/4422">r4422</a>, thanks.</p>