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

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

[elpa] master b306c33: gited-git-checkout: New function


From: Tino Calancha
Subject: [elpa] master b306c33: gited-git-checkout: New function
Date: Wed, 5 Jul 2017 02:31:24 -0400 (EDT)

branch: master
commit b306c33516c48a2b041edb193bf02e3f0a7a94f9
Author: Tino Calancha <address@hidden>
Commit: Tino Calancha <address@hidden>

    gited-git-checkout: New function
    
    In Emacs versions < 25 `gited-git-checkout' has 2 optional
    arguments: EDITABLE and REV.  In Emacs versions >= 25 this
    function has just REV as optional argument.
    Bumo version to 0.3.
    * gited.el (gited-git-checkout): New defun.
    Replace all calls to `vc-git-checkout' with calls to it.
---
 packages/gited/gited.el | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/packages/gited/gited.el b/packages/gited/gited.el
index 048528a..8477322 100644
--- a/packages/gited/gited.el
+++ b/packages/gited/gited.el
@@ -8,11 +8,11 @@
 
 ;; Created: Wed Oct 26 01:28:54 JST 2016
 ;; Compatibility: GNU Emacs: 24.4
-;; Version: 0.2.5
+;; Version: 0.3
 ;; Package-Requires: ((emacs "24.4") (cl-lib "0.5"))
-;; Last-Updated: Sun Jul 02 12:24:55 JST 2017
+;; Last-Updated: Wed Jul 05 15:23:23 JST 2017
 ;;           By: calancha
-;;     Update #: 674
+;;     Update #: 675
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
@@ -203,8 +203,8 @@
 ;;   `gited-get-branchname', `gited-get-commit',
 ;;   `gited-get-date', `gited-get-element-in-row',
 ;;   `gited-get-last-commit-time', `gited-get-mark',
-;;   `gited-get-marked-branches', `gited-git-command',
-;;   `gited-git-command-on-region',
+;;   `gited-get-marked-branches', `gited-git-checkout',
+;;   `gited-git-command', `gited-git-command-on-region',
 ;;   `gited-hide-details-update-invisibility-spec',
 ;;   `gited-insert-marker-char', `gited-internal-do-deletions',
 ;;   `gited-last-commit-title', `gited-listed-branches',
@@ -616,6 +616,16 @@ These branches cannot be deleted or renamed."
 
 
 
+;;; `vc-git-checkout' has 2nd argument EDITABLE for Emacs < 25.
+;;; For Emacs >= 25 that argument doesn't exit.
+(defun gited-git-checkout (file rev)
+  "Like `vc-git-checkout' with arguments FILE and REV.
+In Emacs version < 25 `vc-git-checkout' has 3 arguments."
+  (if (< emacs-major-version 25)
+      (vc-git-checkout file nil rev)
+    (vc-git-checkout file rev)))
+
+
 ;;; Macros.
 
 (defmacro gited-with-current-branch (branch &rest body)
@@ -627,11 +637,11 @@ The value returned is the value of the last form in BODY."
     `(let ((,cur-branch gited-current-branch))
        (unwind-protect
            (progn
-             (vc-git-checkout nil ,branch)
+             (gited-git-checkout nil ,branch)
              (setq gited-current-branch ,branch)
              ,@body)
          ;; Restore original current branch.
-         (vc-git-checkout nil ,cur-branch)
+         (gited-git-checkout nil ,cur-branch)
          (setq gited-current-branch ,cur-branch)))))
 
 ;;; Map over marks.
@@ -1515,7 +1525,7 @@ local, then prompt for a branch name where to check out 
BRANCH."
       ;; Fontify the previous current branch correctly.
       (let ((gited-current-branch "")) (gited--fontify-current-row))
       (if (not new-branch-p)
-          (vc-git-checkout nil branch)
+          (gited-git-checkout nil branch)
         (gited-git-command `("checkout" "-b" ,local-branch ,branch))
         (run-hooks 'gited-after-change-hook))
       (setq gited-current-branch local-branch))



reply via email to

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