From a3ad437d9d25a87d986ff8ff0bbbbc29abbe1e15 Mon Sep 17 00:00:00 2001 From: Jenna Johnson Date: Thu, 31 Oct 2024 19:24:29 +0000 Subject: [PATCH 1/2] fixes bug where remote changes don't cause error for assign and resolve --- .Rbuildignore | 1 + DESCRIPTION | 4 ++-- NAMESPACE | 1 + NEWS.md | 12 ++---------- R/app_01_assign_server.R | 4 ++-- R/app_02_resolve_server.R | 3 ++- R/app_03_record_server.R | 2 -- R/error.R | 6 ++++++ 8 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index 354a430..ae8d3b7 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -4,3 +4,4 @@ ^\.Rproj\.user$ ^LICENSE\.md$ ^README\.Rmd$ +^.github$ diff --git a/DESCRIPTION b/DESCRIPTION index 0cdf77d..fcc88a6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ghqc.app Title: Create QC Checklists in Github Issues -Version: 0.1.4 +Version: 0.1.5 Authors@R: c( person("Jenna", "Johnson", email = "jenna@a2-ai.com", role = c("aut", "cre")), person("Anne", "Zheng", email = "anne@a2-ai.com", role = c("aut")), @@ -8,7 +8,7 @@ Authors@R: c( person("Devin", "Pastoor", email = "devin@a2-ai.com", role = c("aut")), person("Wes", "Cummings", email = "wes@a2-ai.com", role = c("aut"))) Description: A QC tool with 3 major functions: creation and management of QC log, creation and management of QC record, perform semi-automated QC tasks. -License: GPL (>= 3) +License: GPL (>= 3) + file LICENSE Encoding: UTF-8 Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.2 diff --git a/NAMESPACE b/NAMESPACE index 381dcb7..02ccf0d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -14,6 +14,7 @@ importFrom(fs,dir_ls) importFrom(fs,is_dir) importFrom(fs,is_file) importFrom(gert,git_ahead_behind) +importFrom(gert,git_fetch) importFrom(gert,git_status) importFrom(glue,glue) importFrom(jsTreeR,jstree) diff --git a/NEWS.md b/NEWS.md index 7b971e8..29ba988 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ +# ghqc.app 0.1.5 -# ghqc.app (beta version) +- Fixes bug in assign and resolve apps - error checking did not catch remote changes to the directory because checks did not git fetch first # ghqc.app 0.1.4 @@ -16,25 +17,16 @@ # ghqc.app 0.1.1 -# Minor bug fixes - - In the case when someone sets the standard gh environment variable GITHUB_API_URL, each app checks if this URL matches the actual set remote URL. The function that gets the GITHUB_API_URL did not explicitly return a value. - Small grammar fix in error message from apps in the case that the checklists directory isn't in the cloned info repo. - -# ghqc.app (development version) - # ghqc.app 0.0.0.9011 -## Minor improvements - - rename ghqc to ghqc.app and ghqc.launcher to ghqc # ghqc 0.0.0.9010 -## Minor improvements - - terminology changed to match GitHub terminology like "Issue" and "Milestone" - git commit terminology changed from "reference" and "comparator" to "previous" and "current", respectively diff --git a/R/app_01_assign_server.R b/R/app_01_assign_server.R index 78b5aae..eae7465 100644 --- a/R/app_01_assign_server.R +++ b/R/app_01_assign_server.R @@ -4,7 +4,7 @@ #' @importFrom log4r warn error info debug #' @importFrom shinyjs enable disable addClass removeClass delay #' @importFrom waiter Waiter spin_1 spin_2 waiter_hide -#' @importFrom gert git_ahead_behind git_status +#' @importFrom gert git_status #' @importFrom rprojroot find_rstudio_root_file NULL @@ -256,7 +256,7 @@ return "
" + escape(item.username) + "
" { file_names <- sapply(qc_items(), function(x) x$name) uncommitted_git_files <- git_status()$file - git_sync_status <- git_ahead_behind() + git_sync_status <- check_ahead_behind() untracked_selected_files <- Filter(function(file) check_if_qc_file_untracked(file), file_names) issues_in_milestone <- tryCatch( diff --git a/R/app_02_resolve_server.R b/R/app_02_resolve_server.R index 6f7e2ea..f127071 100644 --- a/R/app_02_resolve_server.R +++ b/R/app_02_resolve_server.R @@ -3,7 +3,7 @@ #' @importFrom dplyr %>% #' @importFrom log4r warn error info debug #' @importFrom purrr map_df -#' @importFrom gert git_status git_ahead_behind +#' @importFrom gert git_status NULL ghqc_resolve_server <- function(id, remote, org, repo, milestone_list) { @@ -143,6 +143,7 @@ ghqc_resolve_server <- function(id, remote, org, repo, milestone_list) { { req(issue_parts()$issue_title) uncommitted_git_files <- git_status()$file + fetch <- git_fetch(prune = TRUE) git_sync_status <- git_ahead_behind() untracked_selected_files <- Filter(function(file) check_if_qc_file_untracked(file), issue_parts()$issue_title) commit_update_status <- check_if_updates_since_init(all_commits()) diff --git a/R/app_03_record_server.R b/R/app_03_record_server.R index 0fe25bf..1567dd6 100644 --- a/R/app_03_record_server.R +++ b/R/app_03_record_server.R @@ -2,10 +2,8 @@ #' @importFrom shinyjs enable disable addClass removeClass #' @importFrom log4r warn error info debug #' @importFrom purrr map_df -#' @importFrom gert git_status git_ahead_behind #' @importFrom shinyjs enable disable addClass removeClass delay #' @importFrom waiter Waiter spin_1 spin_2 waiter_hide -#' @importFrom gert git_ahead_behind git_status #' @importFrom rprojroot find_rstudio_root_file NULL diff --git a/R/error.R b/R/error.R index dba8e83..6383898 100644 --- a/R/error.R +++ b/R/error.R @@ -57,3 +57,9 @@ check_if_updates_since_init <- function(commits_df) { rlang::abort(e$message) }) } + +#' @importFrom gert git_ahead_behind git_fetch +check_ahead_behind <- function() { + fetch <- git_fetch(prune = TRUE) # need to fetch first to see if there are changes to be pulled (behind = 0) + git_ahead_behind() +} From ab726b01e8bafc2502c9644c0cfa207e3cae54b1 Mon Sep 17 00:00:00 2001 From: Jenna Johnson Date: Thu, 31 Oct 2024 19:29:09 +0000 Subject: [PATCH 2/2] avoid code duplication --- R/app_02_resolve_server.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/R/app_02_resolve_server.R b/R/app_02_resolve_server.R index f127071..925c906 100644 --- a/R/app_02_resolve_server.R +++ b/R/app_02_resolve_server.R @@ -143,8 +143,7 @@ ghqc_resolve_server <- function(id, remote, org, repo, milestone_list) { { req(issue_parts()$issue_title) uncommitted_git_files <- git_status()$file - fetch <- git_fetch(prune = TRUE) - git_sync_status <- git_ahead_behind() + git_sync_status <- check_ahead_behind() untracked_selected_files <- Filter(function(file) check_if_qc_file_untracked(file), issue_parts()$issue_title) commit_update_status <- check_if_updates_since_init(all_commits()) },