Giter VIP home page Giter VIP logo

blame's People

Contributors

moodymudskipper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

blame's Issues

Cannot run the readme example

library(blame)
hist_data <- git_history("https://github.com/moodymudskipper/unglue", "main")
#> Created local repo at: C:\Users\Dan\AppData\Local\Temp\Rtmpc35YEN\file98e858372650
#> Warning in system(log_cmd, intern = TRUE): running command 'git -C
#> 'C:\Users\Dan\AppData\Local\Temp\Rtmpc35YEN\file98e858372650' log main
#> --pretty=format:'%h,%ae,%cI,%s'' had status 128
#> Wrangle commits
#> Collect changed files
#> Error in `dplyr::mutate()`:
#> i In argument: `file = purrr::map(commit, get_affected_files, .progress
#>   = TRUE)`.
#> Caused by error in `vctrs_vec_compat()`:
#> ! object 'commit' not found
#> Backtrace:
#>      x
#>   1. +-blame::git_history(...)
#>   2. | +-tidyr::unnest_longer(...)
#>   3. | | \-tidyr:::check_data_frame(data)
#>   4. | |   \-base::is.data.frame(x)
#>   5. | +-dplyr::mutate(...)
#>   6. | \-dplyr:::mutate.data.frame(commits_df, file = purrr::map(commit, get_affected_files, .progress = TRUE))
#>   7. |   \-dplyr:::mutate_cols(.data, dplyr_quosures(...), by)
#>   8. |     +-base::withCallingHandlers(...)
#>   9. |     \-dplyr:::mutate_col(dots[[i]], data, mask, new_columns)
#>  10. |       \-mask$eval_all_mutate(quo)
#>  11. |         \-dplyr (local) eval()
#>  12. +-purrr::map(commit, get_affected_files, .progress = TRUE)
#>  13. | \-purrr:::map_("list", .x, .f, ..., .progress = .progress)
#>  14. |   \-purrr:::vctrs_vec_compat(.x, .purrr_user_env)
#>  15. \-base::.handleSimpleError(...)
#>  16.   \-dplyr (local) h(simpleError(msg, call))
#>  17.     \-rlang::abort(message, class = error_class, parent = parent, call = error_call)

Created on 2023-09-16 with reprex v2.0.2

Session info
sessioninfo::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value
#>  version  R version 4.1.3 (2022-03-10)
#>  os       Windows 10 x64 (build 19045)
#>  system   x86_64, mingw32
#>  ui       RTerm
#>  language (EN)
#>  collate  French_France.1252
#>  ctype    French_France.1252
#>  tz       Europe/Paris
#>  date     2023-09-16
#>  pandoc   3.1.1 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version    date (UTC) lib source
#>  askpass       1.1        2019-01-13 [1] CRAN (R 4.1.0)
#>  blame       * 0.0.0.9000 2023-09-15 [1] Github (moodymudskipper/blame@4e87b0b)
#>  cli           3.6.1      2023-03-23 [1] CRAN (R 4.1.3)
#>  credentials   1.3.2      2021-11-29 [1] CRAN (R 4.1.2)
#>  digest        0.6.31     2022-12-11 [1] CRAN (R 4.1.3)
#>  dplyr         1.1.2      2023-04-20 [1] CRAN (R 4.1.3)
#>  evaluate      0.20       2023-01-17 [1] CRAN (R 4.1.3)
#>  fansi         1.0.4      2023-01-22 [1] CRAN (R 4.1.3)
#>  fastmap       1.1.1      2023-02-24 [1] CRAN (R 4.1.3)
#>  fs            1.6.1      2023-02-06 [1] CRAN (R 4.1.3)
#>  generics      0.1.3      2022-07-05 [1] CRAN (R 4.1.3)
#>  gert          1.9.2      2022-12-05 [1] CRAN (R 4.1.3)
#>  glue          1.6.2      2022-02-24 [1] CRAN (R 4.1.3)
#>  htmltools     0.5.5      2023-03-23 [1] CRAN (R 4.1.3)
#>  knitr         1.42       2023-01-25 [1] CRAN (R 4.1.3)
#>  lifecycle     1.0.3      2022-10-07 [1] CRAN (R 4.1.3)
#>  magrittr      2.0.3      2022-03-30 [1] CRAN (R 4.1.3)
#>  openssl       2.0.6      2023-03-09 [1] CRAN (R 4.1.3)
#>  pillar        1.9.0      2023-03-22 [1] CRAN (R 4.1.3)
#>  pkgconfig     2.0.3      2019-09-22 [1] CRAN (R 4.1.0)
#>  purrr         1.0.1      2023-01-10 [1] CRAN (R 4.1.3)
#>  R.cache       0.16.0     2022-07-21 [1] CRAN (R 4.1.3)
#>  R.methodsS3   1.8.2      2022-06-13 [1] CRAN (R 4.1.3)
#>  R.oo          1.25.0     2022-06-12 [1] CRAN (R 4.1.3)
#>  R.utils       2.12.2     2022-11-11 [1] CRAN (R 4.1.3)
#>  R6            2.5.1      2021-08-19 [1] CRAN (R 4.1.0)
#>  reprex        2.0.2      2022-08-17 [1] CRAN (R 4.1.3)
#>  rlang         1.1.0      2023-03-14 [1] CRAN (R 4.1.3)
#>  rmarkdown     2.21       2023-03-26 [1] CRAN (R 4.1.3)
#>  rstudioapi    0.14       2022-08-22 [1] CRAN (R 4.1.3)
#>  sessioninfo   1.2.2      2021-12-06 [1] CRAN (R 4.1.2)
#>  styler        1.9.1      2023-03-04 [1] CRAN (R 4.1.3)
#>  sys           3.4.1      2022-10-18 [1] CRAN (R 4.1.3)
#>  tibble        3.2.1      2023-03-20 [1] CRAN (R 4.1.3)
#>  tidyr         1.3.0      2023-01-24 [1] CRAN (R 4.1.3)
#>  tidyselect    1.2.0      2022-10-10 [1] CRAN (R 4.1.3)
#>  utf8          1.2.3      2023-01-31 [1] CRAN (R 4.1.3)
#>  vctrs         0.6.2      2023-04-19 [1] CRAN (R 4.1.3)
#>  withr         2.5.0      2022-03-03 [1] CRAN (R 4.1.3)
#>  xfun          0.39       2023-04-20 [1] CRAN (R 4.1.3)
#>  yaml          2.3.7      2023-01-23 [1] CRAN (R 4.1.3)
#> 
#>  [1] E:/WINDOWS/MesDocuments/R/win-library/4.1
#>  [2] C:/Program Files/R/R-4.1.3/library
#> 
#> ------------------------------------------------------------------------------

Here is more insight:

#inside debugonce(git_history)
commits <- system(log_cmd, intern = TRUE)
commits
#[1] "fatal: cannot change to ''C:\\Users\\Dan\\AppData\\Local\\Temp\\RtmpYtSANP\\file407c551f6f03'': Invalid argument"
#attr(,"status")
#[1] 128
dir.exists(repo)
#[1] TRUE
gert::git_ls(repo) |> length()
#[1] 4
gert::git_info(repo) |> length()
#[1] 8
gert::git_log(repo) |> length()
#Error in gert::git_log(repo) : 
#  Failed to find git reference 'C:\Users\Dan\AppData\Local\Temp\RtmpYtSANP\file407c551f6f03'
system("git version", intern = TRUE)
#[1] "git version 2.38.1.windows.1"

I have the same problem with repo="https://github.com/DanChaltiel/crosstable".

If this is a git version problem, it seems that parsing the result of the system code is not a problem: https://stackoverflow.com/a/67811664/3888000.

EDITS:

  • updated to latest version 2.42.0.windows.2 with no difference.
  • tried log_cmd <- sprintf('git -C "%s" log %s --pretty=format:"%%h,%%ae,%%cI,%%s"', repo, branch) (switching single and double quotes) with a better result:
commits
#[1] "fatal: ambiguous argument 'main': unknown revision or path not in the working tree."
#[2] "Use '--' to separate paths from revisions, like this:"                              
#[3] "'git <command> [<revision>...] -- [<file>...]'"                                     
#attr(,"status")
#[1] 128
  • works fine if I remove main from the command

I'm really not a git expert so I'm afraid that's all the help I can provide

Integration with {pkg} and git-filter-repo

This is a great tool that allows us to rewrite git history into a new repo: git-filter-repo : https://github.com/newren/git-filter-repo

  • An example would be, keep only commits that affect a given file.
  • In blame we're interested in keeping commits that affect a given function.
  • If we have one function per file it's the same thing

@krlmlr's idea is that we might first rewrite the full history by storing a function in each file. Then we don't need the concept of R object anymore for filtering.

This idea plays very well with {pkg}, and is something we might leverage for {blame}

{pkg} proposes packages and repos as objects. So far repo objects have methods mapping to git commands but don't contain commits or branches as objects, this is something that might be interesting to do.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.