]> code.delx.au - gnu-emacs/blob - lisp/vc-hg.el
(vc-hg-log-switches): Add defcustom.
[gnu-emacs] / lisp / vc-hg.el
1 ;;; vc-hg.el --- VC backend for the mercurial version control system
2
3 ;; Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
4
5 ;; Author: Ivan Kanis
6 ;; Keywords: tools
7
8 ;; This file is part of GNU Emacs.
9
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
14
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22
23 ;;; Commentary:
24
25 ;; This is a mercurial version control backend
26
27 ;;; Thanks:
28
29 ;;; Bugs:
30
31 ;;; Installation:
32
33 ;;; Todo:
34
35 ;; 1) Implement the rest of the vc interface. See the comment at the
36 ;; beginning of vc.el. The current status is:
37
38 ;; FUNCTION NAME STATUS
39 ;; BACKEND PROPERTIES
40 ;; * revision-granularity OK
41 ;; STATE-QUERYING FUNCTIONS
42 ;; * registered (file) OK
43 ;; * state (file) OK
44 ;; - state-heuristic (file) NOT NEEDED
45 ;; - dir-status (dir update-function) OK
46 ;; - dir-status-files (dir files ds uf) OK
47 ;; - dir-extra-headers (dir) OK
48 ;; - dir-printer (fileinfo) OK
49 ;; * working-revision (file) OK
50 ;; - latest-on-branch-p (file) ??
51 ;; * checkout-model (files) OK
52 ;; - workfile-unchanged-p (file) OK
53 ;; - mode-line-string (file) NOT NEEDED
54 ;; STATE-CHANGING FUNCTIONS
55 ;; * register (files &optional rev comment) OK
56 ;; * create-repo () OK
57 ;; - init-revision () NOT NEEDED
58 ;; - responsible-p (file) OK
59 ;; - could-register (file) OK
60 ;; - receive-file (file rev) ?? PROBABLY NOT NEEDED
61 ;; - unregister (file) COMMENTED OUT, MAY BE INCORRECT
62 ;; * checkin (files rev comment) OK
63 ;; * find-revision (file rev buffer) OK
64 ;; * checkout (file &optional editable rev) OK
65 ;; * revert (file &optional contents-done) OK
66 ;; - rollback (files) ?? PROBABLY NOT NEEDED
67 ;; - merge (file rev1 rev2) NEEDED
68 ;; - merge-news (file) NEEDED
69 ;; - steal-lock (file &optional revision) NOT NEEDED
70 ;; HISTORY FUNCTIONS
71 ;; * print-log (files &optional buffer) OK
72 ;; - log-view-mode () OK
73 ;; - show-log-entry (revision) NOT NEEDED, DEFAULT IS GOOD
74 ;; - comment-history (file) NOT NEEDED
75 ;; - update-changelog (files) NOT NEEDED
76 ;; * diff (files &optional rev1 rev2 buffer) OK
77 ;; - revision-completion-table (files) OK?
78 ;; - annotate-command (file buf &optional rev) OK
79 ;; - annotate-time () OK
80 ;; - annotate-current-time () NOT NEEDED
81 ;; - annotate-extract-revision-at-line () OK
82 ;; TAG SYSTEM
83 ;; - create-tag (dir name branchp) NEEDED
84 ;; - retrieve-tag (dir name update) NEEDED
85 ;; MISCELLANEOUS
86 ;; - make-version-backups-p (file) ??
87 ;; - repository-hostname (dirname) ??
88 ;; - previous-revision (file rev) OK
89 ;; - next-revision (file rev) OK
90 ;; - check-headers () ??
91 ;; - clear-headers () ??
92 ;; - delete-file (file) TEST IT
93 ;; - rename-file (old new) OK
94 ;; - find-file-hook () PROBABLY NOT NEEDED
95 ;; - find-file-not-found-hook () PROBABLY NOT NEEDED
96
97 ;; 2) Implement Stefan Monnier's advice:
98 ;; vc-hg-registered and vc-hg-state
99 ;; Both of those functions should be super extra careful to fail gracefully in
100 ;; unexpected circumstances. The reason this is important is that any error
101 ;; there will prevent the user from even looking at the file :-(
102 ;; Ideally, just like in vc-arch and vc-cvs, checking that the file is under
103 ;; mercurial's control and extracting the current revision should be done
104 ;; without even using `hg' (this way even if you don't have `hg' installed,
105 ;; Emacs is able to tell you this file is under mercurial's control).
106
107 ;;; History:
108 ;;
109
110 ;;; Code:
111
112 (eval-when-compile
113 (require 'cl)
114 (require 'vc)
115 (require 'vc-dir))
116
117 ;;; Customization options
118
119 (defcustom vc-hg-global-switches nil
120 "Global switches to pass to any Hg command."
121 :type '(choice (const :tag "None" nil)
122 (string :tag "Argument String")
123 (repeat :tag "Argument List" :value ("") string))
124 :version "22.2"
125 :group 'vc)
126
127 (defcustom vc-hg-diff-switches t ; Hg doesn't support common args like -u
128 "String or list of strings specifying switches for Hg diff under VC.
129 If nil, use the value of `vc-diff-switches'. If t, use no switches."
130 :type '(choice (const :tag "Unspecified" nil)
131 (const :tag "None" t)
132 (string :tag "Argument String")
133 (repeat :tag "Argument List" :value ("") string))
134 :version "23.1"
135 :group 'vc)
136
137 \f
138 ;;; Properties of the backend
139
140 (defun vc-hg-revision-granularity () 'repository)
141 (defun vc-hg-checkout-model (files) 'implicit)
142
143 ;;; State querying functions
144
145 ;;;###autoload (defun vc-hg-registered (file)
146 ;;;###autoload "Return non-nil if FILE is registered with hg."
147 ;;;###autoload (if (vc-find-root file ".hg") ; short cut
148 ;;;###autoload (progn
149 ;;;###autoload (load "vc-hg")
150 ;;;###autoload (vc-hg-registered file))))
151
152 ;; Modeled after the similar function in vc-bzr.el
153 (defun vc-hg-registered (file)
154 "Return non-nil if FILE is registered with hg."
155 (when (vc-hg-root file) ; short cut
156 (let ((state (vc-hg-state file))) ; expensive
157 (and state (not (memq state '(ignored unregistered)))))))
158
159 (defun vc-hg-state (file)
160 "Hg-specific version of `vc-state'."
161 (let*
162 ((status nil)
163 (out
164 (with-output-to-string
165 (with-current-buffer
166 standard-output
167 (setq status
168 (condition-case nil
169 ;; Ignore all errors.
170 (call-process
171 "hg" nil t nil "--cwd" (file-name-directory file)
172 "status" "-A" (file-name-nondirectory file))
173 ;; Some problem happened. E.g. We can't find an `hg'
174 ;; executable.
175 (error nil)))))))
176 (when (eq 0 status)
177 (when (null (string-match ".*: No such file or directory$" out))
178 (let ((state (aref out 0)))
179 (cond
180 ((eq state ?=) 'up-to-date)
181 ((eq state ?A) 'added)
182 ((eq state ?M) 'edited)
183 ((eq state ?I) 'ignored)
184 ((eq state ?R) 'removed)
185 ((eq state ?!) 'missing)
186 ((eq state ??) 'unregistered)
187 ((eq state ?C) 'up-to-date) ;; Older mercurials use this
188 (t 'up-to-date)))))))
189
190 (defun vc-hg-working-revision (file)
191 "Hg-specific version of `vc-working-revision'."
192 (let*
193 ((status nil)
194 (out
195 (with-output-to-string
196 (with-current-buffer
197 standard-output
198 (setq status
199 (condition-case nil
200 ;; Ignore all errors.
201 (call-process
202 "hg" nil t nil "--cwd" (file-name-directory file)
203 "log" "-l1" (file-name-nondirectory file))
204 ;; Some problem happened. E.g. We can't find an `hg'
205 ;; executable.
206 (error nil)))))))
207 (when (eq 0 status)
208 (if (string-match "changeset: *\\([0-9]*\\)" out)
209 (match-string 1 out)
210 "0"))))
211
212 ;;; History functions
213
214 (defcustom vc-hg-log-switches nil
215 "String or list of strings specifying switches for hg log under VC."
216 :type '(choice (const :tag "None" nil)
217 (string :tag "Argument String")
218 (repeat :tag "Argument List" :value ("") string))
219 :group 'vc-hg)
220
221 (defun vc-hg-print-log (files &optional buffer)
222 "Get change log associated with FILES."
223 ;; `log-view-mode' needs to have the file names in order to function
224 ;; correctly. "hg log" does not print it, so we insert it here by
225 ;; hand.
226
227 ;; `vc-do-command' creates the buffer, but we need it before running
228 ;; the command.
229 (vc-setup-buffer buffer)
230 ;; If the buffer exists from a previous invocation it might be
231 ;; read-only.
232 (let ((inhibit-read-only t))
233 (with-current-buffer
234 buffer
235 (apply 'vc-hg-command buffer 0 files "log" vc-hg-log-switches))))
236
237 (defvar log-view-message-re)
238 (defvar log-view-file-re)
239 (defvar log-view-font-lock-keywords)
240 (defvar log-view-per-file-logs)
241
242 (define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View"
243 (require 'add-log) ;; we need the add-log faces
244 (set (make-local-variable 'log-view-file-re) "\\`a\\`")
245 (set (make-local-variable 'log-view-per-file-logs) nil)
246 (set (make-local-variable 'log-view-message-re)
247 "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)")
248 (set (make-local-variable 'log-view-font-lock-keywords)
249 (append
250 log-view-font-lock-keywords
251 '(
252 ;; Handle the case:
253 ;; user: FirstName LastName <foo@bar>
254 ("^user:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
255 (1 'change-log-name)
256 (2 'change-log-email))
257 ;; Handle the cases:
258 ;; user: foo@bar
259 ;; and
260 ;; user: foo
261 ("^user:[ \t]+\\([A-Za-z0-9_.+-]+\\(?:@[A-Za-z0-9_.-]+\\)?\\)"
262 (1 'change-log-email))
263 ("^date: \\(.+\\)" (1 'change-log-date))
264 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))
265
266 (defun vc-hg-diff (files &optional oldvers newvers buffer)
267 "Get a difference report using hg between two revisions of FILES."
268 (let* ((firstfile (car files))
269 (cwd (if firstfile (file-name-directory firstfile)
270 (expand-file-name default-directory)))
271 (working (and firstfile (vc-working-revision firstfile))))
272 (when (and (equal oldvers working) (not newvers))
273 (setq oldvers nil))
274 (when (and (not oldvers) newvers)
275 (setq oldvers working))
276 (apply #'vc-hg-command (or buffer "*vc-diff*") nil
277 (mapcar (lambda (file) (file-relative-name file cwd)) files)
278 "--cwd" cwd
279 "diff"
280 (append
281 (vc-switches 'hg 'diff)
282 (when oldvers
283 (if newvers
284 (list "-r" oldvers "-r" newvers)
285 (list "-r" oldvers)))))))
286
287 (defun vc-hg-revision-table (files)
288 (let ((default-directory (file-name-directory (car files))))
289 (with-temp-buffer
290 (vc-hg-command t nil files "log" "--template" "{rev} ")
291 (split-string
292 (buffer-substring-no-properties (point-min) (point-max))))))
293
294 ;; Modeled after the similar function in vc-cvs.el
295 (defun vc-hg-revision-completion-table (files)
296 (lexical-let ((files files)
297 table)
298 (setq table (lazy-completion-table
299 table (lambda () (vc-hg-revision-table files))))
300 table))
301
302 (defun vc-hg-annotate-command (file buffer &optional revision)
303 "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER.
304 Optional arg REVISION is a revision to annotate from."
305 (vc-hg-command buffer 0 file "annotate" "-d" "-n"
306 (when revision (concat "-r" revision)))
307 (with-current-buffer buffer
308 (goto-char (point-min))
309 (re-search-forward "^[ \t]*[0-9]")
310 (delete-region (point-min) (match-beginning 0))))
311
312 (declare-function vc-annotate-convert-time "vc-annotate" (time))
313
314 ;; The format for one line output by "hg annotate -d -n" looks like this:
315 ;;215 Wed Jun 20 21:22:58 2007 -0700: CONTENTS
316 ;; i.e: VERSION_NUMBER DATE: CONTENTS
317 ;; If the user has set the "--follow" option, the output looks like:
318 ;;215 Wed Jun 20 21:22:58 2007 -0700 foo.c: CONTENTS
319 ;; i.e. VERSION_NUMBER DATE FILENAME: CONTENTS
320 (defconst vc-hg-annotate-re
321 "^[ \t]*\\([0-9]+\\) \\(.\\{30\\}\\)[^:\n]*\\(:[^ \n][^:\n]*\\)*: ")
322
323 (defun vc-hg-annotate-time ()
324 (when (looking-at vc-hg-annotate-re)
325 (goto-char (match-end 0))
326 (vc-annotate-convert-time
327 (date-to-time (match-string-no-properties 2)))))
328
329 (defun vc-hg-annotate-extract-revision-at-line ()
330 (save-excursion
331 (beginning-of-line)
332 (when (looking-at vc-hg-annotate-re) (match-string-no-properties 1))))
333
334 (defun vc-hg-previous-revision (file rev)
335 (let ((newrev (1- (string-to-number rev))))
336 (when (>= newrev 0)
337 (number-to-string newrev))))
338
339 (defun vc-hg-next-revision (file rev)
340 (let ((newrev (1+ (string-to-number rev)))
341 (tip-revision
342 (with-temp-buffer
343 (vc-hg-command t 0 nil "tip")
344 (goto-char (point-min))
345 (re-search-forward "^changeset:[ \t]*\\([0-9]+\\):")
346 (string-to-number (match-string-no-properties 1)))))
347 ;; We don't want to exceed the maximum possible revision number, ie
348 ;; the tip revision.
349 (when (<= newrev tip-revision)
350 (number-to-string newrev))))
351
352 ;; Modeled after the similar function in vc-bzr.el
353 (defun vc-hg-delete-file (file)
354 "Delete FILE and delete it in the hg repository."
355 (condition-case ()
356 (delete-file file)
357 (file-error nil))
358 (vc-hg-command nil 0 file "remove" "--after" "--force"))
359
360 ;; Modeled after the similar function in vc-bzr.el
361 (defun vc-hg-rename-file (old new)
362 "Rename file from OLD to NEW using `hg mv'."
363 (vc-hg-command nil 0 new "mv" old))
364
365 (defun vc-hg-register (files &optional rev comment)
366 "Register FILES under hg.
367 REV is ignored.
368 COMMENT is ignored."
369 (vc-hg-command nil 0 files "add"))
370
371 (defun vc-hg-create-repo ()
372 "Create a new Mercurial repository."
373 (vc-hg-command nil 0 nil "init"))
374
375 (defalias 'vc-hg-responsible-p 'vc-hg-root)
376
377 ;; Modeled after the similar function in vc-bzr.el
378 (defun vc-hg-could-register (file)
379 "Return non-nil if FILE could be registered under hg."
380 (and (vc-hg-responsible-p file) ; shortcut
381 (condition-case ()
382 (with-temp-buffer
383 (vc-hg-command t nil file "add" "--dry-run"))
384 ;; The command succeeds with no output if file is
385 ;; registered.
386 (error))))
387
388 ;; FIXME: This would remove the file. Is that correct?
389 ;; (defun vc-hg-unregister (file)
390 ;; "Unregister FILE from hg."
391 ;; (vc-hg-command nil nil file "remove"))
392
393 (defun vc-hg-checkin (files rev comment)
394 "Hg-specific version of `vc-backend-checkin'.
395 REV is ignored."
396 (vc-hg-command nil 0 files "commit" "-m" comment))
397
398 (defun vc-hg-find-revision (file rev buffer)
399 (let ((coding-system-for-read 'binary)
400 (coding-system-for-write 'binary))
401 (if rev
402 (vc-hg-command buffer 0 file "cat" "-r" rev)
403 (vc-hg-command buffer 0 file "cat"))))
404
405 ;; Modeled after the similar function in vc-bzr.el
406 (defun vc-hg-checkout (file &optional editable rev)
407 "Retrieve a revision of FILE.
408 EDITABLE is ignored.
409 REV is the revision to check out into WORKFILE."
410 (let ((coding-system-for-read 'binary)
411 (coding-system-for-write 'binary))
412 (with-current-buffer (or (get-file-buffer file) (current-buffer))
413 (if rev
414 (vc-hg-command t 0 file "cat" "-r" rev)
415 (vc-hg-command t 0 file "cat")))))
416
417 ;; Modeled after the similar function in vc-bzr.el
418 (defun vc-hg-workfile-unchanged-p (file)
419 (eq 'up-to-date (vc-hg-state file)))
420
421 ;; Modeled after the similar function in vc-bzr.el
422 (defun vc-hg-revert (file &optional contents-done)
423 (unless contents-done
424 (with-temp-buffer (vc-hg-command t 0 file "revert"))))
425
426 ;;; Hg specific functionality.
427
428 (defvar vc-hg-extra-menu-map
429 (let ((map (make-sparse-keymap)))
430 (define-key map [incoming] '(menu-item "Show incoming" vc-hg-incoming))
431 (define-key map [outgoing] '(menu-item "Show outgoing" vc-hg-outgoing))
432 map))
433
434 (defun vc-hg-extra-menu () vc-hg-extra-menu-map)
435
436 (defun vc-hg-extra-status-menu () vc-hg-extra-menu-map)
437
438 (define-derived-mode vc-hg-outgoing-mode vc-hg-log-view-mode "Hg-Outgoing")
439
440 (define-derived-mode vc-hg-incoming-mode vc-hg-log-view-mode "Hg-Incoming")
441
442 (defstruct (vc-hg-extra-fileinfo
443 (:copier nil)
444 (:constructor vc-hg-create-extra-fileinfo (rename-state extra-name))
445 (:conc-name vc-hg-extra-fileinfo->))
446 rename-state ;; rename or copy state
447 extra-name) ;; original name for copies and rename targets, new name for
448
449 (declare-function vc-default-dir-printer "vc-dir" (backend fileentry))
450
451 (defun vc-hg-dir-printer (info)
452 "Pretty-printer for the vc-dir-fileinfo structure."
453 (let ((extra (vc-dir-fileinfo->extra info)))
454 (vc-default-dir-printer 'Hg info)
455 (when extra
456 (insert (propertize
457 (format " (%s %s)"
458 (case (vc-hg-extra-fileinfo->rename-state extra)
459 ('copied "copied from")
460 ('renamed-from "renamed from")
461 ('renamed-to "renamed to"))
462 (vc-hg-extra-fileinfo->extra-name extra))
463 'face 'font-lock-comment-face)))))
464
465 (defun vc-hg-after-dir-status (update-function)
466 (let ((status-char nil)
467 (file nil)
468 (translation '((?= . up-to-date)
469 (?C . up-to-date)
470 (?A . added)
471 (?R . removed)
472 (?M . edited)
473 (?I . ignored)
474 (?! . missing)
475 (? . copy-rename-line)
476 (?? . unregistered)))
477 (translated nil)
478 (result nil)
479 (last-added nil)
480 (last-line-copy nil))
481 (goto-char (point-min))
482 (while (not (eobp))
483 (setq translated (cdr (assoc (char-after) translation)))
484 (setq file
485 (buffer-substring-no-properties (+ (point) 2)
486 (line-end-position)))
487 (cond ((not translated)
488 (setq last-line-copy nil))
489 ((eq translated 'up-to-date)
490 (setq last-line-copy nil))
491 ((eq translated 'copy-rename-line)
492 ;; For copied files the output looks like this:
493 ;; A COPIED_FILE_NAME
494 ;; ORIGINAL_FILE_NAME
495 (setf (nth 2 last-added)
496 (vc-hg-create-extra-fileinfo 'copied file))
497 (setq last-line-copy t))
498 ((and last-line-copy (eq translated 'removed))
499 ;; For renamed files the output looks like this:
500 ;; A NEW_FILE_NAME
501 ;; ORIGINAL_FILE_NAME
502 ;; R ORIGINAL_FILE_NAME
503 ;; We need to adjust the previous entry to not think it is a copy.
504 (setf (vc-hg-extra-fileinfo->rename-state (nth 2 last-added))
505 'renamed-from)
506 (push (list file translated
507 (vc-hg-create-extra-fileinfo
508 'renamed-to (nth 0 last-added))) result)
509 (setq last-line-copy nil))
510 (t
511 (setq last-added (list file translated nil))
512 (push last-added result)
513 (setq last-line-copy nil)))
514 (forward-line))
515 (funcall update-function result)))
516
517 (defun vc-hg-dir-status (dir update-function)
518 (vc-hg-command (current-buffer) 'async dir "status" "-C")
519 (vc-exec-after
520 `(vc-hg-after-dir-status (quote ,update-function))))
521
522 (defun vc-hg-dir-status-files (dir files default-state update-function)
523 (apply 'vc-hg-command (current-buffer) 'async dir "status" "-C" files)
524 (vc-exec-after
525 `(vc-hg-after-dir-status (quote ,update-function))))
526
527 (defun vc-hg-dir-extra-header (name &rest commands)
528 (concat (propertize name 'face 'font-lock-type-face)
529 (propertize
530 (with-temp-buffer
531 (apply 'vc-hg-command (current-buffer) 0 nil commands)
532 (buffer-substring-no-properties (point-min) (1- (point-max))))
533 'face 'font-lock-variable-name-face)))
534
535 (defun vc-hg-dir-extra-headers (dir)
536 "Generate extra status headers for a Mercurial tree."
537 (let ((default-directory dir))
538 (concat
539 (vc-hg-dir-extra-header "Root : " "root") "\n"
540 (vc-hg-dir-extra-header "Branch : " "id" "-b") "\n"
541 (vc-hg-dir-extra-header "Tags : " "id" "-t") ; "\n"
542 ;; these change after each commit
543 ;; (vc-hg-dir-extra-header "Local num : " "id" "-n") "\n"
544 ;; (vc-hg-dir-extra-header "Global id : " "id" "-i")
545 )))
546
547 ;; FIXME: this adds another top level menu, instead figure out how to
548 ;; replace the Log-View menu.
549 (easy-menu-define log-view-mode-menu vc-hg-outgoing-mode-map
550 "Hg-outgoing Display Menu"
551 `("Hg-outgoing"
552 ["Push selected" vc-hg-push]))
553
554 (easy-menu-define log-view-mode-menu vc-hg-incoming-mode-map
555 "Hg-incoming Display Menu"
556 `("Hg-incoming"
557 ["Pull selected" vc-hg-pull]))
558
559 (defun vc-hg-outgoing ()
560 (interactive)
561 (let ((bname "*Hg outgoing*"))
562 (vc-hg-command bname 0 nil "outgoing" "-n")
563 (pop-to-buffer bname)
564 (vc-hg-outgoing-mode)))
565
566 (defun vc-hg-incoming ()
567 (interactive)
568 (let ((bname "*Hg incoming*"))
569 (vc-hg-command bname 0 nil "incoming" "-n")
570 (pop-to-buffer bname)
571 (vc-hg-incoming-mode)))
572
573 (declare-function log-view-get-marked "log-view" ())
574
575 ;; XXX maybe also add key bindings for these functions.
576 (defun vc-hg-push ()
577 (interactive)
578 (let ((marked-list (log-view-get-marked)))
579 (if marked-list
580 (vc-hg-command
581 nil 0 nil
582 (cons "push"
583 (apply 'nconc
584 (mapcar (lambda (arg) (list "-r" arg)) marked-list))))
585 (error "No log entries selected for push"))))
586
587 (defun vc-hg-pull ()
588 (interactive)
589 (let ((marked-list (log-view-get-marked)))
590 (if marked-list
591 (vc-hg-command
592 nil 0 nil
593 (cons "pull"
594 (apply 'nconc
595 (mapcar (lambda (arg) (list "-r" arg)) marked-list))))
596 (error "No log entries selected for pull"))))
597
598 ;;; Internal functions
599
600 (defun vc-hg-command (buffer okstatus file-or-list &rest flags)
601 "A wrapper around `vc-do-command' for use in vc-hg.el.
602 The difference to vc-do-command is that this function always invokes `hg',
603 and that it passes `vc-hg-global-switches' to it before FLAGS."
604 (apply 'vc-do-command (or buffer "*vc*") okstatus "hg" file-or-list
605 (if (stringp vc-hg-global-switches)
606 (cons vc-hg-global-switches flags)
607 (append vc-hg-global-switches
608 flags))))
609
610 (defun vc-hg-root (file)
611 (vc-find-root file ".hg"))
612
613 (provide 'vc-hg)
614
615 ;; arch-tag: bd094dc5-715a-434f-a331-37b9fb7cd954
616 ;;; vc-hg.el ends here