blame-methods: Get blame for file

Description Usage Arguments Value Examples

Description

Get blame for file

Usage

1
2
3
4
blame(repo, path)

## S4 method for signature 'git_repository,character'
blame(repo, path)

Arguments

repo

The repository

path

Path to the file to consider

Value

S4 class git_blame object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 
## Initialize a temporary repository
path <- tempfile(pattern="git2r-")
dir.create(path)
repo <- init(path)

## Create a first user and commit a file
config(repo, user.name="Alice", user.email="[email protected]")
writeLines("Hello world!", file.path(path, "example.txt"))
add(repo, "example.txt")
commit(repo, "First commit message")

## Create a second user and change the file
config(repo, user.name="Bob", user.email="[email protected]")
writeLines(c("Hello world!", "HELLO WORLD!", "HOLA"),
           file.path(path, "example.txt"))
add(repo, "example.txt")
commit(repo, "Second commit message")

## Check blame
blame(repo, "example.txt")

## End(Not run)

git2r documentation built on July 20, 2017, 1:03 a.m.

Related to blame-methods in git2r...