diff options
| author | Eli Zaretskii | 2015-09-19 13:31:38 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2015-09-19 13:31:38 +0300 |
| commit | 9ea6c4df441d85be44dadad4fbd57d2c0f3be4f1 (patch) | |
| tree | 1c933c1e1395c932b867bee0e507125ae577483b | |
| parent | ba3495674e8c6c98f2f180908b2af600a2bd3d2e (diff) | |
| download | emacs-9ea6c4df441d85be44dadad4fbd57d2c0f3be4f1.tar.gz emacs-9ea6c4df441d85be44dadad4fbd57d2c0f3be4f1.zip | |
Resurrect the ability to specify a revision in vc-next-action
* lisp/vc/vc-bzr.el (vc-bzr-checkin):
* lisp/vc/vc-dav.el (vc-dav-checkin):
* lisp/vc/vc-git.el (vc-git-checkin):
* lisp/vc/vc-hg.el (vc-hg-checkin):
* lisp/vc/vc-mtn.el (vc-mtn-checkin): Accept and silently ignore
an additional optional argument, the revision to checkin.
* lisp/vc/vc-sccs.el (vc-sccs-checkin):
* lisp/vc/vc-cvs.el (vc-cvs-checkin):
* lisp/vc/vc-rcs.el (vc-rcs-checkin): Allow to optionally specify
a revision to checkin.
* lisp/vc/vc.el (vc-next-action): Allow to optionally specify the
revision when checking in files.
See http://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00688.html
for the details.
| -rw-r--r-- | lisp/vc/vc-bzr.el | 2 | ||||
| -rw-r--r-- | lisp/vc/vc-cvs.el | 48 | ||||
| -rw-r--r-- | lisp/vc/vc-dav.el | 2 | ||||
| -rw-r--r-- | lisp/vc/vc-git.el | 2 | ||||
| -rw-r--r-- | lisp/vc/vc-hg.el | 2 | ||||
| -rw-r--r-- | lisp/vc/vc-mtn.el | 2 | ||||
| -rw-r--r-- | lisp/vc/vc-rcs.el | 16 | ||||
| -rw-r--r-- | lisp/vc/vc-sccs.el | 3 | ||||
| -rw-r--r-- | lisp/vc/vc.el | 26 |
9 files changed, 47 insertions, 56 deletions
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el index 5f8dd0bf0e8..9b2711d8146 100644 --- a/lisp/vc/vc-bzr.el +++ b/lisp/vc/vc-bzr.el | |||
| @@ -649,7 +649,7 @@ or a superior directory.") | |||
| 649 | "" (replace-regexp-in-string | 649 | "" (replace-regexp-in-string |
| 650 | "\n[ \t]?" " " str))))) | 650 | "\n[ \t]?" " " str))))) |
| 651 | 651 | ||
| 652 | (defun vc-bzr-checkin (files comment) | 652 | (defun vc-bzr-checkin (files comment &optional _rev) |
| 653 | "Check FILES in to bzr with log message COMMENT." | 653 | "Check FILES in to bzr with log message COMMENT." |
| 654 | (apply 'vc-bzr-command "commit" nil 0 files | 654 | (apply 'vc-bzr-command "commit" nil 0 files |
| 655 | (cons "-m" (log-edit-extract-headers | 655 | (cons "-m" (log-edit-extract-headers |
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index 73ef42ac7d6..5f5807fb3c6 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el | |||
| @@ -332,38 +332,20 @@ its parents." | |||
| 332 | (directory-file-name dir)))) | 332 | (directory-file-name dir)))) |
| 333 | (eq dir t))) | 333 | (eq dir t))) |
| 334 | 334 | ||
| 335 | ;; vc-cvs-checkin used to take a 'rev' second argument that allowed | 335 | (defun vc-cvs-checkin (files comment &optional rev) |
| 336 | ;; checking in onto a specified branch tip rather than the current | ||
| 337 | ;; default branch, but nothing in the entire rest of VC exercised | ||
| 338 | ;; this code. Removing it simplifies the backend interface for all | ||
| 339 | ;; modes. | ||
| 340 | ;; | ||
| 341 | ;; Here's the setup code preserved in amber, in case the logic needs | ||
| 342 | ;; to be broken out into a method someday; (if rev (concat "-r" rev)) | ||
| 343 | ;; used to be part of the switches passed to vc-cvs-command. | ||
| 344 | ;; | ||
| 345 | ;; (unless (or (not rev) (vc-cvs-valid-revision-number-p rev)) | ||
| 346 | ;; (if (not (vc-cvs-valid-symbolic-tag-name-p rev)) | ||
| 347 | ;; (error "%s is not a valid symbolic tag name" rev) | ||
| 348 | ;; ;; If the input revision is a valid symbolic tag name, we create it | ||
| 349 | ;; ;; as a branch, commit and switch to it. | ||
| 350 | ;; (apply 'vc-cvs-command nil 0 files "tag" "-b" (list rev)) | ||
| 351 | ;; (apply 'vc-cvs-command nil 0 files "update" "-r" (list rev)) | ||
| 352 | ;; (mapc (lambda (file) (vc-file-setprop file 'vc-cvs-sticky-tag rev)) | ||
| 353 | ;; files))) | ||
| 354 | ;; | ||
| 355 | ;; The following postamble cleaned up after the branch change: | ||
| 356 | ;; | ||
| 357 | ;; ;; if this was an explicit check-in (does not include creation of | ||
| 358 | ;; ;; a branch), remove the sticky tag. | ||
| 359 | ;; (if (and rev (not (vc-cvs-valid-symbolic-tag-name-p rev))) | ||
| 360 | ;; (vc-cvs-command nil 0 files "update" "-A")))) | ||
| 361 | ;; files))) | ||
| 362 | ;; | ||
| 363 | (defun vc-cvs-checkin (files comment) | ||
| 364 | "CVS-specific version of `vc-backend-checkin'." | 336 | "CVS-specific version of `vc-backend-checkin'." |
| 337 | (unless (or (not rev) (vc-cvs-valid-revision-number-p rev)) | ||
| 338 | (if (not (vc-cvs-valid-symbolic-tag-name-p rev)) | ||
| 339 | (error "%s is not a valid symbolic tag name" rev) | ||
| 340 | ;; If the input revision is a valid symbolic tag name, we create it | ||
| 341 | ;; as a branch, commit and switch to it. | ||
| 342 | (apply 'vc-cvs-command nil 0 files "tag" "-b" (list rev)) | ||
| 343 | (apply 'vc-cvs-command nil 0 files "update" "-r" (list rev)) | ||
| 344 | (mapc (lambda (file) (vc-file-setprop file 'vc-cvs-sticky-tag rev)) | ||
| 345 | files))) | ||
| 365 | (let ((status (apply 'vc-cvs-command nil 1 files | 346 | (let ((status (apply 'vc-cvs-command nil 1 files |
| 366 | "ci" (concat "-m" comment) | 347 | "ci" (if rev (concat "-r" rev)) |
| 348 | (concat "-m" comment) | ||
| 367 | (vc-switches 'CVS 'checkin)))) | 349 | (vc-switches 'CVS 'checkin)))) |
| 368 | (set-buffer "*vc*") | 350 | (set-buffer "*vc*") |
| 369 | (goto-char (point-min)) | 351 | (goto-char (point-min)) |
| @@ -394,7 +376,11 @@ its parents." | |||
| 394 | ;; tell it from the permissions of the file (see | 376 | ;; tell it from the permissions of the file (see |
| 395 | ;; vc-cvs-checkout-model). | 377 | ;; vc-cvs-checkout-model). |
| 396 | (mapc (lambda (file) (vc-file-setprop file 'vc-checkout-model nil)) | 378 | (mapc (lambda (file) (vc-file-setprop file 'vc-checkout-model nil)) |
| 397 | files))) | 379 | files) |
| 380 | ;; if this was an explicit check-in (does not include creation of | ||
| 381 | ;; a branch), remove the sticky tag. | ||
| 382 | (if (and rev (not (vc-cvs-valid-symbolic-tag-name-p rev))) | ||
| 383 | (vc-cvs-command nil 0 files "update" "-A")))) | ||
| 398 | 384 | ||
| 399 | (defun vc-cvs-find-revision (file rev buffer) | 385 | (defun vc-cvs-find-revision (file rev buffer) |
| 400 | (apply 'vc-cvs-command | 386 | (apply 'vc-cvs-command |
diff --git a/lisp/vc/vc-dav.el b/lisp/vc/vc-dav.el index 3326f2964c9..880e14be63e 100644 --- a/lisp/vc/vc-dav.el +++ b/lisp/vc/vc-dav.el | |||
| @@ -82,7 +82,7 @@ See `vc-checkout-model' for a list of possible values." | |||
| 82 | ;; Do we need to do anything here? FIXME? | 82 | ;; Do we need to do anything here? FIXME? |
| 83 | ) | 83 | ) |
| 84 | 84 | ||
| 85 | (defun vc-dav-checkin (url comment) | 85 | (defun vc-dav-checkin (url comment &optional _rev) |
| 86 | "Commit changes in URL to WebDAV. COMMENT is used as a check-in comment." | 86 | "Commit changes in URL to WebDAV. COMMENT is used as a check-in comment." |
| 87 | ;; This should PUT the resource and release any locks that we hold. | 87 | ;; This should PUT the resource and release any locks that we hold. |
| 88 | ) | 88 | ) |
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 8a0f5547c4d..2f0439365e8 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el | |||
| @@ -674,7 +674,7 @@ If toggling on, also insert its message into the buffer." | |||
| 674 | "Major mode for editing Git log messages. | 674 | "Major mode for editing Git log messages. |
| 675 | It is based on `log-edit-mode', and has Git-specific extensions.") | 675 | It is based on `log-edit-mode', and has Git-specific extensions.") |
| 676 | 676 | ||
| 677 | (defun vc-git-checkin (files comment) | 677 | (defun vc-git-checkin (files comment &optional _rev) |
| 678 | (let* ((file1 (or (car files) default-directory)) | 678 | (let* ((file1 (or (car files) default-directory)) |
| 679 | (root (vc-git-root file1)) | 679 | (root (vc-git-root file1)) |
| 680 | (default-directory (expand-file-name root)) | 680 | (default-directory (expand-file-name root)) |
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index f634e2eac53..49573986125 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el | |||
| @@ -465,7 +465,7 @@ Optional arg REVISION is a revision to annotate from." | |||
| 465 | 465 | ||
| 466 | (declare-function log-edit-extract-headers "log-edit" (headers string)) | 466 | (declare-function log-edit-extract-headers "log-edit" (headers string)) |
| 467 | 467 | ||
| 468 | (defun vc-hg-checkin (files comment) | 468 | (defun vc-hg-checkin (files comment &optional _rev) |
| 469 | "Hg-specific version of `vc-backend-checkin'. | 469 | "Hg-specific version of `vc-backend-checkin'. |
| 470 | REV is ignored." | 470 | REV is ignored." |
| 471 | (apply 'vc-hg-command nil 0 files | 471 | (apply 'vc-hg-command nil 0 files |
diff --git a/lisp/vc/vc-mtn.el b/lisp/vc/vc-mtn.el index 685ef3b6742..b56a08f2a9e 100644 --- a/lisp/vc/vc-mtn.el +++ b/lisp/vc/vc-mtn.el | |||
| @@ -199,7 +199,7 @@ switches." | |||
| 199 | 199 | ||
| 200 | (declare-function log-edit-extract-headers "log-edit" (headers string)) | 200 | (declare-function log-edit-extract-headers "log-edit" (headers string)) |
| 201 | 201 | ||
| 202 | (defun vc-mtn-checkin (files comment) | 202 | (defun vc-mtn-checkin (files comment &optional _rev) |
| 203 | (apply 'vc-mtn-command nil 0 files | 203 | (apply 'vc-mtn-command nil 0 files |
| 204 | (nconc (list "commit" "-m") | 204 | (nconc (list "commit" "-m") |
| 205 | (log-edit-extract-headers '(("Author" . "--author") | 205 | (log-edit-extract-headers '(("Author" . "--author") |
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el index 995bd059f2d..ba1336424ea 100644 --- a/lisp/vc/vc-rcs.el +++ b/lisp/vc/vc-rcs.el | |||
| @@ -306,27 +306,23 @@ whether to remove it." | |||
| 306 | (yes-or-no-p (format "Directory %s is empty; remove it? " dir)) | 306 | (yes-or-no-p (format "Directory %s is empty; remove it? " dir)) |
| 307 | (delete-directory dir))))) | 307 | (delete-directory dir))))) |
| 308 | 308 | ||
| 309 | ;; It used to be possible to pass in a value for the variable rev, but | 309 | (defun vc-rcs-checkin (files comment &optional rev) |
| 310 | ;; nothing in the rest of VC used this capability. Removing it makes the | ||
| 311 | ;; backend interface simpler for all modes. | ||
| 312 | ;; | ||
| 313 | (defun vc-rcs-checkin (files comment) | ||
| 314 | "RCS-specific version of `vc-backend-checkin'." | 310 | "RCS-specific version of `vc-backend-checkin'." |
| 315 | (let (rev (switches (vc-switches 'RCS 'checkin))) | 311 | (let ((switches (vc-switches 'RCS 'checkin))) |
| 316 | ;; Now operate on the files | 312 | ;; Now operate on the files |
| 317 | (dolist (file (vc-expand-dirs files 'RCS)) | 313 | (dolist (file (vc-expand-dirs files 'RCS)) |
| 318 | (let ((old-version (vc-working-revision file)) new-version | 314 | (let ((old-version (vc-working-revision file)) new-version |
| 319 | (default-branch (vc-file-getprop file 'vc-rcs-default-branch))) | 315 | (default-branch (vc-file-getprop file 'vc-rcs-default-branch))) |
| 320 | ;; Force branch creation if an appropriate | 316 | ;; Force branch creation if an appropriate |
| 321 | ;; default branch has been set. | 317 | ;; default branch has been set. |
| 322 | (and default-branch | 318 | (and (not rev) |
| 319 | default-branch | ||
| 323 | (string-match (concat "^" (regexp-quote old-version) "\\.") | 320 | (string-match (concat "^" (regexp-quote old-version) "\\.") |
| 324 | default-branch) | 321 | default-branch) |
| 325 | (setq rev default-branch) | 322 | (setq rev default-branch) |
| 326 | (setq switches (cons "-f" switches))) | 323 | (setq switches (cons "-f" switches))) |
| 327 | (if old-version | 324 | (if (and (not rev) old-version) |
| 328 | (setq rev (vc-branch-part old-version)) | 325 | (setq rev (vc-branch-part old-version))) |
| 329 | (error "can't find current branch")) | ||
| 330 | (apply #'vc-do-command "*vc*" 0 "ci" (vc-master-name file) | 326 | (apply #'vc-do-command "*vc*" 0 "ci" (vc-master-name file) |
| 331 | ;; if available, use the secure check-in option | 327 | ;; if available, use the secure check-in option |
| 332 | (and (vc-rcs-release-p "5.6.4") "-j") | 328 | (and (vc-rcs-release-p "5.6.4") "-j") |
diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el index 8d8d9e844ed..a3facc56d5d 100644 --- a/lisp/vc/vc-sccs.el +++ b/lisp/vc/vc-sccs.el | |||
| @@ -222,10 +222,11 @@ to the SCCS command." | |||
| 222 | (stringp (vc-sccs-search-project-dir (or (file-name-directory file) "") | 222 | (stringp (vc-sccs-search-project-dir (or (file-name-directory file) "") |
| 223 | (file-name-nondirectory file))))) | 223 | (file-name-nondirectory file))))) |
| 224 | 224 | ||
| 225 | (defun vc-sccs-checkin (files comment) | 225 | (defun vc-sccs-checkin (files comment &optional rev) |
| 226 | "SCCS-specific version of `vc-backend-checkin'." | 226 | "SCCS-specific version of `vc-backend-checkin'." |
| 227 | (dolist (file (vc-expand-dirs files 'SCCS)) | 227 | (dolist (file (vc-expand-dirs files 'SCCS)) |
| 228 | (apply 'vc-sccs-do-command nil 0 "delta" (vc-master-name file) | 228 | (apply 'vc-sccs-do-command nil 0 "delta" (vc-master-name file) |
| 229 | (if rev (concat "-r" rev)) | ||
| 229 | (concat "-y" comment) | 230 | (concat "-y" comment) |
| 230 | (vc-switches 'SCCS 'checkin)) | 231 | (vc-switches 'SCCS 'checkin)) |
| 231 | (vc-sccs-do-command nil 0 "get" (vc-master-name file)))) | 232 | (vc-sccs-do-command nil 0 "get" (vc-master-name file)))) |
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 90d450a5ab9..f08e562efe5 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el | |||
| @@ -233,12 +233,13 @@ | |||
| 233 | ;; Unregister FILE from this backend. This is only needed if this | 233 | ;; Unregister FILE from this backend. This is only needed if this |
| 234 | ;; backend may be used as a "more local" backend for temporary editing. | 234 | ;; backend may be used as a "more local" backend for temporary editing. |
| 235 | ;; | 235 | ;; |
| 236 | ;; * checkin (files comment) | 236 | ;; * checkin (files comment &optional rev) |
| 237 | ;; | 237 | ;; |
| 238 | ;; Commit changes in FILES to this backend. COMMENT is used as a | 238 | ;; Commit changes in FILES to this backend. COMMENT is used as a |
| 239 | ;; check-in comment. The implementation should pass the value of | 239 | ;; check-in comment. The implementation should pass the value of |
| 240 | ;; vc-checkin-switches to the backend command. The revision argument | 240 | ;; vc-checkin-switches to the backend command. The optional REV |
| 241 | ;; of some older VC versions is no longer supported. | 241 | ;; revision argument is only supported with some older VCSes, like |
| 242 | ;; RCS and CVS, and is otherwise silently ignored. | ||
| 242 | ;; | 243 | ;; |
| 243 | ;; * find-revision (file rev buffer) | 244 | ;; * find-revision (file rev buffer) |
| 244 | ;; | 245 | ;; |
| @@ -1221,10 +1222,15 @@ For old-style locking-based version control systems, like RCS: | |||
| 1221 | (message "No files remain to be committed") | 1222 | (message "No files remain to be committed") |
| 1222 | (if (not verbose) | 1223 | (if (not verbose) |
| 1223 | (vc-checkin ready-for-commit backend) | 1224 | (vc-checkin ready-for-commit backend) |
| 1224 | (let ((new-backend (vc-read-backend "New backend: "))) | 1225 | (let* ((revision (read-string "New revision or backend: ")) |
| 1225 | (if new-backend | 1226 | (revision-downcase (downcase revision))) |
| 1226 | (dolist (file files) | 1227 | (if (member |
| 1227 | (vc-transfer-file file new-backend)))))))) | 1228 | revision-downcase |
| 1229 | (mapcar (lambda (arg) (downcase (symbol-name arg))) | ||
| 1230 | vc-handled-backends)) | ||
| 1231 | (let ((vsym (intern revision-downcase))) | ||
| 1232 | (dolist (file files) (vc-transfer-file file vsym))) | ||
| 1233 | (vc-checkin ready-for-commit backend nil nil revision))))))) | ||
| 1228 | ;; locked by somebody else (locking VCSes only) | 1234 | ;; locked by somebody else (locking VCSes only) |
| 1229 | ((stringp state) | 1235 | ((stringp state) |
| 1230 | ;; In the old days, we computed the revision once and used it on | 1236 | ;; In the old days, we computed the revision once and used it on |
| @@ -1522,11 +1528,13 @@ Type \\[vc-next-action] to check in changes.") | |||
| 1522 | ".\n") | 1528 | ".\n") |
| 1523 | (message "Please explain why you stole the lock. Type C-c C-c when done."))) | 1529 | (message "Please explain why you stole the lock. Type C-c C-c when done."))) |
| 1524 | 1530 | ||
| 1525 | (defun vc-checkin (files backend &optional comment initial-contents) | 1531 | (defun vc-checkin (files backend &optional comment initial-contents rev) |
| 1526 | "Check in FILES. COMMENT is a comment string; if omitted, a | 1532 | "Check in FILES. COMMENT is a comment string; if omitted, a |
| 1527 | buffer is popped up to accept a comment. If INITIAL-CONTENTS is | 1533 | buffer is popped up to accept a comment. If INITIAL-CONTENTS is |
| 1528 | non-nil, then COMMENT is used as the initial contents of the log | 1534 | non-nil, then COMMENT is used as the initial contents of the log |
| 1529 | entry buffer. | 1535 | entry buffer. |
| 1536 | The optional argument REV may be a string specifying the new revision | ||
| 1537 | level (only supported for some older VCSes, like RCS and CVS). | ||
| 1530 | 1538 | ||
| 1531 | Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'." | 1539 | Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'." |
| 1532 | (when vc-before-checkin-hook | 1540 | (when vc-before-checkin-hook |
| @@ -1549,7 +1557,7 @@ Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'." | |||
| 1549 | ;; vc-checkin-switches, but 'the' local buffer is | 1557 | ;; vc-checkin-switches, but 'the' local buffer is |
| 1550 | ;; not a well-defined concept for filesets. | 1558 | ;; not a well-defined concept for filesets. |
| 1551 | (progn | 1559 | (progn |
| 1552 | (vc-call-backend backend 'checkin files comment) | 1560 | (vc-call-backend backend 'checkin files comment rev) |
| 1553 | (mapc 'vc-delete-automatic-version-backups files)) | 1561 | (mapc 'vc-delete-automatic-version-backups files)) |
| 1554 | `((vc-state . up-to-date) | 1562 | `((vc-state . up-to-date) |
| 1555 | (vc-checkout-time . ,(nth 5 (file-attributes file))) | 1563 | (vc-checkout-time . ,(nth 5 (file-attributes file))) |