swh.web.api.views.revision module#

swh.web.api.views.revision.api_revision(request: Request, sha1_git: str)[source]#
GET /api/1/revision/(sha1_git)/#

Get information about a revision in the archive. Revisions are identified by sha1 checksums, compatible with Git commit identifiers. See swh.model.git_objects.revision_git_object() in our data model module for details about how they are computed.

Parameters:
  • sha1_git (string) – hexadecimal representation of the revision sha1_git identifier

Request Headers:
  • Accept – the requested response content type, either application/json (default) or application/yaml

Response Headers:
Response JSON Object:
  • author (object) – information about the author of the revision

  • committer (object) – information about the committer of the revision

  • committer_date (string) – RFC3339 representation of the commit date

  • date (string) – RFC3339 representation of the revision date

  • directory (string) – the unique identifier that revision points to

  • directory_url (string) – link to GET /api/1/directory/(sha1_git)/[(path)/] to get information about the directory associated to the revision

  • id (string) – the revision unique identifier

  • merge (boolean) – whether or not the revision corresponds to a merge commit

  • message (string) – the message associated to the revision

  • parents (array) – the parents of the revision, i.e. the previous revisions that head directly to it, each entry of that array contains an unique parent revision identifier but also a link to GET /api/1/revision/(sha1_git)/ to get more information about it

  • type (string) – the type of the revision

Status Codes:

Example:

https://archive.softwareheritage.org/api/1/revision/aafb16d69fd30ff58afdd69036a26047f3aebdc6/
swh.web.api.views.revision.api_revision_raw_message(request: Request, sha1_git: str)[source]#

Return the raw data of the message of revision identified by sha1_git

swh.web.api.views.revision.api_revision_directory(request: Request, sha1_git: str, dir_path: str | None = None)[source]#
GET /api/1/revision/(sha1_git)/directory/[(path)/]#

Get information about directory (entry) objects associated to revisions. Each revision is associated to a single “root” directory. This endpoint behaves like GET /api/1/directory/(sha1_git)/[(path)/], but operates on the root directory associated to a given revision.

Parameters:
  • sha1_git (string) – hexadecimal representation of the revision sha1_git identifier

  • path (string) – optional parameter to get information about the directory entry pointed by that relative path

Request Headers:
  • Accept – the requested response content type, either application/json (default) or application/yaml

Response Headers:
Response JSON Object:
  • content (array) – directory entries as returned by GET /api/1/directory/(sha1_git)/[(path)/]

  • path (string) – path of directory from the revision root one

  • revision (string) – the unique revision identifier

  • type (string) – the type of the directory

Status Codes:

Example:

https://archive.softwareheritage.org/api/1/revision/f1b94134a4b879bc55c3dacdb496690c8ebdc03f/directory/
swh.web.api.views.revision.api_revision_log(request: Request, sha1_git: str)[source]#
GET /api/1/revision/(sha1_git)/log/#

Get a list of all revisions heading to a given one, in other words show the commit log.

The revisions are returned in the breadth-first search order while visiting the revision graph. The number of revisions to return is also bounded by the limit query parameter.

Warning

To get the full BFS traversal of the revision graph when the total number of revisions is greater than 1000, it is up to the client to keep track of the multiple branches of history when there’s merge revisions in the returned objects. In other words, identify all the continuation points that need to be followed to get the full history through recursion.

Parameters:
  • sha1_git (string) – hexadecimal representation of the revision sha1_git identifier

Query Parameters:
  • limit (int) – maximum number of revisions to return when performing BFS traversal on the revision graph (default to 10, cannot exceed 1000)

Request Headers:
  • Accept – the requested response content type, either application/json (default) or application/yaml

Response Headers:
Response JSON Array of Objects:
  • author (object) – information about the author of the revision

  • committer (object) – information about the committer of the revision

  • committer_date (string) – RFC3339 representation of the commit date

  • date (string) – RFC3339 representation of the revision date

  • directory (string) – the unique identifier that revision points to

  • directory_url (string) – link to GET /api/1/directory/(sha1_git)/[(path)/] to get information about the directory associated to the revision

  • id (string) – the revision unique identifier

  • merge (boolean) – whether or not the revision corresponds to a merge commit

  • message (string) – the message associated to the revision

  • parents (array) – the parents of the revision, i.e. the previous revisions that head directly to it, each entry of that array contains an unique parent revision identifier but also a link to GET /api/1/revision/(sha1_git)/ to get more information about it

  • type (string) – the type of the revision

Status Codes:

Example:

https://archive.softwareheritage.org/api/1/revision/e1a315fa3fa734e2a6154ed7b5b9ae0eb8987aad/log/