summaryrefslogtreecommitdiffstats
path: root/app/models/repository/mercurial.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-03-14 13:41:01 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-03-14 13:41:01 +0000
commit8944150ace0186bf244c0f63049fc3a7c272b46c (patch)
treeb786987f3927ccf576882761315730e7c6edfaa3 /app/models/repository/mercurial.rb
parent59c791b2e1801ce9a4061aac362e4161cc8ea50a (diff)
downloadredmine-8944150ace0186bf244c0f63049fc3a7c272b46c.tar.gz
redmine-8944150ace0186bf244c0f63049fc3a7c272b46c.zip
scm: mercurial: latest changesets support named branch (#7246).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5127 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/repository/mercurial.rb')
-rw-r--r--app/models/repository/mercurial.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/app/models/repository/mercurial.rb b/app/models/repository/mercurial.rb
index 6ea61b0c7..a595e4275 100644
--- a/app/models/repository/mercurial.rb
+++ b/app/models/repository/mercurial.rb
@@ -94,8 +94,17 @@ class Repository::Mercurial < Repository
def latest_changesets_cond(path, rev, limit)
cond, args = [], []
-
- if last = rev ? find_changeset_by_name(scm.tagmap[rev] || rev) : nil
+ if scm.branchmap.member? rev
+ # Mercurial named branch is *stable* in each revision.
+ # So, named branch can be stored in database.
+ # Mercurial provides *bookmark* which is equivalent with git branch.
+ # But, bookmark is not implemented.
+ cond << "#{Changeset.table_name}.scmid IN (?)"
+ # Revisions in root directory and sub directory are not equal.
+ # So, in order to get correct limit, we need to get all revisions.
+ # But, it is very heavy.
+ args << scm.nodes_in_branch(rev, :limit => limit)
+ elsif last = rev ? find_changeset_by_name(scm.tagmap[rev] || rev) : nil
cond << "#{Changeset.table_name}.id <= ?"
args << last.id
end