Vote #67892
未完了Subversion: latest changesets performance improvement.
0%
説明
Redmine executes "svn log" command 2 times (Repository::Subversion#fetch_changesets and Repository::Subversion#latest_changesets) when performing repository/show action. As a result, it takes very long time to complete when the repository is on remote server.
This patch improves performance of the Subversion#latest_changesets method by querying changesets table on the database instead of executing "svn log" command.
journals
How about fixing @Repository.latest_changesets@, then makes use of it?
See attachment:latest-changesets-improvements.diff
app/models/repository.rb:
* filter by @changes.path = "..." OR changes.path LIKE ".../%"@.
* @JOIN changes@ for path condition; then @SELECT DISTINCT changesets.*@ to strip duplicated records.
* @ORDER BY@ statement are declared by @has_many :changesets, :order => ...@, so no need to specify explicitly.
app/models/repository/subversion.rb:
* use @Repository.latest_changesets@
--------------------------------------------------------------------------------
Yuya Nishihara wrote:
> See attachment:latest-changesets-improvements.diff
Oops, it has a bug on escaping LIKE pattern. Fixed as attachment:latest-changesets-improvements-2.diff
--------------------------------------------------------------------------------
Updated Yuya's patch so it uses relative paths for easy patching
(see attachment:latest-changesets-improvements-3.diff)
Usage:
<pre>
cd path/to/your/redmine
patch -p0 < latest-changesets-improvements-3.diff
</pre>
--------------------------------------------------------------------------------
I have updated Yuya's patch as attachment:latest-changesets-improvements-4.diff.
Usage:
<pre>
cd path/to/your/redmine
patch -p1 < latest-changesets-improvements-4.diff
</pre>
The reasons of updating are following.
* Subversion latest_changesets switches "file://" or not.
* Add Mercurial ordering to resolve #3449 and #3567
h2. Subversion latest_changesets switches "file://" or not
Redmine 1.0.4 shows all revisions of *branch* and *tag*.
For example, http://www.redmine.org/projects/redmine/repository/show/tags/1.0.4 shows
r4448 (tagged version 1.0.4), r4447, r4445...
But Yuya's patch shows only r4448.
* attachment:svn-before-patch.png
* attachment:svn-after-patch.png
I have updated as following.
* "file://": use "svn log"
* The others: use only database
It maybe better to be configurable whether using "svn log" or "only database" such as "note-5":http://www.redmine.org/issues/6092#note-5 of #6092.
h2. Improvement of browsing sub directory for other SCMs
This patch improves other SCMs which does not override latest_changesets.
Other SCMs are CVS, Bazaar, Darcs and Mercurial.
Subversion and Git overrides latest_changesets.
Redmine 1.0.4 does not show "latest revisions" of sub directory.
This patch shows it.
Following images are Bazaar images of test repository (source:tags/1.0.4/test/fixtures/repositories/bazaar_repository.tar.gz) .
* attachment:bazaar-before-patch.png
* attachment:bazaar-after-patch.png
h2. Mercurial ordering
Yuya's "hg-changeset-order.patch":http://www.redmine.org/attachments/4218/hg-changeset-order.patch of #4455 overrides Mercurial latest_changesets and add "order by id DESC" to resolve #3449 and #3567.
But, if we apply this patch, we do not need to override it.
--------------------------------------------------------------------------------
한글로 수정합니다.
--------------------------------------------------------------------------------
레퍼런스를 관리합니다.
--------------------------------------------------------------------------------
Fix subject typo.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
related_issues
relates,New,7984,Confusing revisions links on repository root
relates,Closed,7246,Handle "named branch" for mercurial
relates,New,1311,Subversion: Show revision histories for branches
relates,New,3943,Subversion: Directory revision list contains faulty revisions
relates,New,7528,Fetch small initial set of repository changesets
relates,New,7719,SVN Start Revision