( )⚙ D757 dirstate: move opendirstatefile to dirstatemap

This is an archive of the discontinued Mercurial Phabricator instance.

dirstate: move opendirstatefile to dirstatemap
ClosedPublic

Authored by durham on Sep 20 2017, 8:03 PM.

Details

Summary

As part of moving the dirstate storage logic to another class, let's move
opendirstatefile to dirstatemap. This will allow extensions to replace the
pending abstraction.

Future patches will move the consumers of _opendirstatefile into dirstatemap as
well.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

durham created this revision.Sep 20 2017, 8:03 PM
indygreg accepted this revision.Sep 24 2017, 11:20 AM
indygreg added a subscriber: indygreg.
indygreg added inline comments.
mercurial/dirstate.py
1299

Nit: I think ui should be the first argument.

1373–1374

This (pre-existing) error message is pretty bad because typical end users won't have a clue what it means or what to do if they see it.

This revision is now accepted and ready to land.Sep 24 2017, 11:20 AM
durham updated this revision to Diff 2081.Sep 26 2017, 6:58 AM
durham marked an inline comment as done.Sep 26 2017, 6:59 AM
durham added inline comments.
mercurial/dirstate.py
1373–1374

Agreed. I'm not even sure what it's actually saying as a mercurial developer...

This revision was automatically updated to reflect the committed changes.
foozy added a subscriber: foozy.Oct 1 2017, 5:30 AM
foozy added inline comments.
mercurial/dirstate.py
1373–1374

(sorry for late response)

With current implementation of dirstate, _pl() reads "dirstate"
file only for parents of wdir, and subsequent _read() will
read "dirstate" file again.

So, in this "changed parallelly" situation, 2 patterns are possible:

  1. previous _pl() read 'dirstate.pending', but current _read() reads 'dirstate'
  2. previous _pl() read 'dirstate', but current _read() reads 'dirstate.pending'

This should mean that:

  • current (spawned) "hg" process is running parallelly from another "hg" process, which causes current transaction, and
  • the latter process moves transaction processing forward without waiting for current "hg" process

For example:

  1. committing (or aborting) transaction between _pl() and _read() removed 'dirstate.pending' file
  2. changing "dirstate" in current (or next?) transaction newly creates 'dirstate.pending'

Spawning "hg" process from a hook process as background one can cause this.

Any hinting helps understanding ?