Compares two versions of a file. The output will appear in the viewer and only rows where there have been additions, deletions or modifications in the file will be shown.

diffPreviousVersions(
  file,
  previous_version,
  current_version = NULL,
  banner_cur = NULL,
  banner_prev = NULL,
  side_by_side = TRUE,
  ignore_white_space = FALSE
)

Arguments

file

file path from working directory

previous_version

commit hash of version to compare to current revision

current_version

current version (defaults to local copy)

banner_cur

Header for first file in viewer

banner_prev

Header for second file in viewer

side_by_side

Logical. Should diffs be displayed side by side?

ignore_white_space

Logical. Should white space be ignored?

Examples

with_demoRepo({

 prev_version <- gitLog("script/data-assembly.R")[2,][["last_commit"]]
 
 diffPreviousVersions(file = "script/data-assembly.R", 
                       previous_version = prev_version)
})
#> < Previous version (d9d77c6)             > Current version (7ea9406)            
#> @@ 11,2 @@                               @@ 11,3 @@                             
#>   lb_0 <- src_abc$lb                       lb_0 <- src_abc$lb                   
#>   lb_1 <- lb_0 %>% filter(LBTEST == 'Te    lb_1 <- lb_0 %>% filter(LBTEST == 'Te
#>   st of interest')                         st of interest')                     
#> ~                                        > vs_0 <- src_abc$vs