@@ -100,15 +100,20 class Repository::Mercurial < Repository | |||||
100 | all |
|
100 | all | |
101 | end |
|
101 | end | |
102 |
|
102 | |||
|
103 | def scmid_for_inserting_db(scmid) | |||
|
104 | # TODO: switch short or long by existing value in DB | |||
|
105 | scmid[0, 12] | |||
|
106 | end | |||
|
107 | ||||
103 | def nodes_in_branch(rev, branch_limit) |
|
108 | def nodes_in_branch(rev, branch_limit) | |
104 | scm.nodes_in_branch(rev, :limit => branch_limit).collect do |b| |
|
109 | scm.nodes_in_branch(rev, :limit => branch_limit).collect do |b| | |
105 | b[0, 12] |
|
110 | scmid_for_inserting_db(b) | |
106 | end |
|
111 | end | |
107 | end |
|
112 | end | |
108 |
|
113 | |||
109 | def tag_scmid(rev) |
|
114 | def tag_scmid(rev) | |
110 | scmid = scm.tagmap[rev] |
|
115 | scmid = scm.tagmap[rev] | |
111 |
scmid.nil? ? nil : scmid |
|
116 | scmid.nil? ? nil : scmid_for_inserting_db(scmid) | |
112 | end |
|
117 | end | |
113 |
|
118 | |||
114 | def latest_changesets_cond(path, rev, limit) |
|
119 | def latest_changesets_cond(path, rev, limit) | |
@@ -152,16 +157,23 class Repository::Mercurial < Repository | |||||
152 | (db_rev + 1).step(scm_rev, FETCH_AT_ONCE) do |i| |
|
157 | (db_rev + 1).step(scm_rev, FETCH_AT_ONCE) do |i| | |
153 | scm.each_revision('', i, [i + FETCH_AT_ONCE - 1, scm_rev].min) do |re| |
|
158 | scm.each_revision('', i, [i + FETCH_AT_ONCE - 1, scm_rev].min) do |re| | |
154 | transaction do |
|
159 | transaction do | |
155 |
parents = (re.parents || []).collect |
|
160 | parents = (re.parents || []).collect do |rp| | |
|
161 | find_changeset_by_name(scmid_for_inserting_db(rp)) | |||
|
162 | end.compact | |||
156 | cs = Changeset.create(:repository => self, |
|
163 | cs = Changeset.create(:repository => self, | |
157 | :revision => re.revision, |
|
164 | :revision => re.revision, | |
158 | :scmid => re.scmid, |
|
165 | :scmid => scmid_for_inserting_db(re.scmid), | |
159 | :committer => re.author, |
|
166 | :committer => re.author, | |
160 | :committed_on => re.time, |
|
167 | :committed_on => re.time, | |
161 | :comments => re.message, |
|
168 | :comments => re.message, | |
162 | :parents => parents) |
|
169 | :parents => parents) | |
163 | unless cs.new_record? |
|
170 | unless cs.new_record? | |
164 |
re.paths.each |
|
171 | re.paths.each do |e| | |
|
172 | if from_revision = e[:from_revision] | |||
|
173 | e[:from_revision] = scmid_for_inserting_db(from_revision) | |||
|
174 | end | |||
|
175 | cs.create_change(e) | |||
|
176 | end | |||
165 | end |
|
177 | end | |
166 | end |
|
178 | end | |
167 | end |
|
179 | end |
General Comments 0
You need to be logged in to leave comments.
Login now