branch: scratch/gited commit 70eccf34106cd3dbdebcd76131d69d4611133c96 Author: Tino Calancha <tino.calan...@gmail.com> Commit: Tino Calancha <tino.calan...@gmail.com>
Simplify code using gited-branch-exists-p * gited.el (gited-list-branches): Use gited-branch-exists-p. * gited-tests.el (gited-test1): Test `gited-mark-branches-by-date'. --- packages/gited/gited-tests.el | 15 +++++++++++++++ packages/gited/gited.el | 7 +++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/gited/gited-tests.el b/packages/gited/gited-tests.el index bf07e6b..5e521db 100644 --- a/packages/gited/gited-tests.el +++ b/packages/gited/gited-tests.el @@ -65,14 +65,29 @@ (gited-git-command '("rev-parse" "HEAD") (current-buffer)) (buffer-substring 1 (1- (point-max)))))) + ;; gited-mark-branches-containing-commit (gited-mark-branches-containing-commit hash) (should (= 1 (gited-number-marked)))) + ;; gited-mark-branches-regexp (gited-unmark-all-marks) (gited-mark-branches-regexp "foo") (should (= 1 (gited-number-marked))) + ;; gited-mark-branches-containing-regexp (gited-unmark-all-marks) (gited-mark-branches-containing-regexp "Update") (should (= 1 (gited-number-marked))) + ;; gited-mark-branches-by-date + (gited-unmark-all-marks) + (gited-mark-branches-by-date + (format-time-string "%F" (current-time))) + (should (= (length (gited-listed-branches)) + (gited-number-marked))) + (gited-unmark-all-marks) + (gited-mark-branches-by-date + (format-time-string + "%F" + (time-add (current-time) (seconds-to-time (* 7 24 60 60))))) + (should (= 0 (gited-number-marked))) (gited-unmark-all-marks)) (gited-copy-branch "foo" "bar") (gited-delete-branch "foo" 'force) diff --git a/packages/gited/gited.el b/packages/gited/gited.el index 648271e..24ec8fc 100644 --- a/packages/gited/gited.el +++ b/packages/gited/gited.el @@ -10,9 +10,9 @@ ;; Compatibility: GNU Emacs: 24.4 ;; Version: 0.2.0 ;; Package-Requires: ((emacs "24.4") (cl-lib "0.5")) -;; Last-Updated: Tue Jun 06 20:23:05 JST 2017 +;; Last-Updated: Wed Jun 07 16:22:51 JST 2017 ;; By: calancha -;; Update #: 643 +;; Update #: 644 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; @@ -3192,8 +3192,7 @@ in the active region." (gited-tabulated-list-entries) (tabulated-list-print) ;; Go to `gited-current-branch' when it is shown. - (when (assoc gited-current-branch - (mapcar (lambda (x) (cdr (cddr x))) gited-branch-alist)) + (when (gited-branch-exists-p gited-current-branch) (gited-goto-branch gited-current-branch) (gited-fontify-current-branch)) (unless gited--hide-details-set