1 ;;; vc-hg.el --- VC backend for the mercurial version control system
3 ;; Copyright (C) 2006-2012 Free Software Foundation, Inc.
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
26 ;; This is a mercurial version control backend
36 ;; 1) Implement the rest of the vc interface. See the comment at the
37 ;; beginning of vc.el. The current status is:
39 ;; FUNCTION NAME STATUS
41 ;; * revision-granularity OK
42 ;; STATE-QUERYING FUNCTIONS
43 ;; * registered (file) OK
45 ;; - state-heuristic (file) NOT NEEDED
46 ;; - dir-status (dir update-function) OK
47 ;; - dir-status-files (dir files ds uf) OK
48 ;; - dir-extra-headers (dir) OK
49 ;; - dir-printer (fileinfo) OK
50 ;; * working-revision (file) OK
51 ;; - latest-on-branch-p (file) ??
52 ;; * checkout-model (files) OK
53 ;; - workfile-unchanged-p (file) OK
54 ;; - mode-line-string (file) NOT NEEDED
55 ;; STATE-CHANGING FUNCTIONS
56 ;; * register (files &optional rev comment) OK
57 ;; * create-repo () OK
58 ;; - init-revision () NOT NEEDED
59 ;; - responsible-p (file) OK
60 ;; - could-register (file) OK
61 ;; - receive-file (file rev) ?? PROBABLY NOT NEEDED
62 ;; - unregister (file) COMMENTED OUT, MAY BE INCORRECT
63 ;; * checkin (files rev comment) OK
64 ;; * find-revision (file rev buffer) OK
65 ;; * checkout (file &optional editable rev) OK
66 ;; * revert (file &optional contents-done) OK
67 ;; - rollback (files) ?? PROBABLY NOT NEEDED
68 ;; - merge (file rev1 rev2) NEEDED
69 ;; - merge-news (file) NEEDED
70 ;; - steal-lock (file &optional revision) NOT NEEDED
72 ;; * print-log (files buffer &optional shortlog start-revision limit) OK
73 ;; - log-view-mode () OK
74 ;; - show-log-entry (revision) NOT NEEDED, DEFAULT IS GOOD
75 ;; - comment-history (file) NOT NEEDED
76 ;; - update-changelog (files) NOT NEEDED
77 ;; * diff (files &optional rev1 rev2 buffer) OK
78 ;; - revision-completion-table (files) OK?
79 ;; - annotate-command (file buf &optional rev) OK
80 ;; - annotate-time () OK
81 ;; - annotate-current-time () NOT NEEDED
82 ;; - annotate-extract-revision-at-line () OK
84 ;; - create-tag (dir name branchp) NEEDED
85 ;; - retrieve-tag (dir name update) NEEDED
87 ;; - make-version-backups-p (file) ??
88 ;; - repository-hostname (dirname) ??
89 ;; - previous-revision (file rev) OK
90 ;; - next-revision (file rev) OK
91 ;; - check-headers () ??
92 ;; - clear-headers () ??
93 ;; - delete-file (file) TEST IT
94 ;; - rename-file (old new) OK
95 ;; - find-file-hook () PROBABLY NOT NEEDED
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).
117 ;;; Customization options
120 "VC Mercurial (hg) backend."
124 (defcustom vc-hg-global-switches nil
125 "Global switches to pass to any Hg command."
126 :type
'(choice (const :tag
"None" nil
)
127 (string :tag
"Argument String")
128 (repeat :tag
"Argument List" :value
("") string
))
132 (defcustom vc-hg-diff-switches t
; Hg doesn't support common args like -u
133 "String or list of strings specifying switches for Hg diff under VC.
134 If nil, use the value of `vc-diff-switches'. If t, use no switches."
135 :type
'(choice (const :tag
"Unspecified" nil
)
136 (const :tag
"None" t
)
137 (string :tag
"Argument String")
138 (repeat :tag
"Argument List" :value
("") string
))
142 (defcustom vc-hg-program
"hg"
143 "Name of the Mercurial executable (excluding any arguments)."
147 (defcustom vc-hg-root-log-format
148 '("{rev}:{tags}: {author|person} {date|shortdate} {desc|firstline}\\n"
149 "^\\([0-9]+\\):\\([^:]*\\): \\(.*?\\)[ \t]+\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)"
150 ((1 'log-view-message-face
)
153 (4 'change-log-date
)))
154 "Mercurial log template for `vc-print-root-log'.
155 This should be a list (TEMPLATE REGEXP KEYWORDS), where TEMPLATE
156 is the \"--template\" argument string to pass to Mercurial,
157 REGEXP is a regular expression matching the resulting Mercurial
158 output, and KEYWORDS is a list of `font-lock-keywords' for
159 highlighting the Log View buffer."
160 :type
'(list string string
(repeat sexp
))
165 ;;; Properties of the backend
167 (defvar vc-hg-history nil
)
169 (defun vc-hg-revision-granularity () 'repository
)
170 (defun vc-hg-checkout-model (files) 'implicit
)
172 ;;; State querying functions
174 ;;;###autoload (defun vc-hg-registered (file)
175 ;;;###autoload "Return non-nil if FILE is registered with hg."
176 ;;;###autoload (if (vc-find-root file ".hg") ; short cut
177 ;;;###autoload (progn
178 ;;;###autoload (load "vc-hg")
179 ;;;###autoload (vc-hg-registered file))))
181 ;; Modeled after the similar function in vc-bzr.el
182 (defun vc-hg-registered (file)
183 "Return non-nil if FILE is registered with hg."
184 (when (vc-hg-root file
) ; short cut
185 (let ((state (vc-hg-state file
))) ; expensive
186 (and state
(not (memq state
'(ignored unregistered
)))))))
188 (defun vc-hg-state (file)
189 "Hg-specific version of `vc-state'."
192 (default-directory (file-name-directory file
))
194 (with-output-to-string
199 ;; Ignore all errors.
200 (let ((process-environment
201 ;; Avoid localization of messages so we
202 ;; can parse the output.
203 (append (list "TERM=dumb" "LANGUAGE=C")
204 process-environment
)))
206 vc-hg-program nil t nil
207 "--config" "alias.status=status"
208 "--config" "defaults.status="
209 "status" "-A" (file-relative-name file
)))
210 ;; Some problem happened. E.g. We can't find an `hg'
214 (when (null (string-match ".*: No such file or directory$" out
))
215 (let ((state (aref out
0)))
217 ((eq state ?
=) 'up-to-date
)
218 ((eq state ?A
) 'added
)
219 ((eq state ?M
) 'edited
)
220 ((eq state ?I
) 'ignored
)
221 ((eq state ?R
) 'removed
)
222 ((eq state ?
!) 'missing
)
223 ((eq state ??
) 'unregistered
)
224 ((eq state ?C
) 'up-to-date
) ;; Older mercurial versions use this.
225 (t 'up-to-date
)))))))
227 (defun vc-hg-working-revision (file)
228 "Hg-specific version of `vc-working-revision'."
229 (let ((default-directory (if (file-directory-p file
)
230 (file-name-as-directory file
)
231 (file-name-directory file
))))
233 (with-output-to-string
234 (process-file vc-hg-program nil standard-output nil
235 "log" "-l" "1" "--template" "{rev}"
236 (file-relative-name file
))))))
238 ;;; History functions
240 (defcustom vc-hg-log-switches nil
241 "String or list of strings specifying switches for hg log under VC."
242 :type
'(choice (const :tag
"None" nil
)
243 (string :tag
"Argument String")
244 (repeat :tag
"Argument List" :value
("") string
))
247 (defun vc-hg-print-log (files buffer
&optional shortlog start-revision limit
)
248 "Get change log associated with FILES."
249 ;; `vc-do-command' creates the buffer, but we need it before running
251 (vc-setup-buffer buffer
)
252 ;; If the buffer exists from a previous invocation it might be
254 (let ((inhibit-read-only t
))
257 (apply 'vc-hg-command buffer
0 files
"log"
259 (when start-revision
(list (format "-r%s:" start-revision
)))
260 (when limit
(list "-l" (format "%s" limit
)))
261 (when shortlog
(list "--template" (car vc-hg-root-log-format
)))
262 vc-hg-log-switches
)))))
264 (defvar log-view-message-re
)
265 (defvar log-view-file-re
)
266 (defvar log-view-font-lock-keywords
)
267 (defvar log-view-per-file-logs
)
268 (defvar log-view-expanded-log-entry-function
)
270 (define-derived-mode vc-hg-log-view-mode log-view-mode
"Hg-Log-View"
271 (require 'add-log
) ;; we need the add-log faces
272 (set (make-local-variable 'log-view-file-re
) "\\`a\\`")
273 (set (make-local-variable 'log-view-per-file-logs
) nil
)
274 (set (make-local-variable 'log-view-message-re
)
275 (if (eq vc-log-view-type
'short
)
276 (cadr vc-hg-root-log-format
)
277 "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)"))
278 ;; Allow expanding short log entries
279 (when (eq vc-log-view-type
'short
)
280 (setq truncate-lines t
)
281 (set (make-local-variable 'log-view-expanded-log-entry-function
)
282 'vc-hg-expanded-log-entry
))
283 (set (make-local-variable 'log-view-font-lock-keywords
)
284 (if (eq vc-log-view-type
'short
)
285 (list (cons (nth 1 vc-hg-root-log-format
)
286 (nth 2 vc-hg-root-log-format
)))
288 log-view-font-lock-keywords
291 ;; user: FirstName LastName <foo@bar>
292 ("^user:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
294 (2 'change-log-email
))
299 ("^user:[ \t]+\\([A-Za-z0-9_.+-]+\\(?:@[A-Za-z0-9_.-]+\\)?\\)"
300 (1 'change-log-email
))
301 ("^date: \\(.+\\)" (1 'change-log-date
))
302 ("^tag: +\\([^ ]+\\)$" (1 'highlight
))
303 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message
)))))))
305 (defun vc-hg-diff (files &optional oldvers newvers buffer
)
306 "Get a difference report using hg between two revisions of FILES."
307 (let* ((firstfile (car files
))
308 (working (and firstfile
(vc-working-revision firstfile
))))
309 (when (and (equal oldvers working
) (not newvers
))
311 (when (and (not oldvers
) newvers
)
312 (setq oldvers working
))
313 (apply #'vc-hg-command
(or buffer
"*vc-diff*") nil files
"diff"
315 (vc-switches 'hg
'diff
)
318 (list "-r" oldvers
"-r" newvers
)
319 (list "-r" oldvers
)))))))
321 (defun vc-hg-expanded-log-entry (revision)
323 (vc-hg-command t nil nil
"log" "-r" revision
)
324 (goto-char (point-min))
326 ;; Indent the expanded log entry.
327 (indent-region (point-min) (point-max) 2)
328 (goto-char (point-max))
331 (defun vc-hg-revision-table (files)
332 (let ((default-directory (file-name-directory (car files
))))
334 (vc-hg-command t nil files
"log" "--template" "{rev} ")
336 (buffer-substring-no-properties (point-min) (point-max))))))
338 ;; Modeled after the similar function in vc-cvs.el
339 (defun vc-hg-revision-completion-table (files)
340 (lexical-let ((files files
)
342 (setq table
(lazy-completion-table
343 table
(lambda () (vc-hg-revision-table files
))))
346 (defun vc-hg-annotate-command (file buffer
&optional revision
)
347 "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER.
348 Optional arg REVISION is a revision to annotate from."
349 (vc-hg-command buffer
0 file
"annotate" "-d" "-n" "--follow"
350 (when revision
(concat "-r" revision
))))
352 (declare-function vc-annotate-convert-time
"vc-annotate" (time))
354 ;; The format for one line output by "hg annotate -d -n" looks like this:
355 ;;215 Wed Jun 20 21:22:58 2007 -0700: CONTENTS
356 ;; i.e: VERSION_NUMBER DATE: CONTENTS
357 ;; If the user has set the "--follow" option, the output looks like:
358 ;;215 Wed Jun 20 21:22:58 2007 -0700 foo.c: CONTENTS
359 ;; i.e. VERSION_NUMBER DATE FILENAME: CONTENTS
360 (defconst vc-hg-annotate-re
361 "^[ \t]*\\([0-9]+\\) \\(.\\{30\\}\\)\\(?:\\(: \\)\\|\\(?: +\\(.+\\): \\)\\)")
363 (defun vc-hg-annotate-time ()
364 (when (looking-at vc-hg-annotate-re
)
365 (goto-char (match-end 0))
366 (vc-annotate-convert-time
367 (date-to-time (match-string-no-properties 2)))))
369 (defun vc-hg-annotate-extract-revision-at-line ()
372 (when (looking-at vc-hg-annotate-re
)
373 (if (match-beginning 3)
374 (match-string-no-properties 1)
375 (cons (match-string-no-properties 1)
376 (expand-file-name (match-string-no-properties 4)
377 (vc-hg-root default-directory
)))))))
379 (defun vc-hg-previous-revision (file rev
)
380 (let ((newrev (1- (string-to-number rev
))))
382 (number-to-string newrev
))))
384 (defun vc-hg-next-revision (file rev
)
385 (let ((newrev (1+ (string-to-number rev
)))
388 (vc-hg-command t
0 nil
"tip")
389 (goto-char (point-min))
390 (re-search-forward "^changeset:[ \t]*\\([0-9]+\\):")
391 (string-to-number (match-string-no-properties 1)))))
392 ;; We don't want to exceed the maximum possible revision number, ie
394 (when (<= newrev tip-revision
)
395 (number-to-string newrev
))))
397 ;; Modeled after the similar function in vc-bzr.el
398 (defun vc-hg-delete-file (file)
399 "Delete FILE and delete it in the hg repository."
403 (vc-hg-command nil
0 file
"remove" "--after" "--force"))
405 ;; Modeled after the similar function in vc-bzr.el
406 (defun vc-hg-rename-file (old new
)
407 "Rename file from OLD to NEW using `hg mv'."
408 (vc-hg-command nil
0 new
"mv" old
))
410 (defun vc-hg-register (files &optional rev comment
)
411 "Register FILES under hg.
414 (vc-hg-command nil
0 files
"add"))
416 (defun vc-hg-create-repo ()
417 "Create a new Mercurial repository."
418 (vc-hg-command nil
0 nil
"init"))
420 (defalias 'vc-hg-responsible-p
'vc-hg-root
)
422 ;; Modeled after the similar function in vc-bzr.el
423 (defun vc-hg-could-register (file)
424 "Return non-nil if FILE could be registered under hg."
425 (and (vc-hg-responsible-p file
) ; shortcut
428 (vc-hg-command t nil file
"add" "--dry-run"))
429 ;; The command succeeds with no output if file is
433 ;; FIXME: This would remove the file. Is that correct?
434 ;; (defun vc-hg-unregister (file)
435 ;; "Unregister FILE from hg."
436 ;; (vc-hg-command nil nil file "remove"))
438 (declare-function log-edit-extract-headers
"log-edit" (headers string
))
440 (defun vc-hg-checkin (files rev comment
)
441 "Hg-specific version of `vc-backend-checkin'.
443 (apply 'vc-hg-command nil
0 files
444 (nconc (list "commit" "-m")
445 (log-edit-extract-headers '(("Author" .
"--user")
449 (defun vc-hg-find-revision (file rev buffer
)
450 (let ((coding-system-for-read 'binary
)
451 (coding-system-for-write 'binary
))
453 (vc-hg-command buffer
0 file
"cat" "-r" rev
)
454 (vc-hg-command buffer
0 file
"cat"))))
456 ;; Modeled after the similar function in vc-bzr.el
457 (defun vc-hg-checkout (file &optional editable rev
)
458 "Retrieve a revision of FILE.
460 REV is the revision to check out into WORKFILE."
461 (let ((coding-system-for-read 'binary
)
462 (coding-system-for-write 'binary
))
463 (with-current-buffer (or (get-file-buffer file
) (current-buffer))
465 (vc-hg-command t
0 file
"cat" "-r" rev
)
466 (vc-hg-command t
0 file
"cat")))))
468 ;; Modeled after the similar function in vc-bzr.el
469 (defun vc-hg-workfile-unchanged-p (file)
470 (eq 'up-to-date
(vc-hg-state file
)))
472 ;; Modeled after the similar function in vc-bzr.el
473 (defun vc-hg-revert (file &optional contents-done
)
474 (unless contents-done
475 (with-temp-buffer (vc-hg-command t
0 file
"revert"))))
477 ;;; Hg specific functionality.
479 (defvar vc-hg-extra-menu-map
480 (let ((map (make-sparse-keymap)))
483 (defun vc-hg-extra-menu () vc-hg-extra-menu-map
)
485 (defun vc-hg-extra-status-menu () vc-hg-extra-menu-map
)
487 (defvar log-view-vc-backend
)
489 (defstruct (vc-hg-extra-fileinfo
491 (:constructor vc-hg-create-extra-fileinfo
(rename-state extra-name
))
492 (:conc-name vc-hg-extra-fileinfo-
>))
493 rename-state
;; rename or copy state
494 extra-name
) ;; original name for copies and rename targets, new name for
496 (declare-function vc-default-dir-printer
"vc-dir" (backend fileentry
))
498 (defun vc-hg-dir-printer (info)
499 "Pretty-printer for the vc-dir-fileinfo structure."
500 (let ((extra (vc-dir-fileinfo->extra info
)))
501 (vc-default-dir-printer 'Hg info
)
505 (case (vc-hg-extra-fileinfo->rename-state extra
)
506 (copied "copied from")
507 (renamed-from "renamed from")
508 (renamed-to "renamed to"))
509 (vc-hg-extra-fileinfo->extra-name extra
))
510 'face
'font-lock-comment-face
)))))
512 (defun vc-hg-after-dir-status (update-function)
513 (let ((status-char nil
)
515 (translation '((?
= . up-to-date
)
522 (? . copy-rename-line
)
523 (?? . unregistered
)))
527 (last-line-copy nil
))
528 (goto-char (point-min))
530 (setq translated
(cdr (assoc (char-after) translation
)))
532 (buffer-substring-no-properties (+ (point) 2)
533 (line-end-position)))
534 (cond ((not translated
)
535 (setq last-line-copy nil
))
536 ((eq translated
'up-to-date
)
537 (setq last-line-copy nil
))
538 ((eq translated
'copy-rename-line
)
539 ;; For copied files the output looks like this:
540 ;; A COPIED_FILE_NAME
541 ;; ORIGINAL_FILE_NAME
542 (setf (nth 2 last-added
)
543 (vc-hg-create-extra-fileinfo 'copied file
))
544 (setq last-line-copy t
))
545 ((and last-line-copy
(eq translated
'removed
))
546 ;; For renamed files the output looks like this:
548 ;; ORIGINAL_FILE_NAME
549 ;; R ORIGINAL_FILE_NAME
550 ;; We need to adjust the previous entry to not think it is a copy.
551 (setf (vc-hg-extra-fileinfo->rename-state
(nth 2 last-added
))
553 (push (list file translated
554 (vc-hg-create-extra-fileinfo
555 'renamed-to
(nth 0 last-added
))) result
)
556 (setq last-line-copy nil
))
558 (setq last-added
(list file translated nil
))
559 (push last-added result
)
560 (setq last-line-copy nil
)))
562 (funcall update-function result
)))
564 (defun vc-hg-dir-status (dir update-function
)
565 (vc-hg-command (current-buffer) 'async dir
"status" "-C")
567 `(vc-hg-after-dir-status (quote ,update-function
))))
569 (defun vc-hg-dir-status-files (dir files default-state update-function
)
570 (apply 'vc-hg-command
(current-buffer) 'async dir
"status" "-C" files
)
572 `(vc-hg-after-dir-status (quote ,update-function
))))
574 (defun vc-hg-dir-extra-header (name &rest commands
)
575 (concat (propertize name
'face
'font-lock-type-face
)
578 (apply 'vc-hg-command
(current-buffer) 0 nil commands
)
579 (buffer-substring-no-properties (point-min) (1- (point-max))))
580 'face
'font-lock-variable-name-face
)))
582 (defun vc-hg-dir-extra-headers (dir)
583 "Generate extra status headers for a Mercurial tree."
584 (let ((default-directory dir
))
586 (vc-hg-dir-extra-header "Root : " "root") "\n"
587 (vc-hg-dir-extra-header "Branch : " "id" "-b") "\n"
588 (vc-hg-dir-extra-header "Tags : " "id" "-t") ; "\n"
589 ;; these change after each commit
590 ;; (vc-hg-dir-extra-header "Local num : " "id" "-n") "\n"
591 ;; (vc-hg-dir-extra-header "Global id : " "id" "-i")
594 (defun vc-hg-log-incoming (buffer remote-location
)
595 (vc-hg-command buffer
1 nil
"incoming" "-n" (unless (string= remote-location
"")
598 (defun vc-hg-log-outgoing (buffer remote-location
)
599 (vc-hg-command buffer
1 nil
"outgoing" "-n" (unless (string= remote-location
"")
602 (declare-function log-view-get-marked
"log-view" ())
604 ;; XXX maybe also add key bindings for these functions.
607 (let ((marked-list (log-view-get-marked)))
609 (apply #'vc-hg-command
613 (mapcar (lambda (arg) (list "-r" arg
)) marked-list
)))
614 (error "No log entries selected for push"))))
616 (defun vc-hg-pull (prompt)
617 "Issue a Mercurial pull command.
618 If called interactively with a set of marked Log View buffers,
619 call \"hg pull -r REVS\" to pull in the specified revisions REVS.
621 With a prefix argument or if PROMPT is non-nil, prompt for a
622 specific Mercurial pull command. The default is \"hg pull -u\",
623 which fetches changesets from the default remote repository and
624 then attempts to update the working directory."
627 ;; The `vc-hg-pull' command existed before the `pull' VC action
628 ;; was implemented. Keep it for backward compatibility.
629 (if (and (called-interactively-p 'interactive
)
630 (setq marked-list
(log-view-get-marked)))
631 (apply #'vc-hg-command
635 (mapcar (lambda (arg) (list "-r" arg
))
637 (let* ((root (vc-hg-root default-directory
))
638 (buffer (format "*vc-hg : %s*" (expand-file-name root
)))
640 (hg-program vc-hg-program
)
641 ;; Fixme: before updating the working copy to the latest
642 ;; state, should check if it's visiting an old revision.
644 ;; If necessary, prompt for the exact command.
646 (setq args
(split-string
647 (read-shell-command "Run Hg (like this): "
648 (format "%s pull -u" hg-program
)
651 (setq hg-program
(car args
)
654 (apply 'vc-do-async-command buffer root hg-program
656 (vc-set-async-update buffer
)))))
658 (defun vc-hg-merge-branch ()
659 "Merge incoming changes into the current working directory.
660 This runs the command \"hg merge\"."
661 (let* ((root (vc-hg-root default-directory
))
662 (buffer (format "*vc-hg : %s*" (expand-file-name root
))))
663 (apply 'vc-do-async-command buffer root vc-hg-program
'("merge"))
664 (vc-set-async-update buffer
)))
666 ;;; Internal functions
668 (defun vc-hg-command (buffer okstatus file-or-list
&rest flags
)
669 "A wrapper around `vc-do-command' for use in vc-hg.el.
670 This function differs from vc-do-command in that it invokes
671 `vc-hg-program', and passes `vc-hg-global-switches' to it before FLAGS."
672 (apply 'vc-do-command
(or buffer
"*vc*") okstatus vc-hg-program file-or-list
673 (if (stringp vc-hg-global-switches
)
674 (cons vc-hg-global-switches flags
)
675 (append vc-hg-global-switches
678 (defun vc-hg-root (file)
679 (vc-find-root file
".hg"))
683 ;;; vc-hg.el ends here