[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/vc-hg.el,v
From: |
Dan Nicolaescu |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/vc-hg.el,v |
Date: |
Thu, 05 Jul 2007 14:55:35 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Dan Nicolaescu <dann> 07/07/05 14:55:35
Index: vc-hg.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc-hg.el,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- vc-hg.el 23 Jun 2007 04:30:24 -0000 1.9
+++ vc-hg.el 5 Jul 2007 14:55:34 -0000 1.10
@@ -91,7 +91,22 @@
(defun vc-hg-state (file)
"Hg-specific version of `vc-state'."
- (let ((out (vc-hg-internal-status file)))
+ (let*
+ ((status nil)
+ (out
+ (with-output-to-string
+ (with-current-buffer
+ standard-output
+ (setq status
+ (condition-case nil
+ ;; Ignore all errors.
+ (call-process
+ "hg" nil t nil "--cwd" (file-name-directory file)
+ "status" (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
(let ((state (aref out 0)))
(cond
@@ -99,14 +114,29 @@
((eq state ?A) 'edited)
((eq state ?P) 'needs-patch)
((eq state ??) nil)
- (t 'up-to-date))))))
+ (t 'up-to-date)))))))
(defun vc-hg-workfile-version (file)
"Hg-specific version of `vc-workfile-version'."
- (let ((out (vc-hg-internal-log file)))
+ (let*
+ ((status nil)
+ (out
+ (with-output-to-string
+ (with-current-buffer
+ standard-output
+ (setq status
+ (condition-case nil
+ ;; Ignore all errors.
+ (call-process
+ "hg" nil t nil "--cwd" (file-name-directory file)
+ "log" "-l1" (file-name-nondirectory file))
+ ;; Some problem happened. E.g. We can't find an `hg'
+ ;; executable.
+ (error nil)))))))
+ (when (eq 0 status)
(if (string-match "changeset: *\\([0-9]*\\)" out)
(match-string 1 out)
- "0")))
+ "0"))))
;;; History functions
@@ -231,6 +261,11 @@
(defun vc-hg-checkout-model (file)
'implicit)
+;; Modelled after the similar function in vc-bzr.el
+(defun vc-hg-revert (file &optional contents-done)
+ (unless contents-done
+ (with-temp-buffer (vc-hg-command t nil file "revert"))))
+
;;; Internal functions
(defun vc-hg-command (buffer okstatus file &rest flags)
@@ -243,24 +278,6 @@
(append vc-hg-global-switches
flags))))
-(defun vc-hg-internal-log (file &optional buffer)
- "Return log of FILE."
- (with-output-to-string
- (with-current-buffer
- standard-output
- (call-process
- "hg" nil t nil "--cwd" (file-name-directory file)
- "log" "-l1" (file-name-nondirectory file)))))
-
-(defun vc-hg-internal-status(file)
- "Return status of FILE."
- (with-output-to-string
- (with-current-buffer
- standard-output
- (call-process
- "hg" nil t nil "--cwd" (file-name-directory file)
- "status" (file-name-nondirectory file)))))
-
(provide 'vc-hg)
;;; vc-hg.el ends here
- [Emacs-diffs] Changes to emacs/lisp/vc-hg.el,v,
Dan Nicolaescu <=
- [Emacs-diffs] Changes to emacs/lisp/vc-hg.el,v, Dan Nicolaescu, 2007/07/05
- [Emacs-diffs] Changes to emacs/lisp/vc-hg.el,v, Dan Nicolaescu, 2007/07/06
- [Emacs-diffs] Changes to emacs/lisp/vc-hg.el,v, Miles Bader, 2007/07/08
- [Emacs-diffs] Changes to emacs/lisp/vc-hg.el,v, Eric S. Raymond, 2007/07/18
- [Emacs-diffs] Changes to emacs/lisp/vc-hg.el,v, Dan Nicolaescu, 2007/07/19
- [Emacs-diffs] Changes to emacs/lisp/vc-hg.el,v, Dan Nicolaescu, 2007/07/19
- [Emacs-diffs] Changes to emacs/lisp/vc-hg.el,v, Dan Nicolaescu, 2007/07/19
- [Emacs-diffs] Changes to emacs/lisp/vc-hg.el,v, Dan Nicolaescu, 2007/07/20
- [Emacs-diffs] Changes to emacs/lisp/vc-hg.el,v, Dan Nicolaescu, 2007/07/21
- [Emacs-diffs] Changes to emacs/lisp/vc-hg.el,v, Miles Bader, 2007/07/26