package swhid
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module Swhid.Lang
Source
The kinds of objects represented by swhids, see the software heritage model documentation.
Must be of length 40 and made only of hexadecimal characters.
The scheme version, the object type and the object identifier.
type context_qualifier =
| Anchor of identifier_core
(*a designated node in the Merkle DAG relative to which a path to the object is specified, as the core identifier of a directory, a revision, a release or a snapshot
*)| Origin of string
(*the software origin where an object has been found or observed in the wild, as an URI
*)| Path of string
(*the absolute file path, from the root directory associated to the anchor node, to the object; when the anchor denotes a directory or a revision, and almost always when it’s a release, the root directory is uniquely determined; when the anchor denotes a snapshot, the root directory is the one pointed to by HEAD (possibly indirectly), and undefined if such a reference is missing
*)| Visit of identifier_core
(*the core identifier of a snapshot corresponding to a specific visit of a repository containing the designated object
*)
type qualifier =
| Context of context_qualifier
(*either a context
*)| Fragment of int * int option
(*or a fragment (a line number or two)
*)
The type for full swhids.
Helper to build an object_type
from a string
.
Checks if an object_id
is invalid, i.e. if it's not of length 40 or if it contains non-hexadecimal characters.
Helper function to build an object_id
from a string
that will return None
if the string isn't valid according to object_type_is_invalid
Builds a swhid of kind content
from it's core id and a list of qualifiers. The given hash defaults to "sha1_git"
and you shouldn't care about it in most cases.
Builds a swhid of kind directory
from it's core id and a list of qualifiers.
Builds a swhid of kind snapshot
from it's core id and a list of qualifiers
Builds a swhid of kind revision
from it's core id and a list of qualifiers
Builds a swhid of kind release
from it's core id and a list of qualifiers
Extract the core id from a given identifier.
Extract the object type from a given identifier.
Exception raised by the parser when e.g. the scheme version is unknown.