diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-02-02 14:53:16 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-02-02 14:53:16 +0000 |
commit | b87a7b8984b38b0e6f6b7106a508c07d3bf4db51 (patch) | |
tree | fa1b30348024bece51bba9cea8b1561220cc7770 /app | |
parent | 85f15f694a6748e546bdabd174f9af9dd8703c7c (diff) | |
download | redmine-b87a7b8984b38b0e6f6b7106a508c07d3bf4db51.tar.gz redmine-b87a7b8984b38b0e6f6b7106a508c07d3bf4db51.zip |
scm: mercurial: insert long id to DB unless existing id in DB is not short id (#14361)
git-svn-id: http://svn.redmine.org/redmine/trunk@12777 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/repository/mercurial.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/models/repository/mercurial.rb b/app/models/repository/mercurial.rb index 36b73e920..f9339d800 100644 --- a/app/models/repository/mercurial.rb +++ b/app/models/repository/mercurial.rb @@ -122,9 +122,15 @@ class Repository::Mercurial < Repository all end + def is_short_id_in_db? + return @is_short_id_in_db unless @is_short_id_in_db.nil? + cs = changesets.first + @is_short_id_in_db = (!cs.nil? && cs.scmid.length != 40) + end + private :is_short_id_in_db? + def scmid_for_inserting_db(scmid) - # TODO: switch short or long by existing value in DB - scmid[0, 12] + is_short_id_in_db? ? scmid[0, 12] : scmid end def nodes_in_branch(rev, branch_limit) |