]> code.delx.au - gnu-emacs/commitdiff
Remove VC rollback method.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 12 Dec 2014 03:44:32 +0000 (22:44 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 12 Dec 2014 03:44:32 +0000 (22:44 -0500)
* 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
lisp/ChangeLog
lisp/vc/vc-git.el
lisp/vc/vc-hg.el
lisp/vc/vc-hooks.el
lisp/vc/vc-mtn.el
lisp/vc/vc-rcs.el
lisp/vc/vc-sccs.el
lisp/vc/vc-src.el
lisp/vc/vc.el

index 5fb15513ea0e380c2e18bc5ecb5f821894333f90..63cd1ae3e44b6a3da5491b32b66d72803dd7f45f 100644 (file)
@@ -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
index 452f4c3e4a9dffcbd49bbeedc9a77dbe4ccc4473..5916f2996e3f6a144dda573fec3af18042f87b73 100644 (file)
@@ -1,3 +1,9 @@
+2014-12-12  Eric S. Raymond  <esr@snark.thyrsus.com>
+
+       * 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  <michael.albinus@gmx.de>
 
        * vc/vc-hg.el (vc-hg-state): Make FILE absolute.  Handle the case
index 048857b605d189290a32fe8ed12e5ea092037ea9..b5e92bb50ac4dc52ffc36d36fa7da31ee4f44165 100644 (file)
@@ -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
index e049aab43162ea3085910b51a69333b95a72e5c3..9037083992135e6542599eec365f2d57478c9fe0 100644 (file)
@@ -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
index 0ffca5645e2f2e9a464a5b7044b170e4f0973650..5448f38f0425c37045d20a62b58ec50fb31e226f 100644 (file)
@@ -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"))
index 57225f5f9efab569029070515c267418da3e2f18..7d2f734989711e37e599498701283a7a2c1e8419 100644 (file)
@@ -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.
index 9bb9af1ab475bb5bf3aeb316d7ab92a6d85b0358..8866bdbad96353e8e416d4f5d60d8d7e632ae745 100644 (file)
@@ -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."
index a8e122d6f93ee62167eb7ba2a940c41041d6eba8..63628647fd44b00869439fc4c6a420610cd8bb81 100644 (file)
@@ -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."
index 36d6a20f9b16cf969082ba692db6abe3ab36aa40..6ba8b8c809f91fbb4257c14fb50b063dcfa17759 100644 (file)
@@ -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
index 3ea48096fdd590cad99bace1c01551a429b87cf0..c6721cb511fb1095b23a37e949550329f2e67a9f 100644 (file)
@@ -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:
 
 ;;   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
 ;;   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")