summaryrefslogtreecommitdiffstats
path: root/app/models/repository
diff options
context:
space:
mode:
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)