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

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

[elpa] scratch/add-vdiff c31755a 220/258: vdiff-magit: Port show stash


From: Justin Burkett
Subject: [elpa] scratch/add-vdiff c31755a 220/258: vdiff-magit: Port show stash
Date: Wed, 17 May 2017 08:13:57 -0400 (EDT)

branch: scratch/add-vdiff
commit c31755a6160b643ef93f3517a8adc43280691dca
Author: Justin Burkett <address@hidden>
Commit: Justin Burkett <address@hidden>

    vdiff-magit: Port show stash
---
 vdiff-magit.el | 106 +++++++++++++++++++++++++--------------------------------
 1 file changed, 47 insertions(+), 59 deletions(-)

diff --git a/vdiff-magit.el b/vdiff-magit.el
index 8d8265d..88f562b 100644
--- a/vdiff-magit.el
+++ b/vdiff-magit.el
@@ -62,37 +62,37 @@
 ;;   :group 'magit-ediff
 ;;   :type 'boolean)
 
-;; (defcustom magit-ediff-show-stash-with-index t
-;;   "Whether `magit-ediff-show-stash' shows the state of the index.
+(defcustom vdiff-magit-show-stash-with-index t
+  "Whether `vdiff-magit-show-stash' shows the state of the index.
 
-;; If non-nil, use a third Ediff buffer to distinguish which changes
-;; in the stash were staged.  In cases where the stash contains no
-;; staged changes, fall back to a two-buffer Ediff.
+If non-nil, use a third vdiff buffer to distinguish which changes
+in the stash were staged.  In cases where the stash contains no
+staged changes, fall back to a two-buffer vdiff.
 
-;; More specificaly, a stash is a merge commit, address@hidden, with
-;; potentially three parents.
+More specificaly, a stash is a merge commit, address@hidden, with
+potentially three parents.
 
-;; * address@hidden represents the HEAD commit at the time the stash
-;;   was created.
+* address@hidden represents the HEAD commit at the time the stash
+  was created.
 
-;; * address@hidden records any changes that were staged when the stash
-;;   was made.
+* address@hidden records any changes that were staged when the stash
+  was made.
 
-;; * address@hidden, if it exists, contains files that were untracked
-;;   when stashing.
+* address@hidden, if it exists, contains files that were untracked
+  when stashing.
 
-;; If this option is non-nil, `magit-ediff-show-stash' will run
-;; Ediff on a file using three buffers: one for address@hidden, another
-;; for address@hidden, and a third for address@hidden
+If this option is non-nil, `vdiff-magit-show-stash' will run
+vdiff on a file using three buffers: one for address@hidden, another
+for address@hidden, and a third for address@hidden
 
-;; Otherwise, Ediff uses two buffers, comparing
-;; address@hidden@{N}.  Along with any unstaged changes, changes
-;; in the index commit, address@hidden, will be shown in this
-;; comparison unless they conflicted with changes in the working
-;; tree at the time of stashing."
-;;   :package-version '(magit . "2.6.0")
-;;   :group 'magit-ediff
-;;   :type 'boolean)
+Otherwise, vdiff uses two buffers, comparing
address@hidden@{N}.  Along with any unstaged changes, changes
+in the index commit, address@hidden, will be shown in this
+comparison unless they conflicted with changes in the working
+tree at the time of stashing."
+  :package-version '(magit . "2.6.0")
+  :group 'vdiff-magit
+  :type 'boolean)
 
 ;; (defvar magit-ediff-previous-winconf nil)
 
@@ -429,41 +429,29 @@ FILE must be relative to the top directory of the 
repository."
            (magit-ediff-read-files revA revB (magit-current-file)))))
 
 ;; ;;;###autoload
-;; (defun magit-ediff-show-stash (stash)
-;;   "Show changes introduced by STASH using Ediff.
-;; `magit-ediff-show-stash-with-index' controls whether a
-;; three-buffer Ediff is used in order to distinguish changes in the
-;; stash that were staged."
-;;   (interactive (list (magit-read-stash "Stash")))
-;;   (-let* ((revA (concat stash "^1"))
-;;           (revB (concat stash "^2"))
-;;           (revC stash)
-;;           ((fileA fileC) (magit-ediff-read-files revA revC))
-;;           (fileB fileC))
-;;     (if (and magit-ediff-show-stash-with-index
-;;              (member fileA (magit-changed-files revB revA)))
-;;         (let ((conf (current-window-configuration))
-;;               (bufA (magit-get-revision-buffer revA fileA))
-;;               (bufB (magit-get-revision-buffer revB fileB))
-;;               (bufC (magit-get-revision-buffer revC fileC)))
-;;           (ediff-buffers3
-;;            (or bufA (magit-find-file-noselect revA fileA))
-;;            (or bufB (magit-find-file-noselect revB fileB))
-;;            (or bufC (magit-find-file-noselect revC fileC))
-;;            `((lambda ()
-;;                (setq-local
-;;                 ediff-quit-hook
-;;                 (lambda ()
-;;                   ,@(unless bufA
-;;                       '((ediff-kill-buffer-carefully ediff-buffer-A)))
-;;                   ,@(unless bufB
-;;                       '((ediff-kill-buffer-carefully ediff-buffer-B)))
-;;                   ,@(unless bufC
-;;                       '((ediff-kill-buffer-carefully ediff-buffer-C)))
-;;                   (let ((magit-ediff-previous-winconf ,conf))
-;;                     (run-hooks 'magit-ediff-quit-hook))))))
-;;            'ediff-buffers3))
-;;       (vdiff-magit-compare revA revC fileA fileC))))
+(defun vdiff-magit-show-stash (stash)
+  "Show changes introduced by STASH using Ediff.
+`vdiff-magit-show-stash-with-index' controls whether a
+three-buffer Ediff is used in order to distinguish changes in the
+stash that were staged."
+  (interactive (list (magit-read-stash "Stash")))
+  (-let* ((revA (concat stash "^1"))
+          (revB (concat stash "^2"))
+          (revC stash)
+          ((fileA fileC) (magit-ediff-read-files revA revC))
+          (fileB fileC))
+    (if (and vdiff-magit-show-stash-with-index
+             (member fileA (magit-changed-files revB revA)))
+        (let ((conf (current-window-configuration))
+              (bufA (magit-get-revision-buffer revA fileA))
+              (bufB (magit-get-revision-buffer revB fileB))
+              (bufC (magit-get-revision-buffer revC fileC)))
+          (vdiff-buffers3
+           (or bufA (magit-find-file-noselect revA fileA))
+           (or bufB (magit-find-file-noselect revB fileB))
+           (or bufC (magit-find-file-noselect revC fileC))
+           nil t t))
+      (vdiff-magit-compare revA revC fileA fileC))))
 
 ;; Don't think this is necessary
 ;; (defun magit-vdiff-cleanup-auxiliary-buffers ()



reply via email to

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