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
960ce091e6fc
Commit
0688c989
authored
Dec 16, 2020
by
Sushil Khanchi
🐨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hgitaly-commit: add Rspec tests for commits_by_message
--HG-- branch : heptapod-stable
parent
4503003c4fa9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
0 deletions
+96
-0
spec/lib/gitlab/mercurial/hgitaly_commit_spec.rb
spec/lib/gitlab/mercurial/hgitaly_commit_spec.rb
+96
-0
No files found.
spec/lib/gitlab/mercurial/hgitaly_commit_spec.rb
View file @
960ce091
...
...
@@ -209,6 +209,102 @@ def gitsha(sha)
end
end
describe
'commit_service#find_commits_by_message'
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 0
#
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
'query'
do
commits
=
subject
.
gitaly_commit_client
.
commits_by_message
(
"commit"
).
map
(
&
:id
)
expect
(
commits
).
to
eq
([
hgsha_2
,
hgsha_0
])
commits
=
subject
.
gitaly_commit_client
.
commits_by_message
(
"bar"
).
map
(
&
:id
)
expect
(
commits
).
to
eq
([
hgsha_2
])
commits
=
subject
.
gitaly_commit_client
.
commits_by_message
(
"car"
).
map
(
&
:id
)
expect
(
commits
).
to
eq
([])
# consistency with HgGitRepository
commits
=
hg_git_repository
.
gitaly_commit_client
.
commits_by_message
(
"commit"
).
map
(
&
:id
)
expect
(
commits
).
to
eq
([
gitsha_2
,
gitsha_0
])
commits
=
hg_git_repository
.
gitaly_commit_client
.
commits_by_message
(
"bar"
).
map
(
&
:id
)
expect
(
commits
).
to
eq
([
gitsha_2
])
commits
=
hg_git_repository
.
gitaly_commit_client
.
commits_by_message
(
"car"
).
map
(
&
:id
)
expect
(
commits
).
to
eq
([])
end
it
'query+revision'
do
commits
=
subject
.
gitaly_commit_client
.
commits_by_message
(
"car"
,
revision:
"branch/stable"
,
).
map
(
&
:id
)
expect
(
commits
).
to
eq
([
hgsha_1
])
# consistency with HgGitRepository
commits
=
hg_git_repository
.
gitaly_commit_client
.
commits_by_message
(
"car"
,
revision:
"branch/stable"
,
).
map
(
&
:id
)
expect
(
commits
).
to
eq
([
gitsha_1
])
end
it
'query+revision+path'
do
commits
=
subject
.
gitaly_commit_client
.
commits_by_message
(
"commit"
,
path:
"foo"
,
).
map
(
&
:id
)
expect
(
commits
).
to
eq
([
hgsha_0
])
# consistency with HgGitRepository
commits
=
hg_git_repository
.
gitaly_commit_client
.
commits_by_message
(
"commit"
,
path:
"foo"
,
).
map
(
&
:id
)
expect
(
commits
).
to
eq
([
gitsha_0
])
end
end
describe
'#commit_stats'
do
subject!
{
non_empty_repository
}
...
...
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