Feature #1536

Using libsvn

Added by Pierre Paysant-Le Roux over 9 years ago. Updated over 3 years ago.

Status:NewStart date:2008-06-27
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

90%

Category:SCM
Target version:Unplanned
Resolution:

Description

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 ?

patch_libsvn - A subversion adapter using libsvn ruby bindings (15.7 KB) Pierre Paysant-Le Roux, 2009-05-03 19:34


Related issues

Related to Redmine - Defect #4448: Subversion password cleanly visible in the process list a... New 2009-12-18

History

#1 Updated by Jean-Philippe Lang over 9 years ago

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 ?

#2 Updated by Pierre Paysant-Le Roux over 9 years ago

There is no documentation specific to the ruby bindings. Here 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).

#3 Updated by Jean-Philippe Lang over 9 years ago

For sure, it would be faster.
Having an alternate adapter that uses libsvn would be nice indeed.

#4 Updated by Pierre Paysant-Le Roux over 8 years ago

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.

#5 Updated by Pierre Paysant-Le Roux over 8 years ago

A simple benchmark : calling Adapter#revisions method on a local repository with 1000 simple changesets :

               user     system      total        real
libsvn       0.150000   0.020000   0.170000 (  0.230447)
svn command  8.150000   0.480000   8.750000 (  8.987669)

#6 Updated by Jens Goldhammer over 8 years ago

+10! Great. Please integrate it into trunk

#7 Updated by Jean-Philippe Lang over 8 years ago

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.

#8 Updated by Pierre Paysant-Le Roux about 8 years ago

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 ?

#9 Updated by Eric Davis about 8 years ago

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:

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

You can also use the module include pattern if you don't want to reopen the SubversionAdapter class.

#10 Updated by Pierre Paysant-Le Roux about 8 years ago

I created a plugin. It is available on github :
http://github.com/pplr/redmine-libsvn/tree/master

Suggestions and beta testers are welcome !

#11 Updated by Jean-Philippe Lang almost 8 years ago

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:

--- 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

Apart from that, it's really faster than the current implementation.

#12 Updated by Pierre Paysant-Le Roux almost 8 years ago

Thanks for feedback. I pushed a bugfix for #properties.

#13 Updated by Pierre Paysant-Le Roux almost 8 years ago

  • Status changed from New to Resolved

#14 Updated by Mischa The Evil about 6 years ago

  • Status changed from Resolved to New

Resolved is used for merging-purposes.

#15 Updated by Mischa The Evil about 6 years ago

  • Target version set to Unplanned

#16 Updated by Rafi Greenberg over 5 years ago

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?

#17 Updated by Bruno Medeiros over 5 years ago

I agree.

#18 Updated by Rafi Greenberg over 5 years ago

Anyone interested in porting this to Redmine 2.0.x?

#19 Updated by Ki Won Kim over 5 years ago

+1

#20 Updated by William Baum almost 5 years ago

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?

#21 Updated by Sen Haerens over 3 years ago

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

Also available in: Atom PDF