Mercurial > emacs
annotate lisp/vc-hg.el @ 111912:d566763f152d
Fix crash with invisible text and overlays (Bug#7016).
* src/dispextern.h (struct it): New member overlay_strings_charpos.
* src/xdisp.c (next_overlay_string, load_overlay_strings): Record the
charpos where we computed n_overlay_strings.
(next_overlay_string): Load overlay strings at recorded position,
which may not be the same as the iterator's charpos (Bug#7016).
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Mon, 06 Dec 2010 01:54:52 -0500 |
parents | 753ce65aa0fc |
children | 376148b31b5e |
rev | line source |
---|---|
78075 | 1 ;;; vc-hg.el --- VC backend for the mercurial version control system |
2 | |
106815 | 3 ;; Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
78075 | 4 |
5 ;; Author: Ivan Kanis | |
6 ;; Keywords: tools | |
7 | |
8 ;; This file is part of GNU Emacs. | |
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 | 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 | 14 |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
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 | 22 |
23 ;;; Commentary: | |
24 | |
25 ;; This is a mercurial version control backend | |
26 | |
27 ;;; Thanks: | |
28 | |
29 ;;; Bugs: | |
30 | |
31 ;;; Installation: | |
32 | |
33 ;;; Todo: | |
34 | |
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 | 36 ;; beginning of vc.el. The current status is: |
37 | |
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 | 42 ;; * registered (file) OK |
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 |
101200
bbf505632d29
(vc-hg-diff): Pass relative file names. (Bug#1903)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100908
diff
changeset
|
47 ;; - dir-extra-headers (dir) OK |
bbf505632d29
(vc-hg-diff): Pass relative file names. (Bug#1903)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100908
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 | 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 | 53 ;; - mode-line-string (file) NOT NEEDED |
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 | 58 ;; - responsible-p (file) OK |
59 ;; - could-register (file) OK | |
60 ;; - receive-file (file rev) ?? PROBABLY NOT NEEDED | |
61 ;; - unregister (file) COMMENTED OUT, MAY BE INCORRECT | |
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 | 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 | 67 ;; - merge (file rev1 rev2) NEEDED |
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 | 70 ;; HISTORY FUNCTIONS |
106472
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106103
diff
changeset
|
71 ;; * print-log (files buffer &optional shortlog start-revision limit) OK |
78075 | 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 | 74 ;; - comment-history (file) NOT NEEDED |
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 | 78 ;; - annotate-command (file buf &optional rev) OK |
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 | 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 |
101200
bbf505632d29
(vc-hg-diff): Pass relative file names. (Bug#1903)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100908
diff
changeset
|
83 ;; - create-tag (dir name branchp) NEEDED |
bbf505632d29
(vc-hg-diff): Pass relative file names. (Bug#1903)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100908
diff
changeset
|
84 ;; - retrieve-tag (dir name update) NEEDED |
78075 | 85 ;; MISCELLANEOUS |
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 | 90 ;; - check-headers () ?? |
91 ;; - clear-headers () ?? | |
92 ;; - delete-file (file) TEST IT | |
93 ;; - rename-file (old new) OK | |
94 ;; - find-file-hook () PROBABLY NOT NEEDED | |
95 | |
94853
1c9a3c7fa4f1
(vc-hg-diff, vc-hg-annotate-command): Use when not if.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94847
diff
changeset
|
96 ;; 2) Implement Stefan Monnier's advice: |
78075 | 97 ;; vc-hg-registered and vc-hg-state |
98 ;; Both of those functions should be super extra careful to fail gracefully in | |
99 ;; unexpected circumstances. The reason this is important is that any error | |
100 ;; there will prevent the user from even looking at the file :-( | |
101 ;; Ideally, just like in vc-arch and vc-cvs, checking that the file is under | |
102 ;; mercurial's control and extracting the current revision should be done | |
103 ;; without even using `hg' (this way even if you don't have `hg' installed, | |
104 ;; Emacs is able to tell you this file is under mercurial's control). | |
105 | |
106 ;;; History: | |
107 ;; | |
108 | |
109 ;;; Code: | |
110 | |
111 (eval-when-compile | |
78182
86c8d81f944f
(vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78167
diff
changeset
|
112 (require 'cl) |
96260 | 113 (require 'vc) |
114 (require 'vc-dir)) | |
78075 | 115 |
116 ;;; Customization options | |
117 | |
118 (defcustom vc-hg-global-switches nil | |
100171 | 119 "Global switches to pass to any Hg command." |
78075 | 120 :type '(choice (const :tag "None" nil) |
121 (string :tag "Argument String") | |
100180
a5dc2e77b960
(vc-hg-diff-switches): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
100171
diff
changeset
|
122 (repeat :tag "Argument List" :value ("") string)) |
78075 | 123 :version "22.2" |
124 :group 'vc) | |
125 | |
100180
a5dc2e77b960
(vc-hg-diff-switches): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
100171
diff
changeset
|
126 (defcustom vc-hg-diff-switches t ; Hg doesn't support common args like -u |
a5dc2e77b960
(vc-hg-diff-switches): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
100171
diff
changeset
|
127 "String or list of strings specifying switches for Hg diff under VC. |
a5dc2e77b960
(vc-hg-diff-switches): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
100171
diff
changeset
|
128 If nil, use the value of `vc-diff-switches'. If t, use no switches." |
99736
015fd0131c0b
(vc-hg-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents:
99159
diff
changeset
|
129 :type '(choice (const :tag "Unspecified" nil) |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
130 (const :tag "None" t) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
131 (string :tag "Argument String") |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
132 (repeat :tag "Argument List" :value ("") string)) |
99736
015fd0131c0b
(vc-hg-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents:
99159
diff
changeset
|
133 :version "23.1" |
015fd0131c0b
(vc-hg-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents:
99159
diff
changeset
|
134 :group 'vc) |
015fd0131c0b
(vc-hg-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents:
99159
diff
changeset
|
135 |
111621
753ce65aa0fc
* vc-hg.el (vc-hg-program): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111350
diff
changeset
|
136 (defcustom vc-hg-program "hg" |
753ce65aa0fc
* vc-hg.el (vc-hg-program): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111350
diff
changeset
|
137 "Name of the Mercurial executable (excluding any arguments)." |
753ce65aa0fc
* vc-hg.el (vc-hg-program): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111350
diff
changeset
|
138 :type 'string |
753ce65aa0fc
* vc-hg.el (vc-hg-program): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111350
diff
changeset
|
139 :group 'vc) |
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
|
140 |
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
|
141 ;;; 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
|
142 |
94563
a0bb8ca25a33
Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94542
diff
changeset
|
143 (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
|
144 (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
|
145 |
78075 | 146 ;;; State querying functions |
147 | |
148 ;;;###autoload (defun vc-hg-registered (file) | |
149 ;;;###autoload "Return non-nil if FILE is registered with hg." | |
150 ;;;###autoload (if (vc-find-root file ".hg") ; short cut | |
151 ;;;###autoload (progn | |
152 ;;;###autoload (load "vc-hg") | |
153 ;;;###autoload (vc-hg-registered file)))) | |
154 | |
96365
65532b2a1819
American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents:
96260
diff
changeset
|
155 ;; Modeled after the similar function in vc-bzr.el |
78075 | 156 (defun vc-hg-registered (file) |
157 "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
|
158 (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
|
159 (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
|
160 (and state (not (memq state '(ignored unregistered))))))) |
78075 | 161 |
162 (defun vc-hg-state (file) | |
163 "Hg-specific version of `vc-state'." | |
91991
f40c311f15ac
Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
91953
diff
changeset
|
164 (let* |
78075 | 165 ((status nil) |
105785
882add770597
(vc-hg-state, vc-hg-working-revision): Use process-file so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105670
diff
changeset
|
166 (default-directory (file-name-directory file)) |
78075 | 167 (out |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
168 (with-output-to-string |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
169 (with-current-buffer |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
170 standard-output |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
171 (setq status |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
172 (condition-case nil |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
173 ;; Ignore all errors. |
106472
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106103
diff
changeset
|
174 (let ((process-environment |
108322
a70c2c59b3f6
Fix hg envvar handling (Bug#5846).
Chong Yidong <cyd@stupidchicken.com>
parents:
107972
diff
changeset
|
175 ;; Avoid localization of messages so we |
a70c2c59b3f6
Fix hg envvar handling (Bug#5846).
Chong Yidong <cyd@stupidchicken.com>
parents:
107972
diff
changeset
|
176 ;; can parse the output. |
110346
05bd64a0d747
* vc/vc-hg.el (vc-hg-state,vc-hg-working-revision):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108322
diff
changeset
|
177 (append (list "TERM=dumb" "LANGUAGE=C") |
108322
a70c2c59b3f6
Fix hg envvar handling (Bug#5846).
Chong Yidong <cyd@stupidchicken.com>
parents:
107972
diff
changeset
|
178 process-environment))) |
a70c2c59b3f6
Fix hg envvar handling (Bug#5846).
Chong Yidong <cyd@stupidchicken.com>
parents:
107972
diff
changeset
|
179 (process-file |
111621
753ce65aa0fc
* vc-hg.el (vc-hg-program): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111350
diff
changeset
|
180 vc-hg-program nil t nil |
110346
05bd64a0d747
* vc/vc-hg.el (vc-hg-state,vc-hg-working-revision):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108322
diff
changeset
|
181 "--config" "alias.status=status" |
05bd64a0d747
* vc/vc-hg.el (vc-hg-state,vc-hg-working-revision):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108322
diff
changeset
|
182 "--config" "defaults.status=" |
108322
a70c2c59b3f6
Fix hg envvar handling (Bug#5846).
Chong Yidong <cyd@stupidchicken.com>
parents:
107972
diff
changeset
|
183 "status" "-A" (file-relative-name file))) |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
184 ;; Some problem happened. E.g. We can't find an `hg' |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
185 ;; executable. |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
186 (error nil))))))) |
78075 | 187 (when (eq 0 status) |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
188 (when (null (string-match ".*: No such file or directory$" out)) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
189 (let ((state (aref out 0))) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
190 (cond |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
191 ((eq state ?=) 'up-to-date) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
192 ((eq state ?A) 'added) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
193 ((eq state ?M) 'edited) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
194 ((eq state ?I) 'ignored) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
195 ((eq state ?R) 'removed) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
196 ((eq state ?!) 'missing) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
197 ((eq state ??) 'unregistered) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
198 ((eq state ?C) 'up-to-date) ;; Older mercurials use this |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
199 (t 'up-to-date))))))) |
78075 | 200 |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
83759
diff
changeset
|
201 (defun vc-hg-working-revision (file) |
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
83759
diff
changeset
|
202 "Hg-specific version of `vc-working-revision'." |
91991
f40c311f15ac
Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
91953
diff
changeset
|
203 (let* |
78075 | 204 ((status nil) |
105785
882add770597
(vc-hg-state, vc-hg-working-revision): Use process-file so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105670
diff
changeset
|
205 (default-directory (file-name-directory file)) |
107972
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
206 ;; Avoid localization of messages so we can parse the output. |
110346
05bd64a0d747
* vc/vc-hg.el (vc-hg-state,vc-hg-working-revision):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108322
diff
changeset
|
207 (avoid-local-env (append (list "TERM=dumb" "LANGUAGE=C") |
107972
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
208 process-environment)) |
78075 | 209 (out |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
210 (with-output-to-string |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
211 (with-current-buffer |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
212 standard-output |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
213 (setq status |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
214 (condition-case nil |
107972
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
215 (let ((process-environment avoid-local-env)) |
106576
ad87b48da2b0
(vc-hg-working-revision): Make sure the command is executed in a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106575
diff
changeset
|
216 ;; Ignore all errors. |
ad87b48da2b0
(vc-hg-working-revision): Make sure the command is executed in a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106575
diff
changeset
|
217 (process-file |
111621
753ce65aa0fc
* vc-hg.el (vc-hg-program): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111350
diff
changeset
|
218 vc-hg-program nil t nil |
110346
05bd64a0d747
* vc/vc-hg.el (vc-hg-state,vc-hg-working-revision):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108322
diff
changeset
|
219 "--config" "alias.parents=parents" |
05bd64a0d747
* vc/vc-hg.el (vc-hg-state,vc-hg-working-revision):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108322
diff
changeset
|
220 "--config" "defaults.parents=" |
108322
a70c2c59b3f6
Fix hg envvar handling (Bug#5846).
Chong Yidong <cyd@stupidchicken.com>
parents:
107972
diff
changeset
|
221 "parents" "--template" "{rev}" (file-relative-name file))) |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
222 ;; Some problem happened. E.g. We can't find an `hg' |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
223 ;; executable. |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
224 (error nil))))))) |
107972
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
225 (if (eq 0 status) |
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
226 out |
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
227 ;; Check if the file is in the 'added state, the above hg |
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
228 ;; command does not distinguish between 'added and 'unregistered. |
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
229 (setq status |
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
230 (condition-case nil |
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
231 (let ((process-environment avoid-local-env)) |
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
232 (process-file |
111621
753ce65aa0fc
* vc-hg.el (vc-hg-program): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111350
diff
changeset
|
233 vc-hg-program nil nil nil |
107972
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
234 ;; We use "log" here, if there's a faster command |
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
235 ;; that returns true for an 'added file and false |
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
236 ;; for an 'unregistered one, we could use that. |
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
237 "log" "-l1" (file-relative-name file))) |
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
238 ;; Some problem happened. E.g. We can't find an `hg' |
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
239 ;; executable. |
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
240 (error nil))) |
d7f8e879d70c
Fix the version number for added files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107969
diff
changeset
|
241 (when (eq 0 status) "0")))) |
78075 | 242 |
243 ;;; History functions | |
244 | |
103403
cb4483f32179
(vc-hg-log-switches): Add defcustom.
Sam Steingold <sds@gnu.org>
parents:
101200
diff
changeset
|
245 (defcustom vc-hg-log-switches nil |
cb4483f32179
(vc-hg-log-switches): Add defcustom.
Sam Steingold <sds@gnu.org>
parents:
101200
diff
changeset
|
246 "String or list of strings specifying switches for hg log under VC." |
cb4483f32179
(vc-hg-log-switches): Add defcustom.
Sam Steingold <sds@gnu.org>
parents:
101200
diff
changeset
|
247 :type '(choice (const :tag "None" nil) |
cb4483f32179
(vc-hg-log-switches): Add defcustom.
Sam Steingold <sds@gnu.org>
parents:
101200
diff
changeset
|
248 (string :tag "Argument String") |
cb4483f32179
(vc-hg-log-switches): Add defcustom.
Sam Steingold <sds@gnu.org>
parents:
101200
diff
changeset
|
249 (repeat :tag "Argument List" :value ("") string)) |
cb4483f32179
(vc-hg-log-switches): Add defcustom.
Sam Steingold <sds@gnu.org>
parents:
101200
diff
changeset
|
250 :group 'vc-hg) |
cb4483f32179
(vc-hg-log-switches): Add defcustom.
Sam Steingold <sds@gnu.org>
parents:
101200
diff
changeset
|
251 |
106575
87010af04b9a
(vc-hg-print-log): Fix argument order.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106472
diff
changeset
|
252 (defun vc-hg-print-log (files buffer &optional shortlog start-revision limit) |
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
|
253 "Get change log associated with FILES." |
78075 | 254 ;; `vc-do-command' creates the buffer, but we need it before running |
255 ;; the command. | |
256 (vc-setup-buffer buffer) | |
257 ;; If the buffer exists from a previous invocation it might be | |
258 ;; read-only. | |
259 (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
|
260 (with-current-buffer |
054335cbee3d
* log-view.el (log-view-diff-changeset): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
95542
diff
changeset
|
261 buffer |
105010
b3c2589ed19e
* vc.el (top): print-log method now takes an optional SHORTLOG
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103596
diff
changeset
|
262 (apply 'vc-hg-command buffer 0 files "log" |
111350
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
263 (nconc |
106472
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106103
diff
changeset
|
264 (when start-revision (list (format "-r%s:" start-revision))) |
106033
2bed02fa3041
* vc.el (vc-log-show-limit): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105785
diff
changeset
|
265 (when limit (list "-l" (format "%s" limit))) |
111350
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
266 (when shortlog (list "--style" "compact")) |
106033
2bed02fa3041
* vc.el (vc-log-show-limit): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105785
diff
changeset
|
267 vc-hg-log-switches))))) |
78075 | 268 |
269 (defvar log-view-message-re) | |
270 (defvar log-view-file-re) | |
271 (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
|
272 (defvar log-view-per-file-logs) |
78075 | 273 |
78404
27f00e50116a
Change capitalization of VC backend names for new backends
Miles Bader <miles@gnu.org>
parents:
78363
diff
changeset
|
274 (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
|
275 (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
|
276 (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
|
277 (set (make-local-variable 'log-view-per-file-logs) nil) |
78075 | 278 (set (make-local-variable 'log-view-message-re) |
111350
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
279 (if (eq vc-log-view-type 'short) |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
280 "^\\([0-9]+\\)\\(\\[.*\\]\\)? +\\([0-9a-z]\\{12\\}\\) +\\(\\(?:[0-9]+\\)-\\(?:[0-9]+\\)-\\(?:[0-9]+\\) \\(?:[0-9]+\\):\\(?:[0-9]+\\) \\(?:[-+0-9]+\\)\\) +\\(.*\\)$" |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
281 "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)")) |
78075 | 282 (set (make-local-variable 'log-view-font-lock-keywords) |
111350
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
283 (if (eq vc-log-view-type 'short) |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
284 (append `((,log-view-message-re |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
285 (1 'log-view-message-face) |
111350
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
286 (2 'highlight nil lax) |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
287 (3 'log-view-message-face) |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
288 (4 'change-log-date) |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
289 (5 'change-log-name)))) |
78075 | 290 (append |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
291 log-view-font-lock-keywords |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
292 '( |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
293 ;; Handle the case: |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
294 ;; user: FirstName LastName <foo@bar> |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
295 ("^user:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]" |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
296 (1 'change-log-name) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
297 (2 'change-log-email)) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
298 ;; Handle the cases: |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
299 ;; user: foo@bar |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
300 ;; and |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
301 ;; user: foo |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
302 ("^user:[ \t]+\\([A-Za-z0-9_.+-]+\\(?:@[A-Za-z0-9_.-]+\\)?\\)" |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
303 (1 'change-log-email)) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
304 ("^date: \\(.+\\)" (1 'change-log-date)) |
111350
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
305 ("^tag: +\\([^ ]+\\)$" (1 'highlight)) |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
306 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))) |
78075 | 307 |
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
|
308 (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
|
309 "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
|
310 (let* ((firstfile (car files)) |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
311 (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
|
312 (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
|
313 (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
|
314 (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
|
315 (setq oldvers working)) |
106103
a3a5df7c686c
(vc-hg-diff): Fix last patch: do not change directory.
Sam Steingold <sds@gnu.org>
parents:
106033
diff
changeset
|
316 (apply #'vc-hg-command (or buffer "*vc-diff*") nil files "diff" |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
317 (append |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
318 (vc-switches 'hg 'diff) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
319 (when oldvers |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
320 (if newvers |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
321 (list "-r" oldvers "-r" newvers) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
322 (list "-r" oldvers))))))) |
78182
86c8d81f944f
(vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78167
diff
changeset
|
323 |
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
|
324 (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
|
325 (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
|
326 (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
|
327 (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
|
328 (split-string |
78182
86c8d81f944f
(vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78167
diff
changeset
|
329 (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
|
330 |
96365
65532b2a1819
American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents:
96260
diff
changeset
|
331 ;; 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
|
332 (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
|
333 (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
|
334 table) |
2dd5d799a16d
* vc-git.el: (vc-directory-exclusion-list, vc-handled-backends):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78236
diff
changeset
|
335 (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
|
336 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
|
337 table)) |
78075 | 338 |
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
|
339 (defun vc-hg-annotate-command (file buffer &optional revision) |
78075 | 340 "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
|
341 Optional arg REVISION is a revision to annotate from." |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105473
diff
changeset
|
342 (vc-hg-command buffer 0 file "annotate" "-d" "-n" "--follow" |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105473
diff
changeset
|
343 (when revision (concat "-r" revision)))) |
78075 | 344 |
96213
09da7727f35f
* vc-hg.el (vc-annotate-convert-time, vc-default-status-printer):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
95966
diff
changeset
|
345 (declare-function vc-annotate-convert-time "vc-annotate" (time)) |
78075 | 346 |
347 ;; The format for one line output by "hg annotate -d -n" looks like this: | |
348 ;;215 Wed Jun 20 21:22:58 2007 -0700: CONTENTS | |
349 ;; 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
|
350 ;; 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
|
351 ;;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
|
352 ;; 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
|
353 (defconst vc-hg-annotate-re |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105473
diff
changeset
|
354 "^[ \t]*\\([0-9]+\\) \\(.\\{30\\}\\)\\(?:\\(: \\)\\|\\(?: +\\(.+\\): \\)\\)") |
78075 | 355 |
356 (defun vc-hg-annotate-time () | |
357 (when (looking-at vc-hg-annotate-re) | |
358 (goto-char (match-end 0)) | |
359 (vc-annotate-convert-time | |
360 (date-to-time (match-string-no-properties 2))))) | |
361 | |
362 (defun vc-hg-annotate-extract-revision-at-line () | |
363 (save-excursion | |
364 (beginning-of-line) | |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105473
diff
changeset
|
365 (when (looking-at vc-hg-annotate-re) |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105473
diff
changeset
|
366 (if (match-beginning 3) |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105473
diff
changeset
|
367 (match-string-no-properties 1) |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105473
diff
changeset
|
368 (cons (match-string-no-properties 1) |
107969
62fa87a581e1
Fix to vc-hg-annotate-extract-revision-at-line (Bug#5960).
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
369 (expand-file-name (match-string-no-properties 4) |
62fa87a581e1
Fix to vc-hg-annotate-extract-revision-at-line (Bug#5960).
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
370 (vc-hg-root default-directory))))))) |
78075 | 371 |
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
|
372 (defun vc-hg-previous-revision (file rev) |
78075 | 373 (let ((newrev (1- (string-to-number rev)))) |
374 (when (>= newrev 0) | |
375 (number-to-string newrev)))) | |
376 | |
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
|
377 (defun vc-hg-next-revision (file rev) |
78075 | 378 (let ((newrev (1+ (string-to-number rev))) |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
379 (tip-revision |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
380 (with-temp-buffer |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
381 (vc-hg-command t 0 nil "tip") |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
382 (goto-char (point-min)) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
383 (re-search-forward "^changeset:[ \t]*\\([0-9]+\\):") |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
384 (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
|
385 ;; 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
|
386 ;; 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
|
387 (when (<= newrev tip-revision) |
78075 | 388 (number-to-string newrev)))) |
389 | |
96365
65532b2a1819
American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents:
96260
diff
changeset
|
390 ;; Modeled after the similar function in vc-bzr.el |
78075 | 391 (defun vc-hg-delete-file (file) |
392 "Delete FILE and delete it in the hg repository." | |
393 (condition-case () | |
394 (delete-file file) | |
395 (file-error nil)) | |
78182
86c8d81f944f
(vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78167
diff
changeset
|
396 (vc-hg-command nil 0 file "remove" "--after" "--force")) |
78075 | 397 |
96365
65532b2a1819
American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents:
96260
diff
changeset
|
398 ;; Modeled after the similar function in vc-bzr.el |
78075 | 399 (defun vc-hg-rename-file (old new) |
400 "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
|
401 (vc-hg-command nil 0 new "mv" old)) |
78075 | 402 |
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
|
403 (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
|
404 "Register FILES under hg. |
78075 | 405 REV is ignored. |
406 COMMENT is ignored." | |
82012
878cfe0c0c5a
(vc-hg-dir-state): Fix loop.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
81998
diff
changeset
|
407 (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
|
408 |
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
|
409 (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
|
410 "Create a new Mercurial repository." |
82012
878cfe0c0c5a
(vc-hg-dir-state): Fix loop.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
81998
diff
changeset
|
411 (vc-hg-command nil 0 nil "init")) |
78075 | 412 |
413 (defalias 'vc-hg-responsible-p 'vc-hg-root) | |
414 | |
96365
65532b2a1819
American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents:
96260
diff
changeset
|
415 ;; Modeled after the similar function in vc-bzr.el |
78075 | 416 (defun vc-hg-could-register (file) |
417 "Return non-nil if FILE could be registered under hg." | |
418 (and (vc-hg-responsible-p file) ; shortcut | |
419 (condition-case () | |
420 (with-temp-buffer | |
421 (vc-hg-command t nil file "add" "--dry-run")) | |
422 ;; The command succeeds with no output if file is | |
423 ;; registered. | |
424 (error)))) | |
425 | |
96519
0197baf37347
*** empty log message ***
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96518
diff
changeset
|
426 ;; FIXME: This would remove the file. Is that correct? |
78075 | 427 ;; (defun vc-hg-unregister (file) |
428 ;; "Unregister FILE from hg." | |
429 ;; (vc-hg-command nil nil file "remove")) | |
430 | |
111350
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
431 (declare-function log-edit-extract-headers "log-edit" (headers string)) |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
432 |
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
|
433 (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
|
434 "Hg-specific version of `vc-backend-checkin'. |
78075 | 435 REV is ignored." |
111350
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
436 (apply 'vc-hg-command nil 0 files |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
437 (nconc (list "commit" "-m") |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
438 (log-edit-extract-headers '(("Author" . "--user") |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
439 ("Date" . "--date")) |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
440 comment)))) |
78075 | 441 |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
83759
diff
changeset
|
442 (defun vc-hg-find-revision (file rev buffer) |
78075 | 443 (let ((coding-system-for-read 'binary) |
444 (coding-system-for-write 'binary)) | |
445 (if rev | |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
446 (vc-hg-command buffer 0 file "cat" "-r" rev) |
78182
86c8d81f944f
(vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78167
diff
changeset
|
447 (vc-hg-command buffer 0 file "cat")))) |
78075 | 448 |
96365
65532b2a1819
American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents:
96260
diff
changeset
|
449 ;; 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
|
450 (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
|
451 "Retrieve a revision of FILE. |
9cbb2ce8ec8c
(vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78086
diff
changeset
|
452 EDITABLE is ignored. |
9cbb2ce8ec8c
(vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78086
diff
changeset
|
453 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
|
454 (let ((coding-system-for-read 'binary) |
9cbb2ce8ec8c
(vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78086
diff
changeset
|
455 (coding-system-for-write 'binary)) |
9cbb2ce8ec8c
(vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78086
diff
changeset
|
456 (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
|
457 (if rev |
78182
86c8d81f944f
(vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78167
diff
changeset
|
458 (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
|
459 (vc-hg-command t 0 file "cat"))))) |
78075 | 460 |
96365
65532b2a1819
American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents:
96260
diff
changeset
|
461 ;; 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
|
462 (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
|
463 (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
|
464 |
96365
65532b2a1819
American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents:
96260
diff
changeset
|
465 ;; Modeled after the similar function in vc-bzr.el |
78075 | 466 (defun vc-hg-revert (file &optional contents-done) |
467 (unless contents-done | |
78182
86c8d81f944f
(vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78167
diff
changeset
|
468 (with-temp-buffer (vc-hg-command t 0 file "revert")))) |
78075 | 469 |
83759
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
470 ;;; Hg specific functionality. |
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
471 |
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
472 (defvar vc-hg-extra-menu-map |
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
473 (let ((map (make-sparse-keymap))) |
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
474 map)) |
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
475 |
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
476 (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
|
477 |
92122
74bf6df13b6c
* vc.el (vc-find-revision): Make vc-parent-buffer local before
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92093
diff
changeset
|
478 (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
|
479 |
105473
07f6674a0832
(log-view-vc-backend): Declare for compiler.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105151
diff
changeset
|
480 (defvar log-view-vc-backend) |
83759
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
481 |
94511
40171abb3041
(vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94481
diff
changeset
|
482 (defstruct (vc-hg-extra-fileinfo |
40171abb3041
(vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94481
diff
changeset
|
483 (:copier nil) |
40171abb3041
(vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94481
diff
changeset
|
484 (: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
|
485 (:conc-name vc-hg-extra-fileinfo->)) |
40171abb3041
(vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94481
diff
changeset
|
486 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
|
487 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
|
488 |
99159
b0dce7f34dda
* vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98492
diff
changeset
|
489 (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
|
490 |
99159
b0dce7f34dda
* vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98492
diff
changeset
|
491 (defun vc-hg-dir-printer (info) |
94511
40171abb3041
(vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94481
diff
changeset
|
492 "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
|
493 (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
|
494 (vc-default-dir-printer 'Hg info) |
94511
40171abb3041
(vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94481
diff
changeset
|
495 (when extra |
40171abb3041
(vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94481
diff
changeset
|
496 (insert (propertize |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
497 (format " (%s %s)" |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
498 (case (vc-hg-extra-fileinfo->rename-state extra) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
499 ('copied "copied from") |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
500 ('renamed-from "renamed from") |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
501 ('renamed-to "renamed to")) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
502 (vc-hg-extra-fileinfo->extra-name extra)) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
503 'face 'font-lock-comment-face))))) |
94511
40171abb3041
(vc-hg-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94481
diff
changeset
|
504 |
94003
2ecb2ea8d5b5
Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93957
diff
changeset
|
505 (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
|
506 (let ((status-char nil) |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
507 (file nil) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
508 (translation '((?= . up-to-date) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
509 (?C . up-to-date) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
510 (?A . added) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
511 (?R . removed) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
512 (?M . edited) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
513 (?I . ignored) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
514 (?! . missing) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
515 (? . copy-rename-line) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
516 (?? . unregistered))) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
517 (translated nil) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
518 (result nil) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
519 (last-added nil) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
520 (last-line-copy nil)) |
87844
3bd7c8c8bbe7
* vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87674
diff
changeset
|
521 (goto-char (point-min)) |
87599
efe45ef69877
* vc.el (vc-status-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87574
diff
changeset
|
522 (while (not (eobp)) |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
523 (setq translated (cdr (assoc (char-after) translation))) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
524 (setq file |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
525 (buffer-substring-no-properties (+ (point) 2) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
526 (line-end-position))) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
527 (cond ((not translated) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
528 (setq last-line-copy nil)) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
529 ((eq translated 'up-to-date) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
530 (setq last-line-copy nil)) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
531 ((eq translated 'copy-rename-line) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
532 ;; For copied files the output looks like this: |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
533 ;; A COPIED_FILE_NAME |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
534 ;; ORIGINAL_FILE_NAME |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
535 (setf (nth 2 last-added) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
536 (vc-hg-create-extra-fileinfo 'copied file)) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
537 (setq last-line-copy t)) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
538 ((and last-line-copy (eq translated 'removed)) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
539 ;; For renamed files the output looks like this: |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
540 ;; A NEW_FILE_NAME |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
541 ;; ORIGINAL_FILE_NAME |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
542 ;; R ORIGINAL_FILE_NAME |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
543 ;; We need to adjust the previous entry to not think it is a copy. |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
544 (setf (vc-hg-extra-fileinfo->rename-state (nth 2 last-added)) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
545 'renamed-from) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
546 (push (list file translated |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
547 (vc-hg-create-extra-fileinfo |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
548 'renamed-to (nth 0 last-added))) result) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
549 (setq last-line-copy nil)) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
550 (t |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
551 (setq last-added (list file translated nil)) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
552 (push last-added result) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
553 (setq last-line-copy nil))) |
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
554 (forward-line)) |
94003
2ecb2ea8d5b5
Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93957
diff
changeset
|
555 (funcall update-function result))) |
87844
3bd7c8c8bbe7
* vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87674
diff
changeset
|
556 |
94003
2ecb2ea8d5b5
Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93957
diff
changeset
|
557 (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
|
558 (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
|
559 (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
|
560 `(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
|
561 |
98492
b3eefcc54430
(vc-hg-dir-status-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96519
diff
changeset
|
562 (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
|
563 (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
|
564 (vc-exec-after |
b3eefcc54430
(vc-hg-dir-status-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96519
diff
changeset
|
565 `(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
|
566 |
99159
b0dce7f34dda
* vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98492
diff
changeset
|
567 (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
|
568 (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
|
569 (propertize |
dfffc14d8182
(vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents:
95087
diff
changeset
|
570 (with-temp-buffer |
dfffc14d8182
(vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents:
95087
diff
changeset
|
571 (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
|
572 (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
|
573 '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
|
574 |
99159
b0dce7f34dda
* vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98492
diff
changeset
|
575 (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
|
576 "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
|
577 (let ((default-directory dir)) |
dfffc14d8182
(vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents:
95087
diff
changeset
|
578 (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
|
579 (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
|
580 (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
|
581 (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
|
582 ;; 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
|
583 ;; (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
|
584 ;; (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
|
585 ))) |
dfffc14d8182
(vc-hg-status-extra-header, vc-hg-status-extra-headers):
Sam Steingold <sds@gnu.org>
parents:
95087
diff
changeset
|
586 |
111350
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
587 (defun vc-hg-log-incoming (buffer remote-location) |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
588 (vc-hg-command buffer 1 nil "incoming" "-n" (unless (string= remote-location "") |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
589 remote-location))) |
83759
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
590 |
111350
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
591 (defun vc-hg-log-outgoing (buffer remote-location) |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
592 (vc-hg-command buffer 1 nil "outgoing" "-n" (unless (string= remote-location "") |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
593 remote-location))) |
83759
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
594 |
86234
860a7a8e779e
* progmodes/octave-mod.el (inferior-octave-send-list-and-digest):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85510
diff
changeset
|
595 (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
|
596 |
83759
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
597 ;; 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
|
598 (defun vc-hg-push () |
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
599 (interactive) |
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
600 (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
|
601 (if marked-list |
111350
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
602 (apply #'vc-hg-command |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
603 nil 0 nil |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
604 "push" |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
605 (apply 'nconc |
111350
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
606 (mapcar (lambda (arg) (list "-r" arg)) marked-list))) |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
607 (error "No log entries selected for push")))) |
83759
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
608 |
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
609 (defun vc-hg-pull () |
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
610 (interactive) |
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
611 (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
|
612 (if marked-list |
111350
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
613 (apply #'vc-hg-command |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
614 nil 0 nil |
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
615 "pull" |
105145
767b63857edd
(vc-hg-print-log): Fix shortlog arg passing.
Sam Steingold <sds@gnu.org>
parents:
105010
diff
changeset
|
616 (apply 'nconc |
111350
8027e412df98
Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents:
110346
diff
changeset
|
617 (mapcar (lambda (arg) (list "-r" arg)) marked-list))) |
83759
493b2df20f41
(vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82245
diff
changeset
|
618 (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
|
619 |
78075 | 620 ;;; Internal functions |
621 | |
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
|
622 (defun vc-hg-command (buffer okstatus file-or-list &rest flags) |
78075 | 623 "A wrapper around `vc-do-command' for use in vc-hg.el. |
99862
83ae2ae7a4c4
(vc-hg-global-switches): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
99783
diff
changeset
|
624 The difference to vc-do-command is that this function always invokes `hg', |
83ae2ae7a4c4
(vc-hg-global-switches): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
99783
diff
changeset
|
625 and that it passes `vc-hg-global-switches' to it before FLAGS." |
111621
753ce65aa0fc
* vc-hg.el (vc-hg-program): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111350
diff
changeset
|
626 (apply 'vc-do-command (or buffer "*vc*") okstatus vc-hg-program file-or-list |
78075 | 627 (if (stringp vc-hg-global-switches) |
628 (cons vc-hg-global-switches flags) | |
629 (append vc-hg-global-switches | |
630 flags)))) | |
631 | |
632 (defun vc-hg-root (file) | |
633 (vc-find-root file ".hg")) | |
634 | |
635 (provide 'vc-hg) | |
636 | |
78086 | 637 ;; arch-tag: bd094dc5-715a-434f-a331-37b9fb7cd954 |
78075 | 638 ;;; vc-hg.el ends here |