You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Nathan Sharp <sp...@phoenix-int.com> on 2004/03/29 02:32:59 UTC

Minor off-by-one in the Book (merging -r406:HEAD should be r405:HEAD)

Unless I've gone completely bonkers I believe I've found an off-by-one 
in the book.  In the chapter on branching and merging (4), it talks 
about how to merge a branch that already had been merged.  It has you 
look up your previous merge in the log file and see that you did 
r341:405.  Then, it says you should therefore do r406:HEAD to get the 
rest of the branch.  This will, however, leave out any changes made in 
version 406 itself.  The correct thing to use would be r405:HEAD.

$ echo "r26 line" >>bla.txt
$ svn commit -m "added a line for r26"
Sending        bla.txt
Transmitting file data .
Committed revision 26.
$ echo "r27 line" >>bla.txt
$ svn commit -m "added a line for r27"
Sending        bla.txt
Transmitting file data .
Committed revision 27.

...  more commits

$ svn diff -r25:26
Index: bla.txt
===================================================================
--- bla.txt     (revision 25)
+++ bla.txt     (revision 26)
@@ -1,2 +1,3 @@
 new file
 
+r26 line

$ svn diff -r27:HEAD
Index: bla.txt
===================================================================
--- bla.txt     (revision 27)
+++ bla.txt     (revision 29)
@@ -2,3 +2,5 @@
 
 r26 line
 r27 line
+more stuff
+another commit


Notice that the r27 line is not included to be added in the patch.


  Nathan


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Minor off-by-one in the Book (merging -r406:HEAD should be r405:HEAD)

Posted by Julian Foad <ju...@btopenworld.com>.
Nathan Sharp wrote:
> I still would argue that it is easy enough for a newbie to commit an 
> off-by-one error with regards to revision numbers that it is worthwhile 
> to be absolutely correct in the documentation, even if the less accurate 
> value still "works".

In the particular example that you are commenting on, where r406 is the first merge, I don't think that the given "r406:something" is "less accurate" than "r405:" would be, but rather is the more correct alternative.  When performing the second merge, the first merge is not one of the changes that you want to include in the second merge.  If, however, there is or were to be an example of merging two contiguous sets of historical revisions, then of course "rX:Y" and "rY:Z" would be necessary.

I agree that it is easy for a newbie to commit an off-by-one error with regards to revision numbers because of the confusion between "the changes made between revision X and revision Y" and "the changes that created revision X, up to and including the changes that created revision Y".  Both of these meanings are expressed by the same syntax "rX:Y" in different commands.  The former meaning is how "diff" and "merge" interpret their argument, and the latter is how "log" and "blame" behave.  Perhaps we should use different syntaxes for the different meanings (such as "rX-Y" for the former and "rX:Y" for the latter).

I would argue that this semantic distinction needs to be explained clearly in the book, early on.  I haven't checked recently to see whether it is explained adequately.  If you would like to check and write a patch, that would be grand.

- Julian


> Julian Foad wrote:
> 
>> You are right that any changes made in r406 will not be included in 
>> the second merge, but in this particular example r406 was the merge of 
>> branch changes into the trunk, so r406 did not make any changes to the 
>> branch itself, so it is perfectly OK.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Minor off-by-one in the Book (merging -r406:HEAD should be r405:HEAD)

Posted by Nathan Sharp <sp...@phoenix-int.com>.
I still would argue that it is easy enough for a newbie to commit an 
off-by-one error with regards to revision numbers that it is worthwhile 
to be absolutely correct in the documentation, even if the less accurate 
value still "works". 

  - Nathan

Julian Foad wrote:

>
> You are right that any changes made in r406 will not be included in 
> the second merge, but in this particular example r406 was the merge of 
> branch changes into the trunk, so r406 did not make any changes to the 
> branch itself, so it is perfectly OK.
>
> - Julian


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Minor off-by-one in the Book (merging -r406:HEAD should be r405:HEAD)

Posted by Julian Foad <ju...@btopenworld.com>.
Nathan Sharp wrote:
> Unless I've gone completely bonkers I believe I've found an off-by-one 
> in the book.  In the chapter on branching and merging (4), it talks 
> about how to merge a branch that already had been merged.  It has you 
> look up your previous merge in the log file and see that you did 
> r341:405.  Then, it says you should therefore do r406:HEAD to get the 
> rest of the branch.  This will, however, leave out any changes made in 
> version 406 itself.  The correct thing to use would be r405:HEAD.

You are right that any changes made in r406 will not be included in the second merge, but in this particular example r406 was the merge of branch changes into the trunk, so r406 did not make any changes to the branch itself, so it is perfectly OK.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org