[PATCH 2 of 5] localrepo: invoke dirstate.unsureifambig in wwrite for safety

Matt Mackall mpm at selenic.com
Wed Jun 24 15:22:06 CDT 2015


On Tue, 2015-06-23 at 01:19 +0900, FUJIWARA Katsunori wrote:
> At Fri, 12 Jun 2015 02:55:04 +0900,
> FUJIWARA Katsunori wrote:

> -------------
> 4. Conclusion
> -------------
> 
> According to cases above, "restore dirstate at failure of command (or
> in wlock scope)" policy doesn't seem suitable for current Mercurial
> implementation.
> 
> Then, what about the policy below ?
> 
>   1. treat dirstate changes in transaction as "all or nothing"
> 
>      - save dirstate just before starting transaction, and
>      - restore it if transaction is rolled back
> 
>   2. keep dirstate changes outside transaction (and write them out)
>      even at failure
> 
>   3. enclose "critical region" by `dirstateguard` to discard dirstate
>      changes at failure
> 
>   4. but in `merge.update`, apply `dirstate.normallookup` explicitly
>      on files to be updated before entering into "critical region"
>      instead of enclosing it by `dirstateguard` because:
> 
>      - `repo.wwrite` in FORKED processes doesn't write
>        `normallookup`-ed result into `.hg/dirstate`, and
> 
>      - explicit `partial` argument of `merge.update` always omits
>        updating dirstate

This sounds pretty good to me.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list