.emacs-my
changeset 1162 aadda3d1653c
parent 1158 89f674f09ca3
child 1163 e7728b2522b2
--- a/.emacs-my	Tue Oct 07 12:34:29 2014 +0300
+++ b/.emacs-my	Fri Oct 17 20:47:53 2014 +0300
@@ -2110,6 +2110,21 @@
 ;; (setq vc-git-diff-switches "-b")
 ;; (setq vc-diff-switches "-b")
 
+(defun my-vc-root-diff (prefix)
+  "Same as `vc-root-diff' but for Hg with C-u show latest MQ patch and
+with C-u C-u show MQ patch and local changes."
+  (interactive "P")
+  (if (and prefix (eq (vc-deduce-backend) 'Hg) (eq (vc-hg-command nil t "." "log" "-r" "qparent") 0))
+      (let* ( (rootdir (vc-call-backend 'Hg 'root default-directory)) (default-directory rootdir) )
+        (cond
+         ((equal prefix '(4))
+          (vc-diff-internal t (list 'Hg (list rootdir)) "qparent" "qtip"))
+         ((equal prefix '(16))
+          (vc-diff-internal t (list 'Hg (list rootdir)) "qparent" nil)) ))
+    (call-interactively 'vc-root-diff nil)))
+
+(global-set-key (kbd "C-x v D") 'my-vc-root-diff)
+
 (when (equal window-system 'w32)
   (modify-coding-system-alist 'process "cvs" '(cp1251-dos . cp1251-dos))
   (modify-coding-system-alist 'process "svn" '(cp1251 . cp1251))