emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] scratch/gited c2306ca: Mark branches by last commit time


From: Tino Calancha
Subject: [elpa] scratch/gited c2306ca: Mark branches by last commit time
Date: Mon, 5 Jun 2017 09:29:14 -0400 (EDT)

branch: scratch/gited
commit c2306caf88ddd7587a976569ada49ba2511b2e44
Author: Tino Calancha <address@hidden>
Commit: Tino Calancha <address@hidden>

    Mark branches by last commit time
    
    Add command to mark all branches whose last commit time
    was after MIN-TIME.
    * gited.el (gited-mark-branches-by-date): New command; bind it to '% t'.
---
 packages/gited/gited.el | 31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)

diff --git a/packages/gited/gited.el b/packages/gited/gited.el
index 50ab824..b262531 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: Mon Jun 05 20:40:08 JST 2017
+;; Last-Updated: Mon Jun 05 21:58:11 JST 2017
 ;;           By: calancha
-;;     Update #: 639
+;;     Update #: 640
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
@@ -117,7 +117,8 @@
 ;;   `gited-goto-first-branch', `gited-goto-last-branch',
 ;;   `gited-kill-line', `gited-list-branches',
 ;;   `gited-log', `gited-log-last-n-commits',
-;;   `gited-mark', `gited-mark-branches-containing-commit',
+;;   `gited-mark', `gited-mark-branches-by-date',
+;;   `gited-mark-branches-containing-commit',
 ;;   `gited-mark-branches-containing-regexp', `gited-mark-branches-regexp',
 ;;   `gited-mark-merged-branches', `gited-mark-unmerged-branches',
 ;;   `gited-merge-branch', `gited-move-to-author',
@@ -2763,6 +2764,29 @@ A prefix argument means to unmark them instead."
             (and fn (string-match-p regexp fn))))
      "matching branch")))
 
+(defun gited-mark-branches-by-date (min-time &optional marker-char)
+  "Mark all branches whose last commit time was after MIN-TIME.
+Interactively, a prefix argument means to unmark them instead.
+MIN-TIME must be a string suitable for `date-to-time' like
+\"2017-06-05 20:32:32\"."
+  (interactive
+   (let* ((prefix current-prefix-arg)
+          ;; Default to 1 week before the last commit time in current row.
+          (default (format-time-string
+                    "%F %T"
+                    (time-subtract (date-to-time (gited-get-date)) (* 7 24 60 
60))))
+          (min-time (read-string
+                     (concat (if current-prefix-arg "Unmark" "Mark")
+                             " branches with last commit after time: ")
+                     default)))
+     (list min-time (and prefix ?\s))))
+  (let ((gited-marker-char (or marker-char gited-marker-char)))
+    (gited-mark-if
+     (and (not (eolp))
+          (let ((commit-time (date-to-time (gited-get-date))))
+            (time-less-p (date-to-time min-time) commit-time)))
+     "matching branch")))
+
 (defun gited-mark-branches-containing-regexp (regexp &optional marker-char 
days)
   "Mark all branches containing REGEXP in some commit message.
 A prefix argument means to unmark them instead.
@@ -3090,6 +3114,7 @@ in the active region."
     ;; marking banches
     (define-key map (kbd "m") 'gited-mark)
     (define-key map (kbd "% n") 'gited-mark-branches-regexp)
+    (define-key map (kbd "% t") 'gited-mark-branches-by-date)
     (define-key map (kbd "% c") 'gited-mark-branches-containing-commit)
     (define-key map (kbd "% g") 'gited-mark-branches-containing-regexp)
     (define-key map (kbd "% m") 'gited-mark-merged-branches)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]