# HG changeset patch
# User Toshi MARUYAMA
# Date 1372260193 -32400
# Node ID c22c4778c7acb4f7f3e70c23ab84b307158e9520
# Parent  e7f5c1827cd895ce95de050f4e674c29a99b87ca
qnew
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 1372260193 -32400
# Node ID cfb77c8c51d3ea09140ffc9089f25a879fb126ff
# Parent  c22c4778c7acb4f7f3e70c23ab84b307158e9520
[mq]: hg-02.diff
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 1372260193 -32400
# Node ID 4f315bf07040bea42806b7252bdabf3f2a15be09
# Parent  cfb77c8c51d3ea09140ffc9089f25a879fb126ff
imported patch hg-03.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,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 1372260193 -32400
# Node ID 9c48849c792660e328ec4706443ce31dbd828475
# Parent  4f315bf07040bea42806b7252bdabf3f2a15be09
imported patch hg-04.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
@@ -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