bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#694: 23.0.60; wrong behaviour of vc-workfile-unchanged-p


From: Alex Harsanyi
Subject: bug#694: 23.0.60; wrong behaviour of vc-workfile-unchanged-p
Date: Mon, 11 Aug 2008 18:24:43 +0800

(I posted this on emacs-devel in December 2007, the problem is still present
in the latest CVS version)

When calling `vc-next-action' (C-x v v) on a file which has no changes, vc.el will revert to the master version for RCS or say that the file is up to date
for CVS.  Unfortunately, this does not work corectly when the file is
unchanged but its timestamp is more recent than the checkout time. Consider
this scenario:

 1/ Create a new file and register it with RCS

 2/ Checkout the file (C-x v v).

3/ Type C-x v v again. Emacs will revert to the master version, since the
 file is unchanged.

4/ Modify the file, save it, undo the changes and save it again. This will have the effect that the file will have the same contents as when checked
 out but a more recent modification time.

5/ Type C-x v v again. Emacs will pop-up the VC-Log buffer and checkin the
 file.

The problem seems to be in `vc-workfile-unchanged-p': if the checkout time is available for a file, it is compared against the modification time and the "unchanged " decision is made on that alone, without consulting the backed
specific function (vc-rcs-workfile-unchanged-p or
vc-default-workfile-unchanged-p)

I believe vc-workfile-unchanged-p and if the two timestamsps are the same, it can conclude that the file is unchanged, but if the timestamps are different,
it should call the backend specific workfile-unchanged-p function.

The following patch is one way to fix the problem:

--- vc-hooks.el.~1.261.~        2008-07-25 17:08:10.000000000 +0800
+++ vc-hooks.el 2008-08-11 18:22:04.000000000 +0800
@@ -561,8 +561,9 @@ and does not employ any heuristic at all
         (lastmod (nth 5 (file-attributes file))))
     (if (and checkout-time
;; Tramp and Ange-FTP return this when they don't know the time.
-             (not (equal lastmod '(0 0))))
-        (equal checkout-time lastmod)
+             (not (equal lastmod '(0 0)))
+             (equal checkout-time lastmod))
+        t
       (let ((unchanged (vc-call workfile-unchanged-p file)))
(vc-file-setprop file 'vc-checkout-time (if unchanged lastmod 0))
         unchanged))))

Best Regards,
Alex.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]