Mercurial > emacs
comparison lisp/vc.el @ 85495:a67741d41dc7
Restore vc-next-action functionality of registering files.
author | Eric S. Raymond <esr@snark.thyrsus.com> |
---|---|
date | Sat, 20 Oct 2007 20:59:36 +0000 |
parents | 5f331ce2c3b0 |
children | b0f9e8f1fbb2 |
comparison
equal
deleted
inserted
replaced
85494:d045b8090f51 | 85495:a67741d41dc7 |
---|---|
1242 (dolist (node file-or-dir-list) | 1242 (dolist (node file-or-dir-list) |
1243 (vc-file-tree-walk | 1243 (vc-file-tree-walk |
1244 node (lambda (f) (if (vc-backend f) (push f flattened))))) | 1244 node (lambda (f) (if (vc-backend f) (push f flattened))))) |
1245 (nreverse flattened))) | 1245 (nreverse flattened))) |
1246 | 1246 |
1247 (defun vc-deduce-fileset (&optional allow-directory-wildcard) | 1247 (defun vc-deduce-fileset (&optional allow-directory-wildcard allow-unregistered) |
1248 "Deduce a set of files and a backend to which to apply an operation. | 1248 "Deduce a set of files and a backend to which to apply an operation. |
1249 | 1249 |
1250 If we're in VC-dired mode, the fileset is the list of marked files. | 1250 If we're in VC-dired mode, the fileset is the list of marked files. |
1251 Otherwise, if we're looking at a buffer visiting a version-controlled file, | 1251 Otherwise, if we're looking at a buffer visiting a version-controlled file, |
1252 the fileset is a singleton containing this file. | 1252 the fileset is a singleton containing this file. |
1253 If neither of these things is true, but ALLOW-DIRECTORY-WILDCARD is on | 1253 If neither of these things is true, but ALLOW-DIRECTORY-WILDCARD is on |
1254 and we're in a dired buffer, select the current directory. | 1254 and we're in a dired buffer, select the current directory. |
1255 If none of these conditions is met, but ALLOW_UNREGISTERED is in and the | |
1256 visited file is not registered, return a singletin fileset containing it. | |
1255 Otherwise, throw an error." | 1257 Otherwise, throw an error." |
1256 (cond (vc-dired-mode | 1258 (cond (vc-dired-mode |
1257 (let ((marked (dired-map-over-marks (dired-get-filename) nil))) | 1259 (let ((marked (dired-map-over-marks (dired-get-filename) nil))) |
1258 (unless marked | 1260 (unless marked |
1259 (error "No files have been selected.")) | 1261 (error "No files have been selected.")) |
1282 (equal list-buffers-directory default-directory))) | 1284 (equal list-buffers-directory default-directory))) |
1283 (progn | 1285 (progn |
1284 (message "All version-controlled files below %s selected." | 1286 (message "All version-controlled files below %s selected." |
1285 default-directory) | 1287 default-directory) |
1286 (list default-directory))) | 1288 (list default-directory))) |
1289 ((and allow-unregistered (not (vc-registered buffer-file-name))) | |
1290 (list buffer-file-name)) | |
1287 (t (error "No fileset is available here.")))) | 1291 (t (error "No fileset is available here.")))) |
1288 | 1292 |
1289 (defun vc-ensure-vc-buffer () | 1293 (defun vc-ensure-vc-buffer () |
1290 "Make sure that the current buffer visits a version-controlled file." | 1294 "Make sure that the current buffer visits a version-controlled file." |
1291 (if vc-dired-mode | 1295 (if vc-dired-mode |
1367 message has been entered, it checks in the resulting changes along | 1371 message has been entered, it checks in the resulting changes along |
1368 with the logmessage as change commentary. A writable file is retained. | 1372 with the logmessage as change commentary. A writable file is retained. |
1369 If the repository file is changed, you are asked if you want to | 1373 If the repository file is changed, you are asked if you want to |
1370 merge in the changes into your working copy." | 1374 merge in the changes into your working copy." |
1371 (interactive "P") | 1375 (interactive "P") |
1372 (let* ((files (vc-deduce-fileset)) | 1376 (let* ((files (vc-deduce-fileset nil t)) |
1373 (state (vc-state (car files))) | 1377 (state (vc-state (car files))) |
1374 (model (vc-checkout-model (car files))) | 1378 (model (vc-checkout-model (car files))) |
1375 revision) | 1379 revision) |
1376 ;; Verify that the fileset is homogenous | 1380 ;; Verify that the fileset is homogenous |
1377 (dolist (file (cdr files)) | 1381 (dolist (file (cdr files)) |