hermes.commands.harvest.git

Module Contents

Classes

ContributorData

Stores contributor data information from Git history.

NodeRegister

Helper class to unify Git commit authors and committers.

Functions

_audit_contributors(contributors, audit_log)

_merge_contributors(→ NodeRegister)

Merges the git authors and git committers NodeRegister and assign the respective roles for each node.

harvest_git(click_ctx, ctx)

Implementation of a harvester that provides autor data from Git.

Attributes

_log

SHELL_ENCODING

_GIT_SEP

_GIT_FORMAT

_GIT_ARGS

hermes.commands.harvest.git._log
hermes.commands.harvest.git.SHELL_ENCODING = 'utf-8'
hermes.commands.harvest.git._GIT_SEP = '|'
hermes.commands.harvest.git._GIT_FORMAT = ['%aN', '%aE', '%aI', '%cN', '%cE', '%cI']
hermes.commands.harvest.git._GIT_ARGS = ['--no-show-signature']
class hermes.commands.harvest.git.ContributorData(name: str | t.List[str], email: str | t.List[str], timestamp: str | t.List[str], role: str | t.List[str])

Stores contributor data information from Git history.

__str__()

Return str(self).

_update_attr(target, value, unique=True)
update(name=None, email=None, timestamp=None, role=None)

Update the current contributor with the given data.

Parameters
  • name – New name to assign (addtionally).

  • email – New email to assign (additionally).

  • timestamp – New timestamp to adapt time range.

merge(other: ContributorData)

Merge another ContributorData instance into this one.

All attributes will be merged yet kept unique if required.

Parameters

other – The other instance that should contribute to this.

to_codemeta() dict

Return the current dataset as CodeMeta.

Returns

The CodeMeta representation of this dataset.

class hermes.commands.harvest.git.NodeRegister(cls, *order, **mapping)

Helper class to unify Git commit authors and committers.

This class keeps track of all registered instances and merges two ContributorData instances if some attributes match.

add(node: Any)

Add (or merge) a new node to the register. :param node: The node that should be added.

update(**kwargs)

Add (or merge) a new item to the register with the given attribute values.

Fixme

This is not a good implementation strategy at all.

Parameters

kwargs – The attribute values to be stored.

hermes.commands.harvest.git._audit_contributors(contributors, audit_log: logging.Logger)
hermes.commands.harvest.git._merge_contributors(git_authors: NodeRegister, git_committers: NodeRegister) NodeRegister

Merges the git authors and git committers NodeRegister and assign the respective roles for each node.

hermes.commands.harvest.git.harvest_git(click_ctx: click.Context, ctx: hermes.model.context.HermesHarvestContext)

Implementation of a harvester that provides autor data from Git.

Parameters
  • click_ctx – Click context that this command was run inside (might be used to extract command line arguments).

  • ctx – The harvesting context that should contain the provided metadata.