No subject


Tue Jan 27 15:54:36 PST 2015


<h3>Modified Paths</h3>
<ul>
<li><a href="#userschunyanghelmlssvnelhelmlssvnel">users/chunyang/helm-ls-svn.el/helm-ls-svn.el</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="userschunyanghelmlssvnelhelmlssvnel"></a>
<div class="modfile"><h4>Modified: users/chunyang/helm-ls-svn.el/helm-ls-svn.el (137510 => 137511)</h4>
<pre class="diff"><span>
<span class="info">--- users/chunyang/helm-ls-svn.el/helm-ls-svn.el	2015-06-13 11:53:16 UTC (rev 137510)
+++ users/chunyang/helm-ls-svn.el/helm-ls-svn.el	2015-06-13 12:14:47 UTC (rev 137511)
</span><span class="lines">@@ -6,7 +6,7 @@
</span><span class="cx"> ;; Created: Wed Jun 10 20:58:26 CST 2015
</span><span class="cx"> ;; Version: 0.1
</span><span class="cx"> ;; URL: https://trac.macports.org/browser/users/chunyang/helm-ls-svn.el
</span><del>-;; Package-Requires: ((emacs &quot;24.1&quot;) (helm &quot;1.7.0&quot;))
</del><ins>+;; Package-Requires: ((emacs &quot;24.1&quot;) (helm &quot;1.7.0&quot;) (cl-lib &quot;0.5&quot;))
</ins><span class="cx"> ;; Keywords: helm svn
</span><span class="cx"> 
</span><span class="cx"> ;; This file is not part of Emacs.
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> ;; TODO
</span><span class="cx"> ;; ====
</span><span class="cx"> ;;
</span><del>-;; - Improve svn status source.
</del><ins>+;; - Implement persistent action (diff) for status source.
</ins><span class="cx"> ;; - Helm-find-files integration.
</span><span class="cx"> ;; - Submit to melpa.
</span><span class="cx"> ;; - Find out a suitable way to search in svn project.
</span><span class="lines">@@ -40,6 +40,9 @@
</span><span class="cx"> 
</span><span class="cx"> ;;; Code:
</span><span class="cx"> 
</span><ins>+(require 'cl-lib)
+(require 'vc)
+(require 'vc-svn)
</ins><span class="cx"> (require 'helm-files)
</span><span class="cx"> 
</span><span class="cx"> ;; Define the sources.
</span><span class="lines">@@ -102,6 +105,52 @@
</span><span class="cx">                     (expand-file-name (cadr (split-string candidate)) root)))
</span><span class="cx">             candidates)))
</span><span class="cx"> 
</span><ins>+(defun helm-ls-svn-diff (candidate)
+  (find-file candidate)
+  (call-interactively #'vc-diff))
+
+(defun helm-ls-svn-revert (_candidate)
+  (let ((marked (helm-marked-candidates)))
+    (cl-loop for f in marked do
+             (progn
+               (vc-svn-revert f)
+               (helm-aif (get-file-buffer f)
+                   (with-current-buffer it
+                     (revert-buffer t t)))))))
+
+(defun helm-ls-svn-status-action-transformer (actions _candidate)
+  (let ((disp (helm-get-selection nil t)))
+    (cond ((string-match &quot;^?&quot; disp)
+           (append actions
+                   (helm-make-actions
+                    &quot;Add files(s)&quot;
+                    (lambda (candidate)
+                      (let ((default-directory
+                              (file-name-directory candidate))
+                            (marked (helm-marked-candidates)))
+                        (vc-call-backend 'SVN 'register marked)))
+                    &quot;Delete file(s)&quot;
+                    #'helm-delete-marked-files)))
+          ((string-match &quot;^M&quot; disp)
+           (append actions
+                   (helm-make-actions
+                    &quot;Diff file&quot; #'helm-ls-svn-diff
+                    &quot;Commit file(s)&quot;
+                    (lambda (_candidate)
+                      (let* ((marked (helm-marked-candidates))
+                             (default-directory
+                               (file-name-directory (car marked))))
+                        (vc-checkin marked 'SVN)))
+                    &quot;Revert file(s)&quot; #'helm-ls-svn-revert
+                    &quot;Copy file(s) `C-u to follow'&quot; #'helm-find-files-copy
+                    &quot;Rename file(s) `C-u to follow'&quot; #'helm-find-files-rename)))
+          ((string-match &quot;^A&quot; disp)
+           (append actions
+                   (helm-make-actions
+                    &quot;svn delete&quot; #'vc-svn-delete-file
+                    &quot;Revert file(s)&quot; #'helm-ls-svn-revert)))
+          (t actions))))
+
</ins><span class="cx"> (defclass helm-ls-svn-source (helm-source-in-buffer)
</span><span class="cx">   ((header-name :initform 'helm-ls-svn-header-name)
</span><span class="cx">    (init :initform 'helm-ls-svn-init)
</span><span class="lines">@@ -118,6 +167,10 @@
</span><span class="cx">              (helm-ls-svn-status))))
</span><span class="cx">    (keymap :initform helm-ls-svn-map)
</span><span class="cx">    (filtered-candidate-transformer :initform 'helm-ls-svn-status-transformer)
</span><ins>+   ;; TODO: Implement persistent action
+   ;; (persistent-action :initform 'helm-ls-svn-diff)
+   ;; (persistent-help :initform &quot;Diff&quot;)
+   (action-transformer :initform 'helm-ls-svn-status-action-transformer)
</ins><span class="cx">    (action :initform
</span><span class="cx">            (helm-make-actions
</span><span class="cx">             &quot;Find file&quot; 'helm-find-many-files
</span></span></pre>
</div>
</div>

</body>
</html>
--zICm0pVAdRg--


More information about the macports-changes mailing list