unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* vc-revert-hook?
@ 2008-05-07  9:12 Marshall, Simon
  2008-05-07 18:29 ` vc-revert-hook? Dan Nicolaescu
  0 siblings, 1 reply; 12+ messages in thread
From: Marshall, Simon @ 2008-05-07  9:12 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1942 bytes --]

Some time ago, vc.el used to have a vc-revert-hook.  I used it to cause
a subsequent recompilation - of a modified source file that I had then
reverted via C-x v u (AKA M-x vc-revert-buffer) - by touching the source
file:

  (add-hook 'vc-revert-hook
	    (lambda ()
	      (shell-command (concat "touch " buffer-file-name))))

Without this, CVS (my backend VCS) or vc.el would leave the reverted
source file with the timestamp of the reverted revision, ie, older than
the modified file, and a dependency-based recompilation would be fooled
into thinking that the source file's compiled object file was
up-to-date.

Possibly this wasn't the best way of solving this problem even then.
However, it's not available anymore.

Would this hook be a good feature to put back in or is there a better
way to solve this particular problem?

Simon.



 "Misys" is the trade name for Misys plc (registered in England and Wales). Registration Number: 01360027. Registered office: Burleigh House, Chapel Oak, Salford Priors, Evesham WR11 8SP. For a list of Misys group operating companies please go to http://www.misys.com/html/about_us/group_operating_companies/. This email and any attachments have been scanned for known viruses using multiple scanners. 
 
We believe that this email and any attachments are virus free, however the recipient must take full responsibility for virus checking. This email message is intended for the named recipient only. It may be privileged and/or confidential. If you are not the named recipient of this email please notify us immediately and do not copy it or use it for any purpose, nor disclose its contents to any other person. This email does not constitute the commencement of legal relations between you and Misys plc. Please refer to the executed contract between you and the relevant member of the Misys group for the identity of the contracting party with which you are dealing. 

[-- Attachment #2: Type: text/html, Size: 5283 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: vc-revert-hook?
  2008-05-07  9:12 vc-revert-hook? Marshall, Simon
@ 2008-05-07 18:29 ` Dan Nicolaescu
  2008-05-08  8:09   ` vc-revert-hook? Marshall, Simon
  0 siblings, 1 reply; 12+ messages in thread
From: Dan Nicolaescu @ 2008-05-07 18:29 UTC (permalink / raw)
  To: Marshall, Simon; +Cc: emacs-devel

"Marshall, Simon" <Simon.Marshall@misys.com> writes:

  > Some time ago, vc.el used to have a vc-revert-hook.  I used it to cause a

Can you point out the version, or the exact name of the hook, a search
vc-revert-hook comes out empty...

  > subsequent recompilation - of a modified source file that I had then reverted
  > via C-x v u (AKA M-x vc-revert-buffer) - by touching the source file:
  > 
  >   (add-hook 'vc-revert-hook
  >             (lambda ()
  >               (shell-command (concat "touch " buffer-file-name))))
  > 
  > Without this, CVS (my backend VCS) or vc.el would leave the reverted source
  > file with the timestamp of the reverted revision, ie, older than the modified
  > file, and a dependency-based recompilation would be fooled into thinking that
  > the source file's compiled object file was up-to-date.

Are you sure?  A quick experiment showed that and after C-x v u the file
on disk had the time stamp set to the current time...
Can you replicate the problem with emacs -Q?




^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: vc-revert-hook?
  2008-05-07 18:29 ` vc-revert-hook? Dan Nicolaescu
@ 2008-05-08  8:09   ` Marshall, Simon
  2008-05-08 15:51     ` vc-revert-hook? Dan Nicolaescu
  0 siblings, 1 reply; 12+ messages in thread
From: Marshall, Simon @ 2008-05-08  8:09 UTC (permalink / raw)
  To: dann; +Cc: Andre Spiegel, emacs-devel

>   > Some time ago, vc.el used to have a vc-revert-hook.  I used it to
cause a
> 
> Can you point out the version, or the exact name of the hook, a search
> vc-revert-hook comes out empty...

Hi Dan, sorry, my bad.  Looking through some archives, it seems I had a
conversation with Andre Spiegel in 2003, when I suggested adding it.  I
had a hacked version of vc.el to try it out, but it seems we didn't
follow it to its conclusion and it didn't get put in emacs itself.

>   > subsequent recompilation - of a modified source file that I had
then reverted
>   > via C-x v u (AKA M-x vc-revert-buffer) - by touching the source
file:
>   > 
>   >   (add-hook 'vc-revert-hook
>   >             (lambda ()
>   >               (shell-command (concat "touch " buffer-file-name))))
>   > 
>   > Without this, CVS (my backend VCS) or vc.el would leave the
reverted source
>   > file with the timestamp of the reverted revision, ie, older than
the modified
>   > file, and a dependency-based recompilation would be fooled into
thinking that
>   > the source file's compiled object file was up-to-date.
> 
> Are you sure?  A quick experiment showed that and after C-x v u the
file
> on disk had the time stamp set to the current time...
> Can you replicate the problem with emacs -Q?

Sure, with CVS:

risksun2 104> ls -l Makefile 
-r--r--r--   1 marshals gcms         707 May  2 11:33 Makefile
risksun2 105> pemacs -Q Makefile&
[1] 12298

Where pemacs is my 22.2 + patches to cc-mode from Alan.
In emacs, do C-x v v on Makefile, edit, save and:

risksun2 106> ls -l Makefile
-rw-r--r--   1 marshals gcms         708 May  8 08:50 Makefile

No surprise there.
In emacs, do C-x v u on Makefile, confirm and:

risksun2 107> ls -l Makefile
-r--r--r--   1 marshals gcms         707 May  2 11:33 Makefile

As you can see, the original timestamp is restored on reversion.

risksun2 108> env|grep CVS
CVSROOT=/repo/cvs
CVSREAD=read-only
risksun2 109> cvs -v

Concurrent Versions System (CVS) 1.12.9 (client/server)

Copyright (c) 1989-2004 Brian Berliner, david d `zoo' zuhn,
                        Jeff Polk, and other authors

CVS may be copied only under the terms of the GNU General Public
License,
a copy of which can be found with the CVS distribution kit.

Specify the --help option for further information about CVS
risksun2 110> 

I verified that unsetting CVSREAD made no difference.

Does this help?  Thanks, Simon.


 "Misys" is the trade name for Misys plc (registered in England and Wales). Registration Number: 01360027. Registered office: Burleigh House, Chapel Oak, Salford Priors, Evesham WR11 8SP. For a list of Misys group operating companies please go to http://www.misys.com/html/about_us/group_operating_companies/. This email and any attachments have been scanned for known viruses using multiple scanners. 
 
We believe that this email and any attachments are virus free, however the recipient must take full responsibility for virus checking. This email message is intended for the named recipient only. It may be privileged and/or confidential. If you are not the named recipient of this email please notify us immediately and do not copy it or use it for any purpose, nor disclose its contents to any other person. This email does not constitute the commencement of legal relations between you and Misys plc. Please refer to the executed contract between you and the relevant member of the Misys group for the identity of the contracting party with which you are dealing. 




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: vc-revert-hook?
  2008-05-08  8:09   ` vc-revert-hook? Marshall, Simon
@ 2008-05-08 15:51     ` Dan Nicolaescu
  2008-05-08 19:16       ` vc-revert-hook? Marshall, Simon
  0 siblings, 1 reply; 12+ messages in thread
From: Dan Nicolaescu @ 2008-05-08 15:51 UTC (permalink / raw)
  To: Marshall, Simon; +Cc: Andre Spiegel, emacs-devel

"Marshall, Simon" <Simon.Marshall@misys.com> writes:

  > >   > Without this, CVS (my backend VCS) or vc.el would leave the
  > reverted source
  > >   > file with the timestamp of the reverted revision, ie, older than
  > the modified
  > >   > file, and a dependency-based recompilation would be fooled into
  > thinking that
  > >   > the source file's compiled object file was up-to-date.
  > > 
  > > Are you sure?  A quick experiment showed that and after C-x v u the
  > file
  > > on disk had the time stamp set to the current time...
  > > Can you replicate the problem with emacs -Q?
  > 
  > Sure, with CVS:
  > 
  > risksun2 104> ls -l Makefile 
  > -r--r--r--   1 marshals gcms         707 May  2 11:33 Makefile
  > risksun2 105> pemacs -Q Makefile&
  > [1] 12298
  > 
  > Where pemacs is my 22.2 + patches to cc-mode from Alan.
  > In emacs, do C-x v v on Makefile, edit, save and:
  > 
  > risksun2 106> ls -l Makefile
  > -rw-r--r--   1 marshals gcms         708 May  8 08:50 Makefile
  > 
  > No surprise there.
  > In emacs, do C-x v u on Makefile, confirm and:
  > 
  > risksun2 107> ls -l Makefile
  > -r--r--r--   1 marshals gcms         707 May  2 11:33 Makefile
  > 
  > As you can see, the original timestamp is restored on reversion.
  > 
  > risksun2 108> env|grep CVS
  > CVSROOT=/repo/cvs
  > CVSREAD=read-only
  > risksun2 109> cvs -v

I followed the same steps and for me the time stamp got set to the
current time after revert.  The only difference is the cvs version:
 cvs -v

Concurrent Versions System (CVS) 1.11.22 (client/server)

Copyright (C) 2006 Free Software Foundation, Inc.

This is what comes by default with Fedora 8.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: vc-revert-hook?
  2008-05-08 15:51     ` vc-revert-hook? Dan Nicolaescu
@ 2008-05-08 19:16       ` Marshall, Simon
  2008-05-09  1:09         ` vc-revert-hook? Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Marshall, Simon @ 2008-05-08 19:16 UTC (permalink / raw)
  To: dann; +Cc: Andre Spiegel, emacs-devel

> I followed the same steps and for me the time stamp got set to the
> current time after revert.  The only difference is the cvs version:
>  cvs -v
> 
> Concurrent Versions System (CVS) 1.11.22 (client/server)
> 
> Copyright (C) 2006 Free Software Foundation, Inc.
> 
> This is what comes by default with Fedora 8.

I get the timestamp of the original on Solaris-8/cvs-1.12.9,
RHEL-5/cvs-1.12.12 and Ubuntu-8.04/cvs-1.12.13.  I can reproduce it
without emacs, just by doing "cvs edit Makefile; touch Makefile; cvs
unedit Makefile".

I notice that the timestamp is stored in CVS/Entries.  It looks like the
timestamp my working copy was last updated or checked in.  I guess that
is where cvs is getting it from, because the timestamp is not of the
revision in the repository itself.  I don't recall doing anything
unusual when I set up the repository.

Can anyone else reproduce this?

Even if not, wouldn't a vc-revert-hook be a good idea?

Simon.


 "Misys" is the trade name for Misys plc (registered in England and Wales). Registration Number: 01360027. Registered office: Burleigh House, Chapel Oak, Salford Priors, Evesham WR11 8SP. For a list of Misys group operating companies please go to http://www.misys.com/html/about_us/group_operating_companies/. This email and any attachments have been scanned for known viruses using multiple scanners. 
 
We believe that this email and any attachments are virus free, however the recipient must take full responsibility for virus checking. This email message is intended for the named recipient only. It may be privileged and/or confidential. If you are not the named recipient of this email please notify us immediately and do not copy it or use it for any purpose, nor disclose its contents to any other person. This email does not constitute the commencement of legal relations between you and Misys plc. Please refer to the executed contract between you and the relevant member of the Misys group for the identity of the contracting party with which you are dealing. 




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: vc-revert-hook?
  2008-05-08 19:16       ` vc-revert-hook? Marshall, Simon
@ 2008-05-09  1:09         ` Stefan Monnier
  2008-05-12 10:14           ` vc-revert-hook? Marshall, Simon
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2008-05-09  1:09 UTC (permalink / raw)
  To: Marshall, Simon; +Cc: dann, Andre Spiegel, emacs-devel

> I get the timestamp of the original on Solaris-8/cvs-1.12.9,
> RHEL-5/cvs-1.12.12 and Ubuntu-8.04/cvs-1.12.13.  I can reproduce it
> without emacs, just by doing "cvs edit Makefile; touch Makefile; cvs
> unedit Makefile".

edit/unedit will save files into and restore them from CVS/Base, which
is probably why you end up seeing the same timestamp.


        Stefan




^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: vc-revert-hook?
  2008-05-09  1:09         ` vc-revert-hook? Stefan Monnier
@ 2008-05-12 10:14           ` Marshall, Simon
  2008-05-12 14:33             ` vc-revert-hook? Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Marshall, Simon @ 2008-05-12 10:14 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: dann, Andre Spiegel, emacs-devel

> > I get the timestamp of the original on Solaris-8/cvs-1.12.9,
> > RHEL-5/cvs-1.12.12 and Ubuntu-8.04/cvs-1.12.13.  I can reproduce it
> > without emacs, just by doing "cvs edit Makefile; touch Makefile; cvs
> > unedit Makefile".
> 
> edit/unedit will save files into and restore them from CVS/Base, which
> is probably why you end up seeing the same timestamp.

OK, thanks.  Would vc-revert-hook be the right way to solve the
consequence of this, within emacs at least, or is there some other way?

Simon.


 "Misys" is the trade name for Misys plc (registered in England and Wales). Registration Number: 01360027. Registered office: Burleigh House, Chapel Oak, Salford Priors, Evesham WR11 8SP. For a list of Misys group operating companies please go to http://www.misys.com/html/about_us/group_operating_companies/. This email and any attachments have been scanned for known viruses using multiple scanners. 
 
We believe that this email and any attachments are virus free, however the recipient must take full responsibility for virus checking. This email message is intended for the named recipient only. It may be privileged and/or confidential. If you are not the named recipient of this email please notify us immediately and do not copy it or use it for any purpose, nor disclose its contents to any other person. This email does not constitute the commencement of legal relations between you and Misys plc. Please refer to the executed contract between you and the relevant member of the Misys group for the identity of the contracting party with which you are dealing. 




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: vc-revert-hook?
  2008-05-12 10:14           ` vc-revert-hook? Marshall, Simon
@ 2008-05-12 14:33             ` Stefan Monnier
  2008-05-12 16:18               ` vc-revert-hook? Marshall, Simon
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2008-05-12 14:33 UTC (permalink / raw)
  To: Marshall, Simon; +Cc: dann, Andre Spiegel, emacs-devel

>> edit/unedit will save files into and restore them from CVS/Base, which
>> is probably why you end up seeing the same timestamp.
> OK, thanks.  Would vc-revert-hook be the right way to solve the
> consequence of this, within Emacs at least, or is there some other way?

I don't know of any other way, tho I don't know vc-revert-hook either.


        Stefan




^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: vc-revert-hook?
  2008-05-12 14:33             ` vc-revert-hook? Stefan Monnier
@ 2008-05-12 16:18               ` Marshall, Simon
  2008-05-12 17:03                 ` vc-revert-hook? Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Marshall, Simon @ 2008-05-12 16:18 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: dann, Andre Spiegel, emacs-devel

> > OK, thanks.  Would vc-revert-hook be the right way to solve the
> > consequence of this, within Emacs at least, or is there some other
way?
> 
> I don't know of any other way, tho I don't know vc-revert-hook either.

I'm not sure what you mean here - vc-revert-hook does not exist.

Originally, I was suggesting that vc-revert-buffer run the new hook
vc-revert-hook, in the same way as vc-next-action runs vc-checkin-hook
or vc-checkout-hook.

WDYT?  Simon.


 "Misys" is the trade name for Misys plc (registered in England and Wales). Registration Number: 01360027. Registered office: Burleigh House, Chapel Oak, Salford Priors, Evesham WR11 8SP. For a list of Misys group operating companies please go to http://www.misys.com/html/about_us/group_operating_companies/. This email and any attachments have been scanned for known viruses using multiple scanners. 
 
We believe that this email and any attachments are virus free, however the recipient must take full responsibility for virus checking. This email message is intended for the named recipient only. It may be privileged and/or confidential. If you are not the named recipient of this email please notify us immediately and do not copy it or use it for any purpose, nor disclose its contents to any other person. This email does not constitute the commencement of legal relations between you and Misys plc. Please refer to the executed contract between you and the relevant member of the Misys group for the identity of the contracting party with which you are dealing. 




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: vc-revert-hook?
  2008-05-12 16:18               ` vc-revert-hook? Marshall, Simon
@ 2008-05-12 17:03                 ` Stefan Monnier
  2008-05-13  9:06                   ` vc-revert-hook? Marshall, Simon
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2008-05-12 17:03 UTC (permalink / raw)
  To: Marshall, Simon; +Cc: dann, Andre Spiegel, emacs-devel

>> > OK, thanks.  Would vc-revert-hook be the right way to solve the
>> > consequence of this, within Emacs at least, or is there some other way?
>> I don't know of any other way, tho I don't know vc-revert-hook either.
> I'm not sure what you mean here - vc-revert-hook does not exist.

That's exactly what I meant.

> Originally, I was suggesting that vc-revert-buffer run the new hook
> vc-revert-hook, in the same way as vc-next-action runs vc-checkin-hook
> or vc-checkout-hook.

Sounds OK.  Be careful to make it usable for filesets.  I.e. it'll
probably have to be a special hook taking the fileset as argument
(i.e. you can't call it vc-revert-hook but vc-revert-functions, or
maybe rather vc-after-revert-functions).


        Stefan





^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: vc-revert-hook?
  2008-05-12 17:03                 ` vc-revert-hook? Stefan Monnier
@ 2008-05-13  9:06                   ` Marshall, Simon
  2008-05-13 14:19                     ` vc-revert-hook? Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Marshall, Simon @ 2008-05-13  9:06 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: dann, Andre Spiegel, emacs-devel

> > Originally, I was suggesting that vc-revert-buffer run the new hook
> > vc-revert-hook, in the same way as vc-next-action runs
vc-checkin-hook
> > or vc-checkout-hook.
> 
> Sounds OK.  Be careful to make it usable for filesets.  I.e. it'll
> probably have to be a special hook taking the fileset as argument
> (i.e. you can't call it vc-revert-hook but vc-revert-functions, or
> maybe rather vc-after-revert-functions).

Sorry, I don't follow why it would be any different to vc-checkin-hook
or vc-checkout-hook...?  Or should they also operate on filesets?

Simon.


 "Misys" is the trade name for Misys plc (registered in England and Wales). Registration Number: 01360027. Registered office: Burleigh House, Chapel Oak, Salford Priors, Evesham WR11 8SP. For a list of Misys group operating companies please go to http://www.misys.com/html/about_us/group_operating_companies/. This email and any attachments have been scanned for known viruses using multiple scanners. 
 
We believe that this email and any attachments are virus free, however the recipient must take full responsibility for virus checking. This email message is intended for the named recipient only. It may be privileged and/or confidential. If you are not the named recipient of this email please notify us immediately and do not copy it or use it for any purpose, nor disclose its contents to any other person. This email does not constitute the commencement of legal relations between you and Misys plc. Please refer to the executed contract between you and the relevant member of the Misys group for the identity of the contracting party with which you are dealing. 




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: vc-revert-hook?
  2008-05-13  9:06                   ` vc-revert-hook? Marshall, Simon
@ 2008-05-13 14:19                     ` Stefan Monnier
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2008-05-13 14:19 UTC (permalink / raw)
  To: Marshall, Simon; +Cc: dann, Andre Spiegel, emacs-devel

>> > Originally, I was suggesting that vc-revert-buffer run the new hook
>> > vc-revert-hook, in the same way as vc-next-action runs vc-checkin-hook
>> > or vc-checkout-hook.
>> 
>> Sounds OK.  Be careful to make it usable for filesets.  I.e. it'll
>> probably have to be a special hook taking the fileset as argument
>> (i.e. you can't call it vc-revert-hook but vc-revert-functions, or
>> maybe rather vc-after-revert-functions).

> Sorry, I don't follow why it would be any different to vc-checkin-hook
> or vc-checkout-hook...?

I guess the main difference is that they were introduced long ago.

> Or should they also operate on filesets?

Yes,


        Stefan




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-05-13 14:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-07  9:12 vc-revert-hook? Marshall, Simon
2008-05-07 18:29 ` vc-revert-hook? Dan Nicolaescu
2008-05-08  8:09   ` vc-revert-hook? Marshall, Simon
2008-05-08 15:51     ` vc-revert-hook? Dan Nicolaescu
2008-05-08 19:16       ` vc-revert-hook? Marshall, Simon
2008-05-09  1:09         ` vc-revert-hook? Stefan Monnier
2008-05-12 10:14           ` vc-revert-hook? Marshall, Simon
2008-05-12 14:33             ` vc-revert-hook? Stefan Monnier
2008-05-12 16:18               ` vc-revert-hook? Marshall, Simon
2008-05-12 17:03                 ` vc-revert-hook? Stefan Monnier
2008-05-13  9:06                   ` vc-revert-hook? Marshall, Simon
2008-05-13 14:19                     ` vc-revert-hook? Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).