[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C-x v v no longer works the way it used to
From: |
Dan Nicolaescu |
Subject: |
Re: C-x v v no longer works the way it used to |
Date: |
Mon, 12 Nov 2007 07:32:50 -0800 |
Dan Nicolaescu <address@hidden> writes:
> "Eric S. Raymond" <address@hidden> writes:
>
> > Dan Nicolaescu <address@hidden>:
> > > This patch fixes it.
> > > vc-next-action still has the logic to deal with unregistered files,
> > > but vc-deduce-fileset would not return one...
> > > This patch is technically incorrect because it changes
> > > vc-deduce-fileset to not do what it's docs says it has to do.
> > > Not sure how the new VC design is supposed to work to fix it
> > > properly...
> >
> > You had the right general idea; the strategy has to go through
> > vc-deduce-fileset in order not to break the design. But your patch
> > produces behavior that won't be welcome in commands other than
> > vc-next-action, so I put the arm you added under control of
> > a new boolean argument ALLOW-UNREGISTERED.
>
> Now this points to another issue:
> vc-next-action does this:
>
> (mapc 'vc-register files))
>
> But vc-register is defined like this:
>
> (defun vc-register (&optional set-revision comment)
>
> i.e. it does not have a file parameter, it works on the current
> buffer.
>
> The easy fix would probably be to change the mapc call to do a
> with-current-buffer. But it might be better to change vc-register to
> take a fileset parameter...
Here's a patch that changes vc-register to take a file parameter. In the
end should take a fileset, but it seems better to first make sure that
the simpler case works.
Jim: this also should not ask the question about "Initial revision
level".
Should I check this in?
Index: vc.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v
retrieving revision 1.480
diff -c -3 -p -c -r1.480 vc.el
*** vc.el 11 Nov 2007 14:55:55 -0000 1.480
--- vc.el 12 Nov 2007 15:19:51 -0000
*************** merge in the changes into your working c
*** 1535,1542 ****
(vc-call-backend backend 'create-repo))
;;;###autoload
! (defun vc-register (&optional set-revision comment)
! "Register the current file into a version control system.
With prefix argument SET-REVISION, allow user to specify initial revision
level. If COMMENT is present, use that as an initial comment.
--- 1535,1543 ----
(vc-call-backend backend 'create-repo))
;;;###autoload
! (defun vc-register (&optional fname set-revision comment)
! "Register into a version control system.
! If FNAME is given register that file, otherwise register the current file.
With prefix argument SET-REVISION, allow user to specify initial revision
level. If COMMENT is present, use that as an initial comment.
*************** directory are already registered under t
*** 1547,1586 ****
register the file. If no backend declares itself responsible, the
first backend that could register the file is used."
(interactive "P")
! (unless buffer-file-name (error "No visited file"))
! (when (vc-backend buffer-file-name)
! (if (vc-registered buffer-file-name)
! (error "This file is already registered")
! (unless (y-or-n-p "Previous master file has vanished. Make a new one?
")
! (error "Aborted"))))
! ;; Watch out for new buffers of size 0: the corresponding file
! ;; does not exist yet, even though buffer-modified-p is nil.
! (if (and (not (buffer-modified-p))
! (zerop (buffer-size))
! (not (file-exists-p buffer-file-name)))
! (set-buffer-modified-p t))
! (vc-buffer-sync)
! (vc-start-entry (list buffer-file-name)
! (if set-revision
! (read-string (format "Initial revision level for %s: "
! (buffer-name)))
! (vc-call-backend (vc-responsible-backend buffer-file-name)
! 'init-revision))
! (or comment (not vc-initial-comment))
! nil
! "Enter initial comment."
! (lambda (files rev comment)
! (dolist (file files)
! (message "Registering %s... " file)
! (let ((backend (vc-responsible-backend file t)))
! (vc-file-clearprops file)
! (vc-call-backend backend 'register (list file) rev
comment)
! (vc-file-setprop file 'vc-backend backend)
! (unless vc-make-backup-files
! (make-local-variable 'backup-inhibited)
! (setq backup-inhibited t)))
! (message "Registering %s... done" file)))))
(defun vc-register-with (backend)
"Register the current file with a specified back end."
--- 1548,1591 ----
register the file. If no backend declares itself responsible, the
first backend that could register the file is used."
(interactive "P")
! (when (and (null fname) (null buffer-file-name)) (error "No visited file"))
! (let ((bname (if fname (get-file-buffer fname) buffer-file-name)))
! (unless fname (setq fname buffer-file-name))
! (when bname
! (with-current-buffer bname
! (when (vc-backend buffer-file-name)
! (if (vc-registered buffer-file-name)
! (error "This file is already registered")
! (unless (y-or-n-p "Previous master file has vanished. Make a new
one? ")
! (error "Aborted"))))
! ;; Watch out for new buffers of size 0: the corresponding file
! ;; does not exist yet, even though buffer-modified-p is nil.
! (if (and (not (buffer-modified-p))
! (zerop (buffer-size))
! (not (file-exists-p buffer-file-name)))
! (set-buffer-modified-p t))
! (vc-buffer-sync)))
! (vc-start-entry (list fname)
! (if set-revision
! (read-string (format "Initial revision level for %s: "
! fname))
! (vc-call-backend (vc-responsible-backend fname)
! 'init-revision))
! (or comment (not vc-initial-comment))
! nil
! "Enter initial comment."
! (lambda (files rev comment)
! (dolist (file files)
! (message "Registering %s... " file)
! (let ((backend (vc-responsible-backend file t)))
! (vc-file-clearprops file)
! (vc-call-backend backend 'register (list file) rev
comment)
! (vc-file-setprop file 'vc-backend backend)
! (unless vc-make-backup-files
! (make-local-variable 'backup-inhibited)
! (setq backup-inhibited t)))
! (message "Registering %s... done" file))))))
(defun vc-register-with (backend)
"Register the current file with a specified back end."
Diffs between working revision and workfile end here.
- Re: C-x v v no longer works the way it used to,
Dan Nicolaescu <=