annotate lisp/vc-hg.el @ 99651:1f2d2e0198b0

(Compilation): Document first-error value of compilation-scroll-output. (Compilation Mode): Note that compilation-auto-jump-to-first-error works as soon as an error is available. Suggested by Juri Linkov.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 17 Nov 2008 01:38:47 +0000
parents b0dce7f34dda
children 015fd0131c0b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1 ;;; vc-hg.el --- VC backend for the mercurial version control system
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
2
79721
73661ddc7ac7 Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79687
diff changeset
3 ;; Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
4
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
5 ;; Author: Ivan Kanis
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
6 ;; Keywords: tools
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
7
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
9
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94572
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94572
diff changeset
12 ;; the Free Software Foundation, either version 3 of the License, or
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94572
diff changeset
13 ;; (at your option) any later version.
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
14
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
18 ;; GNU General Public License for more details.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
19
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94572
diff changeset
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
22
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
23 ;;; Commentary:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
24
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
25 ;; This is a mercurial version control backend
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
26
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
27 ;;; Thanks:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
28
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
29 ;;; Bugs:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
30
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
31 ;;; Installation:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
32
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
33 ;;; Todo:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
34
94853
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
35 ;; 1) Implement the rest of the vc interface. See the comment at the
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
36 ;; beginning of vc.el. The current status is:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
37
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
38 ;; FUNCTION NAME STATUS
81982
d4b8336cd8f5 * vc-hg.el (vc-hg-print-log): Deal with multiple file arguments.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81964
diff changeset
39 ;; BACKEND PROPERTIES
d4b8336cd8f5 * vc-hg.el (vc-hg-print-log): Deal with multiple file arguments.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81964
diff changeset
40 ;; * revision-granularity OK
d4b8336cd8f5 * vc-hg.el (vc-hg-print-log): Deal with multiple file arguments.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81964
diff changeset
41 ;; STATE-QUERYING FUNCTIONS
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
42 ;; * registered (file) OK
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
43 ;; * state (file) OK
94853
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
44 ;; - state-heuristic (file) NOT NEEDED
98492
b3eefcc54430 (vc-hg-dir-status-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96519
diff changeset
45 ;; - dir-status (dir update-function) OK
b3eefcc54430 (vc-hg-dir-status-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96519
diff changeset
46 ;; - dir-status-files (dir files ds uf) OK
99159
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 98492
diff changeset
47 ;; - dir-extra-headers (dir) OK
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 98492
diff changeset
48 ;; - dir-printer (fileinfo) OK
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 83759
diff changeset
49 ;; * working-revision (file) OK
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
50 ;; - latest-on-branch-p (file) ??
94563
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94542
diff changeset
51 ;; * checkout-model (files) OK
78167
252b7f091c04 (vc-hg-workfile-unchanged-p): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78166
diff changeset
52 ;; - workfile-unchanged-p (file) OK
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
53 ;; - mode-line-string (file) NOT NEEDED
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
54 ;; STATE-CHANGING FUNCTIONS
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
55 ;; * register (files &optional rev comment) OK
81982
d4b8336cd8f5 * vc-hg.el (vc-hg-print-log): Deal with multiple file arguments.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81964
diff changeset
56 ;; * create-repo () OK
94853
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
57 ;; - init-revision () NOT NEEDED
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
58 ;; - responsible-p (file) OK
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
59 ;; - could-register (file) OK
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
60 ;; - receive-file (file rev) ?? PROBABLY NOT NEEDED
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
61 ;; - unregister (file) COMMENTED OUT, MAY BE INCORRECT
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
62 ;; * checkin (files rev comment) OK
94853
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
63 ;; * find-revision (file rev buffer) OK
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
64 ;; * checkout (file &optional editable rev) OK
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
65 ;; * revert (file &optional contents-done) OK
91991
f40c311f15ac Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 91953
diff changeset
66 ;; - rollback (files) ?? PROBABLY NOT NEEDED
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
67 ;; - merge (file rev1 rev2) NEEDED
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
68 ;; - merge-news (file) NEEDED
94853
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
69 ;; - steal-lock (file &optional revision) NOT NEEDED
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
70 ;; HISTORY FUNCTIONS
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
71 ;; * print-log (files &optional buffer) OK
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
72 ;; - log-view-mode () OK
94853
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
73 ;; - show-log-entry (revision) NOT NEEDED, DEFAULT IS GOOD
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
74 ;; - comment-history (file) NOT NEEDED
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
75 ;; - update-changelog (files) NOT NEEDED
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
76 ;; * diff (files &optional rev1 rev2 buffer) OK
85462
43a9834cf1a6 * vc-bzr.el (vc-bzr-diff-tree):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85460
diff changeset
77 ;; - revision-completion-table (files) OK?
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
78 ;; - annotate-command (file buf &optional rev) OK
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
79 ;; - annotate-time () OK
94853
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
80 ;; - annotate-current-time () NOT NEEDED
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
81 ;; - annotate-extract-revision-at-line () OK
95020
4da572dc4992 Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94853
diff changeset
82 ;; TAG SYSTEM
4da572dc4992 Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94853
diff changeset
83 ;; - create-tag (dir name branchp) NEEDED
4da572dc4992 Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94853
diff changeset
84 ;; - retrieve-tag (dir name update) NEEDED
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
85 ;; MISCELLANEOUS
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
86 ;; - make-version-backups-p (file) ??
91991
f40c311f15ac Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 91953
diff changeset
87 ;; - repository-hostname (dirname) ??
94853
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
88 ;; - previous-revision (file rev) OK
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
89 ;; - next-revision (file rev) OK
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
90 ;; - check-headers () ??
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
91 ;; - clear-headers () ??
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
92 ;; - delete-file (file) TEST IT
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
93 ;; - rename-file (old new) OK
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
94 ;; - find-file-hook () PROBABLY NOT NEEDED
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
95 ;; - find-file-not-found-hook () PROBABLY NOT NEEDED
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
96
94853
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
97 ;; 2) Implement Stefan Monnier's advice:
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
98 ;; vc-hg-registered and vc-hg-state
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
99 ;; Both of those functions should be super extra careful to fail gracefully in
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
100 ;; unexpected circumstances. The reason this is important is that any error
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
101 ;; there will prevent the user from even looking at the file :-(
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
102 ;; Ideally, just like in vc-arch and vc-cvs, checking that the file is under
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
103 ;; mercurial's control and extracting the current revision should be done
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
104 ;; without even using `hg' (this way even if you don't have `hg' installed,
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
105 ;; Emacs is able to tell you this file is under mercurial's control).
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
106
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
107 ;;; History:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
108 ;;
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
109
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
110 ;;; Code:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
111
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
112 (eval-when-compile
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
113 (require 'cl)
96260
d011b21b3f08 * vc-hg.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96213
diff changeset
114 (require 'vc)
d011b21b3f08 * vc-hg.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96213
diff changeset
115 (require 'vc-dir))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
116
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
117 ;;; Customization options
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
118
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
119 (defcustom vc-hg-global-switches nil
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
120 "*Global switches to pass to any Hg command."
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
121 :type '(choice (const :tag "None" nil)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
122 (string :tag "Argument String")
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
123 (repeat :tag "Argument List"
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
124 :value ("")
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
125 string))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
126 :version "22.2"
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
127 :group 'vc)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
128
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
129
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
130 ;;; Properties of the backend
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
131
94563
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94542
diff changeset
132 (defun vc-hg-revision-granularity () 'repository)
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94542
diff changeset
133 (defun vc-hg-checkout-model (files) 'implicit)
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
134
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
135 ;;; State querying functions
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
136
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
137 ;;;###autoload (defun vc-hg-registered (file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
138 ;;;###autoload "Return non-nil if FILE is registered with hg."
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
139 ;;;###autoload (if (vc-find-root file ".hg") ; short cut
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
140 ;;;###autoload (progn
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
141 ;;;###autoload (load "vc-hg")
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
142 ;;;###autoload (vc-hg-registered file))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
143
96365
65532b2a1819 American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents: 96260
diff changeset
144 ;; Modeled after the similar function in vc-bzr.el
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
145 (defun vc-hg-registered (file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
146 "Return non-nil if FILE is registered with hg."
78166
516805bc7988 (vc-hg-registered): Replace if with when.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78148
diff changeset
147 (when (vc-hg-root file) ; short cut
87455
06f57a4af48c (vc-hg-registered): Return the false when vc-hg-state
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87450
diff changeset
148 (let ((state (vc-hg-state file))) ; expensive
87865
1a3c90d4d8fa * vc-hg.el (vc-hg-registered): Make it work for non-existent
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87844
diff changeset
149 (and state (not (memq state '(ignored unregistered)))))))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
150
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
151 (defun vc-hg-state (file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
152 "Hg-specific version of `vc-state'."
91991
f40c311f15ac Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 91953
diff changeset
153 (let*
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
154 ((status nil)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
155 (out
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
156 (with-output-to-string
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
157 (with-current-buffer
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
158 standard-output
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
159 (setq status
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
160 (condition-case nil
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
161 ;; Ignore all errors.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
162 (call-process
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
163 "hg" nil t nil "--cwd" (file-name-directory file)
87455
06f57a4af48c (vc-hg-registered): Return the false when vc-hg-state
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87450
diff changeset
164 "status" "-A" (file-name-nondirectory file))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
165 ;; Some problem happened. E.g. We can't find an `hg'
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
166 ;; executable.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
167 (error nil)))))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
168 (when (eq 0 status)
78166
516805bc7988 (vc-hg-registered): Replace if with when.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78148
diff changeset
169 (when (null (string-match ".*: No such file or directory$" out))
516805bc7988 (vc-hg-registered): Replace if with when.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78148
diff changeset
170 (let ((state (aref out 0)))
516805bc7988 (vc-hg-registered): Replace if with when.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78148
diff changeset
171 (cond
87574
21fcd219fd6e * mouse.el (mouse-popup-menubar): Fix typo.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87480
diff changeset
172 ((eq state ?=) 'up-to-date)
93118
01d3fd1a2cfe * vc-hg.el (vc-hg-state):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92345
diff changeset
173 ((eq state ?A) 'added)
78166
516805bc7988 (vc-hg-registered): Replace if with when.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78148
diff changeset
174 ((eq state ?M) 'edited)
87450
71fc7b1db920 * vc-hooks.el (vc-state): Document new 'ignored and 'unregistered
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87442
diff changeset
175 ((eq state ?I) 'ignored)
93163
521810ff0616 (vc-hg-state): Return 'removed for removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 93162
diff changeset
176 ((eq state ?R) 'removed)
93327
f6aa1bf031f5 (vc-hg-state, vc-hg-dir-state): Deal with 'missing
Dan Nicolaescu <dann@ics.uci.edu>
parents: 93176
diff changeset
177 ((eq state ?!) 'missing)
87450
71fc7b1db920 * vc-hooks.el (vc-state): Document new 'ignored and 'unregistered
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87442
diff changeset
178 ((eq state ??) 'unregistered)
87574
21fcd219fd6e * mouse.el (mouse-popup-menubar): Fix typo.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87480
diff changeset
179 ((eq state ?C) 'up-to-date) ;; Older mercurials use this
87455
06f57a4af48c (vc-hg-registered): Return the false when vc-hg-state
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87450
diff changeset
180 (t 'up-to-date)))))))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
181
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 83759
diff changeset
182 (defun vc-hg-working-revision (file)
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 83759
diff changeset
183 "Hg-specific version of `vc-working-revision'."
91991
f40c311f15ac Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 91953
diff changeset
184 (let*
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
185 ((status nil)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
186 (out
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
187 (with-output-to-string
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
188 (with-current-buffer
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
189 standard-output
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
190 (setq status
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
191 (condition-case nil
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
192 ;; Ignore all errors.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
193 (call-process
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
194 "hg" nil t nil "--cwd" (file-name-directory file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
195 "log" "-l1" (file-name-nondirectory file))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
196 ;; Some problem happened. E.g. We can't find an `hg'
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
197 ;; executable.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
198 (error nil)))))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
199 (when (eq 0 status)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
200 (if (string-match "changeset: *\\([0-9]*\\)" out)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
201 (match-string 1 out)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
202 "0"))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
203
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
204 ;;; History functions
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
205
87427
1aea302af710 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 86234
diff changeset
206 (defun vc-hg-print-log (files &optional buffer)
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
207 "Get change log associated with FILES."
87427
1aea302af710 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 86234
diff changeset
208 ;; `log-view-mode' needs to have the file names in order to function
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
209 ;; correctly. "hg log" does not print it, so we insert it here by
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
210 ;; hand.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
211
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
212 ;; `vc-do-command' creates the buffer, but we need it before running
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
213 ;; the command.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
214 (vc-setup-buffer buffer)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
215 ;; If the buffer exists from a previous invocation it might be
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
216 ;; read-only.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
217 (let ((inhibit-read-only t))
95966
054335cbee3d * log-view.el (log-view-diff-changeset): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 95542
diff changeset
218 (with-current-buffer
054335cbee3d * log-view.el (log-view-diff-changeset): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 95542
diff changeset
219 buffer
054335cbee3d * log-view.el (log-view-diff-changeset): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 95542
diff changeset
220 (vc-hg-command buffer 0 files "log"))))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
221
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
222 (defvar log-view-message-re)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
223 (defvar log-view-file-re)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
224 (defvar log-view-font-lock-keywords)
95966
054335cbee3d * log-view.el (log-view-diff-changeset): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 95542
diff changeset
225 (defvar log-view-per-file-logs)
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
226
78404
27f00e50116a Change capitalization of VC backend names for new backends
Miles Bader <miles@gnu.org>
parents: 78363
diff changeset
227 (define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View"
83759
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
228 (require 'add-log) ;; we need the add-log faces
95966
054335cbee3d * log-view.el (log-view-diff-changeset): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 95542
diff changeset
229 (set (make-local-variable 'log-view-file-re) "\\`a\\`")
054335cbee3d * log-view.el (log-view-diff-changeset): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 95542
diff changeset
230 (set (make-local-variable 'log-view-per-file-logs) nil)
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
231 (set (make-local-variable 'log-view-message-re)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
232 "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)")
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
233 (set (make-local-variable 'log-view-font-lock-keywords)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
234 (append
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
235 log-view-font-lock-keywords
79725
4ceae4ec8fb2 (vc-hg-log-view-mode): Handle the user field better.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 79722
diff changeset
236 '(
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
237 ;; Handle the case:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
238 ;; user: FirstName LastName <foo@bar>
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
239 ("^user:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
240 (1 'change-log-name)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
241 (2 'change-log-email))
79725
4ceae4ec8fb2 (vc-hg-log-view-mode): Handle the user field better.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 79722
diff changeset
242 ;; Handle the cases:
91991
f40c311f15ac Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 91953
diff changeset
243 ;; user: foo@bar
f40c311f15ac Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 91953
diff changeset
244 ;; and
79725
4ceae4ec8fb2 (vc-hg-log-view-mode): Handle the user field better.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 79722
diff changeset
245 ;; user: foo
4ceae4ec8fb2 (vc-hg-log-view-mode): Handle the user field better.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 79722
diff changeset
246 ("^user:[ \t]+\\([A-Za-z0-9_.+-]+\\(?:@[A-Za-z0-9_.-]+\\)?\\)"
4ceae4ec8fb2 (vc-hg-log-view-mode): Handle the user field better.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 79722
diff changeset
247 (1 'change-log-email))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
248 ("^date: \\(.+\\)" (1 'change-log-date))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
249 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
250
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
251 (defun vc-hg-diff (files &optional oldvers newvers buffer)
85141
b16f7408cd3f Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 85139
diff changeset
252 "Get a difference report using hg between two revisions of FILES."
95966
054335cbee3d * log-view.el (log-view-diff-changeset): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 95542
diff changeset
253 (let* ((firstfile (car files))
054335cbee3d * log-view.el (log-view-diff-changeset): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 95542
diff changeset
254 (working (and firstfile (vc-working-revision firstfile))))
94853
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
255 (when (and (equal oldvers working) (not newvers))
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
256 (setq oldvers nil))
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
257 (when (and (not oldvers) newvers)
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
258 (setq oldvers working))
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
259 (apply #'vc-hg-command (or buffer "*vc-diff*") nil
81998
52950d8efd2b (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81986
diff changeset
260 (mapcar (lambda (file) (file-name-nondirectory file)) files)
95966
054335cbee3d * log-view.el (log-view-diff-changeset): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 95542
diff changeset
261 "--cwd" (or (when firstfile (file-name-directory firstfile))
054335cbee3d * log-view.el (log-view-diff-changeset): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 95542
diff changeset
262 (expand-file-name default-directory))
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
263 "diff"
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
264 (append
94853
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
265 (when oldvers
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
266 (if newvers
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
267 (list "-r" oldvers "-r" newvers)
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
268 (list "-r" oldvers)))))))
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
269
85460
d36b2b98840f (vc-hg-revision-completion-table, vc-hg-revision-table): Make it work when the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85141
diff changeset
270 (defun vc-hg-revision-table (files)
d36b2b98840f (vc-hg-revision-completion-table, vc-hg-revision-table): Make it work when the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85141
diff changeset
271 (let ((default-directory (file-name-directory (car files))))
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
272 (with-temp-buffer
86234
860a7a8e779e * progmodes/octave-mod.el (inferior-octave-send-list-and-digest):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85510
diff changeset
273 (vc-hg-command t nil files "log" "--template" "{rev} ")
91991
f40c311f15ac Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 91953
diff changeset
274 (split-string
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
275 (buffer-substring-no-properties (point-min) (point-max))))))
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
276
96365
65532b2a1819 American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents: 96260
diff changeset
277 ;; Modeled after the similar function in vc-cvs.el
85460
d36b2b98840f (vc-hg-revision-completion-table, vc-hg-revision-table): Make it work when the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85141
diff changeset
278 (defun vc-hg-revision-completion-table (files)
d36b2b98840f (vc-hg-revision-completion-table, vc-hg-revision-table): Make it work when the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85141
diff changeset
279 (lexical-let ((files files)
78359
2dd5d799a16d * vc-git.el: (vc-directory-exclusion-list, vc-handled-backends):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78236
diff changeset
280 table)
2dd5d799a16d * vc-git.el: (vc-directory-exclusion-list, vc-handled-backends):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78236
diff changeset
281 (setq table (lazy-completion-table
85460
d36b2b98840f (vc-hg-revision-completion-table, vc-hg-revision-table): Make it work when the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85141
diff changeset
282 table (lambda () (vc-hg-revision-table files))))
78359
2dd5d799a16d * vc-git.el: (vc-directory-exclusion-list, vc-handled-backends):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78236
diff changeset
283 table))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
284
85141
b16f7408cd3f Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 85139
diff changeset
285 (defun vc-hg-annotate-command (file buffer &optional revision)
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
286 "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER.
85141
b16f7408cd3f Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 85139
diff changeset
287 Optional arg REVISION is a revision to annotate from."
95542
dfffc14d8182 (vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents: 95087
diff changeset
288 (vc-hg-command buffer 0 file "annotate" "-d" "-n"
94853
1c9a3c7fa4f1 (vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
289 (when revision (concat "-r" revision)))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
290 (with-current-buffer buffer
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
291 (goto-char (point-min))
80582
7c7ae81f80df (vc-hg-annotate-command): Allow white space before version number.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 79800
diff changeset
292 (re-search-forward "^[ \t]*[0-9]")
7c7ae81f80df (vc-hg-annotate-command): Allow white space before version number.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 79800
diff changeset
293 (delete-region (point-min) (match-beginning 0))))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
294
96213
09da7727f35f * vc-hg.el (vc-annotate-convert-time, vc-default-status-printer):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 95966
diff changeset
295 (declare-function vc-annotate-convert-time "vc-annotate" (time))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
296
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
297 ;; The format for one line output by "hg annotate -d -n" looks like this:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
298 ;;215 Wed Jun 20 21:22:58 2007 -0700: CONTENTS
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
299 ;; i.e: VERSION_NUMBER DATE: CONTENTS
80585
8c0cc53e8234 (vc-hg-annotate-re): Recognize the output of --follow.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 80582
diff changeset
300 ;; If the user has set the "--follow" option, the output looks like:
8c0cc53e8234 (vc-hg-annotate-re): Recognize the output of --follow.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 80582
diff changeset
301 ;;215 Wed Jun 20 21:22:58 2007 -0700 foo.c: CONTENTS
8c0cc53e8234 (vc-hg-annotate-re): Recognize the output of --follow.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 80582
diff changeset
302 ;; i.e. VERSION_NUMBER DATE FILENAME: CONTENTS
8c0cc53e8234 (vc-hg-annotate-re): Recognize the output of --follow.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 80582
diff changeset
303 (defconst vc-hg-annotate-re
8c0cc53e8234 (vc-hg-annotate-re): Recognize the output of --follow.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 80582
diff changeset
304 "^[ \t]*\\([0-9]+\\) \\(.\\{30\\}\\)[^:\n]*\\(:[^ \n][^:\n]*\\)*: ")
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
305
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
306 (defun vc-hg-annotate-time ()
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
307 (when (looking-at vc-hg-annotate-re)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
308 (goto-char (match-end 0))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
309 (vc-annotate-convert-time
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
310 (date-to-time (match-string-no-properties 2)))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
311
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
312 (defun vc-hg-annotate-extract-revision-at-line ()
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
313 (save-excursion
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
314 (beginning-of-line)
80585
8c0cc53e8234 (vc-hg-annotate-re): Recognize the output of --follow.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 80582
diff changeset
315 (when (looking-at vc-hg-annotate-re) (match-string-no-properties 1))))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
316
85141
b16f7408cd3f Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 85139
diff changeset
317 (defun vc-hg-previous-revision (file rev)
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
318 (let ((newrev (1- (string-to-number rev))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
319 (when (>= newrev 0)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
320 (number-to-string newrev))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
321
85141
b16f7408cd3f Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 85139
diff changeset
322 (defun vc-hg-next-revision (file rev)
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
323 (let ((newrev (1+ (string-to-number rev)))
91991
f40c311f15ac Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 91953
diff changeset
324 (tip-revision
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
325 (with-temp-buffer
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
326 (vc-hg-command t 0 nil "tip")
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
327 (goto-char (point-min))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
328 (re-search-forward "^changeset:[ \t]*\\([0-9]+\\):")
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
329 (string-to-number (match-string-no-properties 1)))))
85141
b16f7408cd3f Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 85139
diff changeset
330 ;; We don't want to exceed the maximum possible revision number, ie
b16f7408cd3f Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 85139
diff changeset
331 ;; the tip revision.
b16f7408cd3f Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 85139
diff changeset
332 (when (<= newrev tip-revision)
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
333 (number-to-string newrev))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
334
96365
65532b2a1819 American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents: 96260
diff changeset
335 ;; Modeled after the similar function in vc-bzr.el
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
336 (defun vc-hg-delete-file (file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
337 "Delete FILE and delete it in the hg repository."
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
338 (condition-case ()
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
339 (delete-file file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
340 (file-error nil))
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
341 (vc-hg-command nil 0 file "remove" "--after" "--force"))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
342
96365
65532b2a1819 American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents: 96260
diff changeset
343 ;; Modeled after the similar function in vc-bzr.el
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
344 (defun vc-hg-rename-file (old new)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
345 "Rename file from OLD to NEW using `hg mv'."
94439
d6a121c992e3 (vc-hg-rename-file): Fix argument order.
Sam Steingold <sds@gnu.org>
parents: 94003
diff changeset
346 (vc-hg-command nil 0 new "mv" old))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
347
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
348 (defun vc-hg-register (files &optional rev comment)
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
349 "Register FILES under hg.
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
350 REV is ignored.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
351 COMMENT is ignored."
82012
878cfe0c0c5a (vc-hg-dir-state): Fix loop.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81998
diff changeset
352 (vc-hg-command nil 0 files "add"))
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
353
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
354 (defun vc-hg-create-repo ()
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
355 "Create a new Mercurial repository."
82012
878cfe0c0c5a (vc-hg-dir-state): Fix loop.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81998
diff changeset
356 (vc-hg-command nil 0 nil "init"))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
357
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
358 (defalias 'vc-hg-responsible-p 'vc-hg-root)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
359
96365
65532b2a1819 American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents: 96260
diff changeset
360 ;; Modeled after the similar function in vc-bzr.el
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
361 (defun vc-hg-could-register (file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
362 "Return non-nil if FILE could be registered under hg."
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
363 (and (vc-hg-responsible-p file) ; shortcut
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
364 (condition-case ()
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
365 (with-temp-buffer
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
366 (vc-hg-command t nil file "add" "--dry-run"))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
367 ;; The command succeeds with no output if file is
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
368 ;; registered.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
369 (error))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
370
96519
0197baf37347 *** empty log message ***
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96518
diff changeset
371 ;; FIXME: This would remove the file. Is that correct?
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
372 ;; (defun vc-hg-unregister (file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
373 ;; "Unregister FILE from hg."
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
374 ;; (vc-hg-command nil nil file "remove"))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
375
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
376 (defun vc-hg-checkin (files rev comment)
78404
27f00e50116a Change capitalization of VC backend names for new backends
Miles Bader <miles@gnu.org>
parents: 78363
diff changeset
377 "Hg-specific version of `vc-backend-checkin'.
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
378 REV is ignored."
82012
878cfe0c0c5a (vc-hg-dir-state): Fix loop.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81998
diff changeset
379 (vc-hg-command nil 0 files "commit" "-m" comment))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
380
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 83759
diff changeset
381 (defun vc-hg-find-revision (file rev buffer)
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
382 (let ((coding-system-for-read 'binary)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
383 (coding-system-for-write 'binary))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
384 (if rev
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
385 (vc-hg-command buffer 0 file "cat" "-r" rev)
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
386 (vc-hg-command buffer 0 file "cat"))))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
387
96365
65532b2a1819 American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents: 96260
diff changeset
388 ;; Modeled after the similar function in vc-bzr.el
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
389 (defun vc-hg-checkout (file &optional editable rev)
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
390 "Retrieve a revision of FILE.
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
391 EDITABLE is ignored.
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
392 REV is the revision to check out into WORKFILE."
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
393 (let ((coding-system-for-read 'binary)
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
394 (coding-system-for-write 'binary))
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
395 (with-current-buffer (or (get-file-buffer file) (current-buffer))
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
396 (if rev
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
397 (vc-hg-command t 0 file "cat" "-r" rev)
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
398 (vc-hg-command t 0 file "cat")))))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
399
96365
65532b2a1819 American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents: 96260
diff changeset
400 ;; Modeled after the similar function in vc-bzr.el
78167
252b7f091c04 (vc-hg-workfile-unchanged-p): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78166
diff changeset
401 (defun vc-hg-workfile-unchanged-p (file)
252b7f091c04 (vc-hg-workfile-unchanged-p): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78166
diff changeset
402 (eq 'up-to-date (vc-hg-state file)))
252b7f091c04 (vc-hg-workfile-unchanged-p): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78166
diff changeset
403
96365
65532b2a1819 American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents: 96260
diff changeset
404 ;; Modeled after the similar function in vc-bzr.el
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
405 (defun vc-hg-revert (file &optional contents-done)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
406 (unless contents-done
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
407 (with-temp-buffer (vc-hg-command t 0 file "revert"))))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
408
83759
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
409 ;;; Hg specific functionality.
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
410
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
411 (defvar vc-hg-extra-menu-map
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
412 (let ((map (make-sparse-keymap)))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
413 (define-key map [incoming] '(menu-item "Show incoming" vc-hg-incoming))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
414 (define-key map [outgoing] '(menu-item "Show outgoing" vc-hg-outgoing))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
415 map))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
416
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
417 (defun vc-hg-extra-menu () vc-hg-extra-menu-map)
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
418
92122
74bf6df13b6c * vc.el (vc-find-revision): Make vc-parent-buffer local before
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92093
diff changeset
419 (defun vc-hg-extra-status-menu () vc-hg-extra-menu-map)
91951
d42fe75822fe * vc.el (vc-status-menu, vc-status-menu-map-filter): New functions.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87903
diff changeset
420
83759
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
421 (define-derived-mode vc-hg-outgoing-mode vc-hg-log-view-mode "Hg-Outgoing")
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
422
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
423 (define-derived-mode vc-hg-incoming-mode vc-hg-log-view-mode "Hg-Incoming")
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
424
94511
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
425 (defstruct (vc-hg-extra-fileinfo
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
426 (:copier nil)
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
427 (:constructor vc-hg-create-extra-fileinfo (rename-state extra-name))
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
428 (:conc-name vc-hg-extra-fileinfo->))
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
429 rename-state ;; rename or copy state
95542
dfffc14d8182 (vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents: 95087
diff changeset
430 extra-name) ;; original name for copies and rename targets, new name for
94511
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
431
99159
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 98492
diff changeset
432 (declare-function vc-default-dir-printer "vc-dir" (backend fileentry))
96213
09da7727f35f * vc-hg.el (vc-annotate-convert-time, vc-default-status-printer):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 95966
diff changeset
433
99159
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 98492
diff changeset
434 (defun vc-hg-dir-printer (info)
94511
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
435 "Pretty-printer for the vc-dir-fileinfo structure."
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
436 (let ((extra (vc-dir-fileinfo->extra info)))
99159
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 98492
diff changeset
437 (vc-default-dir-printer 'Hg info)
94511
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
438 (when extra
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
439 (insert (propertize
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
440 (format " (%s %s)"
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
441 (case (vc-hg-extra-fileinfo->rename-state extra)
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
442 ('copied "copied from")
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
443 ('renamed-from "renamed from")
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
444 ('renamed-to "renamed to"))
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
445 (vc-hg-extra-fileinfo->extra-name extra))
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
446 'face 'font-lock-comment-face)))))
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
447
94003
2ecb2ea8d5b5 Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93957
diff changeset
448 (defun vc-hg-after-dir-status (update-function)
87844
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
449 (let ((status-char nil)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
450 (file nil)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
451 (translation '((?= . up-to-date)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
452 (?C . up-to-date)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
453 (?A . added)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
454 (?R . removed)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
455 (?M . edited)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
456 (?I . ignored)
93176
c985261aee9c * vc-hg.el (vc-hg-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 93163
diff changeset
457 (?! . missing)
94511
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
458 (? . copy-rename-line)
87844
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
459 (?? . unregistered)))
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
460 (translated nil)
94511
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
461 (result nil)
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
462 (last-added nil)
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
463 (last-line-copy nil))
87844
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
464 (goto-char (point-min))
87599
efe45ef69877 * vc.el (vc-status-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87574
diff changeset
465 (while (not (eobp))
94511
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
466 (setq translated (cdr (assoc (char-after) translation)))
91991
f40c311f15ac Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 91953
diff changeset
467 (setq file
f40c311f15ac Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 91953
diff changeset
468 (buffer-substring-no-properties (+ (point) 2)
87844
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
469 (line-end-position)))
94511
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
470 (cond ((not translated)
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
471 (setq last-line-copy nil))
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
472 ((eq translated 'up-to-date)
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
473 (setq last-line-copy nil))
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
474 ((eq translated 'copy-rename-line)
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
475 ;; For copied files the output looks like this:
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
476 ;; A COPIED_FILE_NAME
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
477 ;; ORIGINAL_FILE_NAME
95542
dfffc14d8182 (vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents: 95087
diff changeset
478 (setf (nth 2 last-added)
94511
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
479 (vc-hg-create-extra-fileinfo 'copied file))
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
480 (setq last-line-copy t))
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
481 ((and last-line-copy (eq translated 'removed))
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
482 ;; For renamed files the output looks like this:
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
483 ;; A NEW_FILE_NAME
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
484 ;; ORIGINAL_FILE_NAME
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
485 ;; R ORIGINAL_FILE_NAME
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
486 ;; We need to adjust the previous entry to not think it is a copy.
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
487 (setf (vc-hg-extra-fileinfo->rename-state (nth 2 last-added))
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
488 'renamed-from)
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
489 (push (list file translated
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
490 (vc-hg-create-extra-fileinfo
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
491 'renamed-to (nth 0 last-added))) result)
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
492 (setq last-line-copy nil))
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
493 (t
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
494 (setq last-added (list file translated nil))
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
495 (push last-added result)
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
496 (setq last-line-copy nil)))
87599
efe45ef69877 * vc.el (vc-status-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87574
diff changeset
497 (forward-line))
94003
2ecb2ea8d5b5 Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93957
diff changeset
498 (funcall update-function result)))
87844
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
499
94003
2ecb2ea8d5b5 Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93957
diff changeset
500 (defun vc-hg-dir-status (dir update-function)
94511
40171abb3041 (vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94481
diff changeset
501 (vc-hg-command (current-buffer) 'async dir "status" "-C")
93382
8e46096e0cb3 * vc.el (vc-status-menu-map, vc-status-mode-map): Bind vc-revert.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 93327
diff changeset
502 (vc-exec-after
94003
2ecb2ea8d5b5 Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93957
diff changeset
503 `(vc-hg-after-dir-status (quote ,update-function))))
87599
efe45ef69877 * vc.el (vc-status-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87574
diff changeset
504
98492
b3eefcc54430 (vc-hg-dir-status-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96519
diff changeset
505 (defun vc-hg-dir-status-files (dir files default-state update-function)
b3eefcc54430 (vc-hg-dir-status-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96519
diff changeset
506 (apply 'vc-hg-command (current-buffer) 'async dir "status" "-C" files)
b3eefcc54430 (vc-hg-dir-status-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96519
diff changeset
507 (vc-exec-after
b3eefcc54430 (vc-hg-dir-status-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96519
diff changeset
508 `(vc-hg-after-dir-status (quote ,update-function))))
b3eefcc54430 (vc-hg-dir-status-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96519
diff changeset
509
99159
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 98492
diff changeset
510 (defun vc-hg-dir-extra-header (name &rest commands)
95542
dfffc14d8182 (vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents: 95087
diff changeset
511 (concat (propertize name 'face 'font-lock-type-face)
dfffc14d8182 (vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents: 95087
diff changeset
512 (propertize
dfffc14d8182 (vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents: 95087
diff changeset
513 (with-temp-buffer
dfffc14d8182 (vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents: 95087
diff changeset
514 (apply 'vc-hg-command (current-buffer) 0 nil commands)
dfffc14d8182 (vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents: 95087
diff changeset
515 (buffer-substring-no-properties (point-min) (1- (point-max))))
dfffc14d8182 (vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents: 95087
diff changeset
516 'face 'font-lock-variable-name-face)))
dfffc14d8182 (vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents: 95087
diff changeset
517
99159
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 98492
diff changeset
518 (defun vc-hg-dir-extra-headers (dir)
95542
dfffc14d8182 (vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents: 95087
diff changeset
519 "Generate extra status headers for a Mercurial tree."
dfffc14d8182 (vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents: 95087
diff changeset
520 (let ((default-directory dir))
dfffc14d8182 (vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents: 95087
diff changeset
521 (concat
99159
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 98492
diff changeset
522 (vc-hg-dir-extra-header "Root : " "root") "\n"
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 98492
diff changeset
523 (vc-hg-dir-extra-header "Branch : " "id" "-b") "\n"
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 98492
diff changeset
524 (vc-hg-dir-extra-header "Tags : " "id" "-t") ; "\n"
95542
dfffc14d8182 (vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents: 95087
diff changeset
525 ;; these change after each commit
99159
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 98492
diff changeset
526 ;; (vc-hg-dir-extra-header "Local num : " "id" "-n") "\n"
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 98492
diff changeset
527 ;; (vc-hg-dir-extra-header "Global id : " "id" "-i")
95542
dfffc14d8182 (vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents: 95087
diff changeset
528 )))
dfffc14d8182 (vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents: 95087
diff changeset
529
96519
0197baf37347 *** empty log message ***
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96518
diff changeset
530 ;; FIXME: this adds another top level menu, instead figure out how to
83759
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
531 ;; replace the Log-View menu.
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
532 (easy-menu-define log-view-mode-menu vc-hg-outgoing-mode-map
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
533 "Hg-outgoing Display Menu"
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
534 `("Hg-outgoing"
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
535 ["Push selected" vc-hg-push]))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
536
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
537 (easy-menu-define log-view-mode-menu vc-hg-incoming-mode-map
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
538 "Hg-incoming Display Menu"
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
539 `("Hg-incoming"
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
540 ["Pull selected" vc-hg-pull]))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
541
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
542 (defun vc-hg-outgoing ()
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
543 (interactive)
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
544 (let ((bname "*Hg outgoing*"))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
545 (vc-hg-command bname 0 nil "outgoing" "-n")
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
546 (pop-to-buffer bname)
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
547 (vc-hg-outgoing-mode)))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
548
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
549 (defun vc-hg-incoming ()
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
550 (interactive)
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
551 (let ((bname "*Hg incoming*"))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
552 (vc-hg-command bname 0 nil "incoming" "-n")
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
553 (pop-to-buffer bname)
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
554 (vc-hg-incoming-mode)))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
555
86234
860a7a8e779e * progmodes/octave-mod.el (inferior-octave-send-list-and-digest):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85510
diff changeset
556 (declare-function log-view-get-marked "log-view" ())
860a7a8e779e * progmodes/octave-mod.el (inferior-octave-send-list-and-digest):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85510
diff changeset
557
83759
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
558 ;; XXX maybe also add key bindings for these functions.
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
559 (defun vc-hg-push ()
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
560 (interactive)
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
561 (let ((marked-list (log-view-get-marked)))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
562 (if marked-list
91991
f40c311f15ac Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 91953
diff changeset
563 (vc-hg-command
83759
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
564 nil 0 nil
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
565 (cons "push"
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
566 (apply 'nconc
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
567 (mapcar (lambda (arg) (list "-r" arg)) marked-list))))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
568 (error "No log entries selected for push"))))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
569
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
570 (defun vc-hg-pull ()
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
571 (interactive)
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
572 (let ((marked-list (log-view-get-marked)))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
573 (if marked-list
91991
f40c311f15ac Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 91953
diff changeset
574 (vc-hg-command
83759
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
575 nil 0 nil
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
576 (cons "pull"
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
577 (apply 'nconc
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
578 (mapcar (lambda (arg) (list "-r" arg)) marked-list))))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
579 (error "No log entries selected for pull"))))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
580
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
581 ;;; Internal functions
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
582
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
583 (defun vc-hg-command (buffer okstatus file-or-list &rest flags)
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
584 "A wrapper around `vc-do-command' for use in vc-hg.el.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
585 The difference to vc-do-command is that this function always invokes `hg',
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
586 and that it passes `vc-hg-global-switches' to it before FLAGS."
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
587 (apply 'vc-do-command (or buffer "*vc*") okstatus "hg" file-or-list
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
588 (if (stringp vc-hg-global-switches)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
589 (cons vc-hg-global-switches flags)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
590 (append vc-hg-global-switches
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
591 flags))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
592
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
593 (defun vc-hg-root (file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
594 (vc-find-root file ".hg"))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
595
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
596 (provide 'vc-hg)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
597
78086
9a13508185dc Add arch tagline
Miles Bader <miles@gnu.org>
parents: 78075
diff changeset
598 ;; arch-tag: bd094dc5-715a-434f-a331-37b9fb7cd954
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
599 ;;; vc-hg.el ends here