sapling/infinitepush
Stanislau Hlebik 8b3bb637b4 infinitepush: fix skipping downloading bundle
Summary:
`bundlefile` variable wasn't initialized if `head in nodestobundle` were true.
Even worse, the previous version of `bundlefile` were used. That means that in
some cases infinitepush sends back a wrong bundle.

Adding a unittest is quite tricky because problem shows up only in one rare
case. Example: we have a stack of 2 commits A and B and each commit in the
stack has a bookmark that points to it. Then `getbundlechunks()` `heads`
parameter contains two heads: commit A and commit B in undefined order.
If it happens that first element in the list is commit A we'll create a bundle
that contains only commit A. And we'll reuse the same bundle when we process
commit B. That means that we'll send the same bundle with commit A twice,
but no bundles with commit B.

I refactored the code to make sure we won't get the same bug in
the future.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D4969547

Tasks: 17719083, 15389402

Signature: t1:4969547:1493749313:587f9e4446a3c21b47c081a0fe4cd9e200dab5cd
2017-05-03 00:31:24 -07:00
..
__init__.py infinitepush: fix skipping downloading bundle 2017-05-03 00:31:24 -07:00
backupcommands.py infinitepush: use infinitepush path instead of default push 2017-05-02 05:50:10 -07:00
bundleparts.py fb-hgext: make compatible to upstream changes 2017-02-23 04:08:18 -08:00
common.py infinitepush: refactoring 2017-01-06 04:15:16 -08:00
fileindexapi.py infinitepush: record nodesmetadata 2017-03-30 02:07:30 -07:00
indexapi.py infinitepush: record nodesmetadata 2017-03-30 02:07:30 -07:00
README infinitepush: sample implementation 2016-08-26 06:09:01 -07:00
schema.sql infinitepush: record nodesmetadata 2017-03-30 02:07:30 -07:00
sqlindexapi.py infinitepush: record nodesmetadata 2017-03-30 02:07:30 -07:00
store.py infinitepush: fix string formatting 2017-02-03 07:10:53 -08:00

## What is it?

This extension adds ability to save certain pushes to a remote blob store
as bundles and to serve commits from remote blob store.
The revisions are stored on disk or in everstore.
The metadata are stored in sql or on disk.

## Config options

infinitepush.branchpattern: pattern to detect a scratchbranch, example
                            're:scratch/.+'

infinitepush.indextype: disk or sql for the metadata
infinitepush.reponame: only relevant for sql metadata backend, reponame to put in
                       sql

infinitepush.indexpath: only relevant for ondisk metadata backend, the path to
                        store the index on disk. If not set will be under .hg
                        in a folder named filebundlestore

infinitepush.storepath: only relevant for ondisk metadata backend, the path to
                        store the bundles. If not set, it will be
                        .hg/filebundlestore