@@ -152,24 +152,16 class Repository::Mercurial < Repository | |||
|
152 | 152 | (db_rev + 1).step(scm_rev, FETCH_AT_ONCE) do |i| |
|
153 | 153 | scm.each_revision('', i, [i + FETCH_AT_ONCE - 1, scm_rev].min) do |re| |
|
154 | 154 | transaction do |
|
155 | scmid = re.scmid[0, 12] | |
|
156 | parents = (re.parents || []).collect do |rp| | |
|
157 | find_changeset_by_name(rp[0, 12]) | |
|
158 | end.compact | |
|
155 | parents = (re.parents || []).collect{|rp| find_changeset_by_name(rp)}.compact | |
|
159 | 156 | cs = Changeset.create(:repository => self, |
|
160 | 157 | :revision => re.revision, |
|
161 | :scmid => scmid, | |
|
158 | :scmid => re.scmid, | |
|
162 | 159 | :committer => re.author, |
|
163 | 160 | :committed_on => re.time, |
|
164 | 161 | :comments => re.message, |
|
165 | 162 | :parents => parents) |
|
166 | 163 | unless cs.new_record? |
|
167 |
re.paths.each |
|
|
168 | if from_revision = e[:from_revision] | |
|
169 | e[:from_revision] = from_revision[0, 12] | |
|
170 | end | |
|
171 | cs.create_change(e) | |
|
172 | end | |
|
164 | re.paths.each { |e| cs.create_change(e) } | |
|
173 | 165 | end |
|
174 | 166 | end |
|
175 | 167 | end |
@@ -1,12 +1,12 | |||
|
1 | 1 | changeset = 'This template must be used with --debug option\n' |
|
2 | 2 | changeset_quiet = 'This template must be used with --debug option\n' |
|
3 | 3 | changeset_verbose = 'This template must be used with --debug option\n' |
|
4 | changeset_debug = '<logentry revision="{rev}" node="{node}">\n<author>{author|escape}</author>\n<date>{date|isodatesec}</date>\n<paths>\n{file_mods}{file_adds}{file_dels}{file_copies}</paths>\n<msg>{desc|escape}</msg>\n<parents>\n{parents}</parents>\n</logentry>\n\n' | |
|
4 | changeset_debug = '<logentry revision="{rev}" node="{node|short}">\n<author>{author|escape}</author>\n<date>{date|isodatesec}</date>\n<paths>\n{file_mods}{file_adds}{file_dels}{file_copies}</paths>\n<msg>{desc|escape}</msg>\n<parents>\n{parents}</parents>\n</logentry>\n\n' | |
|
5 | 5 | |
|
6 | 6 | file_mod = '<path action="M">{file_mod|urlescape}</path>\n' |
|
7 | 7 | file_add = '<path action="A">{file_add|urlescape}</path>\n' |
|
8 | 8 | file_del = '<path action="D">{file_del|urlescape}</path>\n' |
|
9 | 9 | file_copy = '<path-copied copyfrom-path="{source|urlescape}">{name|urlescape}</path-copied>\n' |
|
10 | parent = '<parent>{node}</parent>\n' | |
|
10 | parent = '<parent>{node|short}</parent>\n' | |
|
11 | 11 | header='<?xml version="1.0" encoding="UTF-8" ?>\n<log>\n\n' |
|
12 | 12 | # footer="</log>" |
@@ -16,7 +16,7 I/O encoding: | |||
|
16 | 16 | :file path: urlencoded, raw string |
|
17 | 17 | :tag name: utf-8 |
|
18 | 18 | :branch name: utf-8 |
|
19 | :node: hex string | |
|
19 | :node: 12-digits (short) hex string | |
|
20 | 20 | |
|
21 | 21 | Output example of rhsummary:: |
|
22 | 22 | |
@@ -60,7 +60,7 def _tip(ui, repo): | |||
|
60 | 60 | return repo.changelog.count() - 1 |
|
61 | 61 | tipctx = repo.changectx(tiprev()) |
|
62 | 62 | ui.write('<tip revision="%d" node="%s"/>\n' |
|
63 |
% (tipctx.rev(), _x(node. |
|
|
63 | % (tipctx.rev(), _x(node.short(tipctx.node())))) | |
|
64 | 64 | |
|
65 | 65 | _SPECIAL_TAGS = ('tip',) |
|
66 | 66 | |
@@ -74,7 +74,7 def _tags(ui, repo): | |||
|
74 | 74 | except error.LookupError: |
|
75 | 75 | continue |
|
76 | 76 | ui.write('<tag revision="%d" node="%s" name="%s"/>\n' |
|
77 |
% (r, _x(node. |
|
|
77 | % (r, _x(node.short(n)), _x(t))) | |
|
78 | 78 | |
|
79 | 79 | def _branches(ui, repo): |
|
80 | 80 | # see mercurial/commands.py:branches |
@@ -89,7 +89,7 def _branches(ui, repo): | |||
|
89 | 89 | for t, n, r in sorted(iterbranches(), key=lambda e: e[2], reverse=True): |
|
90 | 90 | if repo.lookup(r) in branchheads(t): |
|
91 | 91 | ui.write('<branch revision="%d" node="%s" name="%s"/>\n' |
|
92 |
% (r, _x(node. |
|
|
92 | % (r, _x(node.short(n)), _x(t))) | |
|
93 | 93 | |
|
94 | 94 | def _manifest(ui, repo, path, rev): |
|
95 | 95 | ctx = repo.changectx(rev) |
@@ -114,7 +114,7 def _manifest(ui, repo, path, rev): | |||
|
114 | 114 | tm, tzoffset = fctx.date() |
|
115 | 115 | ui.write('<file name="%s" revision="%d" node="%s" ' |
|
116 | 116 | 'time="%d" size="%d"/>\n' |
|
117 |
% (_u(name), fctx.rev(), _x(node. |
|
|
117 | % (_u(name), fctx.rev(), _x(node.short(fctx.node())), | |
|
118 | 118 | tm, fctx.size(), )) |
|
119 | 119 | |
|
120 | 120 | ui.write('</manifest>\n') |
@@ -219,7 +219,7 module Redmine | |||
|
219 | 219 | end.sort { |a, b| a[:path] <=> b[:path] } |
|
220 | 220 | parents_ary = [] |
|
221 | 221 | as_ary(le['parents']['parent']).map do |par| |
|
222 |
parents_ary << par['__content__'] if par['__content__'] != "000000000000 |
|
|
222 | parents_ary << par['__content__'] if par['__content__'] != "000000000000" | |
|
223 | 223 | end |
|
224 | 224 | yield Revision.new(:revision => le['revision'], |
|
225 | 225 | :scmid => le['node'], |
@@ -234,7 +234,7 module Redmine | |||
|
234 | 234 | |
|
235 | 235 | # Returns list of nodes in the specified branch |
|
236 | 236 | def nodes_in_branch(branch, options={}) |
|
237 | hg_args = ['rhlog', '--template', '{node}\n', '--rhbranch', CGI.escape(branch)] | |
|
237 | hg_args = ['rhlog', '--template', '{node|short}\n', '--rhbranch', CGI.escape(branch)] | |
|
238 | 238 | hg_args << '--from' << CGI.escape(branch) |
|
239 | 239 | hg_args << '--to' << '0' |
|
240 | 240 | hg_args << '--limit' << options[:limit] if options[:limit] |
@@ -90,7 +90,7 begin | |||
|
90 | 90 | repo_path = adp.info.root_url.gsub(/\\/, "/") |
|
91 | 91 | assert_equal REPOSITORY_PATH, repo_path |
|
92 | 92 | assert_equal '31', adp.info.lastrev.revision |
|
93 |
assert_equal '31eeee7395c8 |
|
|
93 | assert_equal '31eeee7395c8',adp.info.lastrev.scmid | |
|
94 | 94 | end |
|
95 | 95 | end |
|
96 | 96 | |
@@ -98,14 +98,14 begin | |||
|
98 | 98 | revisions = @adapter.revisions(nil, 2, 4) |
|
99 | 99 | assert_equal 3, revisions.size |
|
100 | 100 | assert_equal '2', revisions[0].revision |
|
101 |
assert_equal '400bb8672109 |
|
|
101 | assert_equal '400bb8672109', revisions[0].scmid | |
|
102 | 102 | assert_equal '4', revisions[2].revision |
|
103 |
assert_equal 'def6d2f1254a |
|
|
103 | assert_equal 'def6d2f1254a', revisions[2].scmid | |
|
104 | 104 | |
|
105 | 105 | revisions = @adapter.revisions(nil, 2, 4, {:limit => 2}) |
|
106 | 106 | assert_equal 2, revisions.size |
|
107 | 107 | assert_equal '2', revisions[0].revision |
|
108 |
assert_equal '400bb8672109 |
|
|
108 | assert_equal '400bb8672109', revisions[0].scmid | |
|
109 | 109 | end |
|
110 | 110 | |
|
111 | 111 | def test_parents |
@@ -115,12 +115,12 begin | |||
|
115 | 115 | revs2 = @adapter.revisions(nil, 1, 1) |
|
116 | 116 | assert_equal 1, revs2.size |
|
117 | 117 | assert_equal 1, revs2[0].parents.size |
|
118 |
assert_equal "0885933ad4f6 |
|
|
118 | assert_equal "0885933ad4f6", revs2[0].parents[0] | |
|
119 | 119 | revs3 = @adapter.revisions(nil, 30, 30) |
|
120 | 120 | assert_equal 1, revs3.size |
|
121 | 121 | assert_equal 2, revs3[0].parents.size |
|
122 |
assert_equal "a94b0528f24f |
|
|
123 |
assert_equal "3a330eb32958 |
|
|
122 | assert_equal "a94b0528f24f", revs3[0].parents[0] | |
|
123 | assert_equal "3a330eb32958", revs3[0].parents[1] | |
|
124 | 124 | end |
|
125 | 125 | |
|
126 | 126 | def test_diff |
@@ -213,7 +213,7 begin | |||
|
213 | 213 | assert_equal 'file', readme.kind |
|
214 | 214 | assert_equal 27, readme.size |
|
215 | 215 | assert_equal '1', readme.lastrev.revision |
|
216 |
assert_equal '9d5b5b004199 |
|
|
216 | assert_equal '9d5b5b004199', readme.lastrev.identifier | |
|
217 | 217 | # 2007-12-14 10:24:01 +0100 |
|
218 | 218 | assert_equal Time.gm(2007, 12, 14, 9, 24, 1), readme.lastrev.time |
|
219 | 219 | |
@@ -242,7 +242,7 begin | |||
|
242 | 242 | assert_equal 'file', readme.kind |
|
243 | 243 | assert_equal 21, readme.size |
|
244 | 244 | assert_equal '0', readme.lastrev.revision |
|
245 |
assert_equal '0885933ad4f6 |
|
|
245 | assert_equal '0885933ad4f6', readme.lastrev.identifier | |
|
246 | 246 | # 2007-12-14 10:22:52 +0100 |
|
247 | 247 | assert_equal Time.gm(2007, 12, 14, 9, 22, 52), readme.lastrev.time |
|
248 | 248 | end |
@@ -260,7 +260,7 begin | |||
|
260 | 260 | assert_equal 'file', readme.kind |
|
261 | 261 | assert_equal 365, readme.size |
|
262 | 262 | assert_equal '8', readme.lastrev.revision |
|
263 |
assert_equal 'c51f5bb613cd |
|
|
263 | assert_equal 'c51f5bb613cd', readme.lastrev.identifier | |
|
264 | 264 | # 2001-02-01 00:00:00 -0900 |
|
265 | 265 | assert_equal Time.gm(2001, 2, 1, 9, 0, 0), readme.lastrev.time |
|
266 | 266 | end |
@@ -288,9 +288,9 begin | |||
|
288 | 288 | |
|
289 | 289 | def test_tagmap |
|
290 | 290 | tm = { |
|
291 |
@tag_char_1 => 'adf805632193 |
|
|
292 |
'tag_test.00' => '6987191f453a |
|
|
293 |
'tag-init-revision' => '0885933ad4f6 |
|
|
291 | @tag_char_1 => 'adf805632193', | |
|
292 | 'tag_test.00' => '6987191f453a', | |
|
293 | 'tag-init-revision' => '0885933ad4f6', | |
|
294 | 294 | } |
|
295 | 295 | assert_equal tm, @adapter.tagmap |
|
296 | 296 | end |
@@ -303,36 +303,36 begin | |||
|
303 | 303 | assert_equal 7, brs.length |
|
304 | 304 | assert_equal 'default', brs[0].to_s |
|
305 | 305 | assert_equal '31', brs[0].revision |
|
306 |
assert_equal '31eeee7395c8 |
|
|
306 | assert_equal '31eeee7395c8', brs[0].scmid | |
|
307 | 307 | assert_equal 'test-branch-01', brs[1].to_s |
|
308 | 308 | assert_equal '30', brs[1].revision |
|
309 |
assert_equal 'ad4dc4f80284 |
|
|
309 | assert_equal 'ad4dc4f80284', brs[1].scmid | |
|
310 | 310 | assert_equal @branch_char_1, brs[2].to_s |
|
311 | 311 | assert_equal '27', brs[2].revision |
|
312 |
assert_equal '7bbf4c738e71 |
|
|
312 | assert_equal '7bbf4c738e71', brs[2].scmid | |
|
313 | 313 | assert_equal 'branch (1)[2]&,%.-3_4', brs[3].to_s |
|
314 | 314 | assert_equal '25', brs[3].revision |
|
315 |
assert_equal 'afc61e85bde7 |
|
|
315 | assert_equal 'afc61e85bde7', brs[3].scmid | |
|
316 | 316 | assert_equal @branch_char_0, brs[4].to_s |
|
317 | 317 | assert_equal '23', brs[4].revision |
|
318 |
assert_equal 'c8d3e4887474 |
|
|
318 | assert_equal 'c8d3e4887474', brs[4].scmid | |
|
319 | 319 | assert_equal 'test_branch.latin-1', brs[5].to_s |
|
320 | 320 | assert_equal '22', brs[5].revision |
|
321 |
assert_equal 'c2ffe7da686a |
|
|
321 | assert_equal 'c2ffe7da686a', brs[5].scmid | |
|
322 | 322 | assert_equal 'test-branch-00', brs[6].to_s |
|
323 | 323 | assert_equal '13', brs[6].revision |
|
324 |
assert_equal '3a330eb32958 |
|
|
324 | assert_equal '3a330eb32958', brs[6].scmid | |
|
325 | 325 | end |
|
326 | 326 | |
|
327 | 327 | def test_branchmap |
|
328 | 328 | bm = { |
|
329 |
'default' => '31eeee7395c8 |
|
|
330 |
'test_branch.latin-1' => 'c2ffe7da686a |
|
|
331 |
'branch (1)[2]&,%.-3_4' => 'afc61e85bde7 |
|
|
332 |
'test-branch-00' => '3a330eb32958 |
|
|
333 |
"test-branch-01" => 'ad4dc4f80284 |
|
|
334 |
@branch_char_0 => 'c8d3e4887474 |
|
|
335 |
@branch_char_1 => '7bbf4c738e71 |
|
|
329 | 'default' => '31eeee7395c8', | |
|
330 | 'test_branch.latin-1' => 'c2ffe7da686a', | |
|
331 | 'branch (1)[2]&,%.-3_4' => 'afc61e85bde7', | |
|
332 | 'test-branch-00' => '3a330eb32958', | |
|
333 | "test-branch-01" => 'ad4dc4f80284', | |
|
334 | @branch_char_0 => 'c8d3e4887474', | |
|
335 | @branch_char_1 => '7bbf4c738e71', | |
|
336 | 336 | } |
|
337 | 337 | assert_equal bm, @adapter.branchmap |
|
338 | 338 | end |
@@ -378,18 +378,18 begin | |||
|
378 | 378 | when 'branch (1)[2]&,%.-3_4' |
|
379 | 379 | if @adapter.class.client_version_above?([1, 6]) |
|
380 | 380 | assert_equal 3, nib0.size |
|
381 |
assert_equal |
|
|
381 | assert_equal nib0[0], 'afc61e85bde7' | |
|
382 | 382 | nib2 = @adapter.nodes_in_branch(bra, :limit => 2) |
|
383 | 383 | assert_equal 2, nib2.size |
|
384 |
assert_equal |
|
|
384 | assert_equal nib2[1], '933ca60293d7' | |
|
385 | 385 | end |
|
386 | 386 | when @branch_char_1 |
|
387 | 387 | if @adapter.class.client_version_above?([1, 6]) |
|
388 | 388 | assert_equal 2, nib0.size |
|
389 |
assert_equal |
|
|
389 | assert_equal nib0[1], '08ff3227303e' | |
|
390 | 390 | nib2 = @adapter.nodes_in_branch(bra, :limit => 1) |
|
391 | 391 | assert_equal 1, nib2.size |
|
392 |
assert_equal |
|
|
392 | assert_equal nib2[0], '7bbf4c738e71' | |
|
393 | 393 | end |
|
394 | 394 | end |
|
395 | 395 | end |
General Comments 0
You need to be logged in to leave comments.
Login now