Gregory Szorc <gregory.szorc@gmail.com> [Wed, 17 Oct 2018 17:32:15 +0200] rev 40392
sqlitestore: support for storing revisions without their parents
This commit kinda/sorta implements the equivalent of ellipsis nodes for
the SQLite storage backend.
Without implementing full blown ellipsis nodes (and the necessary support for
them in the wire protocol), we instead teach the store to rewrite the p1 and
p2 nodes to nullid when the incoming parent isn't in the local store. This allows
servers to remain dumb and send the real parent and have the clients deal
with the missing parent problem.
This obviously isn't ideal because a benefit of ellipsis nodes is we can
insert a fake parent to ellide missing changesets. But neither solution is
ideal because it drops the original parent from storage. We could probably
teach the SQLite store to retain the original parent and handle missing
parents at read time. However, parent revisions are stored as integers and
it isn't trivial to store an "empty" revision in the store yet, which would
be necessary to represent the "missing" parent.
The store is somewhat intelligent in trying to remove the missing parents
metadata when the revision is re-added. But, revision numbers will be all
messed up in that case, so I'm not sure it is worth it. At some point we'll
likely want to remove the concept of revision numbers from the database and
have the store invent them at index generation time. Or even better, we can
do away with revision numbers from the file storage interface completely.
We'll get there eventually...
Differential Revision: https://phab.mercurial-scm.org/D5168
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 19 Oct 2018 15:38:25 +0200] rev 40391
wireprotov2: support exposing linknode of file revisions
When supporting shallow file storage, clients may fetch file revisions
by changeset. But they may not readily know which changeset introduced a
specific file revision. The "linknode" is used to record which changeset
introduces which file revision.
This commit teaches the "filedata" and "filesdata" wire protocol commands
to expose the linknode for file revisions. The implementation is likely
wrong when hidden changesets are in play, since the linknode may refer to
a hidden changeset. We can deal with this problem later.
Differential Revision: https://phab.mercurial-scm.org/D5167
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 19 Oct 2018 14:59:03 +0200] rev 40390
localrepo: support marking repos as having shallow file storage
Various operations against repositories need to know if repository
storage is full or partial. For example, a checkout (including possibly
a widening of a sparse checkout), needs to know if it can assume all file
revisions are available or whether to look for missing revisions first.
This commit lays the plumbing for doing that.
We define a repo creation option that indicates that shallow file storage
is desired.
The SQLite store uses this creation option to add an extra repo requirement
indicating file storage is shallow.
A new repository feature has been added to indicate that file storage is
shallow. The SQLite store adds this feature when the shallow file store
requirement is present.
Code can now look at repo.features to determine if repo file storage may
be shallow and take additional actions if so.
While we're here, we also teach the SQLite store to handle the narrow repo
requirement, which gets added when making narrow clones.
Differential Revision: https://phab.mercurial-scm.org/D5166
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 26 Sep 2018 14:41:15 -0700] rev 40389
repository: teach addgroup() to receive data with missing parents
The way the narrow extension works today, the server rewrites
outgoing changegroup data to lie about parents when the parents
data is missing. It adds the ellipsis flag to the revision so
it can be recorded as such in the revlog.
In the new wire protocol, such rewriting does not occur on
the server (at least not yet anyway). Instead, it is up to the
client to recognize when it has received a revision without its
parents. This means rewriting will be performed on the client.
Furthermore, the mechanism for storing a shallow revision may
differ from store to store. For example, the revlog store uses
the ellipsis flag to denote a revision's parents have been
rewritten. But a non-revlog store may wish to store things
differently. And, some stores may not even support receiving
shallow revision data!
Therefore, it makes sense for the store itself to be making
decisions about what to do when they receive revision data
without their parents.
This commit teaches the addgroup() bulk insert method to accept
a boolean argument that indicates whether the incoming data may
lack parent revisions. This flag can be set when receiving
"shallow" data from a remote.
The revlog implementation of this method has been taught to rewrite
the missing parent(s) to nullid and to add the ellipsis flag to
the revision when a missing parent is encountered. But it only
does this if ellipsis flags are enabled on the repo and the
incoming data is marked as possibly shallow. An error occurs
otherwise.
Differential Revision: https://phab.mercurial-scm.org/D5165
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 19 Oct 2018 13:44:25 +0200] rev 40388
commands: support passing depth to hg.clone()
This will allow extensions to add --depth or other arguments to control
depth fetching.
Differential Revision: https://phab.mercurial-scm.org/D5164
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 03 Oct 2018 14:57:29 -0700] rev 40387
filelog: add a hasnode() method (API)
Missing in the file storage interface is the ability to query whether
a specified value is a known node.
This commit defines that interface member and implements it on the
revlog and sqlite file stores.
Storage unit tests have been added.
The revlog implementation is a bit more complicated because index lookups
don't consistently raise the same exception. For SQLite, we can simply look
for a key in a dict.
Differential Revision: https://phab.mercurial-scm.org/D5163