Skip to content

Commit

Permalink
Item10307: Save with no rcs file must be new rev
Browse files Browse the repository at this point in the history
Checking this into trunk for now until CDot and/or Sven verify that it
is safe.  This appears to fix the issue with "first save" being
aggregated into rev 1 of a topic.

git-svn-id: http://svn.foswiki.org/branches/Release01x01@10859 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed Feb 28, 2011
1 parent 279f372 commit a637256
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions core/lib/Foswiki/Store/VC/Handler.pm
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ Get an iterator over the identifiers of revisions. Returns the most
recent revision first.
The default is to return an iterator from the current version number
down to 1.
down to 1. Return rev 0 if the file exists without history.
=cut

Expand All @@ -265,7 +265,7 @@ sub getRevisionHistory {
ASSERT( $this->{file} ) if DEBUG;
unless ( -e $this->{rcsFile} ) {
if ( -e $this->{file} ) {
return new Foswiki::ListIterator( [1] );
return new Foswiki::ListIterator( [0] );
}
else {
return new Foswiki::ListIterator( [] );
Expand Down Expand Up @@ -298,11 +298,15 @@ Get the ID of the next (as yet uncreated) revision. The handler is required
to implement this because the store has to be able to embed the revision
ID into TOPICINFO before the revision is actually created.
If the file exists without revisions, then rev 1 does exist, so next rev
should be rev 2, not rev 1, so the first change with missing history
doesn't get merged into rev 1.
=cut

sub getNextRevisionID {
my $this = shift;
return ( $this->numRevisions() || 0 ) + 1;
return ( $this->numRevisions() || ( ( -e $this->{file} ) ? 1 : 0 ) ) + 1 ;
}

=begin TML
Expand Down

0 comments on commit a637256

Please sign in to comment.