back out r12752 (#14361)
Revision, Author and Comment of repository browser are broken. git-svn-id: http://svn.redmine.org/redmine/trunk@12753 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
ae68ff1100
commit
f2ec6f8d77
|
@ -152,24 +152,16 @@ class Repository::Mercurial < Repository
|
|||
(db_rev + 1).step(scm_rev, FETCH_AT_ONCE) do |i|
|
||||
scm.each_revision('', i, [i + FETCH_AT_ONCE - 1, scm_rev].min) do |re|
|
||||
transaction do
|
||||
scmid = re.scmid[0, 12]
|
||||
parents = (re.parents || []).collect do |rp|
|
||||
find_changeset_by_name(rp[0, 12])
|
||||
end.compact
|
||||
parents = (re.parents || []).collect{|rp| find_changeset_by_name(rp)}.compact
|
||||
cs = Changeset.create(:repository => self,
|
||||
:revision => re.revision,
|
||||
:scmid => scmid,
|
||||
:scmid => re.scmid,
|
||||
:committer => re.author,
|
||||
:committed_on => re.time,
|
||||
:comments => re.message,
|
||||
:parents => parents)
|
||||
unless cs.new_record?
|
||||
re.paths.each do |e|
|
||||
if from_revision = e[:from_revision]
|
||||
e[:from_revision] = from_revision[0, 12]
|
||||
end
|
||||
cs.create_change(e)
|
||||
end
|
||||
re.paths.each { |e| cs.create_change(e) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
changeset = 'This template must be used with --debug option\n'
|
||||
changeset_quiet = 'This template must be used with --debug option\n'
|
||||
changeset_verbose = 'This template must be used with --debug option\n'
|
||||
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'
|
||||
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'
|
||||
|
||||
file_mod = '<path action="M">{file_mod|urlescape}</path>\n'
|
||||
file_add = '<path action="A">{file_add|urlescape}</path>\n'
|
||||
file_del = '<path action="D">{file_del|urlescape}</path>\n'
|
||||
file_copy = '<path-copied copyfrom-path="{source|urlescape}">{name|urlescape}</path-copied>\n'
|
||||
parent = '<parent>{node}</parent>\n'
|
||||
parent = '<parent>{node|short}</parent>\n'
|
||||
header='<?xml version="1.0" encoding="UTF-8" ?>\n<log>\n\n'
|
||||
# footer="</log>"
|
||||
|
|
|
@ -16,7 +16,7 @@ I/O encoding:
|
|||
:file path: urlencoded, raw string
|
||||
:tag name: utf-8
|
||||
:branch name: utf-8
|
||||
:node: hex string
|
||||
:node: 12-digits (short) hex string
|
||||
|
||||
Output example of rhsummary::
|
||||
|
||||
|
@ -60,7 +60,7 @@ def _tip(ui, repo):
|
|||
return repo.changelog.count() - 1
|
||||
tipctx = repo.changectx(tiprev())
|
||||
ui.write('<tip revision="%d" node="%s"/>\n'
|
||||
% (tipctx.rev(), _x(node.hex(tipctx.node()))))
|
||||
% (tipctx.rev(), _x(node.short(tipctx.node()))))
|
||||
|
||||
_SPECIAL_TAGS = ('tip',)
|
||||
|
||||
|
@ -74,7 +74,7 @@ def _tags(ui, repo):
|
|||
except error.LookupError:
|
||||
continue
|
||||
ui.write('<tag revision="%d" node="%s" name="%s"/>\n'
|
||||
% (r, _x(node.hex(n)), _x(t)))
|
||||
% (r, _x(node.short(n)), _x(t)))
|
||||
|
||||
def _branches(ui, repo):
|
||||
# see mercurial/commands.py:branches
|
||||
|
@ -89,7 +89,7 @@ def _branches(ui, repo):
|
|||
for t, n, r in sorted(iterbranches(), key=lambda e: e[2], reverse=True):
|
||||
if repo.lookup(r) in branchheads(t):
|
||||
ui.write('<branch revision="%d" node="%s" name="%s"/>\n'
|
||||
% (r, _x(node.hex(n)), _x(t)))
|
||||
% (r, _x(node.short(n)), _x(t)))
|
||||
|
||||
def _manifest(ui, repo, path, rev):
|
||||
ctx = repo.changectx(rev)
|
||||
|
@ -114,7 +114,7 @@ def _manifest(ui, repo, path, rev):
|
|||
tm, tzoffset = fctx.date()
|
||||
ui.write('<file name="%s" revision="%d" node="%s" '
|
||||
'time="%d" size="%d"/>\n'
|
||||
% (_u(name), fctx.rev(), _x(node.hex(fctx.node())),
|
||||
% (_u(name), fctx.rev(), _x(node.short(fctx.node())),
|
||||
tm, fctx.size(), ))
|
||||
|
||||
ui.write('</manifest>\n')
|
||||
|
|
|
@ -219,7 +219,7 @@ module Redmine
|
|||
end.sort { |a, b| a[:path] <=> b[:path] }
|
||||
parents_ary = []
|
||||
as_ary(le['parents']['parent']).map do |par|
|
||||
parents_ary << par['__content__'] if par['__content__'] != "0000000000000000000000000000000000000000"
|
||||
parents_ary << par['__content__'] if par['__content__'] != "000000000000"
|
||||
end
|
||||
yield Revision.new(:revision => le['revision'],
|
||||
:scmid => le['node'],
|
||||
|
@ -234,7 +234,7 @@ module Redmine
|
|||
|
||||
# Returns list of nodes in the specified branch
|
||||
def nodes_in_branch(branch, options={})
|
||||
hg_args = ['rhlog', '--template', '{node}\n', '--rhbranch', CGI.escape(branch)]
|
||||
hg_args = ['rhlog', '--template', '{node|short}\n', '--rhbranch', CGI.escape(branch)]
|
||||
hg_args << '--from' << CGI.escape(branch)
|
||||
hg_args << '--to' << '0'
|
||||
hg_args << '--limit' << options[:limit] if options[:limit]
|
||||
|
|
|
@ -90,7 +90,7 @@ begin
|
|||
repo_path = adp.info.root_url.gsub(/\\/, "/")
|
||||
assert_equal REPOSITORY_PATH, repo_path
|
||||
assert_equal '31', adp.info.lastrev.revision
|
||||
assert_equal '31eeee7395c8c78e66dd54c50addd078d10b2355',adp.info.lastrev.scmid
|
||||
assert_equal '31eeee7395c8',adp.info.lastrev.scmid
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -98,14 +98,14 @@ begin
|
|||
revisions = @adapter.revisions(nil, 2, 4)
|
||||
assert_equal 3, revisions.size
|
||||
assert_equal '2', revisions[0].revision
|
||||
assert_equal '400bb86721098697c7d17b3724c794c57636de70', revisions[0].scmid
|
||||
assert_equal '400bb8672109', revisions[0].scmid
|
||||
assert_equal '4', revisions[2].revision
|
||||
assert_equal 'def6d2f1254a56fb8fbe9ec3b5c0451674dbd8b8', revisions[2].scmid
|
||||
assert_equal 'def6d2f1254a', revisions[2].scmid
|
||||
|
||||
revisions = @adapter.revisions(nil, 2, 4, {:limit => 2})
|
||||
assert_equal 2, revisions.size
|
||||
assert_equal '2', revisions[0].revision
|
||||
assert_equal '400bb86721098697c7d17b3724c794c57636de70', revisions[0].scmid
|
||||
assert_equal '400bb8672109', revisions[0].scmid
|
||||
end
|
||||
|
||||
def test_parents
|
||||
|
@ -115,12 +115,12 @@ begin
|
|||
revs2 = @adapter.revisions(nil, 1, 1)
|
||||
assert_equal 1, revs2.size
|
||||
assert_equal 1, revs2[0].parents.size
|
||||
assert_equal "0885933ad4f68d77c2649cd11f8311276e7ef7ce", revs2[0].parents[0]
|
||||
assert_equal "0885933ad4f6", revs2[0].parents[0]
|
||||
revs3 = @adapter.revisions(nil, 30, 30)
|
||||
assert_equal 1, revs3.size
|
||||
assert_equal 2, revs3[0].parents.size
|
||||
assert_equal "a94b0528f24fe05ebaef496ae0500bb050772e36", revs3[0].parents[0]
|
||||
assert_equal "3a330eb329586ea2adb3f83237c23310e744ebe9", revs3[0].parents[1]
|
||||
assert_equal "a94b0528f24f", revs3[0].parents[0]
|
||||
assert_equal "3a330eb32958", revs3[0].parents[1]
|
||||
end
|
||||
|
||||
def test_diff
|
||||
|
@ -213,7 +213,7 @@ begin
|
|||
assert_equal 'file', readme.kind
|
||||
assert_equal 27, readme.size
|
||||
assert_equal '1', readme.lastrev.revision
|
||||
assert_equal '9d5b5b00419901478496242e0768deba1ce8c51e', readme.lastrev.identifier
|
||||
assert_equal '9d5b5b004199', readme.lastrev.identifier
|
||||
# 2007-12-14 10:24:01 +0100
|
||||
assert_equal Time.gm(2007, 12, 14, 9, 24, 1), readme.lastrev.time
|
||||
|
||||
|
@ -242,7 +242,7 @@ begin
|
|||
assert_equal 'file', readme.kind
|
||||
assert_equal 21, readme.size
|
||||
assert_equal '0', readme.lastrev.revision
|
||||
assert_equal '0885933ad4f68d77c2649cd11f8311276e7ef7ce', readme.lastrev.identifier
|
||||
assert_equal '0885933ad4f6', readme.lastrev.identifier
|
||||
# 2007-12-14 10:22:52 +0100
|
||||
assert_equal Time.gm(2007, 12, 14, 9, 22, 52), readme.lastrev.time
|
||||
end
|
||||
|
@ -260,7 +260,7 @@ begin
|
|||
assert_equal 'file', readme.kind
|
||||
assert_equal 365, readme.size
|
||||
assert_equal '8', readme.lastrev.revision
|
||||
assert_equal 'c51f5bb613cd60793c2a9fe9df29332e74bb949f', readme.lastrev.identifier
|
||||
assert_equal 'c51f5bb613cd', readme.lastrev.identifier
|
||||
# 2001-02-01 00:00:00 -0900
|
||||
assert_equal Time.gm(2001, 2, 1, 9, 0, 0), readme.lastrev.time
|
||||
end
|
||||
|
@ -288,9 +288,9 @@ begin
|
|||
|
||||
def test_tagmap
|
||||
tm = {
|
||||
@tag_char_1 => 'adf805632193500ad3b615cd04f58f9b0769f576',
|
||||
'tag_test.00' => '6987191f453a5f6557018d522feea2c450d5588d',
|
||||
'tag-init-revision' => '0885933ad4f68d77c2649cd11f8311276e7ef7ce',
|
||||
@tag_char_1 => 'adf805632193',
|
||||
'tag_test.00' => '6987191f453a',
|
||||
'tag-init-revision' => '0885933ad4f6',
|
||||
}
|
||||
assert_equal tm, @adapter.tagmap
|
||||
end
|
||||
|
@ -303,36 +303,36 @@ begin
|
|||
assert_equal 7, brs.length
|
||||
assert_equal 'default', brs[0].to_s
|
||||
assert_equal '31', brs[0].revision
|
||||
assert_equal '31eeee7395c8c78e66dd54c50addd078d10b2355', brs[0].scmid
|
||||
assert_equal '31eeee7395c8', brs[0].scmid
|
||||
assert_equal 'test-branch-01', brs[1].to_s
|
||||
assert_equal '30', brs[1].revision
|
||||
assert_equal 'ad4dc4f80284a4f9168b77e0b6de288e5d207ee7', brs[1].scmid
|
||||
assert_equal 'ad4dc4f80284', brs[1].scmid
|
||||
assert_equal @branch_char_1, brs[2].to_s
|
||||
assert_equal '27', brs[2].revision
|
||||
assert_equal '7bbf4c738e7145149d2e5eb1eed1d3a8ddd3b914', brs[2].scmid
|
||||
assert_equal '7bbf4c738e71', brs[2].scmid
|
||||
assert_equal 'branch (1)[2]&,%.-3_4', brs[3].to_s
|
||||
assert_equal '25', brs[3].revision
|
||||
assert_equal 'afc61e85bde74de930e5846c8451bd55b5bafc9c', brs[3].scmid
|
||||
assert_equal 'afc61e85bde7', brs[3].scmid
|
||||
assert_equal @branch_char_0, brs[4].to_s
|
||||
assert_equal '23', brs[4].revision
|
||||
assert_equal 'c8d3e4887474af6a589190140508037ebaa9d9c3', brs[4].scmid
|
||||
assert_equal 'c8d3e4887474', brs[4].scmid
|
||||
assert_equal 'test_branch.latin-1', brs[5].to_s
|
||||
assert_equal '22', brs[5].revision
|
||||
assert_equal 'c2ffe7da686aa3d956e59f2a2854cf8980a8b768', brs[5].scmid
|
||||
assert_equal 'c2ffe7da686a', brs[5].scmid
|
||||
assert_equal 'test-branch-00', brs[6].to_s
|
||||
assert_equal '13', brs[6].revision
|
||||
assert_equal '3a330eb329586ea2adb3f83237c23310e744ebe9', brs[6].scmid
|
||||
assert_equal '3a330eb32958', brs[6].scmid
|
||||
end
|
||||
|
||||
def test_branchmap
|
||||
bm = {
|
||||
'default' => '31eeee7395c8c78e66dd54c50addd078d10b2355',
|
||||
'test_branch.latin-1' => 'c2ffe7da686aa3d956e59f2a2854cf8980a8b768',
|
||||
'branch (1)[2]&,%.-3_4' => 'afc61e85bde74de930e5846c8451bd55b5bafc9c',
|
||||
'test-branch-00' => '3a330eb329586ea2adb3f83237c23310e744ebe9',
|
||||
"test-branch-01" => 'ad4dc4f80284a4f9168b77e0b6de288e5d207ee7',
|
||||
@branch_char_0 => 'c8d3e4887474af6a589190140508037ebaa9d9c3',
|
||||
@branch_char_1 => '7bbf4c738e7145149d2e5eb1eed1d3a8ddd3b914',
|
||||
'default' => '31eeee7395c8',
|
||||
'test_branch.latin-1' => 'c2ffe7da686a',
|
||||
'branch (1)[2]&,%.-3_4' => 'afc61e85bde7',
|
||||
'test-branch-00' => '3a330eb32958',
|
||||
"test-branch-01" => 'ad4dc4f80284',
|
||||
@branch_char_0 => 'c8d3e4887474',
|
||||
@branch_char_1 => '7bbf4c738e71',
|
||||
}
|
||||
assert_equal bm, @adapter.branchmap
|
||||
end
|
||||
|
@ -378,18 +378,18 @@ begin
|
|||
when 'branch (1)[2]&,%.-3_4'
|
||||
if @adapter.class.client_version_above?([1, 6])
|
||||
assert_equal 3, nib0.size
|
||||
assert_equal 'afc61e85bde74de930e5846c8451bd55b5bafc9c', nib0[0]
|
||||
assert_equal nib0[0], 'afc61e85bde7'
|
||||
nib2 = @adapter.nodes_in_branch(bra, :limit => 2)
|
||||
assert_equal 2, nib2.size
|
||||
assert_equal '933ca60293d78f7c7979dd123cc0c02431683575', nib2[1]
|
||||
assert_equal nib2[1], '933ca60293d7'
|
||||
end
|
||||
when @branch_char_1
|
||||
if @adapter.class.client_version_above?([1, 6])
|
||||
assert_equal 2, nib0.size
|
||||
assert_equal '08ff3227303ec0dfcc818efa8e9cc652fe81859f', nib0[1]
|
||||
assert_equal nib0[1], '08ff3227303e'
|
||||
nib2 = @adapter.nodes_in_branch(bra, :limit => 1)
|
||||
assert_equal 1, nib2.size
|
||||
assert_equal '7bbf4c738e7145149d2e5eb1eed1d3a8ddd3b914', nib2[0]
|
||||
assert_equal nib2[0], '7bbf4c738e71'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue