[darcs-devel] [issue1556] task: abandon tentative files and keep the information in memory

Ben Franksen bugs at darcs.net
Mon Jul 23 08:48:54 UTC 2018


Ben Franksen <ben.franksen at online.de> added the comment:

I am currently persuing the idea of making this change in a way that is
compatible with and prepares for future extensions regarding in-repo
branches.

The idea is to condense hashed_inventory and patches/pending into small
files that contain three hashes: the inventory hash, the pristine hash,
and the pending hash. This requires the current head inventory to be
hashed but apparently we already do that (see writeTentativeInventory).
We also need to hash pending, which we do not do yet.

These branch files live under a new directory _darcs/branches. The first
step adds only a single branch named "current". We read that file once
when we identify a repo, falling back to reading the old special files
if it does not exist, and creating the branch file if this is our local
repository. The Repository type is extended to contain the branch data,
consisting of the three hashes and the branch name. On finalization we
atomically write the branch back to disk (but we need to maintain the
old special files, too, for compatibility).

If we take care to make the format extensible (in a forward and backward
compatible way) we can add more hashes later, e.g. for the unrevert
bundle or the rebase patch, once these are converted to a hashable
format or uncoupled from the normal patches, respectively.

I much prefer this refactor over the idea of tracking transaction mode
in the types.

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue1556>
__________________________________


More information about the darcs-devel mailing list