Vote #63512
未完了Using libsvn
90%
説明
Tigris provides a high level ruby api named libsvn (subversion/bindings/swig/ruby in the sources of subversion). It could maybe simplify the way Redmine handles subversion repositories by avoiding out shelling.
Have someone tested this lib ? Is this lib voluntary not used in Redmine ?
journals
The main reason why it's not used in Redmine is that there's no binaries available for windows.
I don't know if this lib has all the necessary functionalities to be used in Redmine, can you point to the documentation of this API please ?
--------------------------------------------------------------------------------
There is no documentation specific to the ruby bindings. "Here":http://svn.collab.net/svn-doxygen is the documentation of the subversion API. I think that the lib has more than all the necessary functionalities the be used in Redmine. I am not convinced that maintaining a Windows compatibility for a server software like Redmine is crucial.
However, it's also possible to have an adapter based on libsvn for Unices and an adapter that uses command line calls for Windows or non libsvn users. I can try to implement this adapter to show if there is a real benefit (memory footprint, cpu or io usage, code simplicity).
Moreover, no ruby bindings exists for all api (Mercurial for example).
--------------------------------------------------------------------------------
For sure, it would be faster.
Having an alternate adapter that uses libsvn would be nice indeed.
--------------------------------------------------------------------------------
I finally succeed in implementing a subversion adapter based on libsvn. I wrote some non regression tests (should be completed). The adapter pass functional and unit tests of the adapter based on svn command line. At the moment, I made no benchmarking. I will write something like parsing a repository with 1000 changesets to see if there is some speed improvement.
--------------------------------------------------------------------------------
A simple benchmark : calling @Adapter#revisions@ method on a local repository with 1000 simple changesets :
<pre>
user system total real
libsvn 0.150000 0.020000 0.170000 ( 0.230447)
svn command 8.150000 0.480000 8.750000 ( 8.987669)
</pre>
--------------------------------------------------------------------------------
+10! Great. Please integrate it into trunk
--------------------------------------------------------------------------------
Looks great! I just found a small bug in the diff view, it seems you need to swap identifier_to and identifier_from in SubversionLibsvnAdapter#diff.
But I think we shouldn't introduce a new Repository class (eg. SubversionLibsvn) since this is not a new kind of repository, but just an other way to read a Subversion repository. I think your patch could be released as a plugin that overides the default adapter. Existing repositories will use this new adapter as well.
--------------------------------------------------------------------------------
Jean-Philippe Lang wrote:
> I think your patch could be released as a plugin that overides the default adapter. Existing repositories will use this new adapter as well.
Because plugins are loaded first, it's hard to override methods with a plugin. Do you have an idea on how to implement that ?
--------------------------------------------------------------------------------
Pierre Paysant-Le Roux wrote:
> Because plugins are loaded first, it's hard to override methods with a plugin. Do you have an idea on how to implement that ?
You can have the plugin load the required files it needs to override. For example:
<pre><code class="ruby">
require_dependency 'subversion_adapter' # Might need to use redmine/scm/adapaters/subversion_adapter
module Redmine
module Scm
module Adapters
class SubversionAdapter < AbstractAdapter
# Override code here.
end
end
end
end
</code></pre>
You can also use the module include pattern if you don't want to reopen the @SubversionAdapter@ class.
--------------------------------------------------------------------------------
I created a plugin. It is available on github :
http://github.com/pplr/redmine-libsvn/tree/master
Suggestions and beta testers are welcome !
--------------------------------------------------------------------------------
I've just tested your plugin and found that @#properties@ uses infinite depth, which is wrong and horribly slow (13s on Redmine repository root).
Here is a fix:
<pre>
--- subversion_libsvn_adapter.rb Sun Dec 20 12:31:16 2009
+++ subversion_libsvn_adapter_fix.rb Sun Dec 20 12:28:55 2009
@@ -100,7 +100,7 @@
def properties(path, identifier=nil)
identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HE
AD"
properties = {}
- ctx.proplist(target(path), identifier) do |path, prop_hash|
+ ctx.proplist(target(path), identifier, nil, false) do |path, prop_hash|
properties.merge!(prop_hash)
end
properties
</pre>
Apart from that, it's really faster than the current implementation.
--------------------------------------------------------------------------------
Thanks for feedback. I pushed a bugfix for #properties.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Resolved is used for merging-purposes.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
I would like to see libsvn work for the stable/trunk versions of Redmine. Somewhere along the line the pplr plugin http://github.com/pplr/redmine-libsvn/tree/master broke.
I wish this would be part of the official build! Anyone else agree?
--------------------------------------------------------------------------------
I agree.
--------------------------------------------------------------------------------
Anyone interested in porting this to Redmine 2.0.x?
--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
Jean-Philippe Lang wrote:
> The main reason why it's not used in Redmine is that there's no binaries available for windows.
I've actually been running the libsvn plugin on Windows for years with win32svn binaries available in the win32svn project on sourceforge: http://sourceforge.net/projects/win32svn/ And yes, it's dramatically faster.
So if the lack of Windows binaries was the primary obstacle, can we get libsvn into the core now?
--------------------------------------------------------------------------------
I updated the init.rb for Redmine 2.x and the plugin seems to work fine with Redmine 2.5.1.
https://github.com/SenH/redmine-libsvn
--------------------------------------------------------------------------------
related_issues
relates,New,4448,Subversion password cleanly visible in the process list and some logs