summaryrefslogtreecommitdiffstats
path: root/app/models/repository
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-02-02 14:53:16 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-02-02 14:53:16 +0000
commitb87a7b8984b38b0e6f6b7106a508c07d3bf4db51 (patch)
treefa1b30348024bece51bba9cea8b1561220cc7770 /app/models/repository
parent85f15f694a6748e546bdabd174f9af9dd8703c7c (diff)
downloadredmine-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/models/repository')
-rw-r--r--app/models/repository/mercurial.rb10
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)