[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 23.0.50; vc-diff needs CVS repository now
From: |
Dan Nicolaescu |
Subject: |
Re: 23.0.50; vc-diff needs CVS repository now |
Date: |
Sun, 11 Nov 2007 12:54:24 -0800 |
"Eric S. Raymond" <address@hidden> writes:
> Glenn Morris <address@hidden>:
> > Any comment on this? The part of vc-diff-internal that does a local
> > diff where possible seems to have disappeared in the 2007-10-10 change
> > "rewrite for filesets".
>
> That's right, because the front end was the wrong place to do it.
> Modern VCS diff tools automatically stay local when they can.
> Subversion diff does the right thing, and it's not even an issue
> in the 3G systems (they keep local repositories). It's the
> kind of variation that should be handled in the VCS-specific back ends.
>
> Actually CVS is the only awkward case. So what ought to happen is
> for something like the old stay-local logic to be implemented in the CVS
> back end.
>
> This is one of my two remaining to-do items for the mode. But someone
> who is more of a CVS expert than I might get it done faster.
I adapted the old vc-diff-internal logic to vc-cvs-diff. After the
patch below the CVS repository is not needed if backup files are
present.
Not sure what is the "correct" return value for vc-cvs-diff in the
case when the CVS repository is not accessed (i.e. when using plain
"diff" instead of "cvs diff").
*** vc-cvs.el.~1.93.~ Fri Nov 9 22:02:03 2007
--- vc-cvs.el Sun Nov 11 12:38:37 2007
***************
*** 515,526 ****
"Get a difference report using CVS between two revisions of FILE."
(let* ((async (and (not vc-disable-async-diff)
(vc-stay-local-p files)))
! (status (apply 'vc-cvs-command (or buffer "*vc-diff*")
! (if async 'async 1)
! files "diff"
! (and oldvers (concat "-r" oldvers))
! (and newvers (concat "-r" newvers))
! (vc-switches 'CVS 'diff))))
(if async 1 status))) ; async diff, pessimistic assumption
(defun vc-cvs-diff-tree (dir &optional rev1 rev2)
--- 515,554 ----
"Get a difference report using CVS between two revisions of FILE."
(let* ((async (and (not vc-disable-async-diff)
(vc-stay-local-p files)))
! (invoke-cvs-diff-list nil)
! status)
! ;; Look through the file list and see if any files have backups
! ;; that can be used to do a plain "diff" instead of "cvs diff".
! (dolist (file files)
! (let ((ov oldvers)
! (nv newvers))
! (when (or (not ov) (string-equal ov ""))
! (setq ov (vc-workfile-version file)))
! (when (string-equal nv "")
! (setq nv nil))
! (let ((file-oldvers (vc-version-backup-file file ov))
! (file-newvers (if (not nv)
! file
! (vc-version-backup-file file nv)))
! (coding-system-for-read (vc-coding-system-for-diff file)))
! (if (and file-oldvers file-newvers)
! (apply 'vc-do-command (or buffer "*vc-diff*") 1 "diff" nil
! (append (if (listp diff-switches)
! diff-switches
! (list diff-switches))
! (if (listp vc-diff-switches)
! vc-diff-switches
! (list vc-diff-switches))
! (list (file-relative-name file-oldvers)
! (file-relative-name file-newvers))))
! (push file invoke-cvs-diff-list)))))
! (when invoke-cvs-diff-list
! (setq status (apply 'vc-cvs-command (or buffer "*vc-diff*")
! (if async 'async 1)
! invoke-cvs-diff-list "diff"
! (and oldvers (concat "-r" oldvers))
! (and newvers (concat "-r" newvers))
! (vc-switches 'CVS 'diff))))
(if async 1 status))) ; async diff, pessimistic assumption
(defun vc-cvs-diff-tree (dir &optional rev1 rev2)