diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-02-01 07:46:45 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-02-01 07:46:45 +0000 |
commit | 6ea2b7a43b7e5e55ff549285db5c6764cf530f8b (patch) | |
tree | 57b8e833b86f2813706d68d3f1038e9daa420f69 /app/models/repository | |
parent | 28fbc270fae8dd674cace231b782362f73a27290 (diff) | |
download | redmine-6ea2b7a43b7e5e55ff549285db5c6764cf530f8b.tar.gz redmine-6ea2b7a43b7e5e55ff549285db5c6764cf530f8b.zip |
scm: mercurial: split Repository::Mercurial#latest_changesets_cond for short and long id (#14361)
git-svn-id: http://svn.redmine.org/redmine/trunk@12751 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/repository')
-rw-r--r-- | app/models/repository/mercurial.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/app/models/repository/mercurial.rb b/app/models/repository/mercurial.rb index dcd07dad5..5eedbb7eb 100644 --- a/app/models/repository/mercurial.rb +++ b/app/models/repository/mercurial.rb @@ -100,6 +100,17 @@ class Repository::Mercurial < Repository all end + def nodes_in_branch(rev, branch_limit) + scm.nodes_in_branch(rev, :limit => branch_limit).collect do |b| + b[0, 12] + end + end + + def tag_scmid(rev) + scmid = scm.tagmap[rev] + scmid.nil? ? nil : scmid[0, 12] + end + def latest_changesets_cond(path, rev, limit) cond, args = [], [] if scm.branchmap.member? rev @@ -114,8 +125,8 @@ class Repository::Mercurial < Repository # Mercurial does not treat direcotry. # So, "hg log DIR" is very heavy. branch_limit = path.blank? ? limit : ( limit * 5 ) - args << scm.nodes_in_branch(rev, :limit => branch_limit) - elsif last = rev ? find_changeset_by_name(scm.tagmap[rev] || rev) : nil + args << nodes_in_branch(rev, branch_limit) + elsif last = rev ? find_changeset_by_name(tag_scmid(rev) || rev) : nil cond << "#{Changeset.table_name}.id <= ?" args << last.id end |