[PATCH 06 of 17] rebase: use nullrev instead of -1

Mads Kiilerich mads at kiilerich.com
Mon Dec 1 07:24:00 CST 2014


On 12/01/2014 08:13 AM, Pierre-Yves David wrote:
>
>
> On 11/30/2014 11:08 AM, Mads Kiilerich wrote:
>> # HG changeset patch
>> # User Mads Kiilerich <madski at unity3d.com>
>> # Date 1417374421 -3600
>> #      Sun Nov 30 20:07:01 2014 +0100
>> # Node ID 09fe6c1db24cc0c3fd3dceae4063c0a8dcbd11a5
>> # Parent  0cff65a0d024e31284ff6eb804ed4ac65f628a6e
>> rebase: use nullrev instead of -1
>
> irk!
>
> Using constant is good. Using unrelated constant because they happen 
> to have the same value is wrong.

The code already use the nullrev constant:
http://selenic.com/hg/file/b913c394386f/hgext/rebase.py#l783
http://selenic.com/hg/file/b913c394386f/hgext/rebase.py#l810
http://selenic.com/hg/file/b913c394386f/hgext/rebase.py#l875

I do not disagree that it probably would be better to use a different 
constant (and preferably a different value). The scope if this change is 
however just consistent use of the existing, not to introduce something new.

/Mads


More information about the Mercurial-devel mailing list