[PATCH 2 of 5 STABLE] transaction: separate calculating TXNID from creating transaction object

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue May 19 17:26:39 CDT 2015



On 05/19/2015 10:39 AM, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1432049572 -32400
> #      Wed May 20 00:32:52 2015 +0900
> # Branch stable
> # Node ID ae2915053ec6ee06c64482fba7ba668ce91305e1
> # Parent  11f3cae961f815ee7f8acc4e0312ed724d4ef8fe
> transaction: separate calculating TXNID from creating transaction object
>
> Before this patch, transaction ID (TXNID) is calculated from
> `transaction` object itself, but this prevents TXNID from being passed
> to `pretxnopen` hooks, which should be executed before starting
> transaction processing (also any preparations for it, like writing
> journal files out).
>
> As a preparation for passing TXNID to `pretxnopen` hooks, this patch
> separates calculation of TXNID from creation of `transaction` object.
>
> To keep uniqueness of assigned TXNID (= prevent `idobj` from being
> reused at another `txnid()` invocation) while corresponded
> `transaction` object is alive, this patch also adds `_txnid` field to
> `transaction` and makes it refer the tuple returned by `txnid()`.

I think this object() business is to awful. We have been using id(txn) 
because it was super simple and "good enough". But this is becoming to 
complicated.

We need a simple way to generate unique ID. I would point at "uuid" if 
the branch was not still Python2.4 compatible. Can I leave you with the 
task of finding a good enough uniq (enough) id generator on stable? 
(marmoute give a side looks at random) and send a V3 of this series?

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list