https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292010-10-07T23:55:57ZRedmineRedmine - Feature #6566: Convert the git adapter to ruggedhttps://www.redmine.org/issues/6566?journal_id=211372010-10-07T23:55:57ZEric Davis
<ul></ul><p>When we added git branch support, there were a few patches that used grit. Might be useful to dig though that code and see if there is anything we can use.</p> Redmine - Feature #6566: Convert the git adapter to ruggedhttps://www.redmine.org/issues/6566?journal_id=211552010-10-08T07:44:22ZFelix Schäfer
<ul></ul><p>I was rather planning on making a "clean" adapter, but I'll sure have a look :-)</p> Redmine - Feature #6566: Convert the git adapter to ruggedhttps://www.redmine.org/issues/6566?journal_id=219102010-10-28T21:17:24Zmichael turner
<ul></ul><p>This would be interesting if you can pull it off, although the few minutes I spent poking at Grit (and redmine.git) recently doesn't fill me with confidence. It went something like this...<br /><pre>
$ irb
ruby-1.8.7-p249 > require 'grit'
=> true
ruby-1.8.7-p249 > repo_path = '/home/michael/rails/redmine'
=> "/home/michael/rails/redmine"
ruby-1.8.7-p249 > grit = Grit::Repo.new(repo_path)
=> #<Grit::Repo "/home/michael/rails/redmine/.git">
ruby-1.8.7-p249 > recent_list = grit.commits_since(start = 'master', since = '2010-10-10', extra_options = {})
SystemStackError: stack level too deep
## full traceback omitted ...
ruby-1.8.7-p249 > recent_list_alt = `cd #{repo_path}; git log --since='2010-10-10' --format='%H'`.split
## succeeded. full array of results omitted ...
ruby-1.8.7-p249 > recent_list_alt.count
=> 81
ruby-1.8.7-p249 > Grit.version
=> "2.3.0"
</pre></p>
<p>Digging a little deeper revealed that Grit attempts to load every commit in the repo, and then handle your constraints (since = DATE, etc.) by filtering the complete list in ruby before returning it to you. Apparently redmine.git is a little too large for that approach to work (not even taking performance into account). <br />Hopefully I'm just doing it wrong and you'll have better luck with it. :)</p> Redmine - Feature #6566: Convert the git adapter to ruggedhttps://www.redmine.org/issues/6566?journal_id=241142011-01-14T23:31:22ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Target version</strong> deleted (<del><i>Unplanned backlogs</i></del>)</li></ul><p>Removing it from the Unplanned features since it doesn't seem to be usable and is no longer updated (last release is 2 years old).</p> Redmine - Feature #6566: Convert the git adapter to ruggedhttps://www.redmine.org/issues/6566?journal_id=241162011-01-14T23:49:38ZJohn Dell
<ul></ul><p>Not saying it works, but last release was just yesterday (2.4.1) <a class="external" href="https://github.com/mojombo/grit/">https://github.com/mojombo/grit/</a> so it certainly is being actively developed.</p> Redmine - Feature #6566: Convert the git adapter to ruggedhttps://www.redmine.org/issues/6566?journal_id=241172011-01-15T00:02:38ZJean-Philippe Langjp_lang@yahoo.fr
<ul></ul><p>Right. I was looking at rubyforge :/</p> Redmine - Feature #6566: Convert the git adapter to ruggedhttps://www.redmine.org/issues/6566?journal_id=241272011-01-15T08:48:14ZFelix Schäfer
<ul><li><strong>Assignee</strong> deleted (<del><i>Felix Schäfer</i></del>)</li></ul> Redmine - Feature #6566: Convert the git adapter to ruggedhttps://www.redmine.org/issues/6566?journal_id=442192013-01-13T20:04:03ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Status</strong> changed from <i>7</i> to <i>New</i></li></ul><p>Assigned issue with no assignee back to New status.</p> Redmine - Feature #6566: Convert the git adapter to ruggedhttps://www.redmine.org/issues/6566?journal_id=450022013-01-26T18:05:36ZGabriel Mazetto
<ul></ul><p>Please change this issue to "Covert the git adapter to rugged". Rugged is the oficial ruby library with ruby bindings for libgit2. You can find more about it here: <a class="external" href="https://github.com/libgit2/rugged">https://github.com/libgit2/rugged</a></p> Redmine - Feature #6566: Convert the git adapter to ruggedhttps://www.redmine.org/issues/6566?journal_id=450092013-01-26T19:14:26ZGabriel Mazetto
<ul></ul><p>I haven't found a way to make searches by date without having to walk over all commits, but found some useful ways of walking over the commit trees (to get for example from x to y hashes, that is probably what's going to be used to get latest commits:</p>
<pre>
<code>
1.9.3-p327 > require 'rugged'
=> true
1.9.3-p327 > repo_path = '/path/to/redmine'
=> "/path/to/redmine"
1.9.3-p327 > repo = Rugged::Repository.new(repo_path)
=> #<Rugged::Repository:0x007fa208972820>
1.9.3-p327 > walker = Rugged::Walker.new(repo)
=> #<Rugged::Walker:0x007f8092965d38>
1.9.3-p327 > walker.push("301d7e7cb13a09854a7c87aecedfcbfd27eb98d3")
1.9.3-p327 > walker.hide("c31f498ba6a21fd3e5ce7b9ba2f3b3cdc1b2e05b")
1.9.3-p327 > result = walker.to_a
=> [#<Rugged::Commit:0x007f8092977560>, #<Rugged::Commit:0x007f8092977538>, #<Rugged::Commit:0x007f8092977510>]
or you can just iterate over for a more memory friendly operation:
1.9.3-p327 > walker.push("301d7e7cb13a09854a7c87aecedfcbfd27eb98d3")
1.9.3-p327 > walker.hide("c31f498ba6a21fd3e5ce7b9ba2f3b3cdc1b2e05b")
1.9.3-p327 > walker.each {|c| puts c.inspect}
#<Rugged::Commit:0x007f809295d2f0>
#<Rugged::Commit:0x007f809295d2a0>
#<Rugged::Commit:0x007f809295d250>
</code><br /></pre>
<p>A commit object have the following methods:</p>
<pre><code>=> [:message, :time, :committer, :author, :tree, :parents, :to_hash,..., :oid, :type,...]</code></pre>
<pre>
1.9.3-p327 > c.to_hash
=> {:message=>"German translation updated by Daniel Felix (#10191)\n\ngit-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10998 e93f8b46-1217-0410-a6f0-8f06a7374b81\n", :committer=>{:name=>"Toshi MARUYAMA", :email=>"marutosijp2@yahoo.co.jp", :time=>2012-12-14 14:47:46 UTC}, :author=>{:name=>"Toshi MARUYAMA", :email=>"marutosijp2@yahoo.co.jp", :time=>2012-12-14 14:47:46 UTC}, :tree=>#<Rugged::Tree:0x007f8091100130>, :parents=>[#<Rugged::Commit:0x007f80911006d0>]}
1.9.3-p327 > c.oid
=> "301d7e7cb13a09854a7c87aecedfcbfd27eb98d3"
1.9.3-p327 > c.type
=> "commit"
1.9.3-p327 > Rugged::Version
=> "0.16.0"
</pre> Redmine - Feature #6566: Convert the git adapter to ruggedhttps://www.redmine.org/issues/6566?journal_id=450222013-01-27T04:58:01ZToshi MARUYAMA
<ul><li><strong>Subject</strong> changed from <i>Convert the git adapter to grit</i> to <i>Covert the git adapter to rugged</i></li></ul> Redmine - Feature #6566: Convert the git adapter to ruggedhttps://www.redmine.org/issues/6566?journal_id=450232013-01-27T04:58:42ZToshi MARUYAMA
<ul></ul><p>Gabriel Mazetto wrote:</p>
<blockquote>
<p>Please change this issue to "Covert the git adapter to rugged".</p>
</blockquote>
<p>Done.</p> Redmine - Feature #6566: Convert the git adapter to ruggedhttps://www.redmine.org/issues/6566?journal_id=450282013-01-27T10:06:56ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Subject</strong> changed from <i>Covert the git adapter to rugged</i> to <i>Convert the git adapter to rugged</i></li></ul><p>Typo</p> Redmine - Feature #6566: Convert the git adapter to ruggedhttps://www.redmine.org/issues/6566?journal_id=460382013-02-25T05:34:00ZGabriel Mazetto
<ul></ul><p>I decided to try making the conversion... and have some questions:<br />Do I have to use "AbstractAdapter"? It was designed to be used with command line in mind, which is not the case with rugged. Should I try to create a lean "AbstractAdapter" with libraries in mind? I saw another issue talking about libsvn for example, that could be the potential for this new abstract library, with only the "SCM actions" in mind.</p> Redmine - Feature #6566: Convert the git adapter to ruggedhttps://www.redmine.org/issues/6566?journal_id=460412013-02-25T09:37:22ZGabriel Mazetto
<ul></ul><p><a class="external" href="https://github.com/brodock/redmine/commit/457322722a1e73ec3f13eec12afc311dc6b2f810">https://github.com/brodock/redmine/commit/457322722a1e73ec3f13eec12afc311dc6b2f810</a></p>
<p>Branches and Tags<br />(tests OK)</p>