nest_commits_by_pattern: Nest all commits by each pattern found in the commit messages

View source: R/utils.R

nest_commits_by_patternR Documentation

Nest all commits by each pattern found in the commit messages

Description

Nest all commits by each pattern found in the commit messages

Usage

nest_commits_by_pattern(
  repo,
  pattern = c(Issues = "#[[:digit:]]+"),
  pattern.table = NULL,
  ref = "main",
  silent = TRUE
)

Arguments

repo

a path to a repository or a git_repository object. Default is '.'

pattern

Named vector with regex pattern to expose commits, like c("Issues" = "#\[\[:digit:\]\]") for issues

pattern.table

data.frame with two columns: pattern and description of the pattern. This is used as correspondence table to add some names to existing patterns.

ref

The name of a reference to list commits from e.g. a tag or a branch. The default is NULL for the current branch.

silent

Logical. Whether to hide messages.

Value

A tibble with a row for each different pattern found in commit messages and following columns:

  • pattern.type: name of the pattern found in the commit message

  • pattern.content: pattern found in the commit message

  • pattern.title: pattern.content or title used in the pattern.table a nested 'data' column with all related commits

  • pattern_numeric: extraction of numeric value in pattern.content

  • link_pattern: internal url of the pattern in the future HTML gitbook

  • data: a nested list of tibbles with commits content as issued from get_commits_pattern()

Examples

repo <- fake_repo()
nest_commits_by_pattern(repo)

# With table of correspondence
pattern.table <- data.frame(
  number = c("#2", "#1", "#1000"),
  title = c("#2 A second issue to illustrate a blog post",
            "#1 An example of issue",
            "#1000 issue with no commit"))
 nest_commits_by_pattern(
  repo,
  pattern.table = pattern.table,
  pattern = c("Tickets" = "ticket[[:digit:]]+", "Issues" = "#[[:digit:]]+"))

gitdown documentation built on March 18, 2022, 6:01 p.m.