[PATCH 5 of 5] cleanup: replace False identity testing with an explicit token object

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed May 11 10:17:29 EDT 2016



On 05/11/2016 04:04 PM, Augie Fackler wrote:
>> On May 11, 2016, at 09:34, Pierre-Yves David <pierre-yves.david at ens-lyon.org> wrote:
>>
>>> (I’ll probably still take this patch, but want to continue this discussion.)
>> That patch is not related to these dirstate.write(None) call in localrepo I'm repo._phasecache.invalidate(not sure why this discussion would delay them.
>> (discussion in itself it useful, but unrelated)
> It's related in my mind, because I was having a lot of trouble understanding why we're using a sentinel object instead of just requiring callers to always pass a transaction. Now that I understand, this patch is a strict improvement (so I'll take it), but there's still some work to be done to make this a clean API (which I'll probably do sometime this week.)

The sentinel object is here for deprecation purpose, the argument will 
become mandatory after 3.9.

Your last statement is a bit confusing to me, especially I'm not sure 
what you find "unclear" in the current API. Here is a wide explanation 
of the situation as an attempt to clarify.

None is valid value and will remain a valid value because dirstate 
change do not requires a transaction. They just have to collaborate with 
one if present. For example `hg update` or `hg add` do not use a 
transaction. As you pointed out in your previous email, there is also 
case around the transaction code that explicitly call the write with 
None because it is the transaction code dirstate is collaborating with, 
so it is supposed to know what it is doing.

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list