[PATCH 1 of 3 V2] journal: add dirstate tracking

Martijn Pieters mj at zopatista.com
Fri Jul 8 06:09:30 EDT 2016

On 7 July 2016 at 19:33, FUJIWARA Katsunori <foozy at lares.dti.ne.jp> wrote:
> Is this test scenario in test-import.t suited to your requirement ?
>     https://selenic.com/repo/hg/file/tip/tests/test-import.t#l454
> In this case, intermediate changes in transaction for "hg import" are
> written into .hg/dirstate.pending file at each external hook (or
> editor) invocation, and some of them differs from final one at closing
> transaction.

Things work reading either .hg/dirstate or .hg/dirstate.pending there.
For each patch applied, the *base* revision is still the current
working directory parent. For each patch applied by hg import, the new
parent is recorded correctly in the journal.

So after importing 3 patches, the journal reads (in --verbose mode):

  base -> patch1rev
  base -> patch2rev
  base -> patch3rev

Note that the hook reads the new state as it is *written out*; it
doesn't matter if that is being written to .hg/dirstate.pending or
.hg/dirstate, it is recorded as the new state either way.

I'm happy to keep reading .hg/dirstate.pending for the old state but
this doesn't actually make any difference for any of the test
scenarios I can come up with.

Martijn Pieters

More information about the Mercurial-devel mailing list