]> code.delx.au - gnu-emacs/blobdiff - lisp/vc/vc-hg.el
Merge from origin/emacs-24
[gnu-emacs] / lisp / vc / vc-hg.el
index 7099defb37c16ae6a711bb3d60a334f00f17e0d5..8b4067f536be405b1da46a5c14d10eff712b5907 100644 (file)
@@ -1,6 +1,6 @@
 ;;; vc-hg.el --- VC backend for the mercurial version control system  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2006-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2015 Free Software Foundation, Inc.
 
 ;; Author: Ivan Kanis
 ;; Maintainer: emacs-devel@gnu.org
@@ -47,7 +47,6 @@
 ;; - dir-extra-headers (dir)                   OK
 ;; - dir-printer (fileinfo)                    OK
 ;; * working-revision (file)                   OK
-;; - latest-on-branch-p (file)                 ??
 ;; * checkout-model (files)                    OK
 ;; - mode-line-string (file)                   NOT NEEDED
 ;; STATE-CHANGING FUNCTIONS
@@ -60,7 +59,6 @@
 ;; * find-revision (file rev buffer)           OK
 ;; * checkout (file &optional rev)             OK
 ;; * revert (file &optional contents-done)     OK
-;; - rollback (files)                          ?? PROBABLY NOT NEEDED
 ;; - merge (file rev1 rev2)                    NEEDED
 ;; - merge-news (file)                         NEEDED
 ;; - steal-lock (file &optional revision)      NOT NEEDED
@@ -188,6 +186,7 @@ highlighting the Log View buffer."
 
 (defun vc-hg-state (file)
   "Hg-specific version of `vc-state'."
+  (setq file (expand-file-name file))
   (let*
       ((status nil)
        (default-directory (file-name-directory file))
@@ -212,19 +211,20 @@ highlighting the Log View buffer."
                     ;; Some problem happened.  E.g. We can't find an `hg'
                     ;; executable.
                     (error nil)))))))
-    (when (eq 0 status)
-        (when (null (string-match ".*: No such file or directory$" out))
-          (let ((state (aref out 0)))
-            (cond
-             ((eq state ?=) 'up-to-date)
-             ((eq state ?A) 'added)
-             ((eq state ?M) 'edited)
-             ((eq state ?I) 'ignored)
-             ((eq state ?R) 'removed)
-             ((eq state ?!) 'missing)
-             ((eq state ??) 'unregistered)
-             ((eq state ?C) 'up-to-date) ;; Older mercurial versions use this.
-             (t 'up-to-date)))))))
+    (when (and (eq 0 status)
+              (> (length out) 0)
+              (null (string-match ".*: No such file or directory$" out)))
+      (let ((state (aref out 0)))
+       (cond
+        ((eq state ?=) 'up-to-date)
+        ((eq state ?A) 'added)
+        ((eq state ?M) 'edited)
+        ((eq state ?I) 'ignored)
+        ((eq state ?R) 'removed)
+        ((eq state ?!) 'missing)
+        ((eq state ??) 'unregistered)
+        ((eq state ?C) 'up-to-date) ;; Older mercurial versions use this.
+        (t 'up-to-date))))))
 
 (defun vc-hg-working-revision (file)
   "Hg-specific version of `vc-working-revision'."
@@ -313,7 +313,7 @@ If LIMIT is non-nil, show no more than this many entries."
 
 (autoload 'vc-switches "vc")
 
-(defun vc-hg-diff (files &optional async oldvers newvers buffer)
+(defun vc-hg-diff (files &optional oldvers newvers buffer async)
   "Get a difference report using hg between two revisions of FILES."
   (let* ((firstfile (car files))
          (working (and firstfile (vc-working-revision firstfile))))
@@ -613,9 +613,11 @@ REV is the revision to check out into WORKFILE."
 (declare-function vc-set-async-update "vc-dispatcher" (process-buffer))
 
 (defun vc-hg-dir-status-files (dir files update-function)
-  (apply 'vc-hg-command (current-buffer) 'async dir "status" "-mardui" "-C" files)
+  (apply 'vc-hg-command (current-buffer) 'async dir "status"
+         (concat "-mardu" (if files "i"))
+         "-C" files)
   (vc-run-delayed
-   (vc-hg-after-dir-status update-function)))
+    (vc-hg-after-dir-status update-function)))
 
 (defun vc-hg-dir-extra-header (name &rest commands)
   (concat (propertize name 'face 'font-lock-type-face)