##// END OF EJS Templates
scm: mercurial: use long id in adapter level (#14361)...
Toshi MARUYAMA -
r12486:5872d079e632
parent child
Show More
@@ -1,12 +1,12
1 changeset = 'This template must be used with --debug option\n'
1 changeset = 'This template must be used with --debug option\n'
2 changeset_quiet = 'This template must be used with --debug option\n'
2 changeset_quiet = 'This template must be used with --debug option\n'
3 changeset_verbose = 'This template must be used with --debug option\n'
3 changeset_verbose = 'This template must be used with --debug option\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'
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'
5
5
6 file_mod = '<path action="M">{file_mod|urlescape}</path>\n'
6 file_mod = '<path action="M">{file_mod|urlescape}</path>\n'
7 file_add = '<path action="A">{file_add|urlescape}</path>\n'
7 file_add = '<path action="A">{file_add|urlescape}</path>\n'
8 file_del = '<path action="D">{file_del|urlescape}</path>\n'
8 file_del = '<path action="D">{file_del|urlescape}</path>\n'
9 file_copy = '<path-copied copyfrom-path="{source|urlescape}">{name|urlescape}</path-copied>\n'
9 file_copy = '<path-copied copyfrom-path="{source|urlescape}">{name|urlescape}</path-copied>\n'
10 parent = '<parent>{node|short}</parent>\n'
10 parent = '<parent>{node}</parent>\n'
11 header='<?xml version="1.0" encoding="UTF-8" ?>\n<log>\n\n'
11 header='<?xml version="1.0" encoding="UTF-8" ?>\n<log>\n\n'
12 # footer="</log>"
12 # footer="</log>"
@@ -16,7 +16,7 I/O encoding:
16 :file path: urlencoded, raw string
16 :file path: urlencoded, raw string
17 :tag name: utf-8
17 :tag name: utf-8
18 :branch name: utf-8
18 :branch name: utf-8
19 :node: 12-digits (short) hex string
19 :node: hex string
20
20
21 Output example of rhsummary::
21 Output example of rhsummary::
22
22
@@ -60,7 +60,7 def _tip(ui, repo):
60 return repo.changelog.count() - 1
60 return repo.changelog.count() - 1
61 tipctx = repo.changectx(tiprev())
61 tipctx = repo.changectx(tiprev())
62 ui.write('<tip revision="%d" node="%s"/>\n'
62 ui.write('<tip revision="%d" node="%s"/>\n'
63 % (tipctx.rev(), _x(node.short(tipctx.node()))))
63 % (tipctx.rev(), _x(node.hex(tipctx.node()))))
64
64
65 _SPECIAL_TAGS = ('tip',)
65 _SPECIAL_TAGS = ('tip',)
66
66
@@ -74,7 +74,7 def _tags(ui, repo):
74 except error.LookupError:
74 except error.LookupError:
75 continue
75 continue
76 ui.write('<tag revision="%d" node="%s" name="%s"/>\n'
76 ui.write('<tag revision="%d" node="%s" name="%s"/>\n'
77 % (r, _x(node.short(n)), _x(t)))
77 % (r, _x(node.hex(n)), _x(t)))
78
78
79 def _branches(ui, repo):
79 def _branches(ui, repo):
80 # see mercurial/commands.py:branches
80 # see mercurial/commands.py:branches
@@ -89,7 +89,7 def _branches(ui, repo):
89 for t, n, r in sorted(iterbranches(), key=lambda e: e[2], reverse=True):
89 for t, n, r in sorted(iterbranches(), key=lambda e: e[2], reverse=True):
90 if repo.lookup(r) in branchheads(t):
90 if repo.lookup(r) in branchheads(t):
91 ui.write('<branch revision="%d" node="%s" name="%s"/>\n'
91 ui.write('<branch revision="%d" node="%s" name="%s"/>\n'
92 % (r, _x(node.short(n)), _x(t)))
92 % (r, _x(node.hex(n)), _x(t)))
93
93
94 def _manifest(ui, repo, path, rev):
94 def _manifest(ui, repo, path, rev):
95 ctx = repo.changectx(rev)
95 ctx = repo.changectx(rev)
@@ -114,7 +114,7 def _manifest(ui, repo, path, rev):
114 tm, tzoffset = fctx.date()
114 tm, tzoffset = fctx.date()
115 ui.write('<file name="%s" revision="%d" node="%s" '
115 ui.write('<file name="%s" revision="%d" node="%s" '
116 'time="%d" size="%d"/>\n'
116 'time="%d" size="%d"/>\n'
117 % (_u(name), fctx.rev(), _x(node.short(fctx.node())),
117 % (_u(name), fctx.rev(), _x(node.hex(fctx.node())),
118 tm, fctx.size(), ))
118 tm, fctx.size(), ))
119
119
120 ui.write('</manifest>\n')
120 ui.write('</manifest>\n')
@@ -219,7 +219,7 module Redmine
219 end.sort { |a, b| a[:path] <=> b[:path] }
219 end.sort { |a, b| a[:path] <=> b[:path] }
220 parents_ary = []
220 parents_ary = []
221 as_ary(le['parents']['parent']).map do |par|
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__'] != "0000000000000000000000000000000000000000"
223 end
223 end
224 yield Revision.new(:revision => le['revision'],
224 yield Revision.new(:revision => le['revision'],
225 :scmid => le['node'],
225 :scmid => le['node'],
@@ -234,7 +234,7 module Redmine
234
234
235 # Returns list of nodes in the specified branch
235 # Returns list of nodes in the specified branch
236 def nodes_in_branch(branch, options={})
236 def nodes_in_branch(branch, options={})
237 hg_args = ['rhlog', '--template', '{node|short}\n', '--rhbranch', CGI.escape(branch)]
237 hg_args = ['rhlog', '--template', '{node}\n', '--rhbranch', CGI.escape(branch)]
238 hg_args << '--from' << CGI.escape(branch)
238 hg_args << '--from' << CGI.escape(branch)
239 hg_args << '--to' << '0'
239 hg_args << '--to' << '0'
240 hg_args << '--limit' << options[:limit] if options[:limit]
240 hg_args << '--limit' << options[:limit] if options[:limit]
@@ -90,7 +90,7 begin
90 repo_path = adp.info.root_url.gsub(/\\/, "/")
90 repo_path = adp.info.root_url.gsub(/\\/, "/")
91 assert_equal REPOSITORY_PATH, repo_path
91 assert_equal REPOSITORY_PATH, repo_path
92 assert_equal '31', adp.info.lastrev.revision
92 assert_equal '31', adp.info.lastrev.revision
93 assert_equal '31eeee7395c8',adp.info.lastrev.scmid
93 assert_equal '31eeee7395c8c78e66dd54c50addd078d10b2355',adp.info.lastrev.scmid
94 end
94 end
95 end
95 end
96
96
@@ -98,14 +98,14 begin
98 revisions = @adapter.revisions(nil, 2, 4)
98 revisions = @adapter.revisions(nil, 2, 4)
99 assert_equal 3, revisions.size
99 assert_equal 3, revisions.size
100 assert_equal '2', revisions[0].revision
100 assert_equal '2', revisions[0].revision
101 assert_equal '400bb8672109', revisions[0].scmid
101 assert_equal '400bb86721098697c7d17b3724c794c57636de70', revisions[0].scmid
102 assert_equal '4', revisions[2].revision
102 assert_equal '4', revisions[2].revision
103 assert_equal 'def6d2f1254a', revisions[2].scmid
103 assert_equal 'def6d2f1254a56fb8fbe9ec3b5c0451674dbd8b8', revisions[2].scmid
104
104
105 revisions = @adapter.revisions(nil, 2, 4, {:limit => 2})
105 revisions = @adapter.revisions(nil, 2, 4, {:limit => 2})
106 assert_equal 2, revisions.size
106 assert_equal 2, revisions.size
107 assert_equal '2', revisions[0].revision
107 assert_equal '2', revisions[0].revision
108 assert_equal '400bb8672109', revisions[0].scmid
108 assert_equal '400bb86721098697c7d17b3724c794c57636de70', revisions[0].scmid
109 end
109 end
110
110
111 def test_parents
111 def test_parents
@@ -115,12 +115,12 begin
115 revs2 = @adapter.revisions(nil, 1, 1)
115 revs2 = @adapter.revisions(nil, 1, 1)
116 assert_equal 1, revs2.size
116 assert_equal 1, revs2.size
117 assert_equal 1, revs2[0].parents.size
117 assert_equal 1, revs2[0].parents.size
118 assert_equal "0885933ad4f6", revs2[0].parents[0]
118 assert_equal "0885933ad4f68d77c2649cd11f8311276e7ef7ce", revs2[0].parents[0]
119 revs3 = @adapter.revisions(nil, 30, 30)
119 revs3 = @adapter.revisions(nil, 30, 30)
120 assert_equal 1, revs3.size
120 assert_equal 1, revs3.size
121 assert_equal 2, revs3[0].parents.size
121 assert_equal 2, revs3[0].parents.size
122 assert_equal "a94b0528f24f", revs3[0].parents[0]
122 assert_equal "a94b0528f24fe05ebaef496ae0500bb050772e36", revs3[0].parents[0]
123 assert_equal "3a330eb32958", revs3[0].parents[1]
123 assert_equal "3a330eb329586ea2adb3f83237c23310e744ebe9", revs3[0].parents[1]
124 end
124 end
125
125
126 def test_diff
126 def test_diff
@@ -213,7 +213,7 begin
213 assert_equal 'file', readme.kind
213 assert_equal 'file', readme.kind
214 assert_equal 27, readme.size
214 assert_equal 27, readme.size
215 assert_equal '1', readme.lastrev.revision
215 assert_equal '1', readme.lastrev.revision
216 assert_equal '9d5b5b004199', readme.lastrev.identifier
216 assert_equal '9d5b5b00419901478496242e0768deba1ce8c51e', readme.lastrev.identifier
217 # 2007-12-14 10:24:01 +0100
217 # 2007-12-14 10:24:01 +0100
218 assert_equal Time.gm(2007, 12, 14, 9, 24, 1), readme.lastrev.time
218 assert_equal Time.gm(2007, 12, 14, 9, 24, 1), readme.lastrev.time
219
219
@@ -242,7 +242,7 begin
242 assert_equal 'file', readme.kind
242 assert_equal 'file', readme.kind
243 assert_equal 21, readme.size
243 assert_equal 21, readme.size
244 assert_equal '0', readme.lastrev.revision
244 assert_equal '0', readme.lastrev.revision
245 assert_equal '0885933ad4f6', readme.lastrev.identifier
245 assert_equal '0885933ad4f68d77c2649cd11f8311276e7ef7ce', readme.lastrev.identifier
246 # 2007-12-14 10:22:52 +0100
246 # 2007-12-14 10:22:52 +0100
247 assert_equal Time.gm(2007, 12, 14, 9, 22, 52), readme.lastrev.time
247 assert_equal Time.gm(2007, 12, 14, 9, 22, 52), readme.lastrev.time
248 end
248 end
@@ -260,7 +260,7 begin
260 assert_equal 'file', readme.kind
260 assert_equal 'file', readme.kind
261 assert_equal 365, readme.size
261 assert_equal 365, readme.size
262 assert_equal '8', readme.lastrev.revision
262 assert_equal '8', readme.lastrev.revision
263 assert_equal 'c51f5bb613cd', readme.lastrev.identifier
263 assert_equal 'c51f5bb613cd60793c2a9fe9df29332e74bb949f', readme.lastrev.identifier
264 # 2001-02-01 00:00:00 -0900
264 # 2001-02-01 00:00:00 -0900
265 assert_equal Time.gm(2001, 2, 1, 9, 0, 0), readme.lastrev.time
265 assert_equal Time.gm(2001, 2, 1, 9, 0, 0), readme.lastrev.time
266 end
266 end
@@ -285,7 +285,7 begin
285 assert_equal "README", entry.path
285 assert_equal "README", entry.path
286 assert_equal "file", entry.kind
286 assert_equal "file", entry.kind
287 assert_equal '0', entry.lastrev.revision
287 assert_equal '0', entry.lastrev.revision
288 assert_equal '0885933ad4f6', entry.lastrev.identifier
288 assert_equal '0885933ad4f68d77c2649cd11f8311276e7ef7ce', entry.lastrev.identifier
289 end
289 end
290 end
290 end
291 ["sources", "/sources", "/sources/"].each do |path|
291 ["sources", "/sources", "/sources/"].each do |path|
@@ -301,7 +301,7 begin
301 assert_equal "sources/watchers_controller.rb", entry.path
301 assert_equal "sources/watchers_controller.rb", entry.path
302 assert_equal "file", entry.kind
302 assert_equal "file", entry.kind
303 assert_equal '0', entry.lastrev.revision
303 assert_equal '0', entry.lastrev.revision
304 assert_equal '0885933ad4f6', entry.lastrev.identifier
304 assert_equal '0885933ad4f68d77c2649cd11f8311276e7ef7ce', entry.lastrev.identifier
305 end
305 end
306 end
306 end
307 end
307 end
@@ -329,9 +329,9 begin
329
329
330 def test_tagmap
330 def test_tagmap
331 tm = {
331 tm = {
332 @tag_char_1 => 'adf805632193',
332 @tag_char_1 => 'adf805632193500ad3b615cd04f58f9b0769f576',
333 'tag_test.00' => '6987191f453a',
333 'tag_test.00' => '6987191f453a5f6557018d522feea2c450d5588d',
334 'tag-init-revision' => '0885933ad4f6',
334 'tag-init-revision' => '0885933ad4f68d77c2649cd11f8311276e7ef7ce',
335 }
335 }
336 assert_equal tm, @adapter.tagmap
336 assert_equal tm, @adapter.tagmap
337 end
337 end
@@ -344,36 +344,36 begin
344 assert_equal 7, brs.length
344 assert_equal 7, brs.length
345 assert_equal 'default', brs[0].to_s
345 assert_equal 'default', brs[0].to_s
346 assert_equal '31', brs[0].revision
346 assert_equal '31', brs[0].revision
347 assert_equal '31eeee7395c8', brs[0].scmid
347 assert_equal '31eeee7395c8c78e66dd54c50addd078d10b2355', brs[0].scmid
348 assert_equal 'test-branch-01', brs[1].to_s
348 assert_equal 'test-branch-01', brs[1].to_s
349 assert_equal '30', brs[1].revision
349 assert_equal '30', brs[1].revision
350 assert_equal 'ad4dc4f80284', brs[1].scmid
350 assert_equal 'ad4dc4f80284a4f9168b77e0b6de288e5d207ee7', brs[1].scmid
351 assert_equal @branch_char_1, brs[2].to_s
351 assert_equal @branch_char_1, brs[2].to_s
352 assert_equal '27', brs[2].revision
352 assert_equal '27', brs[2].revision
353 assert_equal '7bbf4c738e71', brs[2].scmid
353 assert_equal '7bbf4c738e7145149d2e5eb1eed1d3a8ddd3b914', brs[2].scmid
354 assert_equal 'branch (1)[2]&,%.-3_4', brs[3].to_s
354 assert_equal 'branch (1)[2]&,%.-3_4', brs[3].to_s
355 assert_equal '25', brs[3].revision
355 assert_equal '25', brs[3].revision
356 assert_equal 'afc61e85bde7', brs[3].scmid
356 assert_equal 'afc61e85bde74de930e5846c8451bd55b5bafc9c', brs[3].scmid
357 assert_equal @branch_char_0, brs[4].to_s
357 assert_equal @branch_char_0, brs[4].to_s
358 assert_equal '23', brs[4].revision
358 assert_equal '23', brs[4].revision
359 assert_equal 'c8d3e4887474', brs[4].scmid
359 assert_equal 'c8d3e4887474af6a589190140508037ebaa9d9c3', brs[4].scmid
360 assert_equal 'test_branch.latin-1', brs[5].to_s
360 assert_equal 'test_branch.latin-1', brs[5].to_s
361 assert_equal '22', brs[5].revision
361 assert_equal '22', brs[5].revision
362 assert_equal 'c2ffe7da686a', brs[5].scmid
362 assert_equal 'c2ffe7da686aa3d956e59f2a2854cf8980a8b768', brs[5].scmid
363 assert_equal 'test-branch-00', brs[6].to_s
363 assert_equal 'test-branch-00', brs[6].to_s
364 assert_equal '13', brs[6].revision
364 assert_equal '13', brs[6].revision
365 assert_equal '3a330eb32958', brs[6].scmid
365 assert_equal '3a330eb329586ea2adb3f83237c23310e744ebe9', brs[6].scmid
366 end
366 end
367
367
368 def test_branchmap
368 def test_branchmap
369 bm = {
369 bm = {
370 'default' => '31eeee7395c8',
370 'default' => '31eeee7395c8c78e66dd54c50addd078d10b2355',
371 'test_branch.latin-1' => 'c2ffe7da686a',
371 'test_branch.latin-1' => 'c2ffe7da686aa3d956e59f2a2854cf8980a8b768',
372 'branch (1)[2]&,%.-3_4' => 'afc61e85bde7',
372 'branch (1)[2]&,%.-3_4' => 'afc61e85bde74de930e5846c8451bd55b5bafc9c',
373 'test-branch-00' => '3a330eb32958',
373 'test-branch-00' => '3a330eb329586ea2adb3f83237c23310e744ebe9',
374 "test-branch-01" => 'ad4dc4f80284',
374 "test-branch-01" => 'ad4dc4f80284a4f9168b77e0b6de288e5d207ee7',
375 @branch_char_0 => 'c8d3e4887474',
375 @branch_char_0 => 'c8d3e4887474af6a589190140508037ebaa9d9c3',
376 @branch_char_1 => '7bbf4c738e71',
376 @branch_char_1 => '7bbf4c738e7145149d2e5eb1eed1d3a8ddd3b914',
377 }
377 }
378 assert_equal bm, @adapter.branchmap
378 assert_equal bm, @adapter.branchmap
379 end
379 end
@@ -419,18 +419,18 begin
419 when 'branch (1)[2]&,%.-3_4'
419 when 'branch (1)[2]&,%.-3_4'
420 if @adapter.class.client_version_above?([1, 6])
420 if @adapter.class.client_version_above?([1, 6])
421 assert_equal 3, nib0.size
421 assert_equal 3, nib0.size
422 assert_equal nib0[0], 'afc61e85bde7'
422 assert_equal 'afc61e85bde74de930e5846c8451bd55b5bafc9c', nib0[0]
423 nib2 = @adapter.nodes_in_branch(bra, :limit => 2)
423 nib2 = @adapter.nodes_in_branch(bra, :limit => 2)
424 assert_equal 2, nib2.size
424 assert_equal 2, nib2.size
425 assert_equal nib2[1], '933ca60293d7'
425 assert_equal '933ca60293d78f7c7979dd123cc0c02431683575', nib2[1]
426 end
426 end
427 when @branch_char_1
427 when @branch_char_1
428 if @adapter.class.client_version_above?([1, 6])
428 if @adapter.class.client_version_above?([1, 6])
429 assert_equal 2, nib0.size
429 assert_equal 2, nib0.size
430 assert_equal nib0[1], '08ff3227303e'
430 assert_equal '08ff3227303ec0dfcc818efa8e9cc652fe81859f', nib0[1]
431 nib2 = @adapter.nodes_in_branch(bra, :limit => 1)
431 nib2 = @adapter.nodes_in_branch(bra, :limit => 1)
432 assert_equal 1, nib2.size
432 assert_equal 1, nib2.size
433 assert_equal nib2[0], '7bbf4c738e71'
433 assert_equal '7bbf4c738e7145149d2e5eb1eed1d3a8ddd3b914', nib2[0]
434 end
434 end
435 end
435 end
436 end
436 end
General Comments 0
You need to be logged in to leave comments. Login now