Bug 11126 - [resources] API: Setting file time stamp
Summary: [resources] API: Setting file time stamp
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P2 enhancement (vote)
Target Milestone: 3.0 M4   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
: 16551 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-03-11 15:37 EST by Jeff Brown CLA
Modified: 2003-09-18 14:04 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Brown CLA 2002-03-11 15:37:02 EST
VCM needs a Core-supported way of getting / setting the
file's modification stamp in order to be compatible with
the CVS command-line client's mechanism for determining
if files are dirty (have been changed since last checkout).

Current workaround is to obtain an instance of a java.io.File
and use lastModified() / setLastModified().  In the case of
setLastModified() we follow-up the request with a refreshLocal
to avoid resource out of sync errors.
Comment 1 John Arthorne CLA 2002-04-11 11:00:25 EDT
Using java.io.File for this is probably the right solution.  The timestamp that 
we store is not necessarily the same as the one on disk.
Comment 2 Jeff Brown CLA 2002-04-11 13:02:12 EDT
By changing the modification stamp on disk ourselves, we potentially
make the resource tree out-of-sync since the modification stamp is
derived from the timestamp on disk.  The idiom ends up being something
like:
  setLastModified(...)
  refreshLocal(... IResource.DEPTH_ZERO)
  actualTime = lastModified(...)

A core-supported mechanism could perhaps handle this more efficiently,
or at the very least eliminate the refreshLocal.
Comment 3 John Arthorne CLA 2002-05-21 09:48:18 EDT
*** Bug 16551 has been marked as a duplicate of this bug. ***
Comment 4 DJ Houghton CLA 2002-06-05 13:03:42 EDT
Deferring until post 2.0.
Will investigate then to see if this is still necessary.
Comment 5 DJ Houghton CLA 2002-09-10 12:20:04 EDT
Reopening for consideration.
Comment 6 DJ Houghton CLA 2002-09-20 14:19:32 EDT
Adding KM to CC list.
Is this still a requirement?
Comment 7 Kevin McGuire CLA 2002-09-20 15:33:22 EDT
Yes!  There are two issues:

1- Going through the java.io.File API, then forcing refreshFromLocal, is 
expensive.  My understanding is that Core has a faster mechanism for setting 
file timestamps.

2- Going through java.io.File to get the timestamp is expensive, and feels 
needless since I believe Core caches one.  We do this extensively to determine 
dirty state for decorators and spend a considerable amount of decorator time 
doing so.
 
Re, John's comments
>>The timestamp that we store is not necessarily the same as the one on disk.

I don't understand why this is.

Note that the modification indicator on IFile is weak and basically of no use 
to VCM since it doesn't answer our question "Is this file the same as the one 
we got?".

We need:
- a way to set the time on the file when we get it from the server
- a way to compare the current file time with the one stored
- accomodate external modification of files, and use of the CVS command line
Comment 8 Jean-Michel Lemieux CLA 2003-09-15 13:32:08 EDT
I've just profiled the CVS plugin and again noticed that the get/set timestamp
methods are slowing down most CVS operations. Especially the fact that we have
to perform a refreshLocal() after calling java.io.File.setLastModified().

Could this be considered for 3.0?
Comment 9 John Arthorne CLA 2003-09-18 14:04:30 EDT
Done.  Added and released methods IResource.getLocalTimeStamp and
IResource.setLocalTimeStamp.  Please let me know if this API is sufficient.