Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-model
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Renaud Boyer
swh-model
Commits
94242caf
Commit
94242caf
authored
4 years ago
by
Stefano Zacchiroli
Browse files
Options
Downloads
Patches
Plain Diff
swh identify: embrace SWHID naming in user-facing doc/messages
parent
4c78d479
No related branches found
Branches containing commit
Tags
debian/upstream/0.0.13
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/model/cli.py
+6
-6
6 additions, 6 deletions
swh/model/cli.py
with
6 additions
and
6 deletions
swh/model/cli.py
+
6
−
6
View file @
94242caf
...
...
@@ -37,7 +37,7 @@ class PidParamType(click.ParamType):
pids
.
parse_persistent_identifier
(
value
)
return
value
# return as string, as we need just that
except
ValidationError
as
e
:
self
.
fail
(
"
%s is not a valid
P
ID. %s.
"
%
(
value
,
e
),
param
,
ctx
)
self
.
fail
(
"
%s is not a valid
SWH
ID. %s.
"
%
(
value
,
e
),
param
,
ctx
)
def
pid_of_file
(
path
):
...
...
@@ -155,16 +155,16 @@ def identify_object(obj_type, follow_symlinks, obj):
@click.option
(
"
--verify
"
,
"
-v
"
,
metavar
=
"
P
ID
"
,
metavar
=
"
SWH
ID
"
,
type
=
PidParamType
(),
help
=
"
reference identifier to be compared with computed one
"
,
)
@click.argument
(
"
objects
"
,
nargs
=-
1
)
def
identify
(
obj_type
,
verify
,
show_filename
,
follow_symlinks
,
objects
):
"""
Compute the Software Heritage persistent identifier (
P
ID) for the given
"""
Compute the Software Heritage persistent identifier (
SWH
ID) for the given
source code object(s).
For more details about S
oftware Heritage P
IDs see:
For more details about S
WH
IDs see:
\b
https://docs.softwareheritage.org/devel/swh-model/persistent-identifiers.html
...
...
@@ -199,10 +199,10 @@ def identify(obj_type, verify, show_filename, follow_symlinks, objects):
if
verify
:
pid
=
next
(
results
)[
1
]
if
verify
==
pid
:
click
.
echo
(
"
P
ID match: %s
"
%
pid
)
click
.
echo
(
"
SWH
ID match: %s
"
%
pid
)
sys
.
exit
(
0
)
else
:
click
.
echo
(
"
P
ID mismatch: %s != %s
"
%
(
verify
,
pid
))
click
.
echo
(
"
SWH
ID mismatch: %s != %s
"
%
(
verify
,
pid
))
sys
.
exit
(
1
)
else
:
for
(
obj
,
pid
)
in
results
:
...
...
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