# HG changeset patch
# User Toshi MARUYAMA
# Date 1372267591 -32400
# Node ID a76987e6c76d1a40765e26b43c3ec6ffb306748c
# Parent e7f5c1827cd895ce95de050f4e674c29a99b87ca
scm: mercurial: (#14361)
diff --git a/app/models/repository/mercurial.rb b/app/models/repository/mercurial.rb
--- a/app/models/repository/mercurial.rb
+++ b/app/models/repository/mercurial.rb
@@ -59,7 +59,7 @@ class Repository::Mercurial < Repository
# Returns the readable identifier for the given mercurial changeset
def self.format_changeset_identifier(changeset)
- "#{changeset.revision}:#{changeset.scmid}"
+ "#{changeset.revision}:#{changeset.scmid[0, 12]}"
end
# Returns the identifier for the given Mercurial changeset
# HG changeset patch
# User Toshi MARUYAMA
# Date 1372267591 -32400
# Node ID 0edab2cd545d2b50252aa61cb261633c14e122b9
# Parent a76987e6c76d1a40765e26b43c3ec6ffb306748c
scm: mercurial: (#14361)
diff --git a/app/models/repository/mercurial.rb b/app/models/repository/mercurial.rb
--- a/app/models/repository/mercurial.rb
+++ b/app/models/repository/mercurial.rb
@@ -81,7 +81,11 @@ class Repository::Mercurial < Repository
cs = changesets.where(:revision => s).first
end
return cs if cs
- changesets.where('scmid LIKE ?', "#{s}%").first
+ cs = changesets.where(:scmid => s[0, 12]).first
+ return cs if cs
+ cs = changesets.where('scmid LIKE ?', "#{s}%").first
+ return cs if cs
+ changesets.where('scmid LIKE ?', "#{s[0, 12]}%").first
end
# Returns the latest changesets for +path+; sorted by revision number
# HG changeset patch
# User Toshi MARUYAMA
# Date 1372267592 -32400
# Node ID 06378e16d5a210a03857bf86d70d2ccaeb42e512
# Parent 0edab2cd545d2b50252aa61cb261633c14e122b9
scm: mercurial: (#14361)
diff --git a/lib/redmine/scm/adapters/mercurial/redminehelper.py b/lib/redmine/scm/adapters/mercurial/redminehelper.py
--- a/lib/redmine/scm/adapters/mercurial/redminehelper.py
+++ b/lib/redmine/scm/adapters/mercurial/redminehelper.py
@@ -16,7 +16,7 @@ I/O encoding:
:file path: urlencoded, raw string
:tag name: utf-8
:branch name: utf-8
-:node: 12-digits (short) hex string
+:node: hex string
Output example of rhsummary::
@@ -60,7 +60,7 @@ def _tip(ui, repo):
return repo.changelog.count() - 1
tipctx = repo.changectx(tiprev())
ui.write('\n'
- % (tipctx.rev(), _x(node.short(tipctx.node()))))
+ % (tipctx.rev(), _x(node.hex(tipctx.node()))))
_SPECIAL_TAGS = ('tip',)
@@ -74,7 +74,7 @@ def _tags(ui, repo):
except error.LookupError:
continue
ui.write('\n'
- % (r, _x(node.short(n)), _x(t)))
+ % (r, _x(node.hex(n)), _x(t)))
def _branches(ui, repo):
# see mercurial/commands.py:branches
@@ -89,7 +89,7 @@ def _branches(ui, repo):
for t, n, r in sorted(iterbranches(), key=lambda e: e[2], reverse=True):
if repo.lookup(r) in branchheads(t):
ui.write('\n'
- % (r, _x(node.short(n)), _x(t)))
+ % (r, _x(node.hex(n)), _x(t)))
def _manifest(ui, repo, path, rev):
ctx = repo.changectx(rev)
@@ -114,7 +114,7 @@ def _manifest(ui, repo, path, rev):
tm, tzoffset = fctx.date()
ui.write('\n'
- % (_u(name), fctx.rev(), _x(node.short(fctx.node())),
+ % (_u(name), fctx.rev(), _x(node.hex(fctx.node())),
tm, fctx.size(), ))
ui.write('\n')
# HG changeset patch
# User Toshi MARUYAMA
# Date 1372267592 -32400
# Node ID a626b63a6cc600f18f08c5ad17edc6b49a5b997a
# Parent 06378e16d5a210a03857bf86d70d2ccaeb42e512
scm: mercurial: (#14361)
diff --git a/lib/redmine/scm/adapters/mercurial/hg-template-1.0.tmpl b/lib/redmine/scm/adapters/mercurial/hg-template-1.0.tmpl
--- a/lib/redmine/scm/adapters/mercurial/hg-template-1.0.tmpl
+++ b/lib/redmine/scm/adapters/mercurial/hg-template-1.0.tmpl
@@ -1,12 +1,12 @@
changeset = 'This template must be used with --debug option\n'
changeset_quiet = 'This template must be used with --debug option\n'
changeset_verbose = 'This template must be used with --debug option\n'
-changeset_debug = '\n{author|escape}\n{date|isodatesec}\n\n{file_mods}{file_adds}{file_dels}{file_copies}\n{desc|escape}\n\n{parents}\n\n\n'
+changeset_debug = '\n{author|escape}\n{date|isodatesec}\n\n{file_mods}{file_adds}{file_dels}{file_copies}\n{desc|escape}\n\n{parents}\n\n\n'
file_mod = '{file_mod|urlescape}\n'
file_add = '{file_add|urlescape}\n'
file_del = '{file_del|urlescape}\n'
file_copy = '{name|urlescape}\n'
-parent = '{node|short}\n'
+parent = '{node}\n'
header='\n\n\n'
# footer=""
# HG changeset patch
# User Toshi MARUYAMA
# Date 1372267592 -32400
# Node ID 1fa3ef3ff9c208da51af1b063474b7c7a45f2c48
# Parent a626b63a6cc600f18f08c5ad17edc6b49a5b997a
[mq]: hg-05.diff
diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb
--- a/lib/redmine/scm/adapters/mercurial_adapter.rb
+++ b/lib/redmine/scm/adapters/mercurial_adapter.rb
@@ -234,7 +234,7 @@ module Redmine
# Returns list of nodes in the specified branch
def nodes_in_branch(branch, options={})
- hg_args = ['rhlog', '--template', '{node|short}\n', '--rhbranch', CGI.escape(branch)]
+ hg_args = ['rhlog', '--template', '{node}\n', '--rhbranch', CGI.escape(branch)]
hg_args << '--from' << CGI.escape(branch)
hg_args << '--to' << '0'
hg_args << '--limit' << options[:limit] if options[:limit]
# HG changeset patch
# User Toshi MARUYAMA
# Date 1372267592 -32400
# Node ID 205d5f9b3ff2415c919d88e079a26e140c583633
# Parent 1fa3ef3ff9c208da51af1b063474b7c7a45f2c48
[mq]: hg-03-01.diff
diff --git a/app/models/repository/mercurial.rb b/app/models/repository/mercurial.rb
--- a/app/models/repository/mercurial.rb
+++ b/app/models/repository/mercurial.rb
@@ -81,10 +81,13 @@ class Repository::Mercurial < Repository
cs = changesets.where(:revision => s).first
end
return cs if cs
+ cs = changesets.where('scmid LIKE ?', "#{s}%").first
+ return cs if cs
+ cs_first = changesets.last
+ return nil if cs_first.nil?
+ return nil if cs_first.scmid == 40
cs = changesets.where(:scmid => s[0, 12]).first
return cs if cs
- cs = changesets.where('scmid LIKE ?', "#{s}%").first
- return cs if cs
changesets.where('scmid LIKE ?', "#{s[0, 12]}%").first
end
# HG changeset patch
# User Toshi MARUYAMA
# Date 1372267592 -32400
# Node ID 88c8e946666eaf27f462e8a4d74593da39b11dcb
# Parent 205d5f9b3ff2415c919d88e079a26e140c583633
[mq]: hg-06.diff
diff --git a/app/models/repository/mercurial.rb b/app/models/repository/mercurial.rb
--- a/app/models/repository/mercurial.rb
+++ b/app/models/repository/mercurial.rb
@@ -84,8 +84,7 @@ class Repository::Mercurial < Repository
cs = changesets.where('scmid LIKE ?', "#{s}%").first
return cs if cs
cs_first = changesets.last
- return nil if cs_first.nil?
- return nil if cs_first.scmid == 40
+ return nil if !has_short_id?
cs = changesets.where(:scmid => s[0, 12]).first
return cs if cs
changesets.where('scmid LIKE ?', "#{s[0, 12]}%").first
@@ -121,7 +120,13 @@ 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)
+ branch_nodes = []
+ nodes_in_branch = scm.nodes_in_branch(rev, :limit => branch_limit)
+ branch_nodes += nodes_in_branch
+ if has_short_id?
+ branch_nodes += nodes_in_branch.map {|branch| branch[0, 12] }
+ end
+ args << branch_nodes
elsif last = rev ? find_changeset_by_name(scm.tagmap[rev] || rev) : nil
cond << "#{Changeset.table_name}.id <= ?"
args << last.id
@@ -163,4 +168,11 @@ class Repository::Mercurial < Repository
end
end
end
+
+ def has_short_id?
+ return @has_short_id unless @has_short_id.nil?
+ cs_first = changesets.last
+ @has_short_id = (!cs_first.nil? && cs_first.scmid.size == 12)
+ end
+ private :has_short_id?
end