This is an archive of the discontinued Mercurial Phabricator instance.

wireprotov2: define and implement "filehistory" command
AbandonedPublic

Authored by indygreg on May 11 2018, 6:35 PM.

Details

Reviewers
None
Group Reviewers
hg-reviewers
Summary

There are two parts to file storage: index data and revision data.
While the storage interfaces and implementation don't yet have a
strong division between these concepts, that is the reality of how
things are.

It is tempting to say that partial clones will only care about
files revision data. While this may be possible someday, initial
implementations will almost certainly need local index data
to facilitate various operations (such as hg log <file>). I
foresee a future where a local repository only contains file
index data and resolves revision data on-the-fly or even lazily
resolves both.

Anyway, I anticipate a need for clients to want to look up just
the history data for a tracked path.

This commit introduces a wire protocol command for obtaining
the history data of a single tracked path. Given a set of starting
file nodes, it walks backwards along the DAG and emits a history
record for each file revision. Because clients may only want to
fetch history that is new since the last fetch, the command supports
specifying base nodes at which traversal should stop.

There is an inline TODO about handling linknodes better. I'm
honestly not sure how we should best resolve linknodes in this
context. If we were to switch clones/pulls to use this API, we
would experience bugs due to missing/incorrect linknode data.
So we'll need to address this at some point. I'm open to
suggestions...

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped