diff options
| author | Stefan Monnier | 2007-06-22 18:37:16 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-06-22 18:37:16 +0000 |
| commit | 11a4edc2288a6edb94d3d5ea0f7bae2c9d492df6 (patch) | |
| tree | b1ded8a958e2682940fbbf87305cad741605001e | |
| parent | e404adfe16817e404d80db506a97b38336cd78c4 (diff) | |
| download | emacs-11a4edc2288a6edb94d3d5ea0f7bae2c9d492df6.tar.gz emacs-11a4edc2288a6edb94d3d5ea0f7bae2c9d492df6.zip | |
(vc-hg-registered): Add an autoloaded version.
(vc-hg-log-view-mode): Use log-view-font-lock-keywords.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/vc-hg.el | 40 |
2 files changed, 28 insertions, 19 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ca8595e8d78..c347187cad5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2007-06-22 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * vc-hg.el (vc-hg-registered): Add an autoloaded version. | ||
| 4 | (vc-hg-log-view-mode): Use log-view-font-lock-keywords. | ||
| 5 | |||
| 1 | 2007-06-22 Dan Nicolaescu <dann@ics.uci.edu> | 6 | 2007-06-22 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 7 | ||
| 3 | * vc-hg.el (vc-hg-print-log): Insert the file name. | 8 | * vc-hg.el (vc-hg-print-log): Insert the file name. |
| @@ -6,7 +11,7 @@ | |||
| 6 | 2007-06-22 Jay Belanger <jay.p.belanger@gmail.com> | 11 | 2007-06-22 Jay Belanger <jay.p.belanger@gmail.com> |
| 7 | 12 | ||
| 8 | * calc/calc-forms.el (math-format-date-part) | 13 | * calc/calc-forms.el (math-format-date-part) |
| 9 | (calc-parse-standard-date,calcFunc-julian): Fix incorrect number | 14 | (calc-parse-standard-date, calcFunc-julian): Fix incorrect number |
| 10 | used in calculations. | 15 | used in calculations. |
| 11 | 16 | ||
| 12 | 2007-06-22 Thien-Thi Nguyen <ttn@gnuvola.org> | 17 | 2007-06-22 Thien-Thi Nguyen <ttn@gnuvola.org> |
diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el index 5d27cf432e3..f7b37af42a3 100644 --- a/lisp/vc-hg.el +++ b/lisp/vc-hg.el | |||
| @@ -39,7 +39,7 @@ | |||
| 39 | ;; - dired | 39 | ;; - dired |
| 40 | ;; - snapshot? | 40 | ;; - snapshot? |
| 41 | 41 | ||
| 42 | ;; Implement Stefan Monnier's advice: | 42 | ;; Implement Stefan Monnier's advice: |
| 43 | ;; vc-hg-registered and vc-hg-state | 43 | ;; vc-hg-registered and vc-hg-state |
| 44 | ;; Both of those functions should be super extra careful to fail gracefully in | 44 | ;; Both of those functions should be super extra careful to fail gracefully in |
| 45 | ;; unexpected circumstances. The most important such case is when the `hg' | 45 | ;; unexpected circumstances. The most important such case is when the `hg' |
| @@ -51,15 +51,15 @@ | |||
| 51 | ;; Emacs is able to tell you this file is under mercurial's control). | 51 | ;; Emacs is able to tell you this file is under mercurial's control). |
| 52 | 52 | ||
| 53 | ;;; History: | 53 | ;;; History: |
| 54 | ;; | 54 | ;; |
| 55 | 55 | ||
| 56 | ;;; Code: | 56 | ;;; Code: |
| 57 | 57 | ||
| 58 | (eval-when-compile | 58 | (eval-when-compile |
| 59 | (require 'vc)) | 59 | (require 'vc)) |
| 60 | 60 | ||
| 61 | ;; XXX This should be moved to vc-hooks when the full vc interface is | 61 | ;; XXX This should be moved to vc-hooks when we can be sure that vc-state |
| 62 | ;; implemented. | 62 | ;; and friends are always harmless. |
| 63 | (add-to-list 'vc-handled-backends 'HG) | 63 | (add-to-list 'vc-handled-backends 'HG) |
| 64 | 64 | ||
| 65 | ;;; Customization options | 65 | ;;; Customization options |
| @@ -76,7 +76,14 @@ | |||
| 76 | 76 | ||
| 77 | ;;; State querying functions | 77 | ;;; State querying functions |
| 78 | 78 | ||
| 79 | ;;; Modelled after the similar function in vc-bzr.el | 79 | ;;;###autoload (defun vc-hg-registered (file) |
| 80 | ;;;###autoload "Return non-nil if FILE is registered with hg." | ||
| 81 | ;;;###autoload (if (vc-find-root file ".hg") ; short cut | ||
| 82 | ;;;###autoload (progn | ||
| 83 | ;;;###autoload (load "vc-hg") | ||
| 84 | ;;;###autoload (vc-hg-registered file)))) | ||
| 85 | |||
| 86 | ;; Modelled after the similar function in vc-bzr.el | ||
| 80 | (defun vc-hg-registered (file) | 87 | (defun vc-hg-registered (file) |
| 81 | "Return non-nil if FILE is registered with hg." | 88 | "Return non-nil if FILE is registered with hg." |
| 82 | (if (vc-find-root file ".hg") ; short cut | 89 | (if (vc-find-root file ".hg") ; short cut |
| @@ -126,7 +133,6 @@ | |||
| 126 | (defvar log-view-message-re) | 133 | (defvar log-view-message-re) |
| 127 | (defvar log-view-file-re) | 134 | (defvar log-view-file-re) |
| 128 | (defvar log-view-font-lock-keywords) | 135 | (defvar log-view-font-lock-keywords) |
| 129 | (defvar log-view-current-tag-function) | ||
| 130 | 136 | ||
| 131 | (define-derived-mode vc-hg-log-view-mode log-view-mode "HG-Log-View" | 137 | (define-derived-mode vc-hg-log-view-mode log-view-mode "HG-Log-View" |
| 132 | (require 'add-log) ;; we need the faces add-log | 138 | (require 'add-log) ;; we need the faces add-log |
| @@ -135,10 +141,8 @@ | |||
| 135 | (set (make-local-variable 'log-view-message-re) | 141 | (set (make-local-variable 'log-view-message-re) |
| 136 | "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)") | 142 | "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)") |
| 137 | (set (make-local-variable 'log-view-font-lock-keywords) | 143 | (set (make-local-variable 'log-view-font-lock-keywords) |
| 138 | (append | 144 | (append |
| 139 | ;; XXX maybe use a different face for the version number | 145 | log-view-font-lock-keywords |
| 140 | `((,log-view-message-re (1 'change-log-acknowledgement)) | ||
| 141 | (,log-view-file-re (1 'change-log-file-face))) | ||
| 142 | ;; Handle the case: | 146 | ;; Handle the case: |
| 143 | ;; user: foo@bar | 147 | ;; user: foo@bar |
| 144 | '(("^user:[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)" | 148 | '(("^user:[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)" |
| @@ -159,14 +163,14 @@ | |||
| 159 | (if (and (not oldvers) newvers) | 163 | (if (and (not oldvers) newvers) |
| 160 | (setq oldvers working)) | 164 | (setq oldvers working)) |
| 161 | (apply 'call-process "hg" nil (or buffer "*vc-diff*") nil | 165 | (apply 'call-process "hg" nil (or buffer "*vc-diff*") nil |
| 162 | "--cwd" (file-name-directory file) "diff" | 166 | "--cwd" (file-name-directory file) "diff" |
| 163 | (append | 167 | (append |
| 164 | (if oldvers | 168 | (if oldvers |
| 165 | (if newvers | 169 | (if newvers |
| 166 | (list "-r" oldvers "-r" newvers) | 170 | (list "-r" oldvers "-r" newvers) |
| 167 | (list "-r" oldvers)) | 171 | (list "-r" oldvers)) |
| 168 | (list "")) | 172 | (list "")) |
| 169 | (list (file-name-nondirectory file)))))) | 173 | (list (file-name-nondirectory file)))))) |
| 170 | 174 | ||
| 171 | (defun vc-hg-annotate-command (file buffer &optional version) | 175 | (defun vc-hg-annotate-command (file buffer &optional version) |
| 172 | "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER. | 176 | "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER. |
| @@ -178,15 +182,15 @@ Optional arg VERSION is a version to annotate from." | |||
| 178 | (delete-region (point-min) (1- (point))))) | 182 | (delete-region (point-min) (1- (point))))) |
| 179 | 183 | ||
| 180 | 184 | ||
| 181 | ;;; The format for one line output by "hg annotate -d -n" looks like this: | 185 | ;; The format for one line output by "hg annotate -d -n" looks like this: |
| 182 | ;;;215 Wed Jun 20 21:22:58 2007 -0700: CONTENTS | 186 | ;;215 Wed Jun 20 21:22:58 2007 -0700: CONTENTS |
| 183 | ;;; i.e: VERSION_NUMBER DATE: CONTENTS | 187 | ;; i.e: VERSION_NUMBER DATE: CONTENTS |
| 184 | (defconst vc-hg-annotate-re "^[ \t]*\\([0-9]+\\) \\(.\\{30\\}\\): ") | 188 | (defconst vc-hg-annotate-re "^[ \t]*\\([0-9]+\\) \\(.\\{30\\}\\): ") |
| 185 | 189 | ||
| 186 | (defun vc-hg-annotate-time () | 190 | (defun vc-hg-annotate-time () |
| 187 | (when (looking-at vc-hg-annotate-re) | 191 | (when (looking-at vc-hg-annotate-re) |
| 188 | (goto-char (match-end 0)) | 192 | (goto-char (match-end 0)) |
| 189 | (vc-annotate-convert-time | 193 | (vc-annotate-convert-time |
| 190 | (date-to-time (match-string-no-properties 2))))) | 194 | (date-to-time (match-string-no-properties 2))))) |
| 191 | 195 | ||
| 192 | (defun vc-hg-annotate-extract-revision-at-line () | 196 | (defun vc-hg-annotate-extract-revision-at-line () |
| @@ -210,7 +214,7 @@ COMMENT is ignored." | |||
| 210 | REV is ignored." | 214 | REV is ignored." |
| 211 | (vc-hg-command nil nil file "commit" "-m" comment)) | 215 | (vc-hg-command nil nil file "commit" "-m" comment)) |
| 212 | 216 | ||
| 213 | ;;; Modelled after the similar function in vc-bzr.el | 217 | ;; Modelled after the similar function in vc-bzr.el |
| 214 | (defun vc-hg-checkout (file &optional editable rev workfile) | 218 | (defun vc-hg-checkout (file &optional editable rev workfile) |
| 215 | "Retrieve a revision of FILE into a WORKFILE. | 219 | "Retrieve a revision of FILE into a WORKFILE. |
| 216 | EDITABLE is ignored. | 220 | EDITABLE is ignored. |