Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
heptapod
heptapod
Commits
6ed1818859bd
Commit
7feddf88
authored
Dec 15, 2020
by
Sushil Khanchi
🐨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hgitaly_commit: add Rspec tests for #get_messages
--HG-- branch : heptapod-stable
parent
cc5fd1688a9b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
spec/lib/gitlab/mercurial/hgitaly_commit_spec.rb
spec/lib/gitlab/mercurial/hgitaly_commit_spec.rb
+58
-0
No files found.
spec/lib/gitlab/mercurial/hgitaly_commit_spec.rb
View file @
6ed18188
...
...
@@ -138,4 +138,62 @@ def gitsha(sha)
end
end
end
describe
'#get_messages'
do
subject!
{
non_empty_repository
}
before
do
prepare_repo
end
after
do
subject
.
remove
end
def
hgsha
(
rev
)
subject
.
hgsha_from_rev
(
rev
)
end
def
gitsha
(
sha
)
hg_git_repository
.
hg_git_invalidate_maps!
hg_git_repository
.
sha_from_hgsha
(
sha
)
end
# repo structure:
#
# o changeset: 2: Commit bar
# |
# | o changeset: 1: Commit car (branch: stable)
# |/
# o changeset: 0: Commit foo
#
let!
(
:offset
)
{
86400
}
# seconds in 24 hours
let
(
:prepare_repo
)
{
hg_commit
(
subject
,
'car'
,
par:
'0'
,
branch:
'stable'
,
date:
"
#{
offset
}
0"
)
hg_commit
(
subject
,
'bar'
,
par:
'0'
,
date:
"
#{
offset
*
2
}
0"
)
}
let
(
:hgsha_0
)
{
hgsha
(
'0'
)
}
let
(
:hgsha_1
)
{
hgsha
(
'1'
)
}
let
(
:hgsha_2
)
{
hgsha
(
'2'
)
}
let
(
:gitsha_0
)
{
gitsha
(
hgsha_0
)
}
let
(
:gitsha_1
)
{
gitsha
(
hgsha_1
)
}
let
(
:gitsha_2
)
{
gitsha
(
hgsha_2
)
}
it
'returns commit messages for given commit_ids'
do
messages
=
described_class
.
get_messages
(
subject
,
[
hgsha_1
,
hgsha_0
,
hgsha_2
]
).
values
expect
(
messages
).
to
eq
([
"Commit car"
,
"Commit foo"
,
"Commit bar"
])
# consistency with HgGitRepository
messages
=
described_class
.
get_messages
(
hg_git_repository
,
[
gitsha_1
,
gitsha_0
,
gitsha_2
]
).
values
expect
(
messages
).
to
eq
(
[
"Commit car
\n\n
--HG--
\n
branch : stable
\n
"
,
"Commit foo
\n
"
,
"Commit bar
\n
"
]
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment