(vc-hg-registered): Return the false when vc-hg-state
authorDan Nicolaescu <dann@ics.uci.edu>
Fri, 28 Dec 2007 22:50:18 +0000 (22:50 +0000)
committerDan Nicolaescu <dann@ics.uci.edu>
Fri, 28 Dec 2007 22:50:18 +0000 (22:50 +0000)
returns 'ignored or 'unregistered.
(vc-hg-state): Pass "-A" to the status command and deal with the
output.
(vc-hg-dir-state): Pass "-A" to the status command.

lisp/ChangeLog
lisp/vc-hg.el

index 37fe9fa..5b25d73 100644 (file)
@@ -1,3 +1,11 @@
+2007-12-28  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * vc-hg.el (vc-hg-registered): Return the false when vc-hg-state
+       returns 'ignored or 'unregistered.
+       (vc-hg-state): Pass "-A" to the status command and deal with the
+       output.
+       (vc-hg-dir-state): Pass "-A" to the status command.
+
 2007-12-29  Richard Stallman  <rms@gnu.org>
 
        * progmodes/compile.el (compilation-start): Set initial visible
index 592bcca..41cc883 100644 (file)
 (defun vc-hg-registered (file)
   "Return non-nil if FILE is registered with hg."
   (when (vc-hg-root file)           ; short cut
-    (vc-file-setprop file 'vc-state (vc-hg-state file)))) ; expensive
+    (let ((state (vc-hg-state file)))  ; expensive
+      (vc-file-setprop file 'vc-state state)
+      (not (memq state '(ignored unregistered))))))
 
 (defun vc-hg-state (file)
   "Hg-specific version of `vc-state'."
                      ;; Ignore all errors.
                      (call-process
                       "hg" nil t nil "--cwd" (file-name-directory file)
-                      "status" (file-name-nondirectory file))
+                      "status" "-A" (file-name-nondirectory file))
                    ;; Some problem happened.  E.g. We can't find an `hg'
                    ;; executable.
                    (error nil)))))))
     (when (eq 0 status)
-      (if (eq 0 (length out)) 'up-to-date
        (when (null (string-match ".*: No such file or directory$" out))
          (let ((state (aref out 0)))
            (cond
+            ((eq state ?C) 'up-to-date)
             ((eq state ?A) 'edited)
             ((eq state ?M) 'edited)
             ((eq state ?I) 'ignored)
             ((eq state ?R) 'unregistered)
             ((eq state ??) 'unregistered)
-            (t 'up-to-date))))))))
+            (t 'up-to-date)))))))
 
 (defun vc-hg-dir-state (dir)
   (with-temp-buffer
     (buffer-disable-undo)              ;; Because these buffers can get huge
-    (vc-hg-command (current-buffer) nil nil "status")
+    (vc-hg-command (current-buffer) nil nil "status" "-A")
     (goto-char (point-min))
     (let ((status-char nil)
          (file nil))