Project

General

Profile

Actions

Feature #1536

open

Using libsvn

Added by Pierre Paysant-Le Roux over 16 years ago. Updated over 10 years ago.

Status:
New
Priority:
Normal
Category:
SCM
Target version:
Start date:
2008-06-27
Due date:
% Done:

90%

Estimated time:
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 ?


Files

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

Related issues

Related to Redmine - Defect #4448: Subversion password cleanly visible in the process list and some logsNew2009-12-18

Actions
Actions #1

Updated by Jean-Philippe Lang over 16 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 ?

Actions #2

Updated by Pierre Paysant-Le Roux over 16 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).

Actions #3

Updated by Jean-Philippe Lang over 16 years ago

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

Actions #4

Updated by Pierre Paysant-Le Roux over 15 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.

Actions #5

Updated by Pierre Paysant-Le Roux over 15 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)

Actions #6

Updated by Jens Goldhammer over 15 years ago

+10! Great. Please integrate it into trunk

Actions #7

Updated by Jean-Philippe Lang over 15 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.

Actions #8

Updated by Pierre Paysant-Le Roux over 15 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 ?

Actions #9

Updated by Eric Davis over 15 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.

Actions #10

Updated by Pierre Paysant-Le Roux over 15 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 !

Actions #11

Updated by Jean-Philippe Lang almost 15 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.

Actions #12

Updated by Pierre Paysant-Le Roux almost 15 years ago

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

Actions #13

Updated by Pierre Paysant-Le Roux almost 15 years ago

  • Status changed from New to Resolved
Actions #14

Updated by Mischa The Evil about 13 years ago

  • Status changed from Resolved to New

Resolved is used for merging-purposes.

Actions #15

Updated by Mischa The Evil about 13 years ago

  • Target version set to Unplanned backlogs
Actions #16

Updated by Rafi Greenberg almost 13 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?

Actions #17

Updated by Bruno Medeiros over 12 years ago

I agree.

Actions #18

Updated by Rafi Greenberg over 12 years ago

Anyone interested in porting this to Redmine 2.0.x?

Actions #19

Updated by Ki Won Kim over 12 years ago

+1

Actions #20

Updated by William Baum almost 12 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?

Actions #21

Updated by Sen Haerens over 10 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

Actions

Also available in: Atom PDF