Actions
Defect #32110
closed"already initialized constant Redmine::Scm::Adapters::SubversionAdapter::SVN_BIN" warning when executing rake tasks
Added by Go MAEDA over 5 years ago. Updated over 5 years ago.
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
$ bin/rails db:fixtures:load /Users/maeda/redmines/redmine-trunk/lib/redmine/scm/adapters/subversion_adapter.rb:29: warning: already initialized constant Redmine::Scm::Adapters::SubversionAdapter::SVN_BIN /Users/maeda/redmines/redmine-trunk/lib/redmine/scm/adapters/subversion_adapter.rb:29: warning: previous definition of SVN_BIN was here
Related issues
Updated by Go MAEDA over 5 years ago
I found that the following change fixes the warning.
diff --git a/app/models/repository/bazaar.rb b/app/models/repository/bazaar.rb
index 8b07db34d..f7ad5b62c 100644
--- a/app/models/repository/bazaar.rb
+++ b/app/models/repository/bazaar.rb
@@ -17,7 +17,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-require 'redmine/scm/adapters/bazaar_adapter'
+# require 'redmine/scm/adapters/bazaar_adapter'
class Repository::Bazaar < Repository
validates_presence_of :url, :log_encoding
diff --git a/app/models/repository/cvs.rb b/app/models/repository/cvs.rb
index e823275e4..03d57549d 100644
--- a/app/models/repository/cvs.rb
+++ b/app/models/repository/cvs.rb
@@ -17,7 +17,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-require 'redmine/scm/adapters/cvs_adapter'
+# require 'redmine/scm/adapters/cvs_adapter'
require 'digest/sha1'
class Repository::Cvs < Repository
diff --git a/app/models/repository/filesystem.rb b/app/models/repository/filesystem.rb
index 5d823b9f4..51a93dfa1 100644
--- a/app/models/repository/filesystem.rb
+++ b/app/models/repository/filesystem.rb
@@ -20,7 +20,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-require 'redmine/scm/adapters/filesystem_adapter'
+# require 'redmine/scm/adapters/filesystem_adapter'
class Repository::Filesystem < Repository
validates_presence_of :url
diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb
index 839a26676..b367fe06e 100644
--- a/app/models/repository/git.rb
+++ b/app/models/repository/git.rb
@@ -18,7 +18,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-require 'redmine/scm/adapters/git_adapter'
+# require 'redmine/scm/adapters/git_adapter'
class Repository::Git < Repository
validates_presence_of :url
diff --git a/app/models/repository/mercurial.rb b/app/models/repository/mercurial.rb
index 69f7bebdc..ac2921ccc 100644
--- a/app/models/repository/mercurial.rb
+++ b/app/models/repository/mercurial.rb
@@ -17,7 +17,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-require 'redmine/scm/adapters/mercurial_adapter'
+# require 'redmine/scm/adapters/mercurial_adapter'
class Repository::Mercurial < Repository
# sort changesets by revision number
diff --git a/app/models/repository/subversion.rb b/app/models/repository/subversion.rb
index 0f01f863f..8e7962cd5 100644
--- a/app/models/repository/subversion.rb
+++ b/app/models/repository/subversion.rb
@@ -17,7 +17,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-require 'redmine/scm/adapters/subversion_adapter'
+# require 'redmine/scm/adapters/subversion_adapter'
class Repository::Subversion < Repository
validates_presence_of :url
Updated by Go MAEDA over 5 years ago
The warning can be observed only when the current directory is a working copy of the Subversion repo. It means that you obtained the source code of Redmine using "svn" command.
Updated by Go MAEDA over 5 years ago
It is caused by r17407. Reverting the change fixes the issue.
Updated by Go MAEDA over 5 years ago
- Related to Defect #28920: Redmine::VERSION::revision should take subversion_command setting into account added
Updated by Go MAEDA over 5 years ago
Here is a workaround.
diff --git a/lib/redmine/version.rb b/lib/redmine/version.rb
index 8272e29e4..2fe75c55e 100644
--- a/lib/redmine/version.rb
+++ b/lib/redmine/version.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
require 'rexml/document'
+require 'redmine/scm/adapters/subversion_adapter'
module Redmine
# @private
Calling Redmine::Scm::Adapters::SubversionAdapter.client_command
before requiring redmine/scm/adapters/subversion_adapter
in the development mode gets the warning.
$ bin/rails c Loading development environment (Rails 5.2.3) [1] pry(main)> Redmine::Scm::Adapters::SubversionAdapter.client_command => "/usr/local/bin/svn" [2] pry(main)> require 'redmine/scm/adapters/subversion_adapter' /Users/maeda/redmines/redmine-trunk/lib/redmine/scm/adapters/subversion_adapter.rb:29: warning: already initialized constant Redmine::Scm::Adapters::SubversionAdapter::SVN_BIN /Users/maeda/redmines/redmine-trunk/lib/redmine/scm/adapters/subversion_adapter.rb:29: warning: previous definition of SVN_BIN was here => true [3] pry(main)>
Updated by Go MAEDA over 5 years ago
- Subject changed from "already initialized constant" warning when executing rake tasks to "already initialized constant Redmine::Scm::Adapters::SubversionAdapter::SVN_BIN" warning when executing rake tasks
- Category set to Code cleanup/refactoring
Updated by Go MAEDA over 5 years ago
- Target version set to Candidate for next minor release
Updated by Go MAEDA over 5 years ago
- Target version changed from Candidate for next minor release to 4.0.5
Setting the target version to 4.0.5.
The patch to commit: #32110#note-5
Updated by Go MAEDA over 5 years ago
- Status changed from New to Resolved
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the fix.
Actions