Module gitforge::forge[][src]

Expand description

Uniform access to github and gitlab

Currently, listing and creating merge requests is suppored.

Start by creating a Forge, probably by initialising a Config with default-based a literal and calling Setup::forge.

Terminology and model

  • Repository. A single git tree that can contain code, and has other things associated with it such as issues and merge requests. (GitHub, GitLab: project.)

    Identified in the gitforge API by a string, which is typically the path suffix.

  • Merge Request. A request to incorporate changes from a source repository and branch into a target repository and branch. Forges typically associate merge requsts primarily with the target repository. A merge request typically has an associated discussion.

    (GitHub: a pull request.)

  • Issue. A feature request or bug report, associated with a repository, and an associated discussion. *Not currently supported by this library.

  • Merge request or issue Number. A (usually short) string which uniquely identifies a merge request or issue within a repository.

  • User. An individual user, or possibly, organisation. Represented as a string, being the username (as used, eg, as a slug in the forge’s URLs).

  • Branch. A git branch (on the server), ie a remote ref named refs/heads/BRANCH. Identified by the string BRANCH.

See the individual forge module docs for the mapping.

Non-exhaustive structs

Some structs in this api have fields named _non_exhaustive. This indicates that the struct may be extended with additional fields in future, and that this won’t be considered a semver breaking change.

Do not explicitly initialise such a field. Instead, use .. syntax to initialise all the fields you are not naming. Typically, you would write ..Default::default().

This rule is in addition to some (other) structs being marked #[non_exhaustive].

Non-exhaustive enums

Some enums have variants named _NonExhaustive. This indicates that the enum may be extended with additional variants in future, and that this won’t be considered a semver breaking change.

Do not construct such an enum variant. The library will panic if it finds one.

This rule is in addition to some (other) enums being marked #[non_exhaustive].

Structs

Instructions for how to connect to a forge

Overall state of an Issue or Merge Request

Repository and branch

Create a new merge request.

Search for merge requests.

Merge request, in a response

Secret access token.

Enums

Errors accessing forges

Whether an Issue or Merge Request is locked

Issue or Merge Request status

What protocol to use to access a forge. Don’t hardcode.

Kind of a thing on a forge. Used mostly in errors.

Request (command) to a forge

Response from a forge

Instructions for how to obtain an access token

Traits

Main trait; forge objects are Box<dyn Forge>

Main entrypoints once a Forge has been constructed.