Commit Graph

1249 Commits

Author SHA1 Message Date
Stanislau Hlebik
8f8cdc2d49 hgext3rd: cleanobsstore extension
Summary: See comments and docstring

Test Plan: arc unit

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: quark, mjpieters, #sourcecontrol

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

Signature: t1:4851138:1491589247:5ca750e45bcc9fc996c9d7c14e31cb5f24ea983f
2017-04-12 01:16:01 -07:00
Stanislau Hlebik
efbec7652d infinitepush: fix security concern
Summary: Check owner of a log file before writing to it. See comments for details

Test Plan: arc unit

Reviewers: #mercurial, simpkins

Reviewed By: simpkins

Subscribers: net-systems-diffs@fb.com, mjpieters, #sourcecontrol

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

Tasks: 17155924

Signature: t1:4842933:1491861137:e8a027fb7a930c0c5f553c75cb84214d24f66ce3
2017-04-12 01:12:23 -07:00
Jun Wu
e0eb41504b test-fixcorrupt: be OSX compatible
Summary:
`wc` in OSX has different padding behavior that breaks the test:

```
       $ wc -c .hg/store/00changelog* .hg/store/00manifest* | sort
    -   99 .hg/store/00manifest.d
    -  110 .hg/store/00changelog.d
    -  128 .hg/store/00changelog.i
    -  128 .hg/store/00manifest.i
    -  465 total
    +        99 .hg/store/00manifest.d
    +       110 .hg/store/00changelog.d
    +       128 .hg/store/00changelog.i
    +       128 .hg/store/00manifest.i
    +       465 total
```

This patch fixes it.

Test Plan: The fix was verified manually on an OS X machine.

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters

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

Signature: t1:4872689:1491954172:92178178deea88ec3545c42ad0cdecc8099a1db6
2017-04-11 16:43:32 -07:00
Jun Wu
340750c4f4 pushrebase: send obsmarkers to client if client supports it
Summary:
Previously when the client has obsstore enabled, and the server has obsstore
disabled, clients won't get the obsmarkers, which is suboptimal. This diff
makes the server send obsmarkers in that case.

Practically, this means people will no longer need to run `strip` after landing
a diff in this repo.

Note: `test-pushrebase-manifests.t` is somehow flaky about the empty lines. I
guess they are not related to the change. But the test change is not 100%
reproducible.

Test Plan: Added a new test case

Reviewers: #mercurial, stash

Reviewed By: stash

Subscribers: rmcelroy, ikostia, stash, mjpieters

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

Signature: t1:4865150:1491895844:afbc3079a40a9a9fa9af1eab4eeaca91091e8d2d
2017-04-11 13:21:27 -07:00
Jun Wu
de5e7c6545 fixcorrupt: new extension to fix corrupted repo
Summary:
We sometimes get reports about corrupted repos. Usually the corrupted part
is just at the end of changelog or manifest.

Truncating them manually works but people need to be very careful. This
extension is like the manual fix but automatized.

Test Plan:
Run `hg debugfixcorrupt --no-dryrun` on a reported corrupted repo and check
it truncates files correctly and the repo passes `hg verify` afterwards.

Reviewers: #mercurial, durham, stash

Reviewed By: stash

Subscribers: stash, rmcelroy, durham, lcharignon, mjpieters

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

Signature: t1:3408396:1491897232:fc17a105124b568963441adfec97e26735df3258
2017-04-11 13:19:42 -07:00
Adam Simpkins
fdc2c3e6f9 extutil: add unit tests for runbgcommand
Summary:
Add some basic unit tests for extutil.runbgcommand().

This also changes the behavior to throw an OSError if we fail to execute the
process, instead of a subprocess.CalledProcessError.  This matches the behavior
of the subprocess module when it fails to execute the command.

Test Plan: Ran the tests.

Reviewers: stash, quark

Reviewed By: quark

Subscribers: net-systems-diffs@fb.com, yogeshwer, mjpieters

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

Signature: t1:4864999:1491874918:c03edafe02af217e41c28a770137bfd72bcbba9b
2017-04-11 11:25:40 -07:00
Ryan McElroy
8267123b73 scm-prompt: add eden snapshots support
Summary:
Based on the recent commit wez made, but centralized to the scm-prompt
source-of-truth.

Test Plan: updated test

Reviewers: #sourcecontrol, wez, simpkins, simonfar

Reviewed By: simonfar

Subscribers: net-systems-diffs@fb.com, mjpieters

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

Tasks: 17110799

Signature: t1:4867662:1491916786:647edb819a059a3a6baa09c8d189ea706933687b
2017-04-11 08:47:12 -07:00
Jun Wu
46d44c8b07 lfs: use non-chunking spec format if possible
Summary:
The "chunking" feature is not specified by [the current Git LFS standard](21e1695220/docs/spec.md).

Therefore avoid using it if possible - if there is only one chunk, use the
standard specification (`https://git-lfs.github.com/spec/v1`).

An upload message is slightly changed to be more accurate.

Test Plan: Changed existing tests

Reviewers: davidsp, #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:4856527:1491638822:1c6f555b706e7bb22dd9090afa156f2161bf9f7f
2017-04-10 11:17:48 -07:00
Jun Wu
38632025a9 lfs: add bundle support
Summary:
This diff adds bundle support for lfs:

  - Let `hg bundle` use changegroup3 instead of changegroup2 to record revlog
    flags.
  - Hook related functions so `hg -R bundle.hg` works with LFS.

Test Plan: Added a test

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:4856335:1491638660:d56ba54ea5f59262f009418b9c7e48c8f2a25ed6
2017-04-10 11:11:37 -07:00
Jun Wu
cdc9accca5 lfs: do not store mercurial filelog metadata in lfs blobs
Summary:
Per discussion with @davidsp, it's better for LFS to not store Mercurial
filelog metadata, which is currently used to store rename information. That has
many advantages:

  - Large blobs could be reused across renames
  - No need to special handle files starting with `\1\n`
  - P4 LFS server implementation is much easier
  - remotefilelog LFS support is easier and cleaner

That said, the rename information is stored as lfs metadata using the
non-standard `x-hg-copy`, `x-hg-copyrev` keys. So they still exist and are
functional.

The disadvantage is that rename gets no longer hashed, which is probably fine.


Test Plan: Added a test

Reviewers: davidsp, #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: jsgf, rmcelroy, stash, mjpieters, davidsp

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

Signature: t1:4849764:1491580506:1d80ad476b9cbd6773843cb52aee6745f478a0b0
2017-04-07 18:29:35 -07:00
TJ
9b91e50f77 edrecord: allow specifying a different editor for chunk selection
Summary:
a user may want to use a special-purpose 'editor' to do chunk selection, but not
have to use that same 'editor' to write commit messages and resolve merge conflicts

This is hacked together to make it work.  I'm not super familiar with the correct way to do this in python.

Test Plan: added test case

Reviewers: rmcelroy, simonfar, most, quark

Reviewed By: quark

Subscribers: mjpieters

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

Tasks: 15728734

Signature: t1:4832207:1491519433:82a3e62d5ae03f456abe97caf1bd352a02fe35c3
2017-04-06 16:49:27 -07:00
Jeroen Vaelen
8bc1e221b6 hgext: rename show.py to fbshow.py to prevent upstream collision
Summary:
Upstream recently introduced show as an extension. Because the file
name is the same and it lives in core, extensions.show now points to it.

It behaves differently. Rename our extension. In the next diff I'll update
facebook.rc to make extensions.show point to our version.

Test Plan: Ran tests

Reviewers: durham, #sourcecontrol

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4845959
2017-04-06 13:36:18 -07:00
Jun Wu
de84869150 lfs: cleanup user-facing messages
Summary:
The diff cleans up messages shown to the user. It makes verbose messages
gated by `if ui.verbose`, and simplifies some words.

The resulting user experience is, when there is no large file involved, lfs
shows nothing. When there are largefiles being downloaded or uploaded, show
progress bar if it takes long. The progress bar is the only user visible
output from lfs by default.

Test Plan: `rt test-lfs.t`

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:4813297:1491213089:c9ec363eb65df4c85282c90b230da3321b93b5e0
2017-04-05 15:58:56 -07:00
Jun Wu
f0b6b81970 lfs: simplify remote blobstore.logic
Summary:
Previously, the remote blobstore could be either `git-lfs` or `dummy`. The
application code does not really care, it only wants a "remote" blobstore.

This diff adds a factory method and makes `git-lfs` and `dummy` stores private.

The `@staticmethod get(vfs)` interface is also removed as it's duplicated and
unnecessary - as long as mercurial calls `reposetup`, the blob store objects
are set, and they cannot be missing.

The error message about an unsupported store is also changed to be consistent
with mercurial style. A test was added to test the error.

Test Plan: `rt test-lfs.t`

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:4813023:1491382755:b9d8ec6518141d0ba8263e16c53f430ce80c39f0
2017-04-05 15:48:10 -07:00
Stanislau Hlebik
a50af234cb infinitepush: run backup check before backup from time to time
Summary:
It's a good way to check if backup is consistent. If backup is not consistent
then we set special exit code that will be logged. It let's us easily find users
with inconsistent backups and fix it.

Test Plan: arc unit

Reviewers: #mercurial

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402
2017-04-05 00:56:28 -07:00
Stanislau Hlebik
12a13d9b3a infinitepush: do not backup extinct heads
Summary:
Previously we backed up extinct node if bookmark pointed to them. But this not
is not present in the bundle because `findcommonoutgoing()` intentionally skips
extinct and secret commits. In this case we'll have infinitepush bookmark that
points to non-existent infinitepush commit. To fix it let's filter extinct heads

Test Plan: arc unit

Reviewers: #mercurial

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402
2017-04-05 00:56:28 -07:00
Jun Wu
6d19f83af9 lfs: add a "bypass" config option
Summary:
The bypass option limits lfs's functionality to only skip hash checks. It is
intended to be used server-side, to make it more predictable - the server
never interacts with the lfs blob service.

Test Plan: Added a test case

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, simonfar, mjpieters

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

Signature: t1:4811828:1491301114:c2e3c4200ce4cc84b9c5872a8b9a040176bb002a
2017-04-04 16:08:36 -07:00
Stanislau Hlebik
26cd83a2ee fixes: fix tests again
Summary:
fbhistedit changes was reverted upstream, revert it here too.

remove username from the test

Test Plan: arc unit

Reviewers: #sourcecontrol, quark

Reviewed By: quark

Subscribers: quark, mjpieters

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

Signature: t1:4830371:1491343205:9d7aebd603136fb90ccd3199df60c3e0a5772428
2017-04-04 15:00:52 -07:00
Jun Wu
6c51d725bd errorredirect: log and fallback to old error handler when appropriate
Summary:
Previously errorredirect swallows errors in some cases. This diff makes it
more robust.

  - Always log commandexception. `blackbox.log` will probably catch it.
  - Print the trace if the handler script cannot be executed.
  - Print the trace if the handler script exits with non-zero.
  - Add exception for the Ctrl+C case, to not pollute user's terminal.

Test Plan: Added some test cases

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:4824767:1491299807:3fd863cb99ce71a6c2b59643b0c89eece7985d4b
2017-04-04 10:27:30 -07:00
Stanislau Hlebik
9e62d99f6f histedit: fix failures
Summary: Revert of D4762189 since the histedit changes were reverted upstream

Test Plan: arc unit

Reviewers: #sourcecontrol, quark, mjpieters, mitrandir

Reviewed By: mjpieters, mitrandir

Subscribers: mjpieters

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

Signature: t1:4826679:1491319318:db10a0e539cdb9f0a45fe70fe93fe96daf530adb
2017-04-04 08:37:07 -07:00
Stanislau Hlebik
4cfa95492e pushrebase: fix tests
Summary:
7687edc2cef224a3a5ad4961e11073aa2ea73af8 added HG_HOOKNAME and HG_HOOKTYPE info
Let's update the test

Test Plan: arc unit

Reviewers: #sourcecontrol, mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters

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

Signature: t1:4826767:1491319207:a1c9e9af20cc237ff02bedcb9072f2c0816a1fbe
2017-04-04 08:36:10 -07:00
Stanislau Hlebik
ebde6a9a79 gitlookup: fix lookup if not string is passed
Test Plan:
arc unit

Note: making sure that int is passed in repo.lookup(...) is not easy.
For example `hg log -r 1` does not pass an int value to repo.lookup().
But `hg bundle` actually does it so use `hg bundle` to verify that fix works.

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters, #sourcecontrol

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

Signature: t1:4825996:1491292671:9bd0897205dff93cb6dee75498827b3826f894da
2017-04-04 01:04:40 -07:00
Jun Wu
08d017f89e absorb: move to a package
Summary:
The ideal interactive mode couldn't be implemented trivially. Move `absorb`
to a directory so we can add related, but decoupled components as separate
files.

Test Plan: `make local`

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:4813909:1491211561:e9c40b1242c9b74230c0b8937723a2d4548e22c3
2017-04-03 10:40:31 -07:00
Simon Farnsworth
9b44edde6f fb-hgext: fix tests to account for changes to Phabricator interaction
Summary:
@simpkins fixed up some of the tech debt accumulated in our
Phabricator interfaces, which results in a minor change to output. Most tests
are fixed, but this one got missed.

Fix the test to match his fixes.

Test Plan: Run the fixed test locally

Reviewers: #sourcecontrol, stash

Reviewed By: stash

Subscribers: mjpieters, simpkins

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

Signature: t1:4809914:1490955858:bd2c942b9744a5529e8f4fd87bfb50666b53ae6a

Blame Revision: HGEXT8a071fbd26ed6fabf443953183c507606b027bbc
2017-03-31 03:26:04 -07:00
Jun Wu
abb7a83354 lfs: make tests stronger
Summary:
This diff makes the `test-lfs.t` much more stronger. It reveals a lot of core
hg issues in this area. I'll send patches to fix them all.

Regarding on lfs, there are some changes:

  - An existence check in its push hook was added. Otherwise pushing a revision
    with rename will cause crash.
  - The "read" processor is responsible for downloading blobs, and translate
    raw revision to lfs text. It should always return lfs text. But it may
    return raw revision text on error currently. That error handler was
    removed to avoid further damage.


Test Plan: Added new test cases. I also added `hg verify` to sanity check things are good.

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:4792641:1490868946:8f09c84dc9ebda3889d6a1ea04c49a06acbf38a3
2017-03-30 16:41:46 -07:00
Adam Simpkins
36dcf86559 phabstatus: fail gracefully if necessary arcrc settings are missing
Summary:
If the user does not have necesary credentials defined in their arc
configuration, catch the KeyError and convert it into an ArcConfigError.

The existing call sites in the phabstatus and arcdiff extensions catch and
handle ArcConfigError, but not generic KeyErrors.

This also fixes the phabstatus warning messages to end with a newline.

Test Plan: Added a unit test.

Reviewers: #sourcecontrol, quark, simonfar, wez, rmcelroy

Reviewed By: wez, rmcelroy

Subscribers: rmcelroy, net-systems-diffs@fb.com, yogeshwer, mjpieters

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

Tasks: 17002914

Signature: t1:4800977:1490847078:e18bba042e3ff57100e0a7b25c610b5cad17fa2e
2017-03-30 11:55:39 -07:00
Simon Farnsworth
a8febfe71c treemanifest: add a glob to handle the argument change in the traceback
Summary:
The traceback changed due to an upstream change, but it's still doing
what we expect.

Change the test to be less sensitive to code changes.

Test Plan: `../../hg-crew/tests/run-tests.py` locally.

Reviewers: #mercurial, quark, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:4802376:1490872606:8c9b357de7bd65a33abf1d5a3b0568751210aad4
2017-03-30 04:17:12 -07:00
Stanislau Hlebik
8c7c7319dd infinitepush: record nodesmetadata
Summary: Let's add a table that will store metadata about infinitepush nodes.

Test Plan: arc unit

Reviewers: #mercurial

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 16899722
2017-03-30 02:07:30 -07:00
Stanislau Hlebik
526184c5c4 infinitepush: pass reponame to 'DELETE from bookmarkstonode...' query
Summary:
I forgot to insert it, fixing it now. It didn't cause problems before because
we delete bookmarks only during backups and backups usually have different
bookmark names

Test Plan: arc unit

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4795310:1490810441:0a044ebe776c65b03c633017c33771d32bfa3e77
2017-03-30 01:16:06 -07:00
Stanislau Hlebik
2fc45e80f1 gitlookup: fix gitnode() template and revset
Summary:
Neither gitnode() template nor gitnode() revset worked on the server. They
both called `hg.peer(repo, {}, 'default)` and since 'default' is not a valid
url these calls failed. To fix it let's wrap `localrepo.lookup()` and call
local repo instead of peer repo if we can't find default path.

Test Plan: arc unit

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 16848812

Signature: t1:4794488:1490795600:24269507f24613883406f0c1838fce302f86df58
2017-03-29 07:13:41 -07:00
Stanislau Hlebik
1c556e7a8c infinitepush: move sql schemas to schema.sql file
Summary: Let's avoid copy-paste.

Test Plan: arc unit

Reviewers: #mercurial, rmcelroy, quark

Reviewed By: rmcelroy, quark

Subscribers: rmcelroy, quark, mjpieters, #sourcecontrol

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

Signature: t1:4778949:1490700154:51f6144cdb7682d03c0f6af88691fd907178319c
2017-03-29 03:21:30 -07:00
Stanislau Hlebik
e094644fb2 infinitepush: wrap findcommonincoming if nodes are requested
Summary:
Previously we don't set findcommonincoming to True, and that bug was unnoticed
because we send this info anyway in server-side `getbundlechunks()` function.

But next diff in the stack uses a fast path server-side which won't work if
fincommonincoming is not set to True.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4770830:1490719209:c251002d992e244580b7dbfeca0c30dff95734d2
2017-03-29 03:10:12 -07:00
Stanislau Hlebik
099ba152f5 infinitepush: add getavailablebackups command
Summary:
Command to list available backups for the user.
--json will be used by automation

Test Plan: arc unit

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4728729:1490005762:41b9683cb7dfc9d84ae1032c807d1f0c3fe60dbf
2017-03-29 03:00:46 -07:00
Adam Simpkins
675d0280a6 phabdiff: only match at the start of a line
Summary:
Only match the "Differential Revision" label at the start of a line.  We
have some diffs that include legitimate-looking Differential Revision label
strings inside parts of their test plan, which previously confused the phabdiff
output.

Test Plan: Included a unit test.

Reviewers: #sourcecontrol, quark, akushner

Reviewed By: akushner

Subscribers: net-systems-diffs@fb.com, yogeshwer, mjpieters

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

Signature: t1:4793483:1490756514:05b2c49d5d65e1a3eadd5eb78ed0b91ef3bea42c
2017-03-28 20:53:07 -07:00
Phil Cohen
154230c8b0 pushrebase: add a test for manifests
Summary:
From diff:

```
This test does two things:

1/ Simulate a common condition of pushrebase under load. Normally pushrebase
caches data before acquiring the write lock (if lazy locking is enabled).
Under load, however, when a push has to wait for the lock more often than not,
much of this data becomes out of date and must be refetched once the lock is
acquired. This test simulates that particular case.
Specifically, we create two clients, client1 and client2, both with
nonconflicting changesets to push. client1's push is artificially blocked by a
`prepushrebase` hook (post-caching, pre-lock) that is only released after
client2's push succeeds.

2/ Checks how often we call manifest.read() inside the lock (and outside).

This way we can prevent regressions on manifest reads and test improvements.
manifest.read() is wrapped by an extension that prints a short trace. read calls
inside the lock are marked with a ":(".
```

This test is a bit of a doozy, simplification suggestions are encouraged.

Test Plan: this is, in fact, a test

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: quark, rmcelroy, mjpieters

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

Signature: t1:4785464:1490737637:79d77f6b2e49a428d63b8e1b13d769c82149ee72
2017-03-28 17:18:59 -07:00
Jun Wu
eeeb0210ae lfs: allow blobstore to be outside the repo
Summary:
Previously `lfs.blobstore` must be a relative path. If an absolute
blobstore path is set, it will traceback because vfs audit fails:

```
  File "hg/mercurial/revlog.py", line 1356, in _processflags
    text, vhash = writetransform(self, text)
  File "fb-hgext/hgext3rd/lfs/wrapper.py", line 69, in writetostore
    blobstore.local.get(self.opener).write(storeid, chunk)
  File "fb-hgext/hgext3rd/lfs/blobstore.py", line 41, in write
    fp = self._opener(self.filename(storeid), 'w+', atomictemp=True)
  File "hg/mercurial/vfs.py", line 344, in __call__
    self.audit(path)
  File "hg/mercurial/pathutil.py", line 64, in __call__
    raise error.Abort(_("path contains illegal component: %s") % path)
  Abort: path contains illegal component: /home/quark/lfslocalblobstore/d7/dbc611df1fe7dfacfe267a2bfd32ba8fc27ad16aa72af7e6c553a120b92f18
```

That was because the code was using `repo.vfs`. This diff adds a new `lfsvfs`
to avoid the issue. The `lfsvfs` also did the correct filename check (the
old `re.match` check will not match the whole string), so `blobstore.local`
could be simplified a lot.


Test Plan:
A new test case was added to make sure absolute blobstore path works. I also
did some cleanups for the test file to de-dup hgrc, and avoid writing files
outside `$TESTTMP`.

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters, remi

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

Signature: t1:4785084:1490693306:b42eef8e53af107897c2e1bc2984c090bdd2e465
2017-03-28 15:41:59 -07:00
Mateusz Kwapich
3f719913eb fbmetaedit: make it compatible with mutable-history without our hotfixes
Summary:
It's the upstream mutable-history that handles the "--fold" case now.
It doesn't have the fix that avoids touching wd in that case.

Test Plan:
tests are passing when mutable-history is updated to default-upstream-tip
I'll delete the actual mutable-history hotfixes once this is accepted.

Reviewers: #sourcecontrol

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4779366
2017-03-27 08:08:27 -07:00
Jun Wu
c3fd525bf8 lfs: fix tests
Summary:
A bunch of modifications to get the test pass with the new lfs code.

- Move `lfs` to `hgext3rd`. The code was supposed for hg-core. For now, we do
  them in fb-hgext to speed up the process
- Remove the windows test, which is not supported by `run-tests.py` and is
  duplicated with `test-lfs.t`.
- Do import `mercurial.i18n._` correctly.
- Change some i18n logic a bit so it's more translator-friendly.
- Change `revlog.RevlogError` to `error.RevlogError`.
- Avoid direct symbol import of `mercurial.util.bytecount`, which will fail the
  upstream importchecker test.
- Fix various lint issues like lines being too long etc.
- Document lfs config options.

Test Plan: `arc unit`

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:4772216:1490401458:1ad3c18ab80e1d31085d0b6b4c630e62a7dc7930
2017-03-24 19:01:42 -07:00
Remi Chaintron
dcdf35ff63 lfs: new extension
Add the lfs extension and its tests.

----
quark: This imports @remi's lfs work for core hg. See D3980880, D4770352,
and D4771511.
2017-03-24 19:00:30 -07:00
Simon Farnsworth
ccf6655f3a fb-hgext: fix test-check-code.t failures
Summary: test-check-code.t now dislikes our docstrings. Fix them up

Test Plan: Run the test locally on my devserver

Reviewers: #sourcecontrol, durham

Reviewed By: durham

Subscribers: mjpieters

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

Signature: t1:4773908:1490394131:9d9e5f85b4243119a3615044605bcc5abdecbe4f
2017-03-24 15:22:31 -07:00
Stanislau Hlebik
b628d6cc32 sqldirstate: fix sqldirstate-fbhistedit test
Summary: Just as in D4762189. Fixes to match upstream changes

Test Plan: arc unit

Reviewers: #sourcecontrol, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4762596:1490286227:004ed0a7055aab64769893e80a995975b62d5ea0
2017-03-23 09:25:45 -07:00
Simon Farnsworth
0727779c39 fbhistedit: fix tests after core change
Summary:
changeset:   06d6fecfdb713e3a2e2013de046af0bce4005b96   (@)
user:        Jun Wu <quark@fb.com>
date:        Mon, 13 Mar 2017 22:19:06 -0700

    histedit: use safecleanupnode in _finishhistedit

        This simplifies code a lot.

causes significant changes to the test output. Update to match

Test Plan: Run tests locally

Reviewers: #sourcecontrol, quark, stash

Reviewed By: stash

Subscribers: mjpieters

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

Signature: t1:4762189:1490281032:6a48429f60584c4318bd1e247ce2eeb2775d623c
2017-03-23 07:57:35 -07:00
Durham Goode
f108f54ab0 fixtests: fix morestatus and perftweaks tests to match upstream
Upstream changed the transaction logic around rebase, and added better quoting
to tests, so we need to update our internal tests accordingly.
2017-03-21 09:18:01 -07:00
Durham Goode
2393924384 fastmanifest: add __bool__ to hybridmanifest
Upstream added __bool__ to manifestdict, and the test checking that
hybridmanifest matches the functions of manifestdict started failing. Let's add
it.

The check-code.py change matches the one in upstream to support the addition of
__bool__.
2017-03-20 18:58:10 -07:00
Durham Goode
0942e94dcc treemanifest: reverse historypack entries
History pack entries need to be in newest-to-oldest order, so let's reverse
them.
2017-03-20 18:58:09 -07:00
Jun Wu
1e30f781e0 dirsync: rename in-repo config file to .hgdirsync
Summary:
It will allow sparse to not ignore the file, and is more consistent with
other special files.

Test Plan: Updated existing tests

Reviewers: rmcelroy, #sourcecontrol, durham

Reviewed By: durham

Subscribers: mjpieters

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

Signature: t1:4738766:1490032493:199f3fef9c74a137b16ae7637b87de625ca5115d
2017-03-20 10:55:43 -07:00
Stanislau Hlebik
f0b136f93b newhiddencache: add knob to enable fasthiddencache
Summary: Add a knob to easily disable/enable fasthiddencache functionality

Test Plan: arc unit

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 16558840

Signature: t1:4714509:1489717542:d022201fd7c17863ffe664ae4115b8d1d896da3c
2017-03-20 01:38:06 -07:00
Stanislau Hlebik
32199b95b4 newhiddencache: restore back
Summary:
This diff just restores the code that was reverted before. Next diffs will fix
it

Test Plan: arc unit

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 16558840

Signature: t1:4714397:1489717436:9777d783d1443dea46460450e8f3da862c147483
2017-03-20 01:38:06 -07:00
Durham Goode
63f4fa69a0 datapack: remove delta reuse
Summary:
This code that reused deltas if the delta parent wasn't available was bugged
because it meant you could end up with a cycle in the delta chains. This was an
old optimization from before trees had history, so let's drop the optimization
(since trees now have history and can be correctly repacked).

Test Plan:
Ran repack on a packfile that previously caused cycles. Verified the
new version did not with `hg debugdatapack foo.datapack'

Reviewers: #mercurial

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4724520
2017-03-18 19:38:45 -07:00
Jun Wu
5404cd9a3c codemod: get rid of ui.backupconfig
Summary:
The upstream will remove `ui.backupconfig` soon(tm). Let's migrate our code
to `ui.configoverride` to avoid future breakages.

Test Plan: `arc unit`

Reviewers: #sourcecontrol, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:4734300:1489803960:a4101d6bc95ab62af67f0076b8e21f57cf926e13
2017-03-17 19:42:50 -07:00
Jun Wu
c133169b8b dirsync: read ".dirsync" in the working copy as part of its config
Summary:
It'd be nice to have dirsync config in the repo, since it's better synced, and
easier to be modified.

Test Plan: Added a test case

Reviewers: #sourcecontrol, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:4732054:1489793650:ca6c63ef47a1d9ebd181fbaee5554975801324eb
2017-03-17 16:35:08 -07:00
Durham Goode
b7b2cf134a fastmanifest: fix bytearray issue with mdiff.textdiff
Summary:
Upstream converted all array.array usages to bytearray, and in doing so they
also changed mdiff.textdiff(array1, array2) to be
mdiff.textdiff(util.buffer(array1), util.buffer(array2)), which we did not do in
our internal implementation.

This fixes that.

Test Plan: Adds a test

Reviewers: #mercurial, quark, simonfar

Reviewed By: quark, simonfar

Subscribers: quark, mjpieters

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

Signature: t1:4724350:1489697253:8f63350bfc30b3079bf38410054b4763942a82f6
2017-03-16 13:48:48 -07:00
stash@fb.com
d36fb477cb infinitepush: fix the build
Summary:
On macos sshpeer flushes remote output later and it causes tests to fail. Let's
add a call to cleanup() to make sure the output is flushed.

This diff also makes remotefilelog test more robust.

Test Plan: Run tests on macos

Reviewers: #mercurial, tja, mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4721276:1489669109:4ce59f4a1d224d57dbb7c1eb341c4e6a659d2e8c
2017-03-16 08:35:15 -07:00
Stanislau Hlebik
6b7e94a53f infinitepush: add --all option to debugcheckbackup
Summary:
By default debugcheckbackup checks only one backup for the user.
With --all option it checks all backups for the user from all host/reporoots

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4700993:1489548921:800d08f420acc8ef4f807ffd17b31837dbb3fe82
2017-03-16 02:22:39 -07:00
Stanislau Hlebik
280028dd61 infinitepush: add maxheadstobackup option
Summary:
Backing up very big repo can cause problems. And very often old commits are
not necessary at all. Let's add a config option to limit the number of heads
that are being backed up.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4700965:1489549163:4e2c121f01debd7b495486a1f3b062926873399d
2017-03-16 02:22:39 -07:00
Stanislau Hlebik
2faa6709ca infinitepush: change backup state file format
Summary:
Previously we saved bookmark hash and revision number as state of
the last backup. Storing last backed up revision is error-prone. I saw
a few corrupted backups where bookmarks pointed to non-backed up
nodes. Also this approach puts more pressure on mysql bundle index.
On every backup it first deletes all existing backup bookmarks and then it
writes new bookmarks. Even if user changed one head or one bookmark
(and that is the usual case) current approach still deletes bookmarks first
and then rewrites them.

Instead let's store all backed up heads and bookmarks locally in json format.
Json was chosen because it's simple and human-readable. Then during backup
let's compare last backed up state to the current state of the repo, and send
to the server only the difference.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4700930:1489613249:a34369bf53e0718c22258304493dfa27b578857f
2017-03-16 02:22:39 -07:00
Stanislau Hlebik
5ee9ad7feb infinitepush: add timestamp to the logs
Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

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

Tasks: 16474976

Signature: t1:4700897:1489550188:1c6346ff158cec32df92934b585fc9cb983397c6
2017-03-16 02:20:02 -07:00
Jun Wu
ca4723ad22 patchrmdir: new extension to workaround rmdir kernel issues
Summary:
We have encountered a kernel issue where `rmdir` a non-empty directory may race
with other things and hang in kernel for a long time.

This patch changes `os.rmdir` to avoid `rmdir` non-empty directories. It is
written in Cython calling the low-level `readdir` libc friends to make overhead
minimal.

Test Plan: Added a new test

Reviewers: #sourcecontrol, clm, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, simpkins, osandov, mjpieters

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

Tasks: 16647532

Signature: t1:4716711:1489627923:7c7432748c1fd8c070ce257bd172feebd3807f65
2017-03-15 18:55:48 -07:00
Durham Goode
91dc0a18cc fbmetaedit: fix lint breakage
test-check-code doesn't like sed -i, so let's switch to a tiny batch script.
Also fix the test importing the extension directly instead of relying on the
path to be right.
2017-03-15 14:17:28 -07:00
Mateusz Kwapich
1bcc10919d fbmetaedit: intoduce the extension
Summary:
It's just copy-paste from my mutable-history patch series that ended up as
persistent hotfix.

The wrapping logic is very simple: it redirects '--fold' calls to original
metaedit and handles all the rest.

Test Plan:
Included a big copy-pase from test-evolve.t preserving only cases that were
executing metaedit and modified for the smaller test repo (the metaedit tests
were at the end of evolve test file).

Reviewers: #sourcecontrol, quark, simonfar

Reviewed By: quark, simonfar

Subscribers: rmcelroy, quark, mjpieters

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

Signature: t1:4708017:1489524494:d682aab857e8422bb1a23adc22dddfb9f505b6b3
2017-03-15 07:40:26 -07:00
Stanislau Hlebik
314a434baf infinitepush: better client-side logging
Summary: New logging will have rotation and will separate different users and repos

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

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

Tasks: 16474976

Signature: t1:4689191:1489172091:d304d4b19ae6cf52f86c11f442fa760b50d1fdf9
2017-03-14 02:13:16 -07:00
Stanislau Hlebik
ddf10d0f6e infinitepush: add debugwaitbackup command
Summary:
For now these command will be used in test because
`wait_for_background_backup.py` tied to the backup state file. And every change
to this file requires change to wait_for_background_backup.py. Let's create
simple internal backup command.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4667056:1489024344:6c43241e42b7c418baa4e1542f303239ba887c45
2017-03-13 01:35:30 -07:00
Durham Goode
c8fb813c3d treemanifest: add matcher arg to filesnotin
Summary:
Upstream has added a matcher arg to manifest.filesnotin, so let's support it in
our native treemanifest implementation.

Test Plan: Added unit tests for filesnotin with and without matchers.

Reviewers: #mercurial, stash

Reviewed By: stash

Subscribers: stash, mjpieters

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

Signature: t1:4677030:1489076599:23ab67d85bb4fa689f05349253a4d2c4e7d496cc
2017-03-12 12:49:18 -07:00
Durham Goode
84a862e6f3 treemanifest: support matcher in diff
Summary:
Upstream has added a matcher argument to the diff API which allows diff to avoid
traversing certain parts of the tree. This adds support for that to our native
treemanifest implementation.

Test Plan: Added tests for diff with matches

Reviewers: #mercurial, stash

Reviewed By: stash

Subscribers: stash, mjpieters

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

Signature: t1:4677023:1489076627:dbcea209d300a68fa050f68c52b4fd9949b85302
2017-03-12 12:49:18 -07:00
Durham Goode
33a1d6afdc fix: update manifest.diff usages to handle match arg
Summary:
Upstream has added a new match argument to manifest.diff() and removed the
existing manifest.matches() function, so we need to update our internal usage.

A separate diff will update treemanifest to support the new diff() api.

Test Plan:
Ran the tests, some still fail because of the upstream changes, but
future patches fix those.

Reviewers: #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D4677002
2017-03-12 10:14:35 -08:00
Arun Kulshreshtha
7174632e3c fbamend: add --towards flag to hg next
Summary: This diff adds a `--towards` flag to `hg next`. This flag tells `hg next` to always proceed in a linear fashion towards the specified commit. This is useful in situations where the user has a very branchy stack. For example, if the user has a local stack with several branches, each with a feature bookmark at the top, if the user wants to go up a particular stack they can do so with something like `hg next 3 --towards bookmark`.

Test Plan:
Here is an example of basic usage. Also see test file.

```
$ hg debugbuilddag "+5 *2 +2"
$ hg book -r 4 feature1
$ hg book -r 7 feature2
$ hg up 0
$ hg sl
o  92eaf3  debugbuilddag  feature2
|  r7
|
o  8bbe84  debugbuilddag
|  r6
|
o  914970  debugbuilddag
|  r5
|
| o  bebd16  debugbuilddag  feature1
| |  r4
| |
| o  2dc09a  debugbuilddag
| |  r3
| |
| o  012414  debugbuilddag
|/   r2
|
o  66f7d4  debugbuilddag
|  r1
|
@  1ea734  debugbuilddag
   r0
$ hg next 3 --towards feature1
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
[2dc09a] r3
$ hg sl
o  92eaf3  debugbuilddag  feature2
|  r7
|
o  8bbe84  debugbuilddag
|  r6
|
o  914970  debugbuilddag
|  r5
|
| o  bebd16  debugbuilddag  feature1
| |  r4
| |
| @  2dc09a  debugbuilddag
| |  r3
| |
| o  012414  debugbuilddag
|/   r2
|
o  66f7d4  debugbuilddag
|  r1
|
o  1ea734  debugbuilddag
   r0
```

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:4695861:1489325959:1145a29ba87f99d07ede1e81415804723dc48818
2017-03-12 10:09:12 -07:00
Durham Goode
67da0498fb treemanifest: block non-pushrebase pushes to treemanifest servers
Summary:
We are relying on pushrebase to replay each of the incoming commits so they
produce both flat and treemanifests. This patch blocks any commits that don't
come through pushrebase, by intercepting manifest.addgroup calls (which is what
a normal push would use) and throwing an exception.

Test Plan: Added a test

Reviewers: #mercurial, stash

Reviewed By: stash

Subscribers: stash, mjpieters

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

Signature: t1:4093745:1478100170:79b1eea6668cd3efb27742323e11a45bde930440
2017-03-09 14:45:23 -08:00
Durham Goode
e2b422dc98 treemanifest: server - write trees at the same time as flat manifests
Summary:
When a server is a treemanifest enabled server, we want to ensure that every
commit that comes in will be added to the treemanifest as well as the flat
manifest. This patch accomplishes that by hooking into the addmanifest logic and
applying the new manifest to the tree as well.

Test Plan: Added a test

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4093738:1478260442:58f77bd88ab09ccda4ac238a065388be8f4a271d
2017-03-09 14:45:23 -08:00
Durham Goode
911ea4ace5 treemanifest: add backfilltree command
Summary:
This adds a command for producing tree manifests for existing manifests in the
repository. The tree manifests are stored similar to how vanilla mercurial
stores them, but the root revs are in 00manifestree.i instead of 00manifest.i
and we fake the root node to be the same as the flat manifest node, so we can
reference either the flat or the tree easily.

Test Plan: Added a test. Also began converting fbsource

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: stash, mjpieters

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

Signature: t1:4092252:1478260394:a55360a8ba83ad85b1694cb93f0788f1f672ef61
2017-03-09 14:45:23 -08:00
Jun Wu
5c350fb239 test-sigtrace: fix OSX compatibility
"ls" has different exit code on OSX, add "|| false" to normalize it.
2017-03-08 22:38:23 -08:00
Adam Simpkins
143d13f6e3 perftweaks: revert new computehidden cache functionality
Summary:
The computehidden caching functionality doesn't seem to be correct, and breaks
my repository.  "hg log -r head()" now incorrectly reports some obsolete
commits, which causes various mercurial commands to crash.  (They incorrectly
think that these commits aren't obsolete, but their parents are obsolete, which
breaks things.)

This diff reverts the new functionality until it gets fixed.

Test Plan: Confirmed that "hg-dev pull" no longer crashes in my repository.

Reviewers: #mercurial, stash, durham, quark

Reviewed By: quark

Subscribers: net-systems-diffs@fb.com, yogeshwer, mjpieters

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

Tasks: 16558840

Signature: t1:4676573:1489008220:f730da69ec0f8d7220cad16ea6956944cfeb670d
2017-03-08 13:42:01 -08:00
Arun Kulshreshtha
9df08f6f42 fbamend: ensure that restack obsmarkers have correct metadata
Summary: Previously, we were relying on the `allowunstable` extension to wrap various instability-inducing commands and set the appropriate config option to cause the `tweakdefaults` extension to write the correct operation metadata into the obsmarkers produced by each respective command, causing commits to show up as "amended as", "rebased as", etc, in `hg sl`. Since the operation name was based on the command being run, if a user ran `hg amend --fixup` instead of `hg restack`, for example, smartlog would say "amended as" instead of "rebased as". This diff fixes the problem by always setting the operation to "rebase" during a restack.

Test Plan:
1. Create a stack of two commits.
2. Amend the bottom one without `--rebase`.
3. Run `hg amend --fixup` with the `fbamend.userestack` config option enabled.
4. Run `hg sl --hidden` and observe that the rebased commit is marked as "rebased".

See test file for an example.

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Tasks: 16529478

Signature: t1:4670066:1488991076:58c139c50a1aab2aa4fc7e28b1efd57a67bdfb08
2017-03-08 11:30:14 -08:00
Jun Wu
84143416ed sigtrace: new extension provides stack traces on signal
Summary:
Sometimes the hg process gets stuck, and we want to get the stack traces to
learn what it's doing. It's not a big issue if gdb can be used with python
debugging support [1]. However, that feature could not be easily set up on
OS X. This extension will make debugging on OS X easier by providing the
Python stack traces on SIGUSR1.

It's similar to OpenStack's "GuruMeditationReport" feature [2].

Unlike `contrib/showsstack.py`, this extension uses SIGUSR1 instead of SIGQUIT,
and writes to a file, instead of stderr, and prints all threads, instead of
just the current one. So it's more practically useful. We may want to
replace `showstack.py` eventually.

[1]: https://wiki.python.org/moin/DebuggingWithGdb
[2]: https://wiki.openstack.org/wiki/GuruMeditationReport

Test Plan: Added a new test

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:4660938:1488927878:c751856681816a739160c361ed5cc10bab325000
2017-03-07 17:25:40 -08:00
Durham Goode
5dac028b0e cstore: move pythonutil to cstore
Summary:
Now that ctreemanifest no longer depends on python.h, let's move pythonutil over
to cstore where all the python code is.

Test Plan: Ran the build and the tests

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4663988:1488895919:652b3fc35a2dd12c51a9f70e32997c7b4d037c95
2017-03-07 11:39:46 -08:00
Durham Goode
8eede45c7f cstore: add Matcher class
Summary:
As part of breaking the native cstore implementation away from Python, let's
create a Matcher class that can be used to perform path match testing. Initially
the only implementation is the PythonMatcher which just wraps a python match
object.

Test Plan: Covered by existing matcher tests in cstore-treemanifest.py

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:4663354:1488914384:2c33c7e0e7f2eade0786b6ff41503317989fd1e5
2017-03-07 11:39:46 -08:00
Durham Goode
70ce116529 treemanifest: add history data to tree repacks
Summary:
Previously, tree repacks did not take into account tree history. It would just
look at the delta base and if the base existed, it would just reuse the delta.
This would A) result in very long chains, and B) result in chains where the full
text was the oldest version, instead of the newest (recent full texts means
faster access to recent versions).

This patch threads tree history into the repacker, which already knows how to
use history for repacks.

Test Plan:
Updated the tests, and inspected the new test results to ensure tree
entries that were not deltas before the repack became reverse deltas during the
repack.

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4647359:1488882710:dba72cf488766ce827b7641735164fa0efc9a303
2017-03-07 11:15:26 -08:00
Durham Goode
3f65bd2532 treemanifest: don't build pack files that depend on other pack files
Summary:
Previously, when treemanifest would create packs of trees during pull, we
allowed trees to be delta'd against trees in other packs. This resulted in
smaller packs, but if the other pack disappeared for some reason (since it's a
cache), the chain broke.

This patch ensures that the first version of every tree added to a pack is a
full text.

This temporarily makes repacks worse, since the repacker doesn't know about
history to produce deltas when combining packs. The next patch adds history
awareness which improves the repack deltafication.

Test Plan:
Updated the tests, and inspected the new test results to ensure that
all packs only had deltas within the pack.

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:4647348:1488882214:e850622a853a534fc60caeef604c88c30740c60d
2017-03-07 11:15:25 -08:00
Durham Goode
5bc368c71d treemanifest: move tree delta logic up to python layer
Summary:
Previously the treemanifest code itself would create the text deltas when
writing a tree out. This meant we couldn't make the delta decision based on
other data, like if the p1 commit was in the same pack file.

This patch removes treemanifest.write() and moves all calls over to
treemanifest.finalize() which gives the python/pack layer control over delta
choices. A future patch will use this to ensure tree packs always contain
complete delta chains.

Test Plan: All tests pass

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4645942:1488880851:d0c8c902e7e849072a53344630a9184b6d8e1e7f
2017-03-07 11:15:25 -08:00
Durham Goode
943afede25 treemanifest: add support for creating history packs
Summary:
Previously the treemanifest auto-tree-creation logic only produced data packs
containing the actual contents of the tree blobs. This lost history information
which is important for our ability to efficiently repack the data files.

This patch creates history packs during pull as well. A future patch will also
create history packs for the local tree blob store.

Test Plan: Updated the tests to cover this

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4638865:1488449992:48b60961b50b90b6d0e75a64af1f36fb29944e7a
2017-03-07 11:15:25 -08:00
Stanislau Hlebik
4c84f339fa infinitepush: add debugcheckbackup
Summary:
Command that checks that every head and bookmark node is present in the
bundlestore

Test Plan: arc unit

Reviewers: #mercurial

Subscribers: #sourcecontrol

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

Tasks: 15389402
2017-03-07 01:21:44 -08:00
Stanislau Hlebik
1e879a5808 newhiddencache: fix mac build
Test Plan: arc unit

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: mjpieters, #sourcecontrol

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

Signature: t1:4658691:1488814270:b3c63e6821c98bd2be5a6c80d0a5e16a32af2a06
2017-03-06 07:31:57 -08:00
Stanislau Hlebik
ba7fe90440 hgext3rd: newhiddencachekey extension
Summary:
Computing cache key can be quite slow (100ms and even more). Instead let's use
a simpler cache key: size + mtime of phaseroots, obsstore and changelod and
whether changelog write was delayed.

Test Plan:
1) arc unit

2) Run test-newhiddencache.t

3) Run upstream unittest with extension enabled.
python run-tests.py --extra-config-opt extensions.newhiddencachekey=/home/stash/facebook-hg-rpms/fb-hgext/hgext3rd/newhiddencachekey.py -j20

Verify that there are no failures except for those that show that new extension were added.
Note: also need to comment out debug output in the extension

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, quark, mjpieters

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

Signature: t1:4604811:1487958882:702ea8fdee16def674db97344832936d53f0cd9d
2017-03-06 01:18:58 -08:00
Stanislau Hlebik
1aa37581ea infinitepush: pass dest to pull function
Summary: Previously dest wasn't passed to pull command. This diff fixes it.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4643461:1488501956:4684805c618d55edcf4ee1ae13d34a87e92150e6
2017-03-06 00:50:30 -08:00
Stanislau Hlebik
9a343a289b infinitepush: add user cmd-line option
Summary: Option to specify whose backup to restore

Test Plan: arc unit

Reviewers: #mercurial

Subscribers: #sourcecontrol

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

Tasks: 15389402
2017-03-06 00:44:18 -08:00
Stanislau Hlebik
666f7299d3 infinitepush: reuse bundlerepo
Summary:
This diff is part of the series to avoid downloading the same bundle
a few times.

Finally reuse the same bundlerepo.

Test Plan: arc unit

Reviewers: #mercurial

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402
2017-03-06 00:40:49 -08:00
Stanislau Hlebik
ce7e4ac2e0 infinitepush: use util.getuser() instead of ui.username()
Summary:
There are a couple of reasons to avoid using ui.username():
1) If config option ui.username is set on the server then it will use it
instead of the name of the user that does push
2) It prints confusing warning `no username found, using '....' instead`
3) In some cases it fails (probably because it calls socket.getfqdn() which
does network request).

Let's use simple util.getuser() function and set username to 'unknown' if
it fails.

Test Plan: arc unit

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: azich, mjpieters, #sourcecontrol

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

Signature: t1:4642457:1488458040:5dfac435bf44dfa6ab7725d2f5800963e8c860ec
2017-03-02 04:47:21 -08:00
Stanislau Hlebik
68889ae8f4 fastpartialmatch: add amended commits to the index
Summary:
Upstream mercurial doesn't run hooks for temporary amended commits
(see https://bz.mercurial-scm.org/show_bug.cgi?id=3501 and
c2ca20984e3c9f30d73f0f35c35904b64edbd692). No other hook contains info about
temporary amended commits.

Let's wrap localrepository.commit() function and add missing commits inside
this wrapper.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

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

Tasks: 16387175

Signature: t1:4634950:1488399457:1d299c6ad3cfd418dda32a7ec20c60290f8d7778
2017-03-02 01:14:09 -08:00
Stanislau Hlebik
f008b056b4 fastpartialmatch: do not use fastpartialmatch in bundlerepos
Summary:
bundlerepo adds new commits that are not present in fastpartialmatch index.
Without this diff any access to the commit from bundle fails if
fastpartialmatch.raiseifinconsistent config option is set.

Let's not use fastpartialmatch in bundlerepos

Test Plan: arc unit

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 16394593

Signature: t1:4635368:1488393506:15b8f6a9fddabe681de7fd1296bbfafb9512f558
2017-03-02 00:53:09 -08:00
Stanislau Hlebik
098f1ee4b6 fastpartialmatch: remove changectx.__init__() wrapper
Summary:
Turned out that wrapping `changectx.__init__()` doesn't give any performance
benefits but instead it breaks initializing of changectx. For example, if
there is a commit which revision number N is a prefix of another commit A then
`hg log -r N` outputs commit A instead of commit N. Let's get rid of this
wrapping.

Test Plan: arc unit

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 16394593

Signature: t1:4635311:1488393427:eae091a0d155df336adbb122f2881a28e95ba6b6
2017-03-02 00:37:17 -08:00
Durham Goode
940796814d treemanifest: add option for using native store
Summary:
Adds a treemanifest.usecunionstore config flag for enabling and disabling use of
the native code uniondatapackstore.

Since we haven't implemented the repack APIs on the native datapack stores, we
currently have to force repack to use the old python implementations. Instead of
trying to expose just the appropriate APIs through the python interface, I think
we'll rewrite all of repack to be in C++ at a future time, since we can take
advantage of parallelism, etc.

Test Plan:
Updated test-treemanifest.t to use the c datapackstore. Also run all
the tests with --extra-config-opt=treemanifest.usecunionstore=True.

These tests caught a missing null check in the C++ code as well.

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4609795:1488365341:203362db5f470b613c4d6484686cd32c3fa8458f
2017-03-01 16:55:19 -08:00
Durham Goode
15c644baef cstore: implement markForRefresh on cdatapackstore
Summary:
The markForRefresh function allows callers to tell the datapackstore that new
pack files have been written. This is important for being able to support
generation of treemanifests during pull and is a blocker for using the native
datapackstore in production.

Test Plan: Added a test

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4609076:1488365022:d5480897f2b7674b4d07243e20a495551f985321
2017-03-01 16:55:18 -08:00
Kostia Balytskyi
d66dc36bfa tests_: fix test-show.t
Summary: Make `test-show.t` pass again!

Test Plan: - run test locally, see it passing

Reviewers: #sourcecontrol, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:4636012:1488401012:da051bd55c91890c637f954aaf151d88ea37a978
2017-03-01 12:49:53 -08:00
Durham Goode
a2c090cba3 show-tests: remove help string that core changed
Upstream removed this experimental flag, so we need to update the test.
2017-03-01 12:48:26 -08:00
Kostia Balytskyi
dfb3ca4276 tests_: expect --color in global options
Summary: As per upstream's https://www.mercurial-scm.org/repo/hg-committed/rev/8fb2c95d816a, we need to add `--color` to help messages.

Test Plan: - run test locally, see it passing

Reviewers: #sourcecontrol, mitrandir, simonfar

Reviewed By: mitrandir, simonfar

Subscribers: simonfar, mitrandir, mjpieters

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

Signature: t1:4627818:1488296052:eff62a80e71c24965072d13e2f67b0e78b3f4ea3
2017-02-28 07:35:09 -08:00
Kostia Balytskyi
8458ee33af remotefilelog: make _getfiles step size configurable
Summary:
This makes the `_getfiles` batch size configurable. Let me know if some other config name will serve this purpose better.

**Reason for this fix**
Currently, `_getfile` will write 10000 lines of text into a pipe and only upon the success of this operation, will read file blobs from another pipe. Serving process will start writing file blobs into a second pipe as soon as it sees something in the first pipe. Second pipe's buffer will fill up as it is not read from by the client until client writes 10K file requests. 10K file requests fill the buffer of the first pipe and we have a deadlock.
Ideally, we should make client check whether it can write to the first pipe and if not, go and read from the second pipe, but that is a bigger fix.

Test Plan:
- run local tests, see them all passing
- except for `test-cstore.t`, but it fails for me without my changes as well
- this generally makes sense

Reviewers: #sourcecontrol, durham

Reviewed By: durham

Subscribers: durham, mjpieters

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

Signature: t1:4620152:1488221258:04555177926d129c6ba41bc982ad4e913cb31b20
2017-02-27 14:45:51 -08:00
Scott Ragan
598c76eb7b creates hg sparse --clear-rules option
Summary:
The sparse profile in .hg/sparse currently only can grow, removing rules from this must either be done manually (by editing the file), or one by one using the the -d/--delete command line switch.

To mirror the hg sparse --import-rules command line, hg sparse --clear-rules removes local includes/excludes rules.

Test Plan: fb-hgext/tests/test-sparse-clear.t

Reviewers: marianomartin, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters

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

Tasks: 16073155

Signature: t1:4609102:1488028035:f5f7b7420d911667fb4a07ac770b7e0480a76977
2017-02-27 10:53:50 -08:00
Durham Goode
2bc65bd9db hiddenerror: fix out of bounds error
Summary:
The current code checks if the filter error reports a rev number, and if it does
tries to convert it to a node. If the 'number' is actually just a short form of
a hash that happens to be all digits, then it may be a number greater than the
size of the changelog, so we need to not attempt to access it in the changelog,
otherwise we get an IndexError.

Test Plan: Added a test, it failed before with a weird error

Reviewers: #mercurial, kulshrax

Reviewed By: kulshrax

Subscribers: mjpieters

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

Signature: t1:4613988:1488027938:4f5ffcb07aeecbaf59cad20fb3a592dd92ed2beb
2017-02-25 15:26:19 -08:00
Stanislau Hlebik
7ced159e51 infinitepush: fix the build
Summary: Get rid of hardcoded devserver name

Test Plan: arc unit

Reviewers: #sourcecontrol, andrasbelo

Reviewed By: andrasbelo

Subscribers: mjpieters

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

Signature: t1:4611903:1487951306:00465fe52de92c71f85c3706594d1a128d4b9628
2017-02-24 07:49:17 -08:00
Stanislau Hlebik
fa1919b5db infinitepush: simplify --list-remote option
Summary:
Previously --list-remote wasn't user friendly. User have to always specify a
pattern, and specifying * just won't work because of bash globbing. Also
it wasn't possible to specify many patterns at once.
This diff allows specifying many patterns, it allows to not specify
patterns at all and also it allows to specify default scratch patterns to fetch
if no patterns were specified. This is useful if there are many auto-generated
bookmarks under the same scratch bookmark pattern.

Test Plan: arc unit

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters, #sourcecontrol

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

Signature: t1:4605548:1487934838:066a12c28dda16fa8f90674d736d21345631ef7e
2017-02-24 05:41:53 -08:00
Stanislau Hlebik
7dbfae7df1 infinitepush: skip secret commits during backup
Summary:
discovery.findcommonoutgoing() explicitly skips secret commits. Because of it
we also need to skip bookmarks that point to secret commits, otherwise they
will point to non-existent nodes.

Test Plan: arc unit

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4611393:1487933210:72e79923c944b13204f4cde64d415076703bbe47
2017-02-24 05:33:15 -08:00
Durham Goode
38da31b387 cstore: move python c struct headers out to a file
Summary:
A future patch will want to import just the cstore py headers into
py-ctreemanifest, so let's move those out to their own header file.

Test Plan: Ran the tests

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4571320:1487774077:64b4c5053b223f075a1c9f73ddcd92bd73b53e23
2017-02-23 14:03:04 -08:00
Durham Goode
b5b006fedd cstore: create base Store interface
Summary:
To begin the process of weaning treemanifest off of Python and on to the new
cstore, let's introduce a base Store class that implements a simple get()
function. UnionDatapackStore already implements this. Future patches will make a
Python version that implements this interface as well, so we can swap between
them easily.

Test Plan: Built and ran the tests.

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:4569870:1487846232:aa816311ec37a520a2405b68e3c02ad744613049
2017-02-23 14:03:03 -08:00
Durham Goode
1734bf7dec cstore: implement UnionDatapackStore.get()
Summary:
This implements the get function of UnionDatapackStore which iterates over
deltas and produces a full text. Unfortunately the delta chains currently come
out in reverse order (full text last), so we have to read all of them before we
can produce the delta.

Since mpatch takes a char*, and we want to avoid copying the array into a string
array for every read, we event a ref counted string reference type which let's
us transfer ownership of the char* to the caller.

Test Plan: Added a test

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: stash, simonfar, mjpieters

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

Signature: t1:4556547:1487200302:c73b8f464f6ce413f1c22c0125a91fbece701f08
2017-02-23 14:03:03 -08:00
Durham Goode
3b5fb8770e cstore: implement UnionDatapackStore.getdeltachain()
Summary:
Implements the getdeltachain function on the new UnionDatapackStore class.

This required some modifications to the DeltaChainIterator. Since the results of
the iterator may cross multiple different chains, we need to keep each chain
alive until the iterator is destructed, so we need to keep a reference to each
chain. We also had to remove the size() property from the iterator since the
fact that the chain spans chains means we don't know the size up front.

Test Plan: Adds a test

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:4556458:1487199872:07dffa3121acfbeb6d6993b518e6f4887122d4d5
2017-02-23 14:03:03 -08:00
Durham Goode
767c10a592 cstore: implement UnionDatapackStore
Summary:
This adds a new C++ UnionDatapackStore implementation that only has the
getmissing() function at the moment.

Test Plan: Adds a test

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:4556052:1487161607:664752df19c63c06819ee2af5b4c436f1b76609d
2017-02-23 14:03:03 -08:00
Durham Goode
de60b62da4 cstore: implement datapackstore.getmissing()
Summary:
This implements a C++ version of the datapackstore getmissing() function and
adds a test.

Test Plan: Added a test

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, ikostia, mjpieters

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

Signature: t1:4552853:1487191581:c108be4a85f8eacafddbea8086d5d22fdcabdacf
2017-02-23 14:03:03 -08:00
Durham Goode
4fd00d751a cstore: C++ implementation of datapackstore
Summary:
The remaining python parts of the store are a perf bottleneck when accessing
hundreds of thousands of pack file entries (like in treemanifest). Let's
implement them in C++.

This first patch just add the basic boiler plate, and implements a single
function getdeltachain(), with a test. Future patches will add more
functionality and other parts of the store.

Since cstore depends on cdatapack and ctreemanifest (the pythonutils.h part for
now), we need to tweak our setup.py to enforce a certain build order too.

Test Plan: Added a test, yo

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, stash, mjpieters

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

Signature: t1:4547929:1487181318:21c146cf370d26cb97efe6a883868b85b4e32f49
2017-02-23 14:03:03 -08:00
Durham Goode
2cd1eeb08e ctreemanifest: move treemanifest into cstore
Summary:
As part of unifying our native store data structures into a single library,
let's move the treemanifest (including the python extension) into py-cstore.

Test Plan:
Built and ran the tests. Verified there was no ctreemanifest.so
dependency in the built cstore.so by using 'ldd cstore.so' on Linux and 'otools
-L cstore.so' on OSX.

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4602484:1487842683:964cbb43b7cb20d0db699ef691fe7fcf6bccf2e8
2017-02-23 14:03:03 -08:00
Durham Goode
a2cf280498 tree-tests: fix ctreemanifest tests to run against build output
Summary:
'python setup.py build' puts the build artifacts in build/lib.../, but
test-ctreemanifest.py was not configured to look there so it was actually
running against the system ctreemanifest in that case.

The old development workflow was to use make local, which put it at the root of
the repo, which is why this used to work. Let's move the ctreemanifest to be
with the rest of the tests in test-cstore.t so we can set the environment up
correctly.

Test Plan:
Some future diffs broke the test without me knowing. I happened to
catch it via other means, so I came back and fixed the test framework.

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, quark, mjpieters

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

Signature: t1:4570449:1487763880:682800284c01ac25bd99cbe811a8d98d34caf79b
2017-02-23 14:03:03 -08:00
Durham Goode
e1b1c470e6 cstore: move py-cdatapack to be part of py-cstore
Summary:
As part of unifying our storage layer into a single library, let's move
py-cdatapack into the new cstore directory. Future patches will move
ctreemanifest and the upcoming datapackstore into here as well.

py-cdatapack.h required some reordering since it seems forward declarations work
a little differently between C and C++. There were no code changes though,
except one int->size_t fix.

Test Plan: Ran the tests

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4581320:1487788968:e8a34c7a03a16db282214c7dd476b749b92a1bfa
2017-02-23 14:03:02 -08:00
Durham Goode
85ff1268f8 cstore-tests: move remotefilelog py tests to .t test
Summary:
A future patch which renamed cdatapack.so to cstore.so pointed out that our
test-remotefilelog*.py tests are running against the system remotefilelog. Let's
move them to a .t test that sets the appropriate PYTHONPATH.

Test Plan: Ran the tests

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: stash, mjpieters

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

Signature: t1:4581281:1487788843:365c6adf41ba51bdbe7394c1ab423fcc5a63bdbc
2017-02-23 14:03:02 -08:00
TJ
01fdb5bf0d edrecord: introduce interactive commits with an editor interface
Summary: creating a mercurial extension so that `hg record` functionality can be used via a text editor (instead of interactive command prompt or curses menu)

Test Plan: `$ run-tests.py test-edrecord.t`

Reviewers: durham, skreyen, most, #sourcecontrol, asriram, simonfar

Reviewed By: simonfar

Subscribers: quark, rmcelroy, simonfar, mjpieters, #nuclide

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

Tasks: 15728734

Signature: t1:4547080:1487842609:8855e35010cac3b6d2b136a80d7effa369eb1da8
2017-02-23 11:27:52 -08:00
Stanislau Hlebik
295880f660 infinitepush: add docs for config options
Test Plan: arc unit

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters

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

Signature: t1:4590918:1487682839:fb65d327f49d2cf5922b995889fe6de7f0bb24ea
2017-02-23 04:25:02 -08:00
Stanislau Hlebik
6087449988 infinitepush: do one listkeyspatterns request for all scratch bookmarks
Summary:
listkeyspatterns support batching. Let's use and avoid making many network
calls to the hg server.

I had to modify tests because scratchbookmarks are passed to the listkeyspatterns,
and scratchbookmarks is dict and the order of the keys is unpredictable.
Because of it bundles from the server will be sent in unpredictable order, and log
output may be different.

Test Plan: arc unit

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4590914:1487788586:dd5ba0dd41b0cd19f790755d7b3c1fc5ba4ade61
2017-02-23 04:25:02 -08:00
Martijn Pieters
1752a2ba84 Send a single string (normal) to scuba
Summary: The data was being sent to scuba, but then ignored altogether. Turn this into a single string instead.

Test Plan: arc unit

Reviewers: #sourcecontrol, andrasbelo

Reviewed By: andrasbelo

Subscribers: mjpieters, andrasbelo

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

Signature: t1:4598196:1487784582:8952e0e386325d1635029aab2b9d97e9284376ea
2017-02-22 14:36:28 -08:00
Jun Wu
5966b1dbf1 test-hiddenerror: fix Python 2.6 compatibility 2017-02-21 11:11:10 -08:00
Kostia Balytskyi
71cda7492d tests_: add pager help to test-show.t
Differential Revision: https://phabricator.intern.facebook.com/D4591081
2017-02-21 06:47:12 -08:00
Jun Wu
78b2c91c65 profiling: remove the extension
Summary:
The profiling extension is to log interactive time.

The upstream change 459366b580cf breaks the profiling extension as it could
no longer wrap `maybeprofile` in time. And @simonfar's
`ui.timeblockedsection` is going to be a superior solution. So just remove
the profiling extension and its tests.

Test Plan: Checked that the extension is not enabled in our config files.

Reviewers: simonfar, #mercurial

Subscribers: mjpieters, simonfar

Differential Revision: https://phabricator.intern.facebook.com/D4583087
2017-02-17 16:27:19 -08:00
Stanislau Hlebik
bf1907bb0e infinitepush: fix tests
Summary:
1196262099b5ff1f8529afc8055b1bc2c7e41658 upstream change cause test to fail
Fix it

Test Plan: arc unit

Reviewers: #sourcecontrol, mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters

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

Signature: t1:4581218:1487366936:330f5982edcd03e7e8f4b4a514ea3b285713795b
2017-02-17 13:30:24 -08:00
Jeroen Vaelen
0ecf1322c6 fastlog-hg: use smartset to merge multi-path results
Summary:
97d0be4019ac in core broke the fastlog extension for multi-path
queries. We did not have a test to catch it. It was reported as broken by a
user.

Test Plan:
```
$ ../../hg/tests/run-tests.py test-fastlog.t
```

Reviewers: #sourcecontrol

Subscribers: mjpieters

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

Tasks: 16154586
2017-02-17 09:01:50 -08:00
Mateusz Kwapich
7b859c681d whereami: add extension
Summary:
This command will allow us to expose simple api to all automation checking
working copy parent.  It's meant to be overridden by our wrapper to read the
dirsate directly without shelling out to hg (see D4454504 )

Test Plan: see tests

Reviewers: #mercurial, durham, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:4454502:1485441135:09902c6437a7af55dfa5c97e3165681de687231f
2017-02-17 16:01:02 +00:00
Durham Goode
a808c980f0 Backed out changeset c84de4b54530
The cstore changes are breaking the build in some unusual ways and I will need
some time to fix them. Let's back it out for now.
2017-02-16 14:37:23 -08:00
Durham Goode
885c9a00a3 Backed out changeset c00bd7acec6e
The cstore changes are breaking the build in some unusual ways and I will need
some time to fix them. Let's back it out for now.
2017-02-16 14:37:23 -08:00
Durham Goode
f797211a24 Backed out changeset 7f46fb9d639b
The cstore changes are breaking the build in some unusual ways and I will need
some time to fix them. Let's back it out for now.
2017-02-16 14:37:23 -08:00
Durham Goode
ac609a8fcd Backed out changeset f2366f7aceae
The cstore changes are breaking the build in some unusual ways and I will need
some time to fix them. Let's back it out for now.
2017-02-16 14:37:23 -08:00
Durham Goode
2f31853723 Backed out changeset 3f33c87d714b
The cstore changes are breaking the build in some unusual ways and I will need
some time to fix them. Let's back it out for now.
2017-02-16 14:37:23 -08:00
Stanislau Hlebik
3ba3866802 fastpartialmatch: add generation number
Summary:
fastpartialmatch index may be incorrect if fastpartialmatch extension was
disabled, then new commits were added and then fastpartialmatch was
enabled back. We need to detect this situation and rebuild the index in
this case.

One approach would be to use _handleinconsistentindex() function to mark index
as invalid. There are a couple of drawbacks to this approach:
1) It requires more significant code changes
2) The output may still be incorrect if hash with the same prefix was added while fastpartialmatch was disabled.

Another approach would be to use header version from index files
(see class _header). That's even worse because we'll need to bump index
version in the code whenever we disable fastpartialmatch.

Third approach would be to use changelog mtime + size as a validation key but
then we need to ensure partialmatch index is written after changelog.

Instead I suggest to use generation numbers. It's just a number in the config
and in the special file inside partialmatch index directory. If the
two doesn't match then index is incorrect and needs to be deleted. The biggest
drawback to this approach is that we need to bump generation number each time
the extension is enabled. I think it should be fine because the one who enables
extensions usually understands it and he or she will bump the generation number.

Test Plan: arc unit

Reviewers: #sourcecontrol, durham, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters

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

Signature: t1:4571926:1487263035:53419c9ca4e344127f391ac19c1071a826fea3f1
2017-02-16 10:18:22 -08:00
Stanislau Hlebik
bc7415f5e7 fastpartialmatch: use _realopener
Summary:
User reported failures because revlog.opener doesn't have `exists` function.
The reason is that sometimes opener is wrapped inside the function.
Let's use _realopener instead

Test Plan: arc unit

Reviewers: #sourcecontrol, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters

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

Signature: t1:4571659:1487267797:a950ab7c88d75573df64ec1964755c054307c7ea
2017-02-16 10:17:54 -08:00
Durham Goode
a175c77c9c cstore: implement UnionDatapackStore.get()
Summary:
This implements the get function of UnionDatapackStore which iterates over
deltas and produces a full text. Unfortunately the delta chains currently come
out in reverse order (full text last), so we have to read all of them before we
can produce the delta.

Since mpatch takes a char*, and we want to avoid copying the array into a string
array for every read, we event a ref counted string reference type which let's
us transfer ownership of the char* to the caller.

Test Plan: Added a test

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: stash, simonfar, mjpieters

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

Signature: t1:4556547:1487200302:c73b8f464f6ce413f1c22c0125a91fbece701f08
2017-02-15 15:19:37 -08:00
Durham Goode
455a287639 cstore: implement UnionDatapackStore.getdeltachain()
Summary:
Implements the getdeltachain function on the new UnionDatapackStore class.

This required some modifications to the DeltaChainIterator. Since the results of
the iterator may cross multiple different chains, we need to keep each chain
alive until the iterator is destructed, so we need to keep a reference to each
chain. We also had to remove the size() property from the iterator since the
fact that the chain spans chains means we don't know the size up front.

Test Plan: Adds a test

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:4556458:1487199872:07dffa3121acfbeb6d6993b518e6f4887122d4d5
2017-02-15 15:19:36 -08:00
Durham Goode
9c206a743f cstore: implement UnionDatapackStore
Summary:
This adds a new C++ UnionDatapackStore implementation that only has the
getmissing() function at the moment.

Test Plan: Adds a test

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:4556052:1487161607:664752df19c63c06819ee2af5b4c436f1b76609d
2017-02-15 15:19:36 -08:00
Durham Goode
99a0c9b488 cstore: implement datapackstore.getmissing()
Summary:
This implements a C++ version of the datapackstore getmissing() function and
adds a test.

Test Plan: Added a test

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, ikostia, mjpieters

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

Signature: t1:4552853:1487191581:c108be4a85f8eacafddbea8086d5d22fdcabdacf
2017-02-15 15:19:36 -08:00
Durham Goode
41486c3f47 cstore: C++ implementation of datapackstore
Summary:
The remaining python parts of the store are a perf bottleneck when accessing
hundreds of thousands of pack file entries (like in treemanifest). Let's
implement them in C++.

This first patch just add the basic boiler plate, and implements a single
function getdeltachain(), with a test. Future patches will add more
functionality and other parts of the store.

Since cstore depends on cdatapack and ctreemanifest (the pythonutils.h part for
now), we need to tweak our setup.py to enforce a certain build order too.

Test Plan: Added a test, yo

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, stash, mjpieters

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

Signature: t1:4547929:1487181318:21c146cf370d26cb97efe6a883868b85b4e32f49
2017-02-15 15:19:36 -08:00
Jun Wu
3c5f5d0bc4 test-mergedriver: fix compatibility with upstream
Upstream has moved debugmergestate from commands.py to debugcommands.py, in
7699b457fd0a. So update our test code accordingly.
2017-02-15 15:08:15 -08:00
Adam Simpkins
33b2fbc0bc fbconduit: fix error handling in gitnode() revset
Summary:
Don't let errors propagate out of the gitnode() revset.  Always report errors
in gitnode() as a translation failure, rather than letting exceptions propagate
up and crash mercurial.  The code was previously only catching internally
generated ConduitError exceptions, but it can also throw HttpError exceptions,
and the underlying httplib code can throw its own exceptions as well as
socket.error exceptions.

This also fixes the test code to use an ephemeral TCP port rather than assuming
port 8543 will always be available.  Using a fixed TCP port in test code is a
very common way to cause bogus failures if the tests are run in parallel.
(For instance, testing multiple repositories in parallel on the same build
host.)

Test Plan:
Added unit tests that check the behavior when the server returns a 500 error,
and when the server refuses the connection entirely.

Reviewers: quark, durham, rmcelroy

Reviewed By: rmcelroy

Subscribers: net-systems-diffs@fb.com, yogeshwer, mjpieters

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

Signature: t1:4556871:1487062142:b58d770d46c975d44933bec08cfce8acb25ff16b
2017-02-15 12:35:06 -08:00
Stanislau Hlebik
1f65684b71 infinitepush: pull bookmark during update
Summary:
Currently infinitepush pulls only unknown nodes.
Let's also pull non-existing scratch bookmark during update.

Test Plan: arc unit

Reviewers: durham, rmcelroy, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters, #sourcecontrol

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

Signature: t1:4564626:1487171677:d25db859ff35805f8ffc7741bc14abbc8d84dac3
2017-02-15 09:33:44 -08:00
Jun Wu
763e41cee8 smartlog: work better with repos where there is no master
Summary:
Previously, smartlog use `tip` as the fallback master, and prompts:

  warning: there is no master changeset locally, try pulling from server

if master is `tip`.

That makes smartlog less friendly for external users. This patch removes the
prompt and changes the fallback master to the last public revision so it
works out-of-box.

Test Plan: `arc unit`

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters

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

Signature: t1:4555346:1487036530:35a5fa65d5419e7324d3203fa52de9a82b8132e3
2017-02-14 17:25:12 -08:00
Arun Kulshreshtha
e71276b303 hiddenerror: make error message configurable
Summary:
This diff makes the following modifications to the (former) `hiddenhash` extension:

- Makes the error messages configurable, allowing us to easily change the error messages in `facebook.rc`.
- Renames the extension to `hiddenerror`, since the primary feature is now the configurable error messages rather than using a hash in the message.
- Changes the method by which the extension wraps the `changectx` constructor. The old method of wrapping would result in errors in code paths that in `context.py` that performed `isinstance()` checks on contexts.

Test Plan: To test arc patch this extension into your `facebook-hg-rpms` and enable it for a test repo. Then, attempt to access a hidden node. You should see the default error message defined in the extension. Setting `hiddenerror.message` and `hiddenerror.hint` should allow you to customize the messages. See test file for examples.

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, durham, mjpieters

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

Tasks: 15896355

Signature: t1:4548140:1487063552:06395c1eaaa83b00ead8e80e2cd8f9d13f7d08e2
2017-02-14 11:15:19 -08:00
Martijn Pieters
3455bf3ae6 Allow sparse profiles to contain comments
Summary: Sometimes you want to be able to justify why a line is in a sparse profile. Support empty lines and comments (starting with a hash).

Test Plan: Run the test runner

Reviewers: #mercurial, rmcelroy, durham

Reviewed By: durham

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

Tasks: 15993301

Signature: t1:4537617:1486687441:18a00b65df244b573bab095809fb1fbb57e21d71
2017-02-13 04:17:51 -08:00
Arun Kulshreshtha
f46e6eb4da debuginhibit: print out inhibited nodes by default
Summary: If `hg debuginhibit` is run with no arguments, print out a list of inhibited nodes. This is similar to how `hg debugobsolete` works and will assist with debugging.

Test Plan: Run `hg debuginhibit` in a repo with inhibited nodes. (This can be tested by either stripping some test commits and then updating back to them, or by manually inhibiting the commits with `hg debuginhibit`.) A list of inhibited nodes should be printed. See test file for an example.

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

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

Tasks: 16004717

Signature: t1:4541514:1486722366:10b4232830ed88931bd6ac610972114743797192

Revert Plan:
2017-02-10 11:28:33 -08:00
Stanislau Hlebik
3c186b1ee4 infinitepush: pull node during update
Summary:
Let's pull node during update if not found locally.
This is a part of selectivepull functionality.
See remotenames extensions for details about selectivepull.

Test Plan: arc unit

Reviewers: #sourcecontrol, durham

Reviewed By: durham

Subscribers: indragie, mjpieters, sergeyb

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

Tasks: 12479658

Signature: t1:4536129:1486667537:3d1df30cb5d1db0dd7451756102ccafee20789d5
2017-02-10 00:20:54 -08:00
Durham Goode
41d4153092 remotefilelog: adjust PYTHONPATH during tests
When remotefilelog moved from its own repo, the tests needed to be updated to
adjust the PYTHONPATH to ensure the in-repo remotefilelog was loaded instead of
the system one.

This meant any local runs of remotefilelog tests would've been using the system
remotefilelog unless the user had manually set the PYTHONPATH themselves.
2017-02-09 18:02:52 -08:00
Durham Goode
b4bd534579 fastmanifest: wrap manifestlog.get
Summary:
Previously we only wrapped manifestlog.__getitem__ because fastmanifest didn't
support the concept of directory manifests. Unfortunately manifestlog.get() is
used in some flat manifest cases too, like in changegroup.py where it just
passes '' as the directory but still uses .get().

This bug has been present since the manifestlog refactor, but only became
exposed now that we've improved our caching and hold on to manifest ctx's for
longer.

This fix is to just wrap manifestlog.get() too. Fixing this exposed some other
inconsistencies with our fastmanifest api.

Test Plan:
shelve now passes in a repo that was hitting an exception because of
this before. I'm still trying to think of how to test this in a test. I've not
been able to repro it in my own repo yet.

Reviewers: #mercurial, quark

Reviewed By: quark

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

Tasks: 15991119

Signature: t1:4540677:1486690231:07a95b402913d7dcc31633341e235ee1eb0163bc
2017-02-09 17:36:26 -08:00
Ryan McElroy
8d8edfb6e0 remotefilelog: force prefetch when it will speed up linkrev calculation
Summary:
See comment in code for details. This addresses a performance
problem that arises when the same remotefilelog repo makes two changes
to a file far apart in history with no other repo making changes to the
same file in between.

Test Plan: new test verifies that linkrevs are fixed up using remote blob

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: stash, quark, mjpieters

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

Tasks: 12958591

Signature: t1:4475183:1486576777:81f4f9815cb677c94954c23ecd8aa7edb006ffd9
2017-02-09 03:35:58 -08:00
Arun Kulshreshtha
da74a12dac hiddenhash: make hidden commit errors more user friendly
Summary:
Previously, when a command tried to access a hidden revision without the `--hidden` flag, the user would get the following error:

```
abort: hidden revision '0'!
(use --hidden to access hidden revisions)
```

With this extension, the error is now:

```
abort: hidden commit b8144197c244!
```

This way, novice users aren't tempted to immediately re-run the command with `--hidden`, which may have undesired results. It also makes it much easier to find the commit in question in `hg sl --hidden` since by default smartlog does not show rev numbers.


Test Plan: Attempt to access a hidden commit, observe new error message as seen above. Note that in the test file the word "changeset" is present instead of "commit" due to the lack of the `dialect` extension in the test.

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Tasks: 15747879

Signature: t1:4506065:1486122372:d82ebd488a00d1958c235f733a9455111954c116
2017-02-03 12:26:22 -08:00
Stanislau Hlebik
ea2d3d8a1d fastpartialmatch: fix tests
Test Plan: arc unit

Reviewers: #sourcecontrol, andrasbelo

Reviewed By: andrasbelo

Subscribers: mjpieters

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

Signature: t1:4507168:1486110887:01175dc859d68a6668cb4d51cc7b343db843084f
2017-02-03 00:37:10 -08:00
Arun Kulshreshtha
3c80b1176b fbamend: make inhibit hook fire after rebase
Summary:
Recently @rmcelroy discovered that attempting to rebase a single commit in the middle of a stack results in the rest of the stack being marked as unstable. See https://fb.facebook.com/groups/sourcecontrol/permalink/1207767375939547/ for full example.

It turns out that the inhibit extension's post-transaction hook that would ordinarily inhibit the rebased (and thus obsolete) commit, and thereby hide the instability, was not firing in this case. This was similar to a previous problem with `hg next --rebase` wherein `--continue`'ing a rebase with conflicts would result in visible instability for the same reason. In both cases, the problem appears to be that `rebase` doesn't actually create a transaction, so of course the post-transaction hook doesn't fire.

The solution for `hg next --rebase` was to add a (nearly) empty transaction after the rebase call to trigger the hook. This diff just makes this the default behavior for `hg rebase` so that the hook is always called.

Test Plan:
See new test file. Basically, create a situation like:

```
o  e5d56d  debugbuilddag
|  r3
|
| o  c175ba  debugbuilddag
| |  r2
| |
| o  220949  debugbuilddag
|/   r1
|
o  1ad88b  debugbuilddag
   r0
```

Perform `hg rebase -r 1 -d 3`, which rebases commit "r1" onto "r3", which would ordinarily make "r2" unstable. Instead, the result should be as below, with no visible instability because "r1" is inhibited.

```
o  738e8e  debugbuilddag
|  r1
|
o  e5d56d  debugbuilddag
|  r3
|
| o  c175ba  debugbuilddag
| |  r2
| |
| x  220949 (Rebased as 738e8e)  debugbuilddag
|/   r1
|
o  1ad88b  debugbuilddag
   r0
```

Reviewers: rmcelroy, #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters, rmcelroy

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

Tasks: 15697758

Signature: t1:4491870:1486033128:45b8e9a72af1e88ab78484ddef47a788d1aca7b5
2017-02-02 11:49:44 -08:00
Stanislau Hlebik
1632aa627b fastpartialmatch: fix the build
Summary: Sort the output to fix tests on different platforms

Test Plan: arc unit on mac

Reviewers: #sourcecontrol, simonfar, ikostia

Reviewed By: simonfar, ikostia

Subscribers: mjpieters

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

Signature: t1:4501449:1486050577:3041dc3c3691f48e39a0e9e05b1f97954a6d88e2
2017-02-02 08:00:55 -08:00
Stanislau Hlebik
47060cb7d0 fastpartialmatch: trigger rebuilds if there were too many unsorted entries
Summary:
If we have too many unsorted entries then finding matching revisions is
slower. To fix it we will rebuild partial index from time to time.
_findcandidates function marks index as need-to-be-rebuilt if it notices
index file with too many unsorted entries. Then _changegrouphook rebuilds
the index.

Test Plan: arc unit

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D4494617
2017-02-02 05:12:10 -08:00
Stanislau Hlebik
470276319f fastpartialmatch: use bisect to quickly find matching revisions
Summary:
Since we have some of the nodes sorted we can now use bisect to quickly find
matching nodes.

Test Plan: arc unit

Reviewers: #sourcecontrol

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4494419
2017-02-02 05:12:10 -08:00