Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
Poulpe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
octobus
Poulpe
Commits
00db05de
Commit
00db05de
authored
3 years ago
by
Raphaël Gomès
Browse files
Options
Downloads
Patches
Plain Diff
Add a command to get answers to our most common questions
parent
82eff314
Branches
topic/default/questions-answer
No related tags found
No related merge requests found
Pipeline
#55029
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/get-answers
+146
-0
146 additions, 0 deletions
bin/get-answers
with
146 additions
and
0 deletions
bin/get-answers
0 → 100755
+
146
−
0
View file @
00db05de
#!/usr/bin/env python3
# Get answers to the most common questions we have
# quick check:
# for question in 0 1 2 3 4 5 6 7 8 9 10 11 12; do for repo in 0 1 2; do bin/get-answers results-percheron $question $repo; done; done
from
argparse
import
ArgumentParser
import
argparse
from
pathlib
import
Path
import
subprocess
import
sys
repos
=
[
"
mozilla
"
,
"
netbeans
"
,
"
mercurial
"
]
DIFF
=
str
(
Path
(
__file__
).
parent
/
"
diff-result
"
)
K_JANE_D1
=
(
"
Jane fast-path dirstate-v1
"
,
"
result-mercurial-f87e5257eeb1-jane--{repo}-dirstate-v1*
"
,
)
K_JANE_NO_CACHE
=
(
"
Jane fast-path dirstate-v1 (no cache)
"
,
"
result-mercurial-c7e675848027-jane--{repo}-dirstate-v1*
"
,
)
K_RHG_D2
=
(
"
rhg dirstate-v2
"
,
"
result-mercurial-18b212b00ee0-rhg--{repo}-dirstate-v2*
"
)
K_RHG_D2_REL_PATH
=
(
"
rhg dirstate-v2 (relpaths)
"
,
"
result-mercurial-f87e5257eeb1-rhg--{repo}-dirstate-v2*
"
,
)
K_RHG_D2_REL_PATH_NO_CACHE
=
(
"
rhg dirstate-v2 (relpaths, no cache)
"
,
"
result-mercurial-93b4d58a1bfc-rhg--{repo}-dirstate-v2*
"
,
)
K_HG_D1_RUST
=
(
"
hg dirstate-v1 rust
"
,
"
result-mercurial-02e9ad08999b-rust--{repo}-dirstate-v1*
"
,
)
K_HG_D1_NORUST
=
(
"
hg dirstate-v1 no-rust
"
,
"
result-mercurial-02e9ad08999b-no-rust--{repo}-dirstate-v1*
"
,
)
K_HG_D1_NORUST_OLD
=
(
"
dirstate-v1 no-rust (old 5.4)
"
,
"
result-mercurial-5.4.2-no-rust--{repo}-dirstate-v1*
"
,
)
K_HG_D2_RUST
=
(
"
hg dirstate-v2 rust
"
,
"
result-mercurial-02e9ad08999b-rust--{repo}-dirstate-v2*
"
,
)
K_HG_D2_NORUST
=
(
"
hg dirstate-v2 no-rust
"
,
"
result-mercurial-b528861ebfdc-no-rust--{repo}-dirstate-v2*
"
,
)
QUESTIONS
=
[
(
K_JANE_D1
,
K_RHG_D2
),
(
K_HG_D2_NORUST
,
K_RHG_D2
),
(
K_HG_D1_NORUST
,
K_RHG_D2
),
(
K_HG_D2_RUST
,
K_RHG_D2
),
(
K_HG_D1_RUST
,
K_RHG_D2
),
(
K_HG_D1_NORUST_OLD
,
K_HG_D1_NORUST
),
(
K_HG_D1_NORUST
,
K_HG_D2_NORUST
),
(
K_HG_D1_NORUST
,
K_HG_D1_RUST
),
(
K_HG_D1_RUST
,
K_HG_D2_RUST
),
(
K_HG_D1_NORUST
,
K_HG_D2_RUST
),
(
K_JANE_D1
,
K_RHG_D2_REL_PATH
),
(
K_JANE_NO_CACHE
,
K_RHG_D2_REL_PATH_NO_CACHE
),
(
K_RHG_D2_REL_PATH
,
K_RHG_D2_REL_PATH_NO_CACHE
),
]
def
print_err
(
msg
):
print
(
msg
,
file
=
sys
.
stderr
)
def
show_comparison
(
results_dir
:
Path
,
question_index
:
int
,
repo_index
:
int
):
repo
=
repos
[
repo_index
]
(
left_name
,
left_glob
),
(
right_name
,
right_glob
)
=
QUESTIONS
[
question_index
]
question
=
f
"
{
left_name
}
vs
{
right_name
}
"
results_left
=
sorted
(
results_dir
.
glob
(
left_glob
.
format
(
repo
=
repo
)))
results_right
=
sorted
(
results_dir
.
glob
(
right_glob
.
format
(
repo
=
repo
)))
header
=
f
"
Results for
{
question
}
in repo
{
repo
}
"
print
(
"
=
"
*
len
(
header
))
print
(
header
)
print
(
"
=
"
*
len
(
header
))
if
not
results_left
:
print_err
(
f
"
No results for the left
"
)
sys
.
exit
(
1
)
if
not
results_right
:
print_err
(
f
"
No results for the right
"
)
sys
.
exit
(
1
)
for
left
,
right
in
zip
(
results_left
,
results_right
):
bench
=
str
(
left
).
rsplit
(
"
--
"
,
1
)[
1
]
assert
bench
==
str
(
right
).
rsplit
(
"
--
"
,
1
)[
1
]
cmd
=
[
DIFF
,
str
(
left
),
str
(
right
)]
res
=
subprocess
.
run
(
cmd
,
capture_output
=
True
)
bench
=
bench
.
removesuffix
(
"
.pbr
"
)
if
res
.
returncode
!=
0
:
print_err
(
f
"
{
bench
}
returned error code
{
res
.
returncode
}
"
)
continue
print
(
f
"
{
bench
:
<
50
}
{
res
.
stdout
.
strip
().
decode
()
}
"
)
def
main
(
results_dir
,
question_index
,
repo_index
):
if
question_index
<
0
or
question_index
>
len
(
QUESTIONS
)
-
1
:
print_err
(
"
Please input a valid question index
"
)
sys
.
exit
(
1
)
if
repo_index
<
0
or
repo_index
>
len
(
repos
)
-
1
:
print_err
(
"
Please input a valid repo index
"
)
sys
.
exit
(
1
)
results_dir
=
Path
(
results_dir
)
if
not
results_dir
.
is_dir
():
print_err
(
"
The results dir must be a directory
"
)
sys
.
exit
(
1
)
show_comparison
(
results_dir
,
question_index
,
repo_index
)
if
__name__
==
"
__main__
"
:
parser
=
argparse
.
ArgumentParser
(
formatter_class
=
argparse
.
RawTextHelpFormatter
)
parser
.
add_argument
(
"
results_dir
"
,
action
=
"
store
"
,
type
=
str
,
help
=
"
Path to a directory containing the results
"
,
)
parser
.
add_argument
(
"
question
"
,
action
=
"
store
"
,
type
=
int
,
help
=
"
\n
"
.
join
(
f
"
{
i
}
:
{
l
[
0
]
}
vs
{
r
[
0
]
}
"
for
i
,
(
l
,
r
)
in
enumerate
(
QUESTIONS
)),
)
parser
.
add_argument
(
"
repo
"
,
action
=
"
store
"
,
type
=
int
,
help
=
"
\n
"
.
join
(
f
"
{
i
}
:
{
r
}
"
for
i
,
r
in
enumerate
(
repos
)),
)
if
len
(
sys
.
argv
)
<
4
:
parser
.
print_help
()
sys
.
exit
(
1
)
args
=
parser
.
parse_args
()
main
(
args
.
results_dir
,
args
.
question
,
args
.
repo
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment