Handle HG MQ from non-root directory.
--- a/.emacs-my Fri Oct 17 20:47:53 2014 +0300
+++ b/.emacs-my Fri Oct 17 21:08:29 2014 +0300
@@ -2114,14 +2114,19 @@
"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)))
+ (when (eq 'non-hg-mq
+ (catch 'break
+ (unless (and prefix (eq (vc-deduce-backend) 'Hg))
+ (throw 'break 'non-hg-mq))
+ (let* ( (rootdir (vc-call-backend 'Hg 'root default-directory)) (default-directory rootdir) )
+ (unless (eq (vc-hg-command nil t rootdir "log" "-r" "qtip") 0)
+ (throw 'break 'non-hg-mq))
+ (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)