-1

I made some changes in my local copy without commit. Now I want to find the last date of modification of local copy. Can you please help me which command should be used.

1 Answers1

0

Any answer is highly dependent on the working environment (not identified in the question). CVS itself does not offer this functionality per se, though it can support a solution that leverages the status of a checkout.

If one assumes use of a GNU/Linux, or similar shell environment, one might create a script that examines only the files that CVS recognizes as locally modified, uncommitted, or not added. The following solution is environment dependent and rather awkward, but does illustrate the concept.

A sample shell session might look like this:

$ cvs -nq update 2>/dev/null \
> | awk '/^[M?]/ { system(sprintf("stat \"%s\"", $2)) }' - \
> | grep ^Modify: \
> | sort \
> | tail -1
Modify: 2016-04-27 10:22:35.000000000 -0500

This command sequence is run at the top of the checkout so the results include all sub-directories within it.

The cvs -nq update 2</dev/null command generates a relatively terse report of file status. It only reports locally modified or uncommitted new files, unknown files, and files that have been updated upstream.

The 2>/dev/null suppresses uninteresting stderr output of the cvs command.

The awk statement uses a regular expression to match only the locally added and locally modified files in the work space. It then extracts the relative path to the file and performs a stat operation to get modification time of each file.

The grep statement discards uninteresting output of the stat command.

A sort command orders the output modification times from oldest to newest, and tail -1 shows only the most recent modification time.

The most recent CVS-recognized "change" to the checkout is in the result and follows the word "Modify:".

kbulgrien
  • 4,384
  • 2
  • 26
  • 43