From ea8b9df12e38775600e850b8a57add2cf523bde5 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 11 Dec 2014 22:44:32 -0500 Subject: [PATCH] Remove VC rollback method. * vc/vc.el, vc/vc-hg.el, vc/vc-git.el, vc/vc-hooks.el, vc/vc-mtn.el, vc/vc-rcs.el, vc/vc-sccs.el, vc/vc-src.el: rrollback method removed, to be replaced in the future by uncommit. --- doc/emacs/maintaining.texi | 2 - lisp/ChangeLog | 6 +++ lisp/vc/vc-git.el | 1 - lisp/vc/vc-hg.el | 1 - lisp/vc/vc-hooks.el | 8 ---- lisp/vc/vc-mtn.el | 3 -- lisp/vc/vc-rcs.el | 37 ------------------ lisp/vc/vc-sccs.el | 16 -------- lisp/vc/vc-src.el | 1 - lisp/vc/vc.el | 78 +++++++------------------------------- 10 files changed, 20 insertions(+), 133 deletions(-) diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 5fb15513ea0..63cd1ae3e44 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1018,8 +1018,6 @@ Revert the work file(s) in the current VC fileset to the last revision (@code{vc-revert}). @end table -@c `C-x v c' (vc-rollback) was removed, since it's RCS/SCCS specific. - @kindex C-x v u @findex vc-revert @vindex vc-revert-show-diff diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 452f4c3e4a9..5916f2996e3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-12-12 Eric S. Raymond + + * vc/vc.el, vc/vc-hg.el, vc/vc-git.el, vc/vc-hooks.el, + vc/vc-mtn.el, vc/vc-rcs.el, vc/vc-sccs.el, vc/vc-src.el: rrollback + method removed, to be replaced in the future by uncommit. + 2014-12-11 Michael Albinus * vc/vc-hg.el (vc-hg-state): Make FILE absolute. Handle the case diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 048857b605d..b5e92bb50ac 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -65,7 +65,6 @@ ;; * find-revision (file rev buffer) OK ;; * checkout (file &optional rev) OK ;; * revert (file &optional contents-done) OK -;; - rollback (files) COULD BE SUPPORTED ;; - merge-file (file rev1 rev2) It would be possible to merge ;; changes into a single file, but ;; when committing they wouldn't diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index e049aab4316..90370839921 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -60,7 +60,6 @@ ;; * find-revision (file rev buffer) OK ;; * checkout (file &optional rev) OK ;; * revert (file &optional contents-done) OK -;; - rollback (files) ?? PROBABLY NOT NEEDED ;; - merge (file rev1 rev2) NEEDED ;; - merge-news (file) NEEDED ;; - steal-lock (file &optional revision) NOT NEEDED diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 0ffca5645e2..5448f38f042 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -868,7 +868,6 @@ current, and kill the buffer that visits the link." (let ((map (make-sparse-keymap))) (define-key map "a" 'vc-update-change-log) (define-key map "b" 'vc-switch-backend) - (define-key map "c" 'vc-rollback) (define-key map "d" 'vc-dir) (define-key map "g" 'vc-annotate) (define-key map "G" 'vc-ignore) @@ -938,13 +937,6 @@ current, and kill the buffer that visits the link." '(menu-item "Insert Header" vc-insert-headers :help "Insert headers into a file for use with a version control system. ")) - (bindings--define-key map [undo] - '(menu-item "Undo Last Check-In" vc-rollback - :enable (let ((backend (if buffer-file-name - (vc-backend buffer-file-name)))) - (or (not backend) - (vc-find-backend-function backend 'rollback))) - :help "Remove the most recent changeset committed to the repository")) (bindings--define-key map [vc-revert] '(menu-item "Revert to Base Version" vc-revert :help "Revert working copies of the selected file set to their repository contents")) diff --git a/lisp/vc/vc-mtn.el b/lisp/vc/vc-mtn.el index 57225f5f9ef..7d2f7349897 100644 --- a/lisp/vc/vc-mtn.el +++ b/lisp/vc/vc-mtn.el @@ -202,9 +202,6 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." (unless contents-done (vc-mtn-command nil 0 file "revert"))) -;; (defun vc-mtn-rollback (files) -;; ) - (defun vc-mtn-print-log (files buffer &optional _shortlog start-revision limit) "Print commit logs associated with FILES into specified BUFFER. _SHORTLOG is ignored. diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el index 9bb9af1ab47..8866bdbad96 100644 --- a/lisp/vc/vc-rcs.el +++ b/lisp/vc/vc-rcs.el @@ -432,43 +432,6 @@ attempt the checkout for all registered files beneath it." new-version))))) (message "Checking out %s...done" file)))))) -(defun vc-rcs-rollback (files) - "Roll back, undoing the most recent checkins of FILES. Directories are -expanded to all registered subfiles in them." - (if (not files) - (error "RCS backend doesn't support directory-level rollback")) - (dolist (file (vc-expand-dirs files 'RCS)) - (let* ((discard (vc-working-revision file)) - (previous (if (vc-rcs-trunk-p discard) "" (vc-branch-part discard))) - (config (current-window-configuration)) - (done nil)) - (if (null (yes-or-no-p (format "Remove version %s from %s history? " - discard file))) - (error "Aborted")) - (message "Removing revision %s from %s." discard file) - (vc-do-command "*vc*" 0 "rcs" (vc-master-name file) (concat "-o" discard)) - ;; Check out the most recent remaining version. If it - ;; fails, because the whole branch got deleted, do a - ;; double-take and check out the version where the branch - ;; started. - (while (not done) - (condition-case err - (progn - (vc-do-command "*vc*" 0 "co" (vc-master-name file) "-f" - (concat "-u" previous)) - (setq done t)) - (error (set-buffer "*vc*") - (goto-char (point-min)) - (if (search-forward "no side branches present for" nil t) - (progn (setq previous (vc-branch-part previous)) - (vc-rcs-set-default-branch file previous) - ;; vc-do-command popped up a window with - ;; the error message. Get rid of it, by - ;; restoring the old window configuration. - (set-window-configuration config)) - ;; No, it was some other error: re-signal it. - (signal (car err) (cdr err))))))))) - (defun vc-rcs-revert (file &optional _contents-done) "Revert FILE to the version it was based on. If FILE is a directory, revert all registered files beneath it." diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el index a8e122d6f93..63628647fd4 100644 --- a/lisp/vc/vc-sccs.el +++ b/lisp/vc/vc-sccs.el @@ -271,22 +271,6 @@ locked. REV is the revision to check out." switches)))) (message "Checking out %s...done" file)))) -(defun vc-sccs-rollback (files) - "Roll back, undoing the most recent checkins of FILES. Directories -are expanded to all version-controlled subfiles." - (setq files (vc-expand-dirs files 'SCCS)) - (if (not files) - (error "SCCS backend doesn't support directory-level rollback")) - (dolist (file files) - (let ((discard (vc-working-revision file))) - (if (null (yes-or-no-p (format "Remove version %s from %s history? " - discard file))) - (error "Aborted")) - (message "Removing revision %s from %s..." discard file) - (vc-sccs-do-command nil 0 "rmdel" - (vc-master-name file) (concat "-r" discard)) - (vc-sccs-do-command nil 0 "get" (vc-master-name file) nil)))) - (defun vc-sccs-revert (file &optional _contents-done) "Revert FILE to the version it was based on. If FILE is a directory, revert all subfiles." diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el index 36d6a20f9b1..6ba8b8c809f 100644 --- a/lisp/vc/vc-src.el +++ b/lisp/vc/vc-src.el @@ -48,7 +48,6 @@ ;; * find-revision (file rev buffer) OK ;; * checkout (file &optional rev) OK ;; * revert (file &optional contents-done) OK -;; - rollback (files) NOT NEEDED ;; - merge (file rev1 rev2) NOT NEEDED ;; - merge-news (file) NOT NEEDED ;; - steal-lock (file &optional revision) NOT NEEDED diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 3ea48096fdd..c6721cb511f 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -46,7 +46,7 @@ ;; If you maintain a client of the mode or customize it in your .emacs, ;; note that some backend functions which formerly took single file arguments ;; now take a list of files. These include: register, checkin, print-log, -;; rollback, and diff. +;; and diff. ;;; Commentary: @@ -276,15 +276,6 @@ ;; If FILE is in the `added' state it should be returned to the ;; `unregistered' state. ;; -;; - rollback (files) -;; -;; Remove the tip revision of each of FILES from the repository. If -;; this function is not provided, trying to cancel a revision is -;; caught as an error. (Most backends don't provide it.) (Also -;; note that older versions of this backend command were called -;; 'cancel-version' and took a single file arg, not a list of -;; files.) -;; ;; - merge-file (file rev1 rev2) ;; ;; Merge the changes between REV1 and REV2 into the current working @@ -599,17 +590,28 @@ ;; variable are gone. These have't made sense on anything shipped ;; since RCS, and using them was a dumb stunt even on RCS. ;; -;; workfile-unchanged-p is no longer a public back-end method. It +;; - workfile-unchanged-p is no longer a public back-end method. It ;; was redundant with vc-state and usually implemented with a trivial ;; call to it. A few older back ends retain versions for internal use in ;; their vc-state functions. ;; -;; could-register is no longer a public method. Only vc-cvs ever used it +;; - could-register is no longer a public method. Only vc-cvs ever used it +;; +;; The vc-keep-workfiles configuration variable is gone. Used only by +;; the RCS and SCCS backends, it was an invitation to shoot self in foot +;; when set to the (non-default) value nil. The original justication +;; for it (saving disk space) is long obsolete. +;; +;; - The rollback method (implemented by RCS and SCCS only) is gone. See +;; the to-do note on uncommit. ;;; Todo: ;;;; New Primitives: ;; +;; - uncommit: undo last checkin, leave changes in place in the workfile, +;; stash the commit comment for re-use. +;; ;; - deal with push operations. ;; ;;;; Primitives that need changing: @@ -2427,58 +2429,6 @@ to the working revision (except for keyword expansion)." (vc-revert-file file) (message "Reverting %s...done" (vc-delistify files))))) -;;;###autoload -(defun vc-rollback () - "Roll back (remove) the most recent changeset committed to the repository. -This may be either a file-level or a repository-level operation, -depending on the underlying version-control system." - (interactive) - (let* ((vc-fileset (vc-deduce-fileset)) - (backend (car vc-fileset)) - (files (cadr vc-fileset)) - (granularity (vc-call-backend backend 'revision-granularity))) - (unless (vc-find-backend-function backend 'rollback) - (error "Rollback is not supported in %s" backend)) - (when (and (not (eq granularity 'repository)) (/= (length files) 1)) - (error "Rollback requires a singleton fileset or repository versioning")) - ;; FIXME: latest-on-branch-p should take the fileset. - (when (not (vc-call-backend backend 'latest-on-branch-p (car files))) - (error "Rollback is only possible at the tip revision")) - ;; If any of the files is visited by the current buffer, make - ;; sure buffer is saved. If the user says `no', abort since - ;; we cannot show the changes and ask for confirmation to - ;; discard them. - (when (or (not files) (memq (buffer-file-name) files)) - (vc-buffer-sync nil)) - (dolist (file files) - (when (buffer-modified-p (get-file-buffer file)) - (error "Please kill or save all modified buffers before rollback")) - (when (not (vc-up-to-date-p file)) - (error "Please revert all modified workfiles before rollback"))) - ;; Accumulate changes associated with the fileset - (vc-setup-buffer "*vc-diff*") - (set-buffer-modified-p nil) - (message "Finding changes...") - (let* ((tip (vc-working-revision (car files))) - ;; FIXME: `previous-revision' should take the fileset. - (previous (vc-call-backend backend 'previous-revision - (car files) tip))) - (vc-diff-internal nil vc-fileset previous tip)) - ;; Display changes - (unless (yes-or-no-p "Discard these revisions? ") - (error "Rollback canceled")) - (quit-windows-on "*vc-diff*") - ;; Do the actual reversions - (message "Rolling back %s..." (vc-delistify files)) - (with-vc-properties - files - (vc-call-backend backend 'rollback files) - `((vc-state . ,'up-to-date) - (vc-checkout-time . , (nth 5 (file-attributes file))) - (vc-working-revision . nil))) - (dolist (f files) (vc-resynch-buffer f t t)) - (message "Rolling back %s...done" (vc-delistify files)))) - ;;;###autoload (define-obsolete-function-alias 'vc-revert-buffer 'vc-revert "23.1") -- 2.39.2