Patch #6159


Subversion: latest changesets performance improvement.

Added by Go MAEDA almost 14 years ago. Updated about 13 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


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.


svn_latest_changesets_improvement.diff (1.13 KB) svn_latest_changesets_improvement.diff Go MAEDA, 2010-08-17 16:28
latest-changesets-improvements.diff (2.79 KB) latest-changesets-improvements.diff Yuya Nishihara, 2010-08-19 16:21
latest-changesets-improvements-2.diff (2.82 KB) latest-changesets-improvements-2.diff Yuya Nishihara, 2010-08-19 17:10
latest-changesets-improvements-3.diff (2.12 KB) latest-changesets-improvements-3.diff Enrique Garcia, 2010-11-16 16:33
latest-changesets-improvements-4.diff (2.94 KB) latest-changesets-improvements-4.diff Toshi MARUYAMA, 2010-11-30 07:18
svn-before-patch.png (124 KB) svn-before-patch.png Toshi MARUYAMA, 2010-11-30 07:18
svn-after-patch.png (105 KB) svn-after-patch.png Toshi MARUYAMA, 2010-11-30 07:18
bazaar-before-patch.png (51.3 KB) bazaar-before-patch.png Toshi MARUYAMA, 2010-11-30 07:18
bazaar-after-patch.png (61.1 KB) bazaar-after-patch.png Toshi MARUYAMA, 2010-11-30 07:18

Related issues

Related to Redmine - Defect #7984: Confusing revisions links on repository rootNewToshi MARUYAMA2011-03-24

Related to Redmine - Feature #7246: Handle "named branch" for mercurialClosedToshi MARUYAMA2011-01-07

Related to Redmine - Feature #1311: Subversion: Show revision histories for branchesNew2008-05-27

Related to Redmine - Defect #3943: Subversion: Directory revision list contains faulty revisionsNew2009-09-29

Related to Redmine - Patch #7528: Fetch small initial set of repository changesetsNew2011-02-03

Related to Redmine - Feature #7719: SVN Start RevisionNew2011-02-25

Actions #1

Updated by Yuya Nishihara almost 14 years ago

How about fixing Repository.latest_changesets, then makes use of it?
See latest-changesets-improvements.diff

  • 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.
  • use Repository.latest_changesets
Actions #3

Updated by Enrique Garcia over 13 years ago

Updated Yuya's patch so it uses relative paths for easy patching

(see latest-changesets-improvements-3.diff)


cd path/to/your/redmine
patch -p0 < latest-changesets-improvements-3.diff
Actions #4

Updated by Toshi MARUYAMA over 13 years ago

I have updated Yuya's patch as latest-changesets-improvements-4.diff.


cd path/to/your/redmine
patch -p1 < latest-changesets-improvements-4.diff

The reasons of updating are following.

  • Subversion latest_changesets switches "file://" or not.
  • Add Mercurial ordering to resolve #3449 and #3567

Subversion latest_changesets switches "file://" or not

Redmine 1.0.4 shows all revisions of branch and tag.
For example, shows
r4448 (tagged version 1.0.4), r4447, r4445...
But Yuya's patch shows only r4448.

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 of #6092.

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

Mercurial ordering

Yuya's 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.

Actions #5

Updated by 후지 이 over 13 years ago

한글로 수정합니다.

Actions #6

Updated by 후지 이 over 13 years ago

레퍼런스를 관리합니다.

Actions #7

Updated by Toshi MARUYAMA over 13 years ago

  • Subject changed from Repository::Subversion#latest_changesets performance inprovement. to Repository::Subversion#latest_changesets performance improvement.

Fix subject typo.

Actions #8

Updated by Toshi MARUYAMA about 13 years ago

  • Subject changed from Repository::Subversion#latest_changesets performance improvement. to Subversion: latest changesets performance improvement.

Also available in: Atom PDF