[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Annotate of Log output wrong
From: |
Ming Kin Lai |
Subject: |
Annotate of Log output wrong |
Date: |
Mon, 11 Jul 2005 23:15:31 -0700 |
This is to continue the discussion of the thread with the same subject that
started on Dec 7, 2004.
The original discussion appeared to focus on the expansion of the $Log$
keyword both in the file and as output by the "cvs annotate" command (under
version 1.11.17); but I think other keywords such as $Id$ have the same
problem. I am running CVS version 1.11.6 on Solaris. After I committed a
file that contains some keywords, (I did not perform a checkout or update
after that,) the file in my working directory shows the following:
$Id: compiler.c,v 1.3 2005/07/12 03:10:28 mingl Exp $
this is $Date: 2005/07/12 03:10:28 $
$Log: compiler.c,v $
Revision 1.3 2005/07/12 03:10:28 mingl
this is my log ha ha ha
Revision 1.2 2005/07/12 02:32:17 mingl
third commit
Revision 1.1.1.1 2005/07/07 00:05:26 mingl
init import
And I ran "cvs annotate' which output:
Annotations for compiler.c
***************
1.3 (mingl 12-Jul-05): $Id: compiler.c,v 1.2 2005/07/12 02:32:17
mingl Exp $
1.3 (mingl 12-Jul-05): this is $Date: 2005/07/12 02:32:17 $
1.2 (mingl 12-Jul-05): $Log: compiler.c,v $
1.3 (mingl 12-Jul-05): Revision 1.2 2005/07/12 02:32:17 mingl
1.3 (mingl 12-Jul-05): third commit
1.3 (mingl 12-Jul-05):
1.2 (mingl 12-Jul-05): Revision 1.1.1.1 2005/07/07 00:05:26
mingl
1.2 (mingl 12-Jul-05): init import
From the leftmost column, it is obvious that the latest revision is 1.3;
however, the keywords expand to only revision 1.2.
1. Todd Denniston states that "If I Recall Correctly, $Log:$ is expanded on
checkout, so the last
(chronological) log entry seen in a Log in a sandbox has not yet been
checked into CVS. Therefore, the repository knows nothing about it, and can
not annotate what to it does not exist." (Larry Jones says similar thing:
"the $Log$ keyword (not command) is expanded
by checkout/update".) I think the first half of the sentence is inaccurate:
apparently the keywords are expanded (in the working file) upon commitment
(check-in), i.e. no subsequent checkout is needed. (What Todd probably
meant is: $Log$ is expanded in the ,v file on checkout. - But see my Points
2 and 3 below.) And I think "check in" and "check out" should not be
confused. ci and co are two separate commands, aren't they? The keywords
are expanded in the working file on checkin, not checkout. In fact, Section
12 of the cederqvist 1.11.20 manual states " Embedded strings of the form
$keyword$ ... in a file are replaced ... whenever you obtain a new revision
of the file." The way I interpret the phase "whenever you obtain a new
revision of the file" is "in a working file that has a new revision number".
So, when you commit, you obtain a new revision. You don't need to check
out to obtain a new revision. Now, what "annotate" shows is another
question. Section A.7.1 of cederqvist says "[annotate] print[s] the head
revision of the trunk, together with information on the last modification
for each line". I will discuss that in Point 4.
2. Jim Hyslop says "I just created a test file with the $Log$ keyword and
examined the ,v file.
The information in there supports what you (i.e. Todd) just said." Well, I
looked at the ,v file, which has the folowing:
1.3
log
@this is my log ha ha ha
@
text
@$Id: compiler.c,v 1.2 2005/07/12 02:32:17 mingl Exp $
this is $Date: 2005/07/12 02:32:17 $
this is a file
$Log: compiler.c,v $
Revision 1.2 2005/07/12 02:32:17 mingl
third commit
Revision 1.1.1.1 2005/07/07 00:05:26 mingl
init import
This is really the last line I added on Monday....
@
So, indeed, the keywords are not expanded to reflect the latest
modification. However, in Section 12 of cederqvist the word "files" refer
to files in the working directory, not in the repository. Keyword
substition in the ,v files is undefined in cederqvist. Hence, I don't think
it is appropriate to look at the ,v files in the repository to understand
the behavior of keyword substitution. It is confusing to talk about keyword
expansion in the repository files.
3. Todd says "the log entry not yet been checked into CVS". I think that is
the implementation detail that users should not be concerned with. From
users' perspective, all cederqvist in effect says is "After a local file
with a keyword is checked in, the keyword in that file is expanded to
reflect the new revision information." Maybe Todd knows that the keyword is
actually not expanded in the ,v file at the time of the check-in so the ,v
file does not have the keyword expanded to reflect the new revision
information. But I am hesistant to use some undocumented implementation
details, rather than cederqvist, to explain the program behavior.
4. cederqvist says annotate should print the last modification on each line
(Sec A.7.1). It does not say whether the modification is in respect to the
local file or the ,v file. Neither does it say what "modification" means in
respect to keyword. The user does not really "modify" the line that has the
keyword. It is the CVS system that "modifies" it by expanding the keyword.
And apparently the local file is "modified" (in the sense the new revision
information is reflected) as the user sees it. On the other hand, the ,v
file is not "modified" (but because cederqvist is silent on that, it can be
changed in future release). Nevertheless, cederqvist is talking about each
line in the "source file" (i.e. the local file) not the ,v file - annotate
is not printing revision info on each line of the ,v file, it prints
revision info on each line of the source file. So I guess it is reasonable
to assume that he modification is in respect to the source file. As it
meets the eyes of the user, the source file contains a line that is
different from the last version of the source file, that in my opinion would
constitute a "modification." The user may not even know how keyword
substitution works. He just checks out a copy from the repository that has
a line "$Date: 2005/07/12 02:32:17 $ in it, and after he modifies and
commits, he finds out the line changes to $Date: 2005/07/12 03:10:28 $. To
him, that is a modification alright. And since annotate prints out
"information on the last modification for each line", he should reasonably
expect 03:10:28 be printed. Therefore I think the actual behavior of the
annotate command is inconsistent with what is described in the manual.
Either the program or the documentation has a bug.
5. Larry Jones says "the $Log$ keyword (not command) is expanded by
checkout/update".
For the record, the annotate output is not affected by update:
address@hidden cvs update
cvs update: Updating .
address@hidden cvs annotate
Annotations for compiler.c
***************
1.3 (mingl 12-Jul-05): $Id: compiler.c,v 1.2 2005/07/12 02:32:17
mingl Exp $
1.3 (mingl 12-Jul-05): this is $Date: 2005/07/12 02:32:17 $
1.2 (mingl 12-Jul-05): $Log: compiler.c,v $
1.3 (mingl 12-Jul-05): Revision 1.2 2005/07/12 02:32:17 mingl
1.3 (mingl 12-Jul-05): third commit
1.3 (mingl 12-Jul-05):
1.2 (mingl 12-Jul-05): Revision 1.1.1.1 2005/07/07 00:05:26
mingl
1.2 (mingl 12-Jul-05): init import
The update command does NOT do keyword expansion in the ,v file:
1.3
log
@this is my log ha ha ha
@
text
@$Id: compiler.c,v 1.2 2005/07/12 02:32:17 mingl Exp $
this is $Date: 2005/07/12 02:32:17 $
this is a file
$Log: compiler.c,v $
Revision 1.2 2005/07/12 02:32:17 mingl
third commit
A "cvs checkout" does not reflect the new revision info either.
- Ming Kin Lai
_________________________________________________________________
Dont just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
- Annotate of Log output wrong,
Ming Kin Lai <=