diff options
| author | Stefan Monnier | 2007-10-19 20:59:49 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-10-19 20:59:49 +0000 |
| commit | a7192ddb049df67d647f72fa464f30f749814b32 (patch) | |
| tree | 5aab78a03dd173ffd897761f30eafa42dcdd42ce | |
| parent | b5322ed70f60c57a1bb699b00fb7039e56289bf1 (diff) | |
| download | emacs-a7192ddb049df67d647f72fa464f30f749814b32.tar.gz emacs-a7192ddb049df67d647f72fa464f30f749814b32.zip | |
Remove `diff-tree' operation, now subsumed by `diff'.
Also `revision-completion-table' now takes a list of files.
(vc-deduce-fileset): Remove unused var `regexp'.
Only obey allow-directory-wildcard in dired buffers.
(vc-default-diff-tree): Remove.
(vc-diff-added-files): New var.
(vc-diff-internal): Use it. Remove arg `backend'. Update callers.
(vc-version-diff): Revert from `vc-history-diff' to the original name.
Remove the `backend' arg.
(vc-contains-version-controlled-file): Remove.
(vc-diff): Bring it closer to the version in Emacs-22.
(vc-revert): Fix typo in let-binding.
(vc-default-unregister): Remove.
(vc-dired-buffers-for-dir): Remove N^2 behavior.
| -rw-r--r-- | lisp/ChangeLog | 19 | ||||
| -rw-r--r-- | lisp/vc.el | 380 |
2 files changed, 197 insertions, 202 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f88bd4df165..19986354bd4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,20 @@ | |||
| 1 | 2007-10-19 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * vc.el: Remove `diff-tree' operation, now subsumed by `diff'. | ||
| 4 | Also `revision-completion-table' now takes a list of files. | ||
| 5 | (vc-deduce-fileset): Remove unused var `regexp'. | ||
| 6 | Only obey allow-directory-wildcard in dired buffers. | ||
| 7 | (vc-default-diff-tree): Remove. | ||
| 8 | (vc-diff-added-files): New var. | ||
| 9 | (vc-diff-internal): Use it. Remove arg `backend'. Update callers. | ||
| 10 | (vc-version-diff): Revert from `vc-history-diff' to the original name. | ||
| 11 | Remove the `backend' arg. | ||
| 12 | (vc-contains-version-controlled-file): Remove. | ||
| 13 | (vc-diff): Bring it closer to the version in Emacs-22. | ||
| 14 | (vc-revert): Fix typo in let-binding. | ||
| 15 | (vc-default-unregister): Remove. | ||
| 16 | (vc-dired-buffers-for-dir): Remove N^2 behavior. | ||
| 17 | |||
| 1 | 2007-10-19 Dan Nicolaescu <dann@ics.uci.edu> | 18 | 2007-10-19 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 19 | ||
| 3 | * textmodes/two-column.el (2C-split, 2C-merge): | 20 | * textmodes/two-column.el (2C-split, 2C-merge): |
| @@ -20,7 +37,7 @@ | |||
| 20 | 2007-10-19 Richard Stallman <rms@gnu.org> | 37 | 2007-10-19 Richard Stallman <rms@gnu.org> |
| 21 | 38 | ||
| 22 | * font-core.el (turn-on-font-lock-if-desired): | 39 | * font-core.el (turn-on-font-lock-if-desired): |
| 23 | Renamed from `turn-on-font-lock-if-enabled'. | 40 | Rename from `turn-on-font-lock-if-enabled'. |
| 24 | Fully obey `font-lock-global-modes'. | 41 | Fully obey `font-lock-global-modes'. |
| 25 | 42 | ||
| 26 | 2007-10-19 Stefan Monnier <monnier@iro.umontreal.ca> | 43 | 2007-10-19 Stefan Monnier <monnier@iro.umontreal.ca> |
diff --git a/lisp/vc.el b/lisp/vc.el index 0cf800c2ddd..09898aa98c1 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -49,15 +49,15 @@ | |||
| 49 | ;; | 49 | ;; |
| 50 | ;; Features in the new version: | 50 | ;; Features in the new version: |
| 51 | ;; * Key commands (vc-next-action = C-x v v, vc-print-log = C-x v l, vc-revert | 51 | ;; * Key commands (vc-next-action = C-x v v, vc-print-log = C-x v l, vc-revert |
| 52 | ;; = C-x v u, vc-rollback = C-x v c, vc-diff = C-x v =, vc-update = C-x v +) | 52 | ;; = C-x v u, vc-rollback = C-x v c, vc-diff = C-x v =, vc-update = C-x v +) |
| 53 | ;; now operate on filesets rather than individual files. | 53 | ;; now operate on filesets rather than individual files. |
| 54 | ;; * The fileset for a command is either (a) all marked files in VC-dired | 54 | ;; * The fileset for a command is either (a) all marked files in VC-dired |
| 55 | ;; mode, (b) the currently visited file if it's under version control, | 55 | ;; mode, (b) the currently visited file if it's under version control, |
| 56 | ;; or (c) the current directory if the visited buffer is not under | 56 | ;; or (c) the current directory if the visited buffer is not under |
| 57 | ;; version control and a wildcarding-enable flag has been set. | 57 | ;; version control and a wildcarding-enable flag has been set. |
| 58 | ;; | 58 | ;; |
| 59 | ;; If you maintain a client of the mode or customize it in your .emacs, | 59 | ;; If you maintain a client of the mode or customize it in your .emacs, |
| 60 | ;; note that some backend functions which formerly took single file arguments | 60 | ;; note that some backend functions which formerly took single file arguments |
| 61 | ;; now take a list of files. These include: register, checkin, print-log, | 61 | ;; now take a list of files. These include: register, checkin, print-log, |
| 62 | ;; rollback, and diff. | 62 | ;; rollback, and diff. |
| 63 | 63 | ||
| @@ -129,7 +129,7 @@ | |||
| 129 | ;; that return 'file have per-file revision numbering; backends | 129 | ;; that return 'file have per-file revision numbering; backends |
| 130 | ;; that return 'repository have per-repository revision numbering, | 130 | ;; that return 'repository have per-repository revision numbering, |
| 131 | ;; so a revision level implicitly identifies a changeset | 131 | ;; so a revision level implicitly identifies a changeset |
| 132 | ;; | 132 | ;; |
| 133 | ;; STATE-QUERYING FUNCTIONS | 133 | ;; STATE-QUERYING FUNCTIONS |
| 134 | ;; | 134 | ;; |
| 135 | ;; * registered (file) | 135 | ;; * registered (file) |
| @@ -168,7 +168,7 @@ | |||
| 168 | ;; | 168 | ;; |
| 169 | ;; Return the working revision of FILE. This is the revision fetched | 169 | ;; Return the working revision of FILE. This is the revision fetched |
| 170 | ;; by the last checkout or upate, not necessarily the same thing as the | 170 | ;; by the last checkout or upate, not necessarily the same thing as the |
| 171 | ;; head or tip revision. Should return "0" for a file added but not yet | 171 | ;; head or tip revision. Should return "0" for a file added but not yet |
| 172 | ;; committed. | 172 | ;; committed. |
| 173 | ;; | 173 | ;; |
| 174 | ;; - latest-on-branch-p (file) | 174 | ;; - latest-on-branch-p (file) |
| @@ -197,7 +197,7 @@ | |||
| 197 | ;; - mode-line-string (file) | 197 | ;; - mode-line-string (file) |
| 198 | ;; | 198 | ;; |
| 199 | ;; If provided, this function should return the VC-specific mode | 199 | ;; If provided, this function should return the VC-specific mode |
| 200 | ;; line string for FILE. The returned string should have a | 200 | ;; line string for FILE. The returned string should have a |
| 201 | ;; `help-echo' property which is the text to be displayed as a | 201 | ;; `help-echo' property which is the text to be displayed as a |
| 202 | ;; tooltip when the mouse hovers over the VC entry on the mode-line. | 202 | ;; tooltip when the mouse hovers over the VC entry on the mode-line. |
| 203 | ;; The default implementation deals well with all states that | 203 | ;; The default implementation deals well with all states that |
| @@ -213,8 +213,8 @@ | |||
| 213 | ;; | 213 | ;; |
| 214 | ;; * create-repo (backend) | 214 | ;; * create-repo (backend) |
| 215 | ;; | 215 | ;; |
| 216 | ;; Create an empty repository in the current directory and initialize | 216 | ;; Create an empty repository in the current directory and initialize |
| 217 | ;; it so VC mode can add files to it. For file-oriented systems, this | 217 | ;; it so VC mode can add files to it. For file-oriented systems, this |
| 218 | ;; need do no more than create a subdirectory with the right name. | 218 | ;; need do no more than create a subdirectory with the right name. |
| 219 | ;; | 219 | ;; |
| 220 | ;; * register (files &optional rev comment) | 220 | ;; * register (files &optional rev comment) |
| @@ -223,7 +223,7 @@ | |||
| 223 | ;; and an initial description of the file, COMMENT, may be specified, | 223 | ;; and an initial description of the file, COMMENT, may be specified, |
| 224 | ;; but it is not guaranteed that the backend will do anything with this. | 224 | ;; but it is not guaranteed that the backend will do anything with this. |
| 225 | ;; The implementation should pass the value of vc-register-switches | 225 | ;; The implementation should pass the value of vc-register-switches |
| 226 | ;; to the backend command. (Note: in older versions of VC, this | 226 | ;; to the backend command. (Note: in older versions of VC, this |
| 227 | ;; command took a single file argument and not a list.) | 227 | ;; command took a single file argument and not a list.) |
| 228 | ;; | 228 | ;; |
| 229 | ;; - init-revision (file) | 229 | ;; - init-revision (file) |
| @@ -264,7 +264,7 @@ | |||
| 264 | ;; should become the new revision number (not all backends do | 264 | ;; should become the new revision number (not all backends do |
| 265 | ;; anything with it). COMMENT is used as a check-in comment. The | 265 | ;; anything with it). COMMENT is used as a check-in comment. The |
| 266 | ;; implementation should pass the value of vc-checkin-switches to | 266 | ;; implementation should pass the value of vc-checkin-switches to |
| 267 | ;; the backend command. (Note: in older versions of VC, this | 267 | ;; the backend command. (Note: in older versions of VC, this |
| 268 | ;; command took a single file argument and not a list.) | 268 | ;; command took a single file argument and not a list.) |
| 269 | ;; | 269 | ;; |
| 270 | ;; * find-revision (file rev buffer) | 270 | ;; * find-revision (file rev buffer) |
| @@ -374,18 +374,11 @@ | |||
| 374 | ;; differences found), or 1 (either non-empty diff or the diff is | 374 | ;; differences found), or 1 (either non-empty diff or the diff is |
| 375 | ;; run asynchronously). | 375 | ;; run asynchronously). |
| 376 | ;; | 376 | ;; |
| 377 | ;; - revision-completion-table (file) | 377 | ;; - revision-completion-table (files) |
| 378 | ;; | 378 | ;; |
| 379 | ;; Return a completion table for existing revisions of FILE. | 379 | ;; Return a completion table for existing revisions of FILES. |
| 380 | ;; The default is to not use any completion table. | 380 | ;; The default is to not use any completion table. |
| 381 | ;; | 381 | ;; |
| 382 | ;; - diff-tree (dir &optional rev1 rev2) | ||
| 383 | ;; | ||
| 384 | ;; Insert the diff for all files at and below DIR into the *vc-diff* | ||
| 385 | ;; buffer. The meaning of REV1 and REV2 is the same as for | ||
| 386 | ;; vc-BACKEND-diff. The default implementation does an explicit tree | ||
| 387 | ;; walk, calling vc-BACKEND-diff for each individual file. | ||
| 388 | ;; | ||
| 389 | ;; - annotate-command (file buf &optional rev) | 382 | ;; - annotate-command (file buf &optional rev) |
| 390 | ;; | 383 | ;; |
| 391 | ;; If this function is provided, it should produce an annotated display | 384 | ;; If this function is provided, it should produce an annotated display |
| @@ -620,7 +613,7 @@ These are passed to the checkin program by \\[vc-register]." | |||
| 620 | :group 'vc | 613 | :group 'vc |
| 621 | :version "20.3") | 614 | :version "20.3") |
| 622 | 615 | ||
| 623 | (defcustom vc-directory-exclusion-list '("SCCS" "RCS" "CVS" "MCVS" ".svn" | 616 | (defcustom vc-directory-exclusion-list '("SCCS" "RCS" "CVS" "MCVS" ".svn" |
| 624 | ".git" ".hg" ".bzr" "{arch}") | 617 | ".git" ".hg" ".bzr" "{arch}") |
| 625 | "List of directory names to be ignored when walking directory trees." | 618 | "List of directory names to be ignored when walking directory trees." |
| 626 | :type '(repeat string) | 619 | :type '(repeat string) |
| @@ -859,12 +852,11 @@ been updated to their corresponding values." | |||
| 859 | `(let ((vc-touched-properties (list t))) | 852 | `(let ((vc-touched-properties (list t))) |
| 860 | ,form | 853 | ,form |
| 861 | (dolist (file ,files) | 854 | (dolist (file ,files) |
| 862 | (mapc (lambda (setting) | 855 | (dolist (setting ,settings) |
| 863 | (let ((property (car setting))) | 856 | (let ((property (car setting))) |
| 864 | (unless (memq property vc-touched-properties) | 857 | (unless (memq property vc-touched-properties) |
| 865 | (put (intern file vc-file-prop-obarray) | 858 | (put (intern file vc-file-prop-obarray) |
| 866 | property (cdr setting))))) | 859 | property (cdr setting)))))))) |
| 867 | ,settings)))) | ||
| 868 | 860 | ||
| 869 | ;; Two macros for elisp programming | 861 | ;; Two macros for elisp programming |
| 870 | 862 | ||
| @@ -874,7 +866,7 @@ been updated to their corresponding values." | |||
| 874 | Check in FILE with COMMENT (a string) after BODY has been executed. | 866 | Check in FILE with COMMENT (a string) after BODY has been executed. |
| 875 | FILE is passed through `expand-file-name'; BODY executed within | 867 | FILE is passed through `expand-file-name'; BODY executed within |
| 876 | `save-excursion'. If FILE is not under version control, or you are | 868 | `save-excursion'. If FILE is not under version control, or you are |
| 877 | using a locking version-control system and the file is locked by | 869 | using a locking version-control system and the file is locked by |
| 878 | somebody else, signal error." | 870 | somebody else, signal error." |
| 879 | (declare (debug t) (indent 2)) | 871 | (declare (debug t) (indent 2)) |
| 880 | (let ((filevar (make-symbol "file"))) | 872 | (let ((filevar (make-symbol "file"))) |
| @@ -1010,7 +1002,7 @@ considered successful if its exit status does not exceed OKSTATUS (if | |||
| 1010 | OKSTATUS is nil, that means to ignore error status, if it is `async', that | 1002 | OKSTATUS is nil, that means to ignore error status, if it is `async', that |
| 1011 | means not to wait for termination of the subprocess; if it is t it means to | 1003 | means not to wait for termination of the subprocess; if it is t it means to |
| 1012 | ignore all execution errors). FILE-OR-LIST is the name of a working file; | 1004 | ignore all execution errors). FILE-OR-LIST is the name of a working file; |
| 1013 | it may be a list of files or be nil (to execute commands that don't expect | 1005 | it may be a list of files or be nil (to execute commands that don't expect |
| 1014 | a file name or set of files). If an optional list of FLAGS is present, | 1006 | a file name or set of files). If an optional list of FLAGS is present, |
| 1015 | that is inserted into the command line before the filename." | 1007 | that is inserted into the command line before the filename." |
| 1016 | ;; FIXME: file-relative-name can return a bogus result because | 1008 | ;; FIXME: file-relative-name can return a bogus result because |
| @@ -1020,15 +1012,15 @@ that is inserted into the command line before the filename." | |||
| 1020 | (mapcar (lambda (f) (file-relative-name (expand-file-name f))) | 1012 | (mapcar (lambda (f) (file-relative-name (expand-file-name f))) |
| 1021 | (if (listp file-or-list) file-or-list (list file-or-list)))) | 1013 | (if (listp file-or-list) file-or-list (list file-or-list)))) |
| 1022 | (full-command | 1014 | (full-command |
| 1023 | ;; What we're doing here is preparing a version of the command | 1015 | ;; What we're doing here is preparing a version of the command |
| 1024 | ;; for display in a debug-progess message. If it's fewer than | 1016 | ;; for display in a debug-progess message. If it's fewer than |
| 1025 | ;; 20 characters display the entire command (without trailing | 1017 | ;; 20 characters display the entire command (without trailing |
| 1026 | ;; newline). Otherwise display the first 20 followed by an ellipsis. | 1018 | ;; newline). Otherwise display the first 20 followed by an ellipsis. |
| 1027 | (concat (if (string= (substring command -1) "\n") | 1019 | (concat (if (string= (substring command -1) "\n") |
| 1028 | (substring command 0 -1) | 1020 | (substring command 0 -1) |
| 1029 | command) | 1021 | command) |
| 1030 | " " | 1022 | " " |
| 1031 | (vc-delistify (mapcar (lambda (s) (if (> (length s) 20) (concat (substring s 0 2) "...") s)) flags)) | 1023 | (vc-delistify (mapcar (lambda (s) (if (> (length s) 20) (concat (substring s 0 2) "...") s)) flags)) |
| 1032 | " " (vc-delistify files)))) | 1024 | " " (vc-delistify files)))) |
| 1033 | (save-current-buffer | 1025 | (save-current-buffer |
| 1034 | (unless (or (eq buffer t) | 1026 | (unless (or (eq buffer t) |
| @@ -1082,7 +1074,7 @@ that is inserted into the command line before the filename." | |||
| 1082 | (if vc-command-messages | 1074 | (if vc-command-messages |
| 1083 | (message "Running %s...OK = %d" full-command status))) | 1075 | (message "Running %s...OK = %d" full-command status))) |
| 1084 | (vc-exec-after | 1076 | (vc-exec-after |
| 1085 | `(run-hook-with-args 'vc-post-command-functions | 1077 | `(run-hook-with-args 'vc-post-command-functions |
| 1086 | ',command ',file-or-list ',flags)) | 1078 | ',command ',file-or-list ',flags)) |
| 1087 | status)))) | 1079 | status)))) |
| 1088 | 1080 | ||
| @@ -1168,7 +1160,8 @@ Used by `vc-restore-buffer-context' to later restore the context." | |||
| 1168 | CONTEXT is that which `vc-buffer-context' returns." | 1160 | CONTEXT is that which `vc-buffer-context' returns." |
| 1169 | (let ((point-context (nth 0 context)) | 1161 | (let ((point-context (nth 0 context)) |
| 1170 | (mark-context (nth 1 context)) | 1162 | (mark-context (nth 1 context)) |
| 1171 | (reparse (nth 2 context))) | 1163 | ;; (reparse (nth 2 context)) |
| 1164 | ) | ||
| 1172 | ;; The new compilation code does not use compilation-error-list any | 1165 | ;; The new compilation code does not use compilation-error-list any |
| 1173 | ;; more, so the code below is now ineffective and might as well | 1166 | ;; more, so the code below is now ineffective and might as well |
| 1174 | ;; be disabled. -- Stef | 1167 | ;; be disabled. -- Stef |
| @@ -1251,29 +1244,23 @@ Only files already under version control are noticed." | |||
| 1251 | (nreverse flattened))) | 1244 | (nreverse flattened))) |
| 1252 | 1245 | ||
| 1253 | (defun vc-deduce-fileset (&optional allow-directory-wildcard) | 1246 | (defun vc-deduce-fileset (&optional allow-directory-wildcard) |
| 1254 | "Deduce a set of files and a backend to apply an operation to. | 1247 | "Deduce a set of files and a backend to which to apply an operation. |
| 1255 | 1248 | ||
| 1256 | If we're in VC-dired-mode, the fileset is the list of marked | 1249 | If we're in VC-dired mode, the fileset is the list of marked files. |
| 1257 | files. Otherwise, if we're looking at a buffer visiting a | 1250 | Otherwise, if we're looking at a buffer visiting a version-controlled file, |
| 1258 | version-controlled file. the fileset is a singleton containing | 1251 | the fileset is a singleton containing this file. |
| 1259 | the relative filename, throw an error. | 1252 | If neither of these things is true, but ALLOW-DIRECTORY-WILDCARD is on |
| 1260 | 1253 | and we're in a dired buffer, select the current directory. | |
| 1261 | If neither of these things is true, but allow-directory-wildcard is on, | 1254 | Otherwise, throw an error." |
| 1262 | select all files under version control at and below the current | 1255 | (cond (vc-dired-mode |
| 1263 | directory. | 1256 | (let ((marked (dired-map-over-marks (dired-get-filename) nil))) |
| 1264 | |||
| 1265 | Otherwise, throw an error. | ||
| 1266 | " | ||
| 1267 | (cond (vc-dired-mode | ||
| 1268 | (let ((regexp (dired-marker-regexp)) | ||
| 1269 | (marked (dired-map-over-marks (dired-get-filename) nil))) | ||
| 1270 | (unless marked | 1257 | (unless marked |
| 1271 | (error "No files have been selected.")) | 1258 | (error "No files have been selected.")) |
| 1272 | ;; All members of the fileset must have the same backend | 1259 | ;; All members of the fileset must have the same backend |
| 1273 | (let ((firstbackend (vc-backend (car marked)))) | 1260 | (let ((firstbackend (vc-backend (car marked)))) |
| 1274 | (mapc (lambda (f) (unless (eq (vc-backend f) firstbackend) | 1261 | (dolist (f (cdr marked)) |
| 1275 | (error "All members of a fileset must be under the same version-control system."))) | 1262 | (unless (eq (vc-backend f) firstbackend) |
| 1276 | (cdr marked))) | 1263 | (error "All members of a fileset must be under the same version-control system.")))) |
| 1277 | marked)) | 1264 | marked)) |
| 1278 | ((vc-backend buffer-file-name) | 1265 | ((vc-backend buffer-file-name) |
| 1279 | (list buffer-file-name)) | 1266 | (list buffer-file-name)) |
| @@ -1281,12 +1268,17 @@ Otherwise, throw an error. | |||
| 1281 | (progn | 1268 | (progn |
| 1282 | (set-buffer vc-parent-buffer) | 1269 | (set-buffer vc-parent-buffer) |
| 1283 | (vc-deduce-fileset))) | 1270 | (vc-deduce-fileset))) |
| 1284 | ;; This is guarded by an enabling arg so users won't potentially | 1271 | ;; This is guarded by an enabling arg so users won't potentially |
| 1285 | ;; shoot themselves in the foot by modifying a fileset they can't | 1272 | ;; shoot themselves in the foot by modifying a fileset they can't |
| 1286 | ;; verify by eyeball. Allow it for nondestructive commands like | 1273 | ;; verify by eyeball. Allow it for nondestructive commands like |
| 1287 | ;; making diffs, or possibly for destructive ones that have | 1274 | ;; making diffs, or possibly for destructive ones that have |
| 1288 | ;; confirmation prompts. | 1275 | ;; confirmation prompts. |
| 1289 | (allow-directory-wildcard | 1276 | ((and allow-directory-wildcard |
| 1277 | ;; I think this is a misfeature. For now, I'll leave it in, but | ||
| 1278 | ;; I'll disable it anywhere else than in dired buffers. --Stef | ||
| 1279 | (and (derived-mode-p 'dired-mode) | ||
| 1280 | (equal buffer-file-name nil) | ||
| 1281 | (equal list-buffers-directory default-directory))) | ||
| 1290 | (progn | 1282 | (progn |
| 1291 | (message "All version-controlled files below %s selected." | 1283 | (message "All version-controlled files below %s selected." |
| 1292 | default-directory) | 1284 | default-directory) |
| @@ -1377,7 +1369,6 @@ with the logmessage as change commentary. A writable file is retained. | |||
| 1377 | merge in the changes into your working copy." | 1369 | merge in the changes into your working copy." |
| 1378 | (interactive "P") | 1370 | (interactive "P") |
| 1379 | (let* ((files (vc-deduce-fileset)) | 1371 | (let* ((files (vc-deduce-fileset)) |
| 1380 | (backend (vc-backend (car files))) | ||
| 1381 | (state (vc-state (car files))) | 1372 | (state (vc-state (car files))) |
| 1382 | (model (vc-checkout-model (car files))) | 1373 | (model (vc-checkout-model (car files))) |
| 1383 | revision) | 1374 | revision) |
| @@ -1411,7 +1402,7 @@ merge in the changes into your working copy." | |||
| 1411 | (or (y-or-n-p (message "Use %s on disk, keeping modified buffer? " file)) | 1402 | (or (y-or-n-p (message "Use %s on disk, keeping modified buffer? " file)) |
| 1412 | (error "Aborted"))))))) | 1403 | (error "Aborted"))))))) |
| 1413 | ;; Do the right thing | 1404 | ;; Do the right thing |
| 1414 | (cond | 1405 | (cond |
| 1415 | ;; Files aren't registered | 1406 | ;; Files aren't registered |
| 1416 | ((not state) | 1407 | ((not state) |
| 1417 | (mapc 'vc-register files)) | 1408 | (mapc 'vc-register files)) |
| @@ -1423,16 +1414,16 @@ merge in the changes into your working copy." | |||
| 1423 | (setq revision (read-string "Branch, revision, or backend to move to: ")) | 1414 | (setq revision (read-string "Branch, revision, or backend to move to: ")) |
| 1424 | (let ((vsym (intern-soft (upcase revision)))) | 1415 | (let ((vsym (intern-soft (upcase revision)))) |
| 1425 | (if (member vsym vc-handled-backends) | 1416 | (if (member vsym vc-handled-backends) |
| 1426 | (mapc (lambda (file) (vc-transfer-file file vsym)) files) | 1417 | (dolist (file files) (vc-transfer-file file vsym)) |
| 1427 | (mapc (lambda (file) | 1418 | (dolist (file files) |
| 1428 | (vc-checkout file (eq model 'implicit) revision)))))) | 1419 | (vc-checkout file (eq model 'implicit) revision))))) |
| 1429 | ((not (eq model 'implicit)) | 1420 | ((not (eq model 'implicit)) |
| 1430 | ;; check the files out | 1421 | ;; check the files out |
| 1431 | (mapc (lambda (file) (vc-checkout file t)) files)) | 1422 | (dolist (file files) (vc-checkout file t))) |
| 1432 | (t | 1423 | (t |
| 1433 | ;; do nothing | 1424 | ;; do nothing |
| 1434 | (message "Fileset is up-to-date")))) | 1425 | (message "Fileset is up-to-date")))) |
| 1435 | ;; Files have local changes | 1426 | ;; Files have local changes |
| 1436 | ((eq state 'edited) | 1427 | ((eq state 'edited) |
| 1437 | (let ((ready-for-commit files)) | 1428 | (let ((ready-for-commit files)) |
| 1438 | ;; If files are edited but read-only, give user a chance to correct | 1429 | ;; If files are edited but read-only, give user a chance to correct |
| @@ -1444,27 +1435,25 @@ merge in the changes into your working copy." | |||
| 1444 | (error "Aborted")) | 1435 | (error "Aborted")) |
| 1445 | (set-file-modes file (logior (file-modes file) 128)) | 1436 | (set-file-modes file (logior (file-modes file) 128)) |
| 1446 | (let ((visited (get-file-buffer file))) | 1437 | (let ((visited (get-file-buffer file))) |
| 1447 | (if visited | 1438 | (if visited |
| 1448 | (save-excursion | 1439 | (with-current-buffer visited |
| 1449 | (set-buffer visited) | ||
| 1450 | (toggle-read-only -1))))))) | 1440 | (toggle-read-only -1))))))) |
| 1451 | ;; Allow user to revert files with no changes | 1441 | ;; Allow user to revert files with no changes |
| 1452 | (save-excursion | 1442 | (save-excursion |
| 1453 | (let ((revertlist '())) | 1443 | (dolist (file files) |
| 1454 | (dolist (file files) | 1444 | (let ((visited (get-file-buffer file))) |
| 1455 | (let ((visited (get-file-buffer file))) | 1445 | ;; For files with locking, if the file does not contain |
| 1456 | ;; For files with locking, if the file does not contain | 1446 | ;; any changes, just let go of the lock, i.e. revert. |
| 1457 | ;; any changes, just let go of the lock, i.e. revert. | 1447 | (if (and (not (eq model 'implicit)) |
| 1458 | (if (and (not (eq model 'implicit)) | 1448 | (vc-workfile-unchanged-p file) |
| 1459 | (vc-workfile-unchanged-p file) | 1449 | ;; If buffer is modified, that means the user just |
| 1460 | ;; If buffer is modified, that means the user just | 1450 | ;; said no to saving it; in that case, don't revert, |
| 1461 | ;; said no to saving it; in that case, don't revert, | 1451 | ;; because the user might intend to save after |
| 1462 | ;; because the user might intend to save after | 1452 | ;; finishing the log entry and committing. |
| 1463 | ;; finishing the log entry and committing. | 1453 | (not (and visited (buffer-modified-p)))) |
| 1464 | (not (and visited (buffer-modified-p)))) | 1454 | (progn |
| 1465 | (progn | 1455 | (vc-revert-file file) |
| 1466 | (vc-revert-file file) | 1456 | (delete file ready-for-commit)))))) |
| 1467 | (delete file ready-for-commit))))))) | ||
| 1468 | ;; Remaining files need to be committed | 1457 | ;; Remaining files need to be committed |
| 1469 | (if (not ready-for-commit) | 1458 | (if (not ready-for-commit) |
| 1470 | (message "No files remain to be committed") | 1459 | (message "No files remain to be committed") |
| @@ -1478,12 +1467,12 @@ merge in the changes into your working copy." | |||
| 1478 | (vc-checkin ready-for-commit revision)))))))) | 1467 | (vc-checkin ready-for-commit revision)))))))) |
| 1479 | ;; locked by somebody else (locking VCSes only) | 1468 | ;; locked by somebody else (locking VCSes only) |
| 1480 | ((stringp state) | 1469 | ((stringp state) |
| 1481 | (let ((revision | 1470 | (let ((revision |
| 1482 | (if verbose | 1471 | (if verbose |
| 1483 | (read-string "Revision to steal: ") | 1472 | (read-string "Revision to steal: ") |
| 1484 | (vc-working-revision file)))) | 1473 | (vc-working-revision file)))) |
| 1485 | (mapc (lambda (file) (vc-steal-lock file revision state) files)))) | 1474 | (dolist (file files) (vc-steal-lock file revision state)))) |
| 1486 | ;; needs-patch | 1475 | ;; needs-patch |
| 1487 | ((eq state 'needs-patch) | 1476 | ((eq state 'needs-patch) |
| 1488 | (dolist (file files) | 1477 | (dolist (file files) |
| 1489 | (if (yes-or-no-p (format | 1478 | (if (yes-or-no-p (format |
| @@ -1504,12 +1493,10 @@ merge in the changes into your working copy." | |||
| 1504 | ;; unlocked-changes | 1493 | ;; unlocked-changes |
| 1505 | ((eq state 'unlocked-changes) | 1494 | ((eq state 'unlocked-changes) |
| 1506 | (dolist (file files) | 1495 | (dolist (file files) |
| 1507 | (if (not (equal buffer-file-name file)) | 1496 | (if (not (equal buffer-file-name file)) |
| 1508 | (find-file-other-window file)) | 1497 | (find-file-other-window file)) |
| 1509 | (if (save-window-excursion | 1498 | (if (save-window-excursion |
| 1510 | (vc-diff-internal | 1499 | (vc-diff-internal nil (list file) (vc-working-revision file) nil) |
| 1511 | (vc-backend file) nil (list file) | ||
| 1512 | (vc-working-revision file) nil) | ||
| 1513 | (goto-char (point-min)) | 1500 | (goto-char (point-min)) |
| 1514 | (let ((inhibit-read-only t)) | 1501 | (let ((inhibit-read-only t)) |
| 1515 | (insert | 1502 | (insert |
| @@ -1644,9 +1631,9 @@ entered COMMENT. If COMMENT is t, also do action immediately with an | |||
| 1644 | empty comment. Remember the file's buffer in `vc-parent-buffer' | 1631 | empty comment. Remember the file's buffer in `vc-parent-buffer' |
| 1645 | \(current one if no file). AFTER-HOOK specifies the local value | 1632 | \(current one if no file). AFTER-HOOK specifies the local value |
| 1646 | for vc-log-operation-hook." | 1633 | for vc-log-operation-hook." |
| 1647 | (let ((parent | 1634 | (let ((parent |
| 1648 | (if (and files (equal (length files) 1)) | 1635 | (if (and files (equal (length files) 1)) |
| 1649 | (get-file-buffer (car files)) | 1636 | (get-file-buffer (car files)) |
| 1650 | (current-buffer)))) | 1637 | (current-buffer)))) |
| 1651 | (if vc-before-checkin-hook | 1638 | (if vc-before-checkin-hook |
| 1652 | (if files | 1639 | (if files |
| @@ -1774,7 +1761,7 @@ the buffer contents as a comment." | |||
| 1774 | ;; Check and record the comment, if any. | 1761 | ;; Check and record the comment, if any. |
| 1775 | (unless nocomment | 1762 | (unless nocomment |
| 1776 | ;; Comment too long? | 1763 | ;; Comment too long? |
| 1777 | (vc-call-backend (or (and vc-log-fileset (vc-backend (car vc-log-fileset))) | 1764 | (vc-call-backend (or (if vc-log-fileset (vc-backend vc-log-fileset)) |
| 1778 | (vc-responsible-backend default-directory)) | 1765 | (vc-responsible-backend default-directory)) |
| 1779 | 'logentry-check) | 1766 | 'logentry-check) |
| 1780 | (run-hooks 'vc-logentry-check-hook)) | 1767 | (run-hooks 'vc-logentry-check-hook)) |
| @@ -1810,8 +1797,8 @@ the buffer contents as a comment." | |||
| 1810 | (pop-to-buffer tmp-vc-parent-buffer)))) | 1797 | (pop-to-buffer tmp-vc-parent-buffer)))) |
| 1811 | ;; Now make sure we see the expanded headers | 1798 | ;; Now make sure we see the expanded headers |
| 1812 | (if log-fileset | 1799 | (if log-fileset |
| 1813 | (mapc | 1800 | (mapc |
| 1814 | (lambda (file) (vc-resynch-buffer file vc-keep-workfiles t)) | 1801 | (lambda (file) (vc-resynch-buffer file vc-keep-workfiles t)) |
| 1815 | log-fileset)) | 1802 | log-fileset)) |
| 1816 | (if vc-dired-mode | 1803 | (if vc-dired-mode |
| 1817 | (dired-move-to-filename)) | 1804 | (dired-move-to-filename)) |
| @@ -1819,24 +1806,24 @@ the buffer contents as a comment." | |||
| 1819 | 1806 | ||
| 1820 | ;;; Additional entry points for examining version histories | 1807 | ;;; Additional entry points for examining version histories |
| 1821 | 1808 | ||
| 1822 | (defun vc-default-diff-tree (backend dir rev1 rev2) | 1809 | ;; (defun vc-default-diff-tree (backend dir rev1 rev2) |
| 1823 | "List differences for all registered files at and below DIR. | 1810 | ;; "List differences for all registered files at and below DIR. |
| 1824 | The meaning of REV1 and REV2 is the same as for `vc-revision-diff'." | 1811 | ;; The meaning of REV1 and REV2 is the same as for `vc-revision-diff'." |
| 1825 | ;; This implementation does an explicit tree walk, and calls | 1812 | ;; ;; This implementation does an explicit tree walk, and calls |
| 1826 | ;; vc-BACKEND-diff directly for each file. An optimization | 1813 | ;; ;; vc-BACKEND-diff directly for each file. An optimization |
| 1827 | ;; would be to use `vc-diff-internal', so that diffs can be local, | 1814 | ;; ;; would be to use `vc-diff-internal', so that diffs can be local, |
| 1828 | ;; and to call it only for files that are actually changed. | 1815 | ;; ;; and to call it only for files that are actually changed. |
| 1829 | ;; However, this is expensive for some backends, and so it is left | 1816 | ;; ;; However, this is expensive for some backends, and so it is left |
| 1830 | ;; to backend-specific implementations. | 1817 | ;; ;; to backend-specific implementations. |
| 1831 | (setq default-directory dir) | 1818 | ;; (setq default-directory dir) |
| 1832 | (vc-file-tree-walk | 1819 | ;; (vc-file-tree-walk |
| 1833 | default-directory | 1820 | ;; default-directory |
| 1834 | (lambda (f) | 1821 | ;; (lambda (f) |
| 1835 | (vc-exec-after | 1822 | ;; (vc-exec-after |
| 1836 | `(let ((coding-system-for-read (vc-coding-system-for-diff ',f))) | 1823 | ;; `(let ((coding-system-for-read (vc-coding-system-for-diff ',f))) |
| 1837 | (message "Looking at %s" ',f) | 1824 | ;; (message "Looking at %s" ',f) |
| 1838 | (vc-call-backend ',(vc-backend f) | 1825 | ;; (vc-call-backend ',(vc-backend f) |
| 1839 | 'diff (list ',f) ',rev1 ',rev2)))))) | 1826 | ;; 'diff (list ',f) ',rev1 ',rev2)))))) |
| 1840 | 1827 | ||
| 1841 | (defun vc-coding-system-for-diff (file) | 1828 | (defun vc-coding-system-for-diff (file) |
| 1842 | "Return the coding system for reading diff output for FILE." | 1829 | "Return the coding system for reading diff output for FILE." |
| @@ -1885,7 +1872,10 @@ The meaning of REV1 and REV2 is the same as for `vc-revision-diff'." | |||
| 1885 | (goto-char (point-min)) | 1872 | (goto-char (point-min)) |
| 1886 | (shrink-window-if-larger-than-buffer)) | 1873 | (shrink-window-if-larger-than-buffer)) |
| 1887 | 1874 | ||
| 1888 | (defun vc-diff-internal (backend async files rev1 rev2 &optional verbose) | 1875 | (defvar vc-diff-added-files nil |
| 1876 | "If non-nil, diff added files by comparing them to /dev/null.") | ||
| 1877 | |||
| 1878 | (defun vc-diff-internal (async files rev1 rev2 &optional verbose) | ||
| 1889 | "Report diffs between two revisions of a fileset. | 1879 | "Report diffs between two revisions of a fileset. |
| 1890 | Diff output goes to the *vc-diff* buffer. The function | 1880 | Diff output goes to the *vc-diff* buffer. The function |
| 1891 | returns t if the buffer had changes, nil otherwise." | 1881 | returns t if the buffer had changes, nil otherwise." |
| @@ -1895,30 +1885,38 @@ returns t if the buffer had changes, nil otherwise." | |||
| 1895 | ;; Set coding system based on the first file. It's a kluge, | 1885 | ;; Set coding system based on the first file. It's a kluge, |
| 1896 | ;; but the only way to set it for each file included would | 1886 | ;; but the only way to set it for each file included would |
| 1897 | ;; be to call the back end separately for each file. | 1887 | ;; be to call the back end separately for each file. |
| 1898 | (coding-system-for-read | 1888 | (coding-system-for-read |
| 1899 | (if files (vc-coding-system-for-diff (car files)) 'undecided))) | 1889 | (if files (vc-coding-system-for-diff (car files)) 'undecided))) |
| 1900 | (vc-setup-buffer "*vc-diff*") | 1890 | (vc-setup-buffer "*vc-diff*") |
| 1901 | (message "Finding changes in %s..." filenames) | 1891 | (message "Finding changes in %s..." filenames) |
| 1902 | ;; Many backends don't handle well the case of a file that has been | 1892 | ;; Many backends don't handle well the case of a file that has been |
| 1903 | ;; added but not yet committed to the repo (notably CVS and Subversion). | 1893 | ;; added but not yet committed to the repo (notably CVS and Subversion). |
| 1904 | ;; Do that work here so the backends don't have to futz with it. | 1894 | ;; Do that work here so the backends don't have to futz with it. --ESR |
| 1905 | (let ((filtered '())) | 1895 | ;; |
| 1906 | (dolist (file files) | 1896 | ;; Actually most backends (including CVS) have options to control the |
| 1907 | (cond ((and (not (file-directory-p file)) (string= (vc-working-revision file) "0")) | 1897 | ;; behavior since which one is better depends on the user and on the |
| 1908 | (progn | 1898 | ;; situation). Worse yet: this code does not handle the case where |
| 1909 | ;; This file is added but not yet committed; | 1899 | ;; `file' is a directory which contains added files. |
| 1910 | ;; there is no master file to diff against. | 1900 | ;; I made it conditional on vc-diff-added-files but it should probably |
| 1911 | (if (or rev1 rev2) | 1901 | ;; just be removed (or copied/moved to specific backends). --Stef. |
| 1912 | (error "No revisions of %s exist" file) | 1902 | (when vc-diff-added-files |
| 1913 | ;; We regard this as "changed". | 1903 | (let ((filtered '())) |
| 1914 | ;; Diff it against /dev/null. | 1904 | (dolist (file files) |
| 1915 | (apply 'vc-do-command "*vc-diff*" | 1905 | (if (or (file-directory-p file) |
| 1916 | 1 "diff" file | 1906 | (not (string= (vc-working-revision file) "0"))) |
| 1917 | (append (vc-switches nil 'diff) '("/dev/null")))))) | 1907 | (push file filtered) |
| 1918 | (t | 1908 | ;; This file is added but not yet committed; |
| 1919 | (add-to-list 'filtered file t)))) | 1909 | ;; there is no master file to diff against. |
| 1920 | (let ((vc-disable-async-diff (not async))) | 1910 | (if (or rev1 rev2) |
| 1921 | (vc-call-backend backend 'diff filtered rev1 rev2 "*vc-diff*"))) | 1911 | (error "No revisions of %s exist" file) |
| 1912 | ;; We regard this as "changed". | ||
| 1913 | ;; Diff it against /dev/null. | ||
| 1914 | (apply 'vc-do-command "*vc-diff*" | ||
| 1915 | 1 "diff" file | ||
| 1916 | (append (vc-switches nil 'diff) '("/dev/null")))))) | ||
| 1917 | (setq files (nreverse filtered)))) | ||
| 1918 | (let ((vc-disable-async-diff (not async))) | ||
| 1919 | (vc-call diff files rev1 rev2 "*vc-diff*")) | ||
| 1922 | (set-buffer "*vc-diff*") | 1920 | (set-buffer "*vc-diff*") |
| 1923 | (if (and (zerop (buffer-size)) | 1921 | (if (and (zerop (buffer-size)) |
| 1924 | (not (get-buffer-process (current-buffer)))) | 1922 | (not (get-buffer-process (current-buffer)))) |
| @@ -1936,14 +1934,13 @@ returns t if the buffer had changes, nil otherwise." | |||
| 1936 | t))) | 1934 | t))) |
| 1937 | 1935 | ||
| 1938 | ;;;###autoload | 1936 | ;;;###autoload |
| 1939 | (defun vc-history-diff (backend files rev1 rev2) | 1937 | (defun vc-version-diff (files rev1 rev2) |
| 1940 | "Report diffs between revisions of the fileset in the repository history." | 1938 | "Report diffs between revisions of the fileset in the repository history." |
| 1941 | (interactive | 1939 | (interactive |
| 1942 | (let* ((files (vc-deduce-fileset t)) | 1940 | (let* ((files (vc-deduce-fileset t)) |
| 1943 | (first (car files)) | 1941 | (first (car files)) |
| 1944 | (backend (vc-backend first)) | ||
| 1945 | (completion-table | 1942 | (completion-table |
| 1946 | (vc-call-backend backend 'revision-completion-table first)) | 1943 | (vc-call revision-completion-table files)) |
| 1947 | (rev1-default nil) | 1944 | (rev1-default nil) |
| 1948 | (rev2-default nil)) | 1945 | (rev2-default nil)) |
| 1949 | (cond | 1946 | (cond |
| @@ -1980,47 +1977,37 @@ returns t if the buffer had changes, nil otherwise." | |||
| 1980 | (read-string rev2-prompt nil nil rev2-default)))) | 1977 | (read-string rev2-prompt nil nil rev2-default)))) |
| 1981 | (if (string= rev1 "") (setq rev1 nil)) | 1978 | (if (string= rev1 "") (setq rev1 nil)) |
| 1982 | (if (string= rev2 "") (setq rev2 nil)) | 1979 | (if (string= rev2 "") (setq rev2 nil)) |
| 1983 | (list backend files rev1 rev2)))) | 1980 | (list files rev1 rev2)))) |
| 1984 | (if (and (not rev1) rev2) | 1981 | (if (and (not rev1) rev2) |
| 1985 | (error "Not a valid revision range.")) | 1982 | (error "Not a valid revision range.")) |
| 1986 | (vc-diff-internal backend t files rev1 rev2 (interactive-p))) | 1983 | (vc-diff-internal t files rev1 rev2 (interactive-p))) |
| 1987 | 1984 | ||
| 1988 | (defun vc-contains-version-controlled-file (dir) | 1985 | ;; (defun vc-contains-version-controlled-file (dir) |
| 1989 | "Return t if DIR contains a version-controlled file, nil otherwise." | 1986 | ;; "Return t if DIR contains a version-controlled file, nil otherwise." |
| 1990 | (catch 'found | 1987 | ;; (catch 'found |
| 1991 | (mapc (lambda (f) (and (not (file-directory-p f)) (vc-backend f) (throw 'found 't))) (directory-files dir)) | 1988 | ;; (mapc (lambda (f) (and (not (file-directory-p f)) (vc-backend f) (throw 'found 't))) (directory-files dir)) |
| 1992 | nil)) | 1989 | ;; nil)) |
| 1993 | 1990 | ||
| 1994 | ;;;###autoload | 1991 | ;;;###autoload |
| 1995 | (defun vc-diff (historic) | 1992 | (defun vc-diff (historic &optional not-urgent) |
| 1996 | "Display diffs between file revisions. | 1993 | "Display diffs between file revisions. |
| 1997 | Normally this compares the currently selected fileset with their | 1994 | Normally this compares the currently selected fileset with their |
| 1998 | working revisions. With a prefix argument HISTORIC, it reads two revision | 1995 | working revisions. With a prefix argument HISTORIC, it reads two revision |
| 1999 | designators specifying which revisions to compare. | 1996 | designators specifying which revisions to compare. |
| 2000 | 1997 | ||
| 2001 | If no current fileset is available (that is, we are not in | 1998 | If no current fileset is available (that is, we are not in |
| 2002 | VC-Dired mode and the visited file of the current buffer is not | 1999 | VC-Dired mode and the visited file of the current buffer is not |
| 2003 | under version control) behave specially; if there are | 2000 | under version control) and we're in a Dired buffer, use |
| 2004 | version-controlled files in the current directory, treat all | 2001 | the current directory. |
| 2005 | version-controlled files recursively beneath the current | 2002 | The optional argument NOT-URGENT non-nil means it is ok to say no to |
| 2006 | directory as the selected fileset. | 2003 | saving the buffer." |
| 2007 | " | 2004 | (interactive (list current-prefix-arg t)) |
| 2005 | (if historic | ||
| 2006 | (call-interactively 'vc-version-diff) | ||
| 2007 | (let* ((files (vc-deduce-fileset t))) | ||
| 2008 | (if buffer-file-name (vc-buffer-sync not-urgent)) | ||
| 2009 | (vc-diff-internal t files nil nil (interactive-p))))) | ||
| 2008 | 2010 | ||
| 2009 | (interactive "P") | ||
| 2010 | (cond | ||
| 2011 | ;;((not (vc-contains-version-controlled-file default-directory)) | ||
| 2012 | ;;(error "No version-controlled files directly beneath default directory")) | ||
| 2013 | (historic | ||
| 2014 | (call-interactively 'vc-history-diff)) | ||
| 2015 | (t | ||
| 2016 | (let* ((files (vc-deduce-fileset t)) | ||
| 2017 | (first (car files)) | ||
| 2018 | (backend | ||
| 2019 | (cond ((file-directory-p first) | ||
| 2020 | (vc-responsible-backend first)) | ||
| 2021 | (t | ||
| 2022 | (vc-backend first))))) | ||
| 2023 | (vc-diff-internal backend t files nil nil (interactive-p)))))) | ||
| 2024 | 2011 | ||
| 2025 | ;;;###autoload | 2012 | ;;;###autoload |
| 2026 | (defun vc-revision-other-window (rev) | 2013 | (defun vc-revision-other-window (rev) |
| @@ -2252,7 +2239,7 @@ There is a special command, `*l', to mark all files currently locked." | |||
| 2252 | (setq mode-name (concat mode-name backend-name)) | 2239 | (setq mode-name (concat mode-name backend-name)) |
| 2253 | ;; Add menu after `vc-dired-mode-map' has `dired-mode-map' as the parent. | 2240 | ;; Add menu after `vc-dired-mode-map' has `dired-mode-map' as the parent. |
| 2254 | (let ((vc-dire-menu-map (copy-keymap vc-menu-map))) | 2241 | (let ((vc-dire-menu-map (copy-keymap vc-menu-map))) |
| 2255 | (define-key-after (lookup-key vc-dired-mode-map [menu-bar]) [vc] | 2242 | (define-key-after (lookup-key vc-dired-mode-map [menu-bar]) [vc] |
| 2256 | (cons backend-name vc-dire-menu-map) 'subdir))) | 2243 | (cons backend-name vc-dire-menu-map) 'subdir))) |
| 2257 | (setq vc-dired-mode t)) | 2244 | (setq vc-dired-mode t)) |
| 2258 | 2245 | ||
| @@ -2377,12 +2364,11 @@ Called by dired after any portion of a vc-dired buffer has been read in." | |||
| 2377 | (let (result) | 2364 | (let (result) |
| 2378 | ;; Check whether dired is loaded. | 2365 | ;; Check whether dired is loaded. |
| 2379 | (when (fboundp 'dired-buffers-for-dir) | 2366 | (when (fboundp 'dired-buffers-for-dir) |
| 2380 | (mapc (lambda (buffer) | 2367 | (dolist (buffer (dired-buffers-for-dir dir)) |
| 2381 | (with-current-buffer buffer | 2368 | (with-current-buffer buffer |
| 2382 | (if vc-dired-mode | 2369 | (if vc-dired-mode |
| 2383 | (setq result (append result (list buffer)))))) | 2370 | (push buffer result))))) |
| 2384 | (dired-buffers-for-dir dir))) | 2371 | (nreverse result))) |
| 2385 | result)) | ||
| 2386 | 2372 | ||
| 2387 | (defun vc-dired-resynch-file (file) | 2373 | (defun vc-dired-resynch-file (file) |
| 2388 | "Update the entries for FILE in any VC Dired buffers that list it." | 2374 | "Update the entries for FILE in any VC Dired buffers that list it." |
| @@ -2484,7 +2470,7 @@ allowed and simply skipped)." | |||
| 2484 | If WORKING-REVISION is non-nil, leave the point at that revision." | 2470 | If WORKING-REVISION is non-nil, leave the point at that revision." |
| 2485 | (interactive) | 2471 | (interactive) |
| 2486 | (let* ((files (vc-deduce-fileset)) | 2472 | (let* ((files (vc-deduce-fileset)) |
| 2487 | (backend (vc-backend (car files))) | 2473 | (backend (vc-backend files)) |
| 2488 | (working-revision (or working-revision (vc-working-revision (car files))))) | 2474 | (working-revision (or working-revision (vc-working-revision (car files))))) |
| 2489 | ;; Don't switch to the output buffer before running the command, | 2475 | ;; Don't switch to the output buffer before running the command, |
| 2490 | ;; so that any buffer-local settings in the vc-controlled | 2476 | ;; so that any buffer-local settings in the vc-controlled |
| @@ -2513,8 +2499,7 @@ If WORKING-REVISION is non-nil, leave the point at that revision." | |||
| 2513 | This asks for confirmation if the buffer contents are not identical | 2499 | This asks for confirmation if the buffer contents are not identical |
| 2514 | to the working revision (except for keyword expansion)." | 2500 | to the working revision (except for keyword expansion)." |
| 2515 | (interactive) | 2501 | (interactive) |
| 2516 | (let* ((files (vc-deduce-fileset)) | 2502 | (let* ((files (vc-deduce-fileset))) |
| 2517 | (backend (vc-backend (car files)))) | ||
| 2518 | ;; If any of the files is visited by the current buffer, make | 2503 | ;; If any of the files is visited by the current buffer, make |
| 2519 | ;; sure buffer is saved. If the user says `no', abort since | 2504 | ;; sure buffer is saved. If the user says `no', abort since |
| 2520 | ;; we cannot show the changes and ask for confirmation to | 2505 | ;; we cannot show the changes and ask for confirmation to |
| @@ -2522,13 +2507,13 @@ to the working revision (except for keyword expansion)." | |||
| 2522 | (if (or (not files) (memq (buffer-file-name) files)) | 2507 | (if (or (not files) (memq (buffer-file-name) files)) |
| 2523 | (vc-buffer-sync nil)) | 2508 | (vc-buffer-sync nil)) |
| 2524 | (dolist (file files) | 2509 | (dolist (file files) |
| 2525 | (let (buf (get-file-buffer file)) | 2510 | (let ((buf (get-file-buffer file))) |
| 2526 | (if (and buf (buffer-modified-p buf)) | 2511 | (if (and buf (buffer-modified-p buf)) |
| 2527 | (error "Please kill or save all modified buffers before reverting."))) | 2512 | (error "Please kill or save all modified buffers before reverting."))) |
| 2528 | (if (vc-up-to-date-p file) | 2513 | (if (vc-up-to-date-p file) |
| 2529 | (unless (yes-or-no-p (format "%s seems up-to-date. Revert anyway? " file)) | 2514 | (unless (yes-or-no-p (format "%s seems up-to-date. Revert anyway? " file)) |
| 2530 | (error "Revert canceled")))) | 2515 | (error "Revert canceled")))) |
| 2531 | (if (vc-diff-internal backend vc-allow-async-revert files nil nil) | 2516 | (if (vc-diff-internal vc-allow-async-revert files nil nil) |
| 2532 | (progn | 2517 | (progn |
| 2533 | (unless (yes-or-no-p (format "Discard changes in %s? " (vc-delistify files))) | 2518 | (unless (yes-or-no-p (format "Discard changes in %s? " (vc-delistify files))) |
| 2534 | (error "Revert canceled")) | 2519 | (error "Revert canceled")) |
| @@ -2547,7 +2532,7 @@ This may be either a file-level or a repository-level operation, | |||
| 2547 | depending on the underlying version-control system." | 2532 | depending on the underlying version-control system." |
| 2548 | (interactive) | 2533 | (interactive) |
| 2549 | (let* ((files (vc-deduce-fileset)) | 2534 | (let* ((files (vc-deduce-fileset)) |
| 2550 | (backend (vc-backend (car files))) | 2535 | (backend (vc-backend files)) |
| 2551 | (granularity (vc-call-backend backend 'revision-granularity))) | 2536 | (granularity (vc-call-backend backend 'revision-granularity))) |
| 2552 | (unless (vc-find-backend-function backend 'rollback) | 2537 | (unless (vc-find-backend-function backend 'rollback) |
| 2553 | (error "Rollback is not supported in %s" backend)) | 2538 | (error "Rollback is not supported in %s" backend)) |
| @@ -2572,8 +2557,8 @@ depending on the underlying version-control system." | |||
| 2572 | (message "Finding changes...") | 2557 | (message "Finding changes...") |
| 2573 | (let* ((tip (vc-working-revision (car files))) | 2558 | (let* ((tip (vc-working-revision (car files))) |
| 2574 | (previous (vc-call previous-revision (car files) tip))) | 2559 | (previous (vc-call previous-revision (car files) tip))) |
| 2575 | (vc-diff-internal backend nil files previous tip)) | 2560 | (vc-diff-internal nil files previous tip)) |
| 2576 | ;; Display changes | 2561 | ;; Display changes |
| 2577 | (unless (yes-or-no-p "Discard these revisions? ") | 2562 | (unless (yes-or-no-p "Discard these revisions? ") |
| 2578 | (error "Rollback canceled")) | 2563 | (error "Rollback canceled")) |
| 2579 | (delete-windows-on "*vc-diff*") | 2564 | (delete-windows-on "*vc-diff*") |
| @@ -2586,7 +2571,7 @@ depending on the underlying version-control system." | |||
| 2586 | `((vc-state . ,'up-to-date) | 2571 | `((vc-state . ,'up-to-date) |
| 2587 | (vc-checkout-time . , (nth 5 (file-attributes file))) | 2572 | (vc-checkout-time . , (nth 5 (file-attributes file))) |
| 2588 | (vc-working-revision . nil))) | 2573 | (vc-working-revision . nil))) |
| 2589 | (mapc (lambda (f) (vc-resynch-buffer f t t)) files) | 2574 | (dolist (f files) (vc-resynch-buffer f t t)) |
| 2590 | (message "Rolling back %s...done" (vc-delistify files)))) | 2575 | (message "Rolling back %s...done" (vc-delistify files)))) |
| 2591 | 2576 | ||
| 2592 | ;;;###autoload | 2577 | ;;;###autoload |
| @@ -2595,9 +2580,9 @@ depending on the underlying version-control system." | |||
| 2595 | ;;;###autoload | 2580 | ;;;###autoload |
| 2596 | (defun vc-update () | 2581 | (defun vc-update () |
| 2597 | "Update the current fileset's files to their tip revisions. | 2582 | "Update the current fileset's files to their tip revisions. |
| 2598 | For each one that contains no changes, and is not locked, then this simply | 2583 | For each one that contains no changes, and is not locked, then this simply |
| 2599 | replaces the work file with the latest revision on its branch. If the file | 2584 | replaces the work file with the latest revision on its branch. If the file |
| 2600 | contains changes, and the backend supports merging news, then any recent | 2585 | contains changes, and the backend supports merging news, then any recent |
| 2601 | changes from the current branch are merged into the working file." | 2586 | changes from the current branch are merged into the working file." |
| 2602 | (interactive) | 2587 | (interactive) |
| 2603 | (dolist (file (vc-deduce-fileset)) | 2588 | (dolist (file (vc-deduce-fileset)) |
| @@ -2623,7 +2608,7 @@ changes from the current branch are merged into the working file." | |||
| 2623 | (defun vc-version-backup-file (file &optional rev) | 2608 | (defun vc-version-backup-file (file &optional rev) |
| 2624 | "Return name of backup file for revision REV of FILE. | 2609 | "Return name of backup file for revision REV of FILE. |
| 2625 | If version backups should be used for FILE, and there exists | 2610 | If version backups should be used for FILE, and there exists |
| 2626 | such a backup for REV or the working revision of file, return | 2611 | such a backup for REV or the working revision of file, return |
| 2627 | its name; otherwise return nil." | 2612 | its name; otherwise return nil." |
| 2628 | (when (vc-call make-version-backups-p file) | 2613 | (when (vc-call make-version-backups-p file) |
| 2629 | (let ((backup-file (vc-version-backup-file-name file rev))) | 2614 | (let ((backup-file (vc-version-backup-file-name file rev))) |
| @@ -3048,10 +3033,6 @@ to provide the `find-revision' operation instead." | |||
| 3048 | (vc-call-backend backend 'wash-log) | 3033 | (vc-call-backend backend 'wash-log) |
| 3049 | (buffer-string)))) | 3034 | (buffer-string)))) |
| 3050 | 3035 | ||
| 3051 | (defun vc-default-unregister (backend file) | ||
| 3052 | "Default implementation of `vc-unregister', signals an error." | ||
| 3053 | (error "Unregistering files is not supported for %s" backend)) | ||
| 3054 | |||
| 3055 | (defun vc-default-receive-file (backend file rev) | 3036 | (defun vc-default-receive-file (backend file rev) |
| 3056 | "Let BACKEND receive FILE from another version control system." | 3037 | "Let BACKEND receive FILE from another version control system." |
| 3057 | (vc-call-backend backend 'register file rev "")) | 3038 | (vc-call-backend backend 'register file rev "")) |
| @@ -3283,9 +3264,9 @@ age, and everything that is older than that is shown in blue. | |||
| 3283 | Customization variables: | 3264 | Customization variables: |
| 3284 | 3265 | ||
| 3285 | `vc-annotate-menu-elements' customizes the menu elements of the | 3266 | `vc-annotate-menu-elements' customizes the menu elements of the |
| 3286 | mode-specific menu. `vc-annotate-color-map' and | 3267 | mode-specific menu. `vc-annotate-color-map' and |
| 3287 | `vc-annotate-very-old-color' defines the mapping of time to | 3268 | `vc-annotate-very-old-color' define the mapping of time to colors. |
| 3288 | colors. `vc-annotate-background' specifies the background color." | 3269 | `vc-annotate-background' specifies the background color." |
| 3289 | (interactive | 3270 | (interactive |
| 3290 | (save-current-buffer | 3271 | (save-current-buffer |
| 3291 | (vc-ensure-vc-buffer) | 3272 | (vc-ensure-vc-buffer) |
| @@ -3422,11 +3403,8 @@ revisions after." | |||
| 3422 | (if (not prev-rev) | 3403 | (if (not prev-rev) |
| 3423 | (message "Cannot diff from any revision prior to %s" rev-at-line) | 3404 | (message "Cannot diff from any revision prior to %s" rev-at-line) |
| 3424 | (save-window-excursion | 3405 | (save-window-excursion |
| 3425 | (vc-diff-internal | 3406 | (vc-diff-internal nil (list vc-annotate-parent-file) |
| 3426 | (vc-backend vc-annotate-parent-file) | 3407 | prev-rev rev-at-line)) |
| 3427 | nil | ||
| 3428 | (list vc-annotate-parent-file) | ||
| 3429 | prev-rev rev-at-line)) | ||
| 3430 | (switch-to-buffer "*vc-diff*")))))) | 3408 | (switch-to-buffer "*vc-diff*")))))) |
| 3431 | 3409 | ||
| 3432 | (defun vc-annotate-warp-revision (revspec) | 3410 | (defun vc-annotate-warp-revision (revspec) |