Commit Graph

4322 Commits

Author SHA1 Message Date
Liubov Dmitrieva
98f863b323 use commitknown api for checking existing commits
Summary:
use `commitknown` edenapi api for checking the existing commits

it uses the same `lookup_commits` under the hood but a bit shorter to use

we won't need the tokens for existing changesets, so can use a simpler api

also, make `lookupfilenodes` function a bit shorter

Reviewed By: markbt

Differential Revision: D29134677

fbshipit-source-id: 257624d64480102c34761560b2bd768049cbfa83
2021-06-17 08:22:33 -07:00
Mark Juggurnauth-Thomas
759d6fc5b7 commitcloud: remove syncing of obsmarkers
Summary: Obsolescence markers have been deprecated in favour of mutation and visibility for some time.  Remove syncing of obsmarkers via the commit cloud service.

Reviewed By: liubov-dmitrieva

Differential Revision: D29159443

fbshipit-source-id: 33e1d526a9df5c02059931c880529d695036c616
2021-06-17 06:09:02 -07:00
Jun Wu
d12a1fe872 test-inherit-mode: stabilize the test
Summary:
In some envs the mode 02775 gets printed, and some other envs have 00775:

    --- test-inherit-mode.t
    +++ test-inherit-mode.t.err
    @@ -85,7 +85,7 @@
       006?0 ./.hg/store/00changelog.i (glob)
       00664 ./.hg/store/00changelog.len
       00660 ./.hg/store/00manifest.i
    -  02775 ./.hg/store/allheads/
    +  00775 ./.hg/store/allheads/
       00664 ./.hg/store/allheads/index2-node
       00664 ./.hg/store/allheads/log
       00664 ./.hg/store/allheads/meta

Allow both in the test.

Reviewed By: singhsrb

Differential Revision: D29185622

fbshipit-source-id: 40995c3941a88dbae7ad484c1a3abf9cded40bab
2021-06-16 23:33:42 -07:00
Jun Wu
d0d8e61daf setup: check Python.h existence
Summary:
Non-buck build cannot succeed if Python.h is missing.
Let's check it explicitly so we don't pick a bad Python.

Reviewed By: DurhamG

Differential Revision: D29179295

fbshipit-source-id: 421c824053d066914a6611f05815527768f257ee
2021-06-16 15:08:52 -07:00
Jun Wu
960cdcc4b9 setup: pick the right Python more aggressively
Summary:
It turns out that `python3` might be a symlink to a fbcode Python that cannot
perform the build in some (not all) environment. Let's try more names like
`python3.8`, `python3.7`, etc.

Reviewed By: DurhamG

Differential Revision: D29178933

fbshipit-source-id: da6cae351f25a90ab8a9da85282d09f79505c5e7
2021-06-16 15:07:23 -07:00
Jun Wu
ee1939e4d1 setup: downgrade IPython to 5.8
Summary:
IPython 7 has compatibility issues when bundling into zip:
- The dependency parso does not work when embedded in zip. It expects
  `python/grammar38.txt` to exist on the filesystem (not in a zip).
- It stacktraces after exiting the IPython shell.
- TAB completion does not really work.

Downgrading to IPython 5 and avoid the bundling the parso dep to resolve the
issues.

This should fix `test-autofix.t` and `test-argspans.py` failures.

Reviewed By: DurhamG

Differential Revision: D29170653

fbshipit-source-id: 14a3d16deaca72fbfb7b3acc0a4246a771c4d0aa
2021-06-16 11:51:11 -07:00
Andrey Chursin
11f0f9152d dag: separate out AbstractNameDag::{verify_missing, reload, persist}
Summary: They will be reused in import_pull_data

Reviewed By: quark-zju

Differential Revision: D29147950

fbshipit-source-id: 192bf33c30067f43c4fcaaf3054741b39efb4e25
2021-06-16 11:07:50 -07:00
Andrey Chursin
2de68ff1fd dag: introduce DagImportPullData
Summary: This is an interface for importing pull data into dag

Reviewed By: quark-zju

Differential Revision: D29142979

fbshipit-source-id: b40b94403a044c0b74d1574528aa374ec309a0cf
2021-06-16 11:07:50 -07:00
Andrey Chursin
2d76e5ce61 commits: introduce AppendCommits::import_pull_data
Summary: This will be used to import pull data into segmented changelog

Reviewed By: quark-zju

Differential Revision: D29142981

fbshipit-source-id: 2d19a035ee0b6cefef8fc0547a5dfb79f284a1de
2021-06-16 11:07:49 -07:00
Jun Wu
f7fde44264 setup3: remove duplicated deps
Summary:
It causes warnings:

  /usr/lib64/python3.6/zipfile.py:1378: UserWarning: Duplicate name: 'toml/__init__.pyc'
    return self._open_to_write(zinfo, force_zip64=force_zip64)
  /usr/lib64/python3.6/zipfile.py:1378: UserWarning: Duplicate name: 'toml/encoder.pyc'
    return self._open_to_write(zinfo, force_zip64=force_zip64)
  /usr/lib64/python3.6/zipfile.py:1378: UserWarning: Duplicate name: 'toml/decoder.pyc'
    return self._open_to_write(zinfo, force_zip64=force_zip64)
  /usr/lib64/python3.6/zipfile.py:1378: UserWarning: Duplicate name: 'toml/tz.pyc'
    return self._open_to_write(zinfo, force_zip64=force_zip64)
  /usr/lib64/python3.6/zipfile.py:1378: UserWarning: Duplicate name: 'toml/ordered.pyc'
    return self._open_to_write(zinfo, force_zip64=force_zip64)
  /usr/lib64/python3.6/zipfile.py:1378: UserWarning: Duplicate name: 'six.pyc'
    return self._open_to_write(zinfo, force_zip64=force_zip64)
  /usr/lib64/python3.6/zipfile.py:1378: UserWarning: Duplicate name: '__init__.pyc'
    return self._open_to_write(zinfo, force_zip64=force_zip64)

Reviewed By: andll

Differential Revision: D29107803

fbshipit-source-id: 0c46d739bf4f0c5e2faec835a29b3e0017f55ddd
2021-06-16 10:25:28 -07:00
Jun Wu
d0e16f1a25 setdiscovery: use native set types
Summary: Avoid converting to Python `set` for better performance.

Reviewed By: andll

Differential Revision: D29145340

fbshipit-source-id: 9c560f14404ac764184736bd09f5ea99f83cb7d5
2021-06-16 09:10:27 -07:00
Jun Wu
8afaafc486 changelog: remove code dealing with cl.userust() is False
Summary:
`cl.userust()` is always True after D29020191 (3765f8bd76) so `cl.userust() is False` code
is now dead.

Reviewed By: andll

Differential Revision: D29142464

fbshipit-source-id: f9a7e5c56641218758f12bad3de43d1cd1a71716
2021-06-16 09:10:27 -07:00
Meyer Jacobs
94be2053d5 tests: remove pack file-only tests
Summary: Pack files are no longer supported, yet we still have many tests which exercise them. In preparation for landing `scmstore` as a drop-in replacement for ContentStore, I'm removing our tests which only exist to test datapack-specific functionality.

Reviewed By: DurhamG

Differential Revision: D29099012

fbshipit-source-id: 635a913ee0d93ed8d536e71f8fa6a600b823b343
2021-06-15 19:00:58 -07:00
Andres Suarez
0f273c5ded update globset from 0.4.5 to 0.4.7
Summary:
The only real change here is: https://github.com/BurntSushi/ripgrep/pull/1756
This is a patch release but fixes a very glaring bug that others have
depended on. This diff fixes the uses to match the old behavior.

Although it's billed as a "fix", it's actually a huge perf improvement
for Linttool, which uses predominantly recursive suffix globs. The fact
that we don't have to compile ~5,000 regexps at Linttool startup anymore
makes such a huge difference that I am going to do write up soon.

Reviewed By: ndmitchell

Differential Revision: D29085977

fbshipit-source-id: 304470e5fa8cb986738aa0d9dd941641684a9194
2021-06-15 15:47:49 -07:00
Durham Goode
0e8bbd2e51 py3: remove py3 options and py2 rpm spec
Summary:
Python 2 is no longer built anywhere. Let's make the various py3
options the default, like renaming 'make local3' to 'make local' and let's get
rid of the dead setup.py and rpm spec.

Reviewed By: quark-zju

Differential Revision: D29077093

fbshipit-source-id: 0c50c2296fe10ff1db9ac8f9b0df2a4836c0ea5b
2021-06-15 14:46:42 -07:00
Andrey Chursin
c8d63eff2f async: replace block_on_future with block_on
Summary:
For a while we had two methods in async runtime: block_on_future and block_on_exclusive, due to historic reasons

Recently those methods were calling same code, and now it is time to replace both of them and rename to block_on

Reviewed By: quark-zju

Differential Revision: D29121107

fbshipit-source-id: 5faa76ae181e491b55d799c23c9de1b4e80298f3
2021-06-15 14:08:13 -07:00
Thomas Orozco
28e474eb82 hg: set ignoreautobackup on hg cloud backup
Summary:
If this opens a transaction and fails, then we start a never-ending cycle of
starting hg cloud backup and failing.

This command normally doesn't open transactions but it might via other
extensions, here is one example: P423007962.

This ends up killing people's machines:

https://fb.workplace.com/groups/scm/permalink/3957513017631622/

This fixes that by not kicking off background backups in this case.

Reviewed By: liubov-dmitrieva

Differential Revision: D29136077

fbshipit-source-id: 1c4e6de6147571dd6d728f761324506b1804f303
2021-06-15 12:54:40 -07:00
Jun Wu
be06ac3ada hgcommands: add debugdumpdynamicconfig for no-repo use-cases
Summary:
The added command gives access to read (execute) dynamicconfig without
using an on-disk repo.

It can be used by the clone script to stage rollout lazy changelog, or just to
verify dynamic config changes without using a repo.

Reviewed By: DurhamG

Differential Revision: D29123072

fbshipit-source-id: e8856d816a636fa860bfcc9694306a4a37552523
2021-06-15 10:48:01 -07:00
Liubov Dmitrieva
99a2b85f1a upload file content
Summary:
implement uploading file content via Eden API

* in this diff I aim to upload file content for the given set of filenodes
* also, the code would check with Mononoke using the lookup request what is already there and skip those
* also, this diff introduces calculation of blake2 hash (called ContentId) for file contents (we would probably need to store/cache those and the mapping from hg filenode id to the canonical Mononoke content_id)
* for every uploaded content EdenApi returns a token that we would also need to store later

Reviewed By: markbt

Differential Revision: D29063229

fbshipit-source-id: 739a44bc3ff904cb04a39514ba5efd01c80ba6d0
2021-06-15 08:09:00 -07:00
Andrey Chursin
41c476a200 pyedenapi: add pullfastforwardmaster binding
Reviewed By: quark-zju

Differential Revision: D29118724

fbshipit-source-id: f6083244dffe2cab050330e1213c98e144d278a7
2021-06-14 21:11:15 -07:00
Andrey Chursin
3cf926bcfe eagerepo: impl pull_fast_forward_master for EagerRepo
Reviewed By: quark-zju

Differential Revision: D29113217

fbshipit-source-id: f7c84d450b6c029c251474bfe1be86767979a78b
2021-06-14 21:11:15 -07:00
Andrey Chursin
6e4d6a5671 dag: pull_fast_forward_master implementation for AbstractNameDag
Summary: This will be used in eager repo integration tests

Reviewed By: quark-zju

Differential Revision: D29113218

fbshipit-source-id: a24232bd6c19010d8ac90d1305f57f1094b06323
2021-06-14 21:11:15 -07:00
Jun Wu
880b5c3cd8 mutation: avoid expensive server lookups for lazy changelog
Summary:
Similar to D29111710. Let's avoid asking servers for unknown nodes.

In theory this might affect correctness. Practically, this should only affect "landed as" markers,
because all drafts should be non-lazy. If the "landed as" correctness is an issue, we can fix
forward "landed as" later (ex. by writing down the public commit hash explicitly in
debugmarklanded).

Reviewed By: andll

Differential Revision: D29114049

fbshipit-source-id: db8dc34244feb66919cdff9433b6f18967c9ea9b
2021-06-14 16:00:58 -07:00
Jun Wu
f555f9c55d pydag: add a way to test commit existence without asking remote server
Summary: This will be used by upcoming changes.

Reviewed By: andll

Differential Revision: D29114048

fbshipit-source-id: ce963a42ebc5722ca9c61ab0a4e7a7377bbf7abb
2021-06-14 16:00:58 -07:00
Jun Wu
ac6c6cf3fa mutationstore: avoid excessive server lookups for lazy dag
Summary:
The mutationstore might contain lots of names (commit hashes) that are unknown
to the repo. When using a lazy changelog, by default, those names will be
looked up remotely, and most of the time the server just returns "name is outside
the graph".

We don't have negative cache to speed it up, because cache invalidation is
tricky - every lazy pull would in theory invalidate them.

To make things faster, let's just skip names in the mutationstore that are unknown
_locally_ without asking the server.

In theory this might affect correctness. Practically, this should only affect "landed as" markers,
because all drafts should be non-lazy. If the "landed as" correctness is an issue, we can fix
forward "landed as" later (ex. by writing down the public commit hash explicitly in
debugmarklanded).

Reviewed By: andll

Differential Revision: D29111710

fbshipit-source-id: 2c1b16a8140ca4f7195bf1206ffe1db4750185b9
2021-06-14 16:00:58 -07:00
Jun Wu
1e2b3cf87a configmodel: impl Config on BTreeMap<String, String>
Summary: This allows BTreeMap to be used as a provide of config for testing.

Reviewed By: andll

Differential Revision: D28019023

fbshipit-source-id: 94a1585139d6c6612fa163f2ff1aecc909db3a72
2021-06-13 09:19:22 -07:00
Pedro Rittner
b91da1d115 Bump crossbeam from 0.7 to 0.8, lsp from 0.3 to 0.5, lsp-types from 0.73 to 0.89
Summary: Bumping the crossbeam version so we can use `recv_deadline`. This also necessitates updating the lsp and lsp-types crates.

Reviewed By: alunyov, dtolnay

Differential Revision: D29056473

fbshipit-source-id: 9434e9e0895d82482f4c70afa01a2f77702b965f
2021-06-11 21:57:21 -07:00
Meyer Jacobs
8e79a2ce47 scmstore: add support for writing LFS pointers directly via FileStore
Summary:
This functionality is exercised in `test-lfs-copytracing.t` and a few other tests, though I'm not sure if it's necessary outside of that. I've added a `TODO` to investigate and try to eliminate such cases.

Because we'd rather not support this, I implemented it on top of ContentStore - it looks like we might have some lingering datapack-related tests where I think this comes up, too.

Reviewed By: DurhamG

Differential Revision: D29056647

fbshipit-source-id: e6bd5ec31dde06d8c509665f738cfe19270ddc76
2021-06-11 18:53:11 -07:00
Meyer Jacobs
ee1b174558 scmstore: update scmstore ExtractInnerRef types
Summary:
Modify the `ExtractInnerRef` implementations for `filescmstore` and `treescmstore` to return the new scmstore objects rather than the deprecated ones.

Modify `pycheckout` to use a new methods, `get_oldscmstore`, to access the deprecated scmstore instead (native checkout will be updated to use the new scmstore later on).

Reviewed By: DurhamG

Differential Revision: D29056498

fbshipit-source-id: 09b4655941bca048b01e6d365fcca1ccfb1cd700
2021-06-11 18:53:11 -07:00
Meyer Jacobs
41bc3699f8 scmstore: implement LFS upload for FileStore via legacy codepath
Summary: Temporarily implement `upload` on `FileStore` by forwarding to the existing `upload` implementation using `LfsRemote`. Eventually we'll want to re-implement this entirely inside `FileStore`.

Reviewed By: DurhamG

Differential Revision: D29045264

fbshipit-source-id: 8ebbaead4c1032949e5bdd1dcf9a733d0086a77c
2021-06-11 18:53:11 -07:00
Meyer Jacobs
5dfcaeefbd scmstore: add contentstore Python methods to filescmstore and treescmstore
Summary: Implement `ContentStore`'s Python methods on `filescmstore` and `treescmstore`.

Reviewed By: DurhamG

Differential Revision: D29042603

fbshipit-source-id: e077d7a2efc7780a384132703a2a1dc983612194
2021-06-11 18:53:10 -07:00
Meyer Jacobs
062fc5be4b scmstore: implement get_shared_mutable for TreeStore for compatibility with ContentStore
Summary: Add a `get_shared_mutable` method to `TreeStore` which behaves like `ContentStore::get_shared_mutable`, returning a store which will read/write only to the local cache stores (aka shared stores).

Reviewed By: DurhamG

Differential Revision: D29042716

fbshipit-source-id: f2236ff8b47ef213b2ffc61501ca301da02dc492
2021-06-11 18:53:10 -07:00
Meyer Jacobs
7bf2eccf87 scmstore: implement get_shared_mutable for FileStore for compatibility with ContentStore
Summary: Add a `get_shared_mutable` method to `FileStore` which behaves like `ContentStore::get_shared_mutable`, returning a store which will read/write only to the local cache stores (aka shared stores).

Reviewed By: DurhamG

Differential Revision: D29042485

fbshipit-source-id: e28af0bafac5eba87523b0ef522f32355106b467
2021-06-11 18:53:10 -07:00
Meyer Jacobs
47bbb75678 scmstore: track remote fetches in FileStore with FetchLogger
Summary: Add `FetchLogger` to `FileStore` to track remote fetches which match `remotefilelog.undesiredfileregex`.

Reviewed By: DurhamG

Differential Revision: D29042243

fbshipit-source-id: 08ec69d979d66ef93e8bbe8659171a412ade7e22
2021-06-11 18:53:10 -07:00
Meyer Jacobs
8be436187f scmstore: extract out FetchLogger from ReportingRemoteDataStore for use by scmstore
Summary: `ReportingRemoteDataStore` wraps a store and records all fetches which match `remotefilelog.undesiredfileregex`. Since scmstore doesn't use a hierarchical store composition, this change extracts out the matching/reporting logic into `FetchLogger` so that it can be re-used by both `ReportingRemoteDataStore` and scmstore.

Reviewed By: DurhamG

Differential Revision: D29041488

fbshipit-source-id: db0c4b545886ffebcf2a2841a506d301b2f2f230
2021-06-11 18:53:10 -07:00
Jun Wu
f1411b154f setup: add IPython deps for Python 3
Summary:
The files are listed by:

    python3 -m pip download IPython pip

Reviewed By: DurhamG

Differential Revision: D29072480

fbshipit-source-id: 96be7142bee4cc9ee67cbdea35a3e1e91170dbe7
2021-06-11 16:20:51 -07:00
Meyer Jacobs
a292d63d7f scmstore: update debugscmstore to use new scmstore
Summary: Straightforward update of `debugscmstore` from old scmstore to new scmstore. I'll want to improve this command a bit more in the future, but this at least enables you to easily test arbitrary fetches.

Reviewed By: DurhamG

Differential Revision: D29047527

fbshipit-source-id: 4e10cb88cba4b572d3e413640ca3d800940d675d
2021-06-11 12:40:08 -07:00
Durham Goode
63884d65c1 rotatelog: add fix cleaning up partially cleaned up logs
Summary:
Our log deletion is a two step process. First it deletes the meta file,
then it deletes the log. There was a bug where if the meta file deletion
succeeded but the log deletion failed (often because Eden has the log open) then
future attempts to delete the log will fail because it fails to delete the meta
file.

Reviewed By: quark-zju

Differential Revision: D29035913

fbshipit-source-id: 33ab9a4e46b285819c4bf14031426983d2b4342f
2021-06-11 11:36:05 -07:00
Durham Goode
60001b5161 rotatelog: add debug logging for rotatelog cleanup
Summary:
Since all the errors are eaten, we don't have good insight into the
rotatelog cleanup process. Windows users were seeing large growth in their
hgcache and this logging would've been useful, so let's add it.

Reviewed By: quark-zju

Differential Revision: D29035914

fbshipit-source-id: 54f0f05aa8bed1911b6b95438cd2d3ccc45e8ec9
2021-06-11 11:36:05 -07:00
Durham Goode
7a10894540 py3: fix crecord for non-utf8 files
Summary:
The crecord width calculation used a function that requires a string,
so we tried to force the rows from bytes to columns, which crashed if the row
wasn't utf8. Let's just use the error="replace" utf8 error handler since we
don't care if the row computation is slightly off.

Reviewed By: quark-zju

Differential Revision: D29043385

fbshipit-source-id: a00d867bca9c62007ae4f68b6198d159deeb6016
2021-06-11 11:33:15 -07:00
Andrey Chursin
c82b8867f6 dag: introduce PreparedFlatSegments::parents_and_head
Summary: This method will be used to get all Ids that needs to be included into CloneData::id_map during fast forward pull.

Reviewed By: quark-zju

Differential Revision: D29045538

fbshipit-source-id: f6eb04f537aa5365f7588391ea4c60b3dc010a53
2021-06-11 11:26:54 -07:00
Alex Hornby
4457092322 rust: revert zstd crates
Summary: revert the zstd crates back to previous version

Reviewed By: johansglock

Differential Revision: D29038514

fbshipit-source-id: 3cbc31203052034bca428441d5514557311b86ae
2021-06-11 04:39:54 -07:00
CodemodService Bot
cb6754e1d8 Daily arc lint --take BLACK
Reviewed By: zertosh

Differential Revision: D29058106

fbshipit-source-id: e114f36939ad24a41e1211258824184552b7655e
2021-06-11 04:13:52 -07:00
Liubov Dmitrieva
65366c688b implement known method
Summary:
implement `known` method based on the existing `lookup` API that has been already implemented

this might be useful for eden api pull project / wireproto deprecation, as the pull algorithm queries the server for whether commits are known by the server

Differential Revision: D29030429

fbshipit-source-id: 4d78c8b1e7983d89de917951d9765b1bd1d90fb0
2021-06-11 01:38:41 -07:00
Andrey Chursin
fb8aba2a6a edenapi: introduce EdenApi::fast_forward_master
Summary: This will be used in fastpath pull

Reviewed By: quark-zju

Differential Revision: D29010304

fbshipit-source-id: 9a7464fbc42544f8c5cc52f6fa25db5f7b5d6bd9
2021-06-10 21:59:43 -07:00
Andrey Chursin
63ea075334 dag: IdDag::idset_to_flat_segments
Summary: idset_to_flat_segments allows to return intersection between flat segments and span set

Reviewed By: quark-zju

Differential Revision: D28980521

fbshipit-source-id: da90c66a021a1e8bb95edbbc2e06cd2a850d7dcd
2021-06-10 21:59:43 -07:00
Andrey Chursin
44c8583c3b dag: impl Subspan for FlatSegment
Summary: Allows to intersects spans and flat segments

Reviewed By: quark-zju

Differential Revision: D28980522

fbshipit-source-id: 0c9c97dc9987348931931f79e9b1b36c07c30b3e
2021-06-10 21:59:43 -07:00
Andrey Chursin
4b4d54c876 dag: general span intersection
Summary:
This diff introduces Subspan trait for objects that contains spans and allows to take a 'subspan' of an object

Implementing Subspan trait allows to intersect arbitrary objects and spans

Reviewed By: quark-zju

Differential Revision: D28980523

fbshipit-source-id: 29a2e58ec3c79a838db751d8a37227b4cdaaa372
2021-06-10 21:59:42 -07:00
Jun Wu
8cc60851cb clindex: remove the extension
Summary:
It is only useful for Python revlog-based changelog, which was removed by the
previous diff.

Reviewed By: DurhamG

Differential Revision: D29020190

fbshipit-source-id: 3332f1532a510dc72f21d68801e093b5eba10145
2021-06-10 20:28:27 -07:00
Meyer Jacobs
8f9bcf232a scmstore: basic scmstore & sha256-based status
Summary:
Modify the status command to prefer comparing content sha256 when comparing files over comparing content directly, using cached aux data when possible and writing newly computed hashes to cache.

A new config option, `scmstore.status`, gates this new behavior.

When `scmstore.status` is enabled, the `status` output should be more accurate, not assuming files with non-matching `HgId`s in an arbitrary pair of revisions are different. As written, this will cause fetching of data that wouldn't otherwise be fetched, but remote fetching of aux data is planned.

This change also doesn't introduce batch fetching, this is planned.

Reviewed By: DurhamG

Differential Revision: D28826219

fbshipit-source-id: dcd253f169723983738148559d61ba655dd453a4
2021-06-10 18:24:59 -07:00
Meyer Jacobs
4d1dac0001 scmstore: add config to enable aux data persistence
Summary: Introduce a config for enabling separate indexedlogs for storing "aux data" in scmstore. The storage format is not yet finalized, and isn't used in production yet, so we gate the constructing it on a cofig.

Reviewed By: DurhamG

Differential Revision: D28826209

fbshipit-source-id: 1ed8c20329f21b3ced598eea16d9fac0f40112e6
2021-06-10 18:24:59 -07:00
Jun Wu
fa7466cf90 doctor: work with non-revlog changelog
Summary:
Make `doctor` aware of non-revlog changelog and do not hide commits
incorrectly.

Reviewed By: DurhamG

Differential Revision: D29020189

fbshipit-source-id: af7fab75a877997e3f11dd21e506c965da078f83
2021-06-10 14:44:27 -07:00
Jun Wu
6f63fe94d0 test-doctor: demonstrate it hides commits incorrectly for non-revlog changelog
Summary: The doctor command assumes revlog changelog, which does not cover all setups.

Reviewed By: DurhamG

Differential Revision: D29020188

fbshipit-source-id: 68bb4e20efb49482df84a71ab7d86a20a6fa93ce
2021-06-10 14:44:27 -07:00
Jun Wu
3765f8bd76 changelog: remove Python revlog-based changelog
Summary: For all clients and tests we're using revlog changelog based on Rust.

Reviewed By: DurhamG

Differential Revision: D29020191

fbshipit-source-id: 44ab603ea07b8891831692285e94ea0e4df849f5
2021-06-10 14:44:27 -07:00
Jun Wu
e4c9a1ae17 verify: make verify a no-op
Summary:
Verify is tightly coupled with revlog details, and assumes a non-lazy repo.
Revlog is going away and our repo is lazy typically, so let's just make verify
a no-op.

Reviewed By: DurhamG

Differential Revision: D28974546

fbshipit-source-id: 487dc65ceb9a1e445b58d03a53353a8382aefc08
2021-06-10 14:44:27 -07:00
Durham Goode
fde02a6e12 getdeps: fix oss-eden_scm-darwin-getdeps
Summary: More python 3 shenanigans.

Reviewed By: quark-zju

Differential Revision: D29005541

fbshipit-source-id: 210d90b0258927019a08fa79a26e38e0f01b4eaa
2021-06-10 14:24:25 -07:00
Jun Wu
b2d5645a09 changelog: remove inline to non-inline changelog migration
Summary:
Practically, our client-side revlog changelogs should be non-inline now for a
long time. There is no need to keep the migration logic.

The revlog is being deprecated too so its implementation details (inline) is
going to be irreverent. The related test is then removed.

Reviewed By: DurhamG

Differential Revision: D28974551

fbshipit-source-id: ea456c46dac11d6a8b225c269b49598ab34c2548
2021-06-10 13:56:59 -07:00
Jun Wu
827bea0b58 linkrevcache: remove the extension
Summary: It was only useful server-side and will be incompatible with upcoming changes.

Reviewed By: DurhamG

Differential Revision: D28974549

fbshipit-source-id: 70a715ce170baa78adb8b1fcf7d29e3d1479c05e
2021-06-10 13:56:59 -07:00
Jun Wu
7dca190311 test-hgsql: remove more hgsql related tests
Summary: hgsql is irrelevant. Remove more tests that will be broken by upcoming changes.

Reviewed By: DurhamG

Differential Revision: D29019287

fbshipit-source-id: 6fd04d2eb088a0ca9c975b25a4f28a5772f0e088
2021-06-10 13:56:59 -07:00
Jun Wu
ceaf71e9bc test-bundle2-remote-changegroup: remove the test
Summary:
This test uses bundle2 details that are hard to maintain.
Let's just remove the test.

Reviewed By: DurhamG

Differential Revision: D29019286

fbshipit-source-id: a64918736039331bf2fc3cd23e9c67dd77510c22
2021-06-10 13:56:59 -07:00
Jun Wu
8fcb63ccd3 test-strip-cross: remove the test
Summary:
This test is too tricky to maintain with modern setups. Namely, we don't
support strip and are dropping revlog usage. Let's just remove the test.

Reviewed By: DurhamG

Differential Revision: D28974550

fbshipit-source-id: e8d30e726735432820ceaf4ef27d1b83753122a4
2021-06-10 12:32:26 -07:00
Jun Wu
1deab38235 test-treemanifest-server: remove the test
Summary:
We no longer uses this code base for hg server logic.

The test requires non-Rust commit backend which will be removed.

Reviewed By: DurhamG

Differential Revision: D28974547

fbshipit-source-id: 433a6697f6cbf08450c43ce810490fcdb53cf718
2021-06-10 12:32:26 -07:00
Jun Wu
97d1414888 test-revlog: remove the test
Summary: It tests revlog details that are going to be irrelevant.

Reviewed By: DurhamG

Differential Revision: D28974552

fbshipit-source-id: 3ff08473be236849442c3c30d5cf1e1c2a1b628d
2021-06-10 12:32:26 -07:00
Jun Wu
7b3c6a8e7f test-generaldelta: remove the test
Summary: It tests revlog details that are going to be irrelevant.

Reviewed By: DurhamG

Differential Revision: D28974548

fbshipit-source-id: a44e97daa24aece446d899e7711a59cb4a133398
2021-06-10 12:32:26 -07:00
Jun Wu
1f045a5683 debugchangelog: fix help text
Summary: Revise the help text so it matches the latest implementation.

Reviewed By: DurhamG

Differential Revision: D28971683

fbshipit-source-id: 3f8fb7ccc42a71fdb65b87e2b99d06fb347983f3
2021-06-10 12:32:26 -07:00
Andrey Chursin
ae4ef064e6 debughiddencommit: add --no-ignored-files option
Summary: This option allows to exclude ignored files, this way if user specifices wildcard patterns in --include, they will still not include ignored files

Reviewed By: mrkmndz

Differential Revision: D29007062

fbshipit-source-id: a8458811b4c16e11a91abdc31967b53c3cdf2ed7
2021-06-10 11:11:24 -07:00
Mark Juggurnauth-Thomas
98ada843e3 rage: include Windows disk usage information
Summary:
`df` doesn't exist on Windows, so this part of `rage` isn't populated.

The closest equivalent on Windows is `wmic LogicalDisk`.  Use this to query the
free space and size of the disks.

Reviewed By: quark-zju

Differential Revision: D28997337

fbshipit-source-id: 08b3b74d70928f2e9801061f049359a58108f4bf
2021-06-10 02:44:14 -07:00
Chad Austin
4ccb60e46d config: namespace facebook::eden
Summary: Start applying C++17 to our namespace definitions.

Reviewed By: fanzeyi

Differential Revision: D28964224

fbshipit-source-id: 72ad3f93c9304b34eef91d530e4e988420bd8fdc
2021-06-08 19:29:37 -07:00
Alex Hornby
f89dbebae8 rust: update zstd bindings to 1.5.0
Summary: Update to latest version.  This includes a patch to async-compression crate from [my PR updating it](https://github.com/Nemo157/async-compression/pull/125), I will remove once the crate is released.

Reviewed By: mitrandir77

Differential Revision: D28897019

fbshipit-source-id: 07c72f2880e7f8b85097837d084178c6625e77be
2021-06-08 07:57:29 -07:00
CodemodService Bot
8cddb36cf2 Daily arc lint --take BLACK
Reviewed By: zertosh

Differential Revision: D28957848

fbshipit-source-id: 80ce3c197a09bc924a8920aedb7c7fb093760dd3
2021-06-08 03:55:06 -07:00
Durham Goode
9aa2e6a7bf make: remove 'make local'
Summary:
Now that we don't publish any Python 2 packages, let's drop make local.
Once we've confirmed that nothing was using make local, we can rename make
local3 to be make local.

Reviewed By: kulshrax

Differential Revision: D28647154

fbshipit-source-id: de277887e93a6dbc0324a30f592198ef7c83f818
2021-06-07 16:46:18 -07:00
Durham Goode
40f304d428 run-tests: more Python 3 fixes
Summary:
More things needing fixing to be python 3 compatible. Caught when
trying to remove the Python 2 build.

Reviewed By: quark-zju

Differential Revision: D28880028

fbshipit-source-id: d162c78237f330f1f931c3581b25ead24e3ea375
2021-06-07 16:46:18 -07:00
Durham Goode
8a679138dd windows: fix local clones
Summary:
The combination of metalog and the new clone pattern of first creating
the repo causes local copy clones to fail on Windows because the initial metalog
files are held open and the copy can't overwrite them.

Let's drop the destrepo before we do the local copy.

Reviewed By: quark-zju

Differential Revision: D28880029

fbshipit-source-id: 2a4ef52675eebf16afa528e645acd927a6110cb4
2021-06-07 16:46:18 -07:00
Jan Mazur
3054c4eb63 send additional data identifying client
Summary: This will be used for rate limiting decisions. Also, could be logged to scuba tables to get more info about clients.

Reviewed By: quark-zju

Differential Revision: D28750197

fbshipit-source-id: 83f54e38f998c9dd824ef2d3834c777a44d0ffed
2021-06-07 06:38:37 -07:00
Jan Mazur
b5c73dde5b x2pagentd for LFS
Summary: Let clients connect to lfs with HTTP through unix socket so we don't have to worry about certificates presence.

Reviewed By: johansglock

Differential Revision: D28683392

fbshipit-source-id: f6228b4099ef04fe584e320cb1892e6cb513e355
2021-06-07 04:57:49 -07:00
Liubov Dmitrieva
7fc42817cb edenapi: create a call to the lookup API for different types
Summary:
create end to end intergation for the lookup API on the client

Start prototyping of `hg cloud upload` command.

Currently, it just performs lookup for existing heads.

This way we can end to end test the new APIs.

Reviewed By: markbt

Differential Revision: D28848205

fbshipit-source-id: 730c1ed4a21c1559d5d9b54d533b0cf551c41b9c
2021-06-04 10:11:25 -07:00
Liubov Dmitrieva
e32102a1f1 skeleton lookup and upload API for files
Summary:
Files upload will be executed in 2 stages:

* check if content is already present
* upload missing files

The check api is generic, it could be used for any id type. Called 'lookup' API.

Reviewed By: markbt

Differential Revision: D28708934

fbshipit-source-id: 654c73b054790d5a4c6e76f7dac6c97091a4311f
2021-06-04 10:11:25 -07:00
Durham Goode
9d994c93aa build: set SDKROOT via make local as well
Summary:
Previously we set this in the rpm spec, but we need to set it in make
local as well since sometimes hgbuild invokes make local directly.

Ideally we'd put this in setup.py, since make and rpmspecs go through that, but
we need this environment also set for the dulwich build, which we don't really
control the setup.py for.

Reviewed By: singhsrb

Differential Revision: D28902015

fbshipit-source-id: bfc170c3027cc43b24c6a517512a63a71f433d23
2021-06-04 09:51:48 -07:00
Durham Goode
ffa6c61481 run-tests: fix allow/deny list of tests with multiple cases
Summary:
The recent change to make run-tests work with Python 3 broke the
allow/deny list functionality because it started testing the full test name
instead of the base. This fixes that.

Reviewed By: quark-zju

Differential Revision: D28885125

fbshipit-source-id: 586a71e66e0f094b79e6a3e07e27813db6f662d3
2021-06-03 15:54:03 -07:00
Eric Chen (swe)
0ba2c44d90 uncopy: new command to mark files as not copied
Summary: create `uncopy` command to unmark files that were copied using `copy`.

Reviewed By: quark-zju

Differential Revision: D28821574

fbshipit-source-id: c1c15f6fb2837cec529860aba70b516ddd794f10
2021-06-03 13:54:48 -07:00
Jeremy Fitzhardinge
c652f9a11f third-party/rust: update time to 0.2
Summary:
Time 0.2 is current, and 0.1 is long obsolete. Unfortunately there's a
large 0.1 -> 0.2 API change, so I preserved 0.1 and updated the targets of its
users. Also unfortunate that `chrono` has `oldtime` as a default feature, which
makes it use `time-0.1`'s `Duration` type. Excluding it from the features
doesn't help because every other user is specifying it by default.

Reviewed By: dtolnay

Differential Revision: D28854148

fbshipit-source-id: 0c41ac6b998dfbdcddc85a22178aadb05e2b2f2b
2021-06-03 13:52:54 -07:00
Jun Wu
94c1c510d7 tests: remove some hgsql tests
Summary:
They are breaking and hgsql is not relevant (hg server repo was forked). So
let's just remove the tests.

Reviewed By: andll

Differential Revision: D28852159

fbshipit-source-id: 04a47ea489b3f190cffe7f714a9f4161847a2c86
2021-06-02 16:08:06 -07:00
Jun Wu
13ab29ce76 runtests: fix remaining issues
Summary:
Fix remaining issues like encoding and `bname` vs `name` difference
(bname was deleted by a previous change, but it's not just encoding
difference from name, bname does not have " (case x)" suffix).

Differential Revision: D28852092

fbshipit-source-id: df013b284414600deb6f20a5c0883f09906bf976
2021-06-02 16:08:06 -07:00
Jun Wu
be797a960b test-run-tests: remove pygments test
Summary:
The test might fail with wrong pygments detection (ex. hghave runs with
different python that runs run-tests.py). It's not critical. Remove it.

Example failure:

   #if no-windows pygments
     $ rt test-failure.t --color always
  +  warning: --color=always ignored because pygments is not installed

  -  \x1b[38;5;124m--- test-failure.t\x1b[39m (esc)
  -  \x1b[38;5;34m+++ test-failure.t.err\x1b[39m (esc)
  -  \x1b[38;5;90;01m@@ -1,4 +1,4 @@\x1b[39;00m (esc)
  +  --- test-failure.t
  +  +++ test-failure.t.err
  +  @@ -1,4 +1,4 @@
        $ echo "bar-baz"; echo "bar-bad"; echo foo
  -  \x1b[38;5;34m+  bar*baz (glob)\x1b[39m (esc)
  +  +  bar*baz (glob)
        bar*bad (glob)
  -  \x1b[38;5;124m-  bar*baz (glob)\x1b[39m (esc)
  -  \x1b[38;5;124m-  | fo (re)\x1b[39m (esc)
  -  \x1b[38;5;34m+  foo\x1b[39m (esc)
  +  -  bar*baz (glob)
  +  -  | fo (re)
  +  +  foo

Differential Revision: D28852093

fbshipit-source-id: 98397cb79bedc0c605131462483b78eb5bc2671a
2021-06-02 16:08:06 -07:00
Meyer Jacobs
a1b4aa8117 scmstore: add tracing logging
Summary:
Instrument file scmstore with tracing logging. There's more we should add here, but this will be a good starting place - I've already discovered some issues from looking at the log output. (Why does drop run twice? How does it run twice?)

It'd also probably be nice to support formatting the output like https://crates.io/crates/tracing-tree, which will be a lot less cluttered by the logged fields (like `attrs` on `fetch`).

Reviewed By: DurhamG

Differential Revision: D28750954

fbshipit-source-id: 63baa602f7147d24ac3e34defa969a70a92f96a4
2021-06-02 14:15:40 -07:00
CodemodService FBSourceClangFormatLinterBot
9e789df34c Daily arc lint --take CLANGFORMAT
Reviewed By: zertosh

Differential Revision: D28826571

fbshipit-source-id: e3929280917dffcb00707823963ab2ba0e786bd1
2021-06-02 04:06:31 -07:00
Durham Goode
7b2bfe61a6 backingstore: add batch tree fetching to backing store C++ bindings
Summary:
Now that EdenFS is using EdenAPI more, let's let it take advantage of
EdenAPI's better batching. We alread have a batch API for files, let's copy the
pattern for trees as well. This adds the C++ bindings. The next diff consumes
this from EdenFS

This is largely just a copy of how batch blob fetching does this. But I'm a C++
noob, so feel free to tear this apart with nits.

Reviewed By: chadaustin

Differential Revision: D28426789

fbshipit-source-id: 88d359985e849018fb3c2b4ef9e52d07c96bf31a
2021-06-01 22:41:07 -07:00
Durham Goode
feb3792609 backingstore: add batch tree fetching to Rust backing store
Summary:
Now that EdenFS is using EdenAPI more, let's let it take advantage of
EdenAPI's better batching. We alread have a batch API for files, let's copy the
pattern for trees as well. This first diff just produces the Rust code. Future
diffs will add the C++ bindings then integrate it into EdenFS.

This is largely just a copy of how batch blob fetching does it.

Reviewed By: chadaustin

Differential Revision: D28426790

fbshipit-source-id: 822ef6e7b3458df5dba7a007657e85351162b9ff
2021-06-01 22:41:07 -07:00
Durham Goode
8da8be4fde py3: fix shell aliases on Windows
Summary: Windows has an issue where subprocess don't inherit stdout/stderr correctly. util.system() has a workaround for this, so let's use that instead of subprocess when executing shell aliases.  This fixes 'hg pull --rebase' which is a shell alias.

Reviewed By: kulshrax

Differential Revision: D28815381

fbshipit-source-id: 7521c17166a2b2c0e4ee872dacfd09d2d97e00ce
2021-06-01 21:00:31 -07:00
Durham Goode
a2410c8783 tests: fix more run-tests.py Python 3 issues
Summary: These are breaking buck test runs

Reviewed By: quark-zju

Differential Revision: D28802741

fbshipit-source-id: a30c7b64d72356df05676ffab87291a246033d49
2021-06-01 11:43:09 -07:00
Jun Wu
b488208048 changelog2: support migrating from revlog to lazy backend directly
Summary:
Previously it requires migrating to doublewrite first. There is no reason why
the doublewrite migration cannot be done automatically. So let's do it.

Reviewed By: DurhamG

Differential Revision: D28757734

fbshipit-source-id: ba2533b5506309610b87865a838d7efe22bccfac
2021-05-27 17:35:19 -07:00
Meyer Jacobs
09b49e5e06 scmstore: add python method for fetching contentshas for a list of keys
Summary:
Add the `fetch_contentsha256` python method to `filescmstore`, which accepts a list of keys and returns a list of (key, sha256).

This is intended to be used by the modified `status` command implementation, which will prefer comparing content hashes to directly comparing file content.

Reviewed By: DurhamG

Differential Revision: D28696618

fbshipit-source-id: a0304319b0a19d4f09d07bec02dc41964aec7255
2021-05-27 14:42:23 -07:00
Meyer Jacobs
d05571b3cf scmstore: refactor FileStore attributes support and separate computation from fetching
Summary:
Merge `found_file` and `found_aux_indexedlog` into a new `found_attributes` method, which simply "or"s the newly found attributes into the `found` map.

Replaces the `satisfies` concept with a new `pending` check, used the same way by each `pending_*` method, which considers a key pending if fetching from a store which returns a given set of attributes would allow us to resolve any requested by missing attributes, optionally taking into account attributes that can be computed from those already found. This will still need to be adjusted to support preferring remote fetching of attributes to local computation, but it is no longer as brittle as the previous implementation: there's no requirement that aux data be computed as content is fetched in order to avoid redundantly fetching content.

Move attribute computation to a separate phase, and filter out un-requested attributes in the `finish` function.

Reviewed By: DurhamG

Differential Revision: D28694192

fbshipit-source-id: 9b096c056736cadc0f97ff09243ed09d5266504d
2021-05-27 14:42:23 -07:00
Meyer Jacobs
6bc13e4b8b scmstore: modify attributes to use associated constants
Summary: Use associated constants instead of methods for `FileAttributes` bit masks.

Reviewed By: DurhamG

Differential Revision: D28724729

fbshipit-source-id: 441c0d2361166824c4ee7cfd5ad0b6f21ee1ac26
2021-05-27 14:42:23 -07:00
Meyer Jacobs
d1e8a913eb scmstore: extract errors to separate type to ease lifetime issues
Summary:
Previously, the `found_error` required `&mut self`, even though it only ever interacted with the error fields. This prevents Rust's type checker from validating the safety of logging errors while iterating over the `found` map, for instance.

Replacing the `&mut self` method call with a field access into an existing `&mut self` resolves this problem, and allows logging errors while mutating other fetch state.

Reviewed By: DurhamG

Differential Revision: D28722547

fbshipit-source-id: 59c6a530cbf331282d6f654a56e492d47cafcd2f
2021-05-27 14:42:23 -07:00
Meyer Jacobs
95abadf752 scmstore: FileStore bugfixes
Summary:
Don't try to fetch from a store if we don't have any pending keys.

Handle missing content when writing to cache after fetching from remote stores. Currently, `found_in_*` will be populated even if we don't store the content, having just used it for aux data computation. This change won't be necessary, but won't cause any problems either, after the next change which only prunes overfetching in the `finish` method, allowing remote blobs to be written to local cache even if we only fetched them to compute their attributes. I might revert this portion of the change, or warn if content is unexpectedly unavailable.

Reviewed By: DurhamG

Differential Revision: D28694964

fbshipit-source-id: 465211c9257cbf49b1cb68856473323fc940f10b
2021-05-27 14:42:23 -07:00
Meyer Jacobs
03c2fcded5 scmstore: add support for computing attributes from content
Summary: Extends the previous change to add support for computing aux data (currently only Content Sha256) and caching it locally. Introduces a `FetchState` config option, `compute_aux_data`, which controls if content will be fetched in order to compute aux data, or if unavailable aux data will be treated as "not found".

Reviewed By: DurhamG

Differential Revision: D28528456

fbshipit-source-id: 26189d18c8e453040f3c1f6e22a34d623a5aa40d
2021-05-27 14:42:23 -07:00
Durham Goode
38be9c8f05 tests: fix run-tests.py diff output with Python 3
Summary:
The migration to Python 3 broke the unified diff code because difflib
expected the paths to also be bytes.

Reviewed By: quark-zju

Differential Revision: D28758876

fbshipit-source-id: 367ef237594d2908377cd8b81def364b77ee02e2
2021-05-27 14:10:07 -07:00
Jun Wu
7617f2ef23 rm: do not list clean files with -A
Summary:
`rm -A` means removing files that are "deleted" (`rm`-ed but not `hg rm`-ed).
It does not need to list clean files. Listing clean files can be very slow
in a large repo.

Avoid listing clean files so `rm -A` can be faster.

This has a side effect that we no longer maintain the exit value (0: repo
becomes empty, 1: repo is not empty) like before. But I guess nobody really
cares the 1 exit value (and it does not really make sense in the `rm -A`
case).

Reviewed By: DurhamG

Differential Revision: D28622558

fbshipit-source-id: 2087d6508932905564a8307e9438895538ecede9
2021-05-27 11:28:51 -07:00
Durham Goode
92b4a86bf4 runtests: stop using bytes for paths and environment variables
Summary:
The usage of bytes for paths and environment variables makes this entire file hacky and makes it not work on Windows.  Let's remove all of that.

We still use bytes for test output and other file content type cases.

Reviewed By: andll

Differential Revision: D28227825

fbshipit-source-id: b15993601db501160c9fa4eb2463678cde1fa554
2021-05-27 09:52:16 -07:00
Jun Wu
38db21c8d8 changelog2: migrating to lazy makes changelog lazy
Summary:
Previously, migrating to lazy means repo requirement changes. This diff uses
the new API to actually make the changelog lazy.

Reviewed By: DurhamG

Differential Revision: D28700896

fbshipit-source-id: 82cfd70645230cd67223195e25ef07ae5abe7df6
2021-05-26 19:18:57 -07:00
Jun Wu
1721f5f866 debugrebuildchangelog: support rebuild with lazy segmented changelog
Summary:
Switch debugrebuildchangelog from using revlog stream clone to lazy segment clone.
This removes the revlog techdebt and can be used as a way to repair
repos with broken segmented changelog. As we migrate off double-write backend we
can no longer migrate down to revlog then migrate up, and a full reclone can be
slow. So a partial reclone command that just recreates the segmented changelog
seems useful.

This command is one of the two commands that handle emergency situations
when segmented changelog related logic goes wrong. The other command
is the emergency clone mode, added by D27897892 (d1413bbbad), which assumes everything
related to segmented changelog is broken on Mononoke side and we still
need to commit and push. This command relies on segmented changelog
related features, such as hash<->location lookup, and clone on Mononoke
to work properly and the server having a compatible IdMap. So it might
not be able to address all issues if Mononoke goes wrong.

Reviewed By: DurhamG

Differential Revision: D28430885

fbshipit-source-id: 17357a33f6fda4a67d46e2c7e7be6653b530f499
2021-05-26 19:00:01 -07:00
Jun Wu
f8f149c2ac pydag: make async function interruptible
Summary:
Use the interruptible block_on API so the Python methods can be interrupted by Ctrl+C.
This is especially useful if some operation triggers lots of expensive network fetches.

Reviewed By: DurhamG

Differential Revision: D28723008

fbshipit-source-id: b6c692de6290a49852eabcd960ebd9b2fb68685a
2021-05-26 19:00:01 -07:00
Jun Wu
74db74527e test-debugchangelog: prepare commits in the master group
Summary:
This will be used by the next change to test migrating from a non-lazy
changelog to a lazy changelog actually makes commits lazy.

More commits were added to the graph to test laziness. The old graph
does not have commits that will be made lazy by the current standard
(parents of merges are not lazy).

Reviewed By: DurhamG

Differential Revision: D28700897

fbshipit-source-id: 527c3ce672327ed5e2398c0d89a8e9e92e5b244f
2021-05-26 15:27:16 -07:00
Jun Wu
687761400c pydag: make full->lazy migration support migrating non-master heads
Summary:
This will be used by the next change to migrate from a non-lazy changelog to a
lazy changelog.

Reviewed By: DurhamG

Differential Revision: D28700898

fbshipit-source-id: ff12754f224586b9d0d62f73b41bbb07fc7a6eea
2021-05-26 15:27:16 -07:00
Durham Goode
2e6735be81 patch: fix infinite loop for incorrect patches
Summary:
If a patch declared the length of it's last hunk as N lines, but it
only contained N-1 lines, the Rust code would enter into an infinite loop. This
could happen if a text editor remove the trailing spaces from a patch file.

Let's fix it and add a test

Reviewed By: kulshrax

Differential Revision: D28683977

fbshipit-source-id: 0a999ae108676531a2cf18e77a3b426ba4647164
2021-05-26 11:18:19 -07:00
Johan Schuijt-Li
151b533a6f mononokepeer: log extra timings
Summary: Sometimes things take longer, make sure we are able to distinguish whether that's due to networking, tls handshake, http parsing, or Mononoke wireproto handling.

Reviewed By: markbt

Differential Revision: D28705508

fbshipit-source-id: 1bafda7fc447f2e429690f47fe7ab81cec511494
2021-05-26 06:47:46 -07:00
Meyer Jacobs
998be9b07d scmstore: construct aux data store in scmstore builder
Summary:
Extends the `FileScmStoreBuilder` to construct two new indexedlog stores for caching aux data. The stores will be created in a directory adjacent to the normal non-LFS indexedlog stores.

Currently aux data stores will not be constructed for production users, a configuration option will be introduced to gate this before `.store_aux_data()` is called in the `filescmstore` constructor bindings.

Reviewed By: DurhamG

Differential Revision: D28689693

fbshipit-source-id: e3ad1594e5beee00b1a8b9fe489e3b6af3a2e93e
2021-05-25 21:52:15 -07:00
Meyer Jacobs
3aa07eddaa scmstore: add basic attributes support to FileStore
Summary:
Modify `FileStore` to introduce basic aux data fetching. Aux data is currently read from a separate IndexedLog store, serialized with `serde_json` (chosen for expediency / ease of debugging, I intend to optimize the storage format before releasing this, at the very least to avoid unnecessarily serializing the key path).

Currently aux data fetching will never succeed, as aux data fetching is not supported in the EdenApi "files" API and nothing else exists to populate the local aux data stores. Later in this stack, computing aux data (currently only content sha256) to populate the aux data storage is implemented.

Reviewed By: DurhamG

Differential Revision: D28526788

fbshipit-source-id: c8e21a1377689d7913a68426a3a480d53148da66
2021-05-25 21:52:15 -07:00
Meyer Jacobs
580207279b scmstore: refactor FetchState in preparation for attributes support
Summary:
Simplify tracking of incomplete fetches in preparation for attributes support in the next change.

Now, all keys which have not been completely and successfully fetched are recorded in `pending`, and are removed only when the complete fetch is recorded in `found`. Keys are now removed from `lfs_pointers` and `pointer_origin` as they are completed, as they aren't needed for anything other than fetching from local LFS and remote LFS respectively.

Reviewed By: DurhamG

Differential Revision: D28546515

fbshipit-source-id: c657e5c6350cadc8da970f57bb7694ed71022efb
2021-05-25 21:52:15 -07:00
Jun Wu
c72cd2333f metalog: remove conditional metalog logic
Summary:
Now metalog can no longer be `None`. Let's just remove logic handling its
`None` case.

This changes the commitcloud-sync-race test because the metalog itself has
internal locking and changes are atomic.

Reviewed By: DurhamG

Differential Revision: D28595292

fbshipit-source-id: bd9851f5f3bb25f28f15d673f608af2863953c46
2021-05-25 19:43:45 -07:00
Jun Wu
1f8d8cfbf0 store: always enable store and fncache
Summary:
fncache and store have been default on for years. Enable them unconditionally.
This also makes sure that metalog is always available.

Practically, the only place that does not use fncache is hgsql server repos and
they are irrelevant now.

Reviewed By: DurhamG

Differential Revision: D28595289

fbshipit-source-id: 32b9906c179518acdb17a206b54f98a3dc994921
2021-05-25 19:43:45 -07:00
Jan Mazur
0e960695e0 put command renewing certificate in the error message
Summary: I have modified the places where most of the errors were raised that users reported and were resolved by renewal of certificates.

Reviewed By: krallin

Differential Revision: D28568561

fbshipit-source-id: 44fb127a49bde83efee1c934e0435b31f8602a8d
2021-05-25 01:05:16 -07:00
Jun Wu
fc9912dbfe test-metalog-migration: remove the test
Summary: Upcoming changes will force enable metalog so there will be no way to migrate down.

Reviewed By: DurhamG

Differential Revision: D28595290

fbshipit-source-id: a130b3c60c5b553d024868f28a28e48c50d44783
2021-05-24 16:40:30 -07:00
Jun Wu
a586d3f636 test-encodedstore-long: remove the test
Summary:
It was added by D8527475 (72c3d8afc1) to workaround hgsql with no-fncache and long file
names synced from svn. Upcoming changes will force fncache to simplify
configuration and the hgsql server code was forked. So let's just delete
the test.

Reviewed By: DurhamG

Differential Revision: D28595291

fbshipit-source-id: 60d2449cca7af46b8b5b3c3b557a36507ff1576e
2021-05-24 15:24:18 -07:00
Jun Wu
2aa432e134 clone: add a config to clone with lazy changelog
Summary: This will be used by fbclone to ship lazy commit hash backend.

Reviewed By: DurhamG

Differential Revision: D28554445

fbshipit-source-id: a263ae7683124b3b86f4025b02c7de20dcb9813e
2021-05-24 14:51:58 -07:00
Jun Wu
5edc1f6433 metalog: expose compact as debugcompactmetalog command
Summary: This makes it possible to use non-debugshell to compact the metalog.

Reviewed By: DurhamG

Differential Revision: D28550902

fbshipit-source-id: 789830ba35243d248397e6a52ee343584c1e01a9
2021-05-24 11:44:55 -07:00
Jun Wu
318f2ae812 metalog: expose compact and path API to Python
Summary:
The "compact" API rebuilds the metalog by removing older history. It could be
useful to reduce the size overhead of the metalog.

This is also useful if we're doing other "rebuild" work, such as rebuilding the
changelog.

Reviewed By: DurhamG

Differential Revision: D28550903

fbshipit-source-id: 56f875bd955247181236a976dcce6163d126a4b6
2021-05-24 11:44:55 -07:00
Jun Wu
bd1fb8e337 zipimport: workaroud pyc invalidation due to timezone settings
Summary:
The zipimport logic requires the pyc mtime to match its source. However, the
Windows system time zone can invalidate it and cause slow startups.

Workaround it by making the zipimport mtime function return a fallback value so
the mtime check is then bypassed.

    # zipimport.py, _unmarshal_code
    source_mtime, source_size = \
        _get_mtime_and_size_of_source(self, fullpath)

    if source_mtime:  # if source_mtime is false, then the check is bypassed.
        # We don't use _bootstrap_external._validate_timestamp_pyc
        # to allow for a more lenient timestamp check.
        if (not _eq_mtime(_unpack_uint32(data[8:12]), source_mtime) or
                _unpack_uint32(data[12:16]) != source_size):
            _bootstrap._verbose_message(
                f'bytecode is stale for {fullname!r}')
            return None

Change my Windows time zone from GMT-7 to GMT-4. Set PYTHONVERBOSE and
PYTHONDEBUG to 1. Ran `hg init -h` and check its stderr. It prints:

  # bytecode is stale for 'edenscm.traceimport'

and alike before this change, and no longer after replacing the `__init__.py`
in the zip with the new version.

Reviewed By: DurhamG

Differential Revision: D28622287

fbshipit-source-id: bb3e8e378ea168e4f83f4b6aa9713103b2c90ef8
2021-05-24 09:36:37 -07:00
Johan Schuijt-Li
112008bf7a mononokepeer: fix error message
Summary:
Would previously fail with:
  AttributeError: 'timeout' object has no attribute 'message'

Reviewed By: mzr

Differential Revision: D28636534

fbshipit-source-id: 44df954b659cfbfbe0b468798e7eb5142478be67
2021-05-24 05:34:10 -07:00
Liubov Dmitrieva
9f3609ec51 implement omision of old public bookmarks
Summary:
don't apply an old public bookmark if the commit is older than max_sync_age

there is a complicated logic because we need to make sure if we later run it with different commitcloud.max_sync_age value or hg cloud sync --full the bookmarks will be appear back.

So, the changes required in both:

* checkomission
* _mergebookmarks

but both cases covered in the tests

also, if you run with max_sync_age=1000 and later max_sync_age=0, the bookmarks will not disappear, which is expected.

Reviewed By: markbt

Differential Revision: D28572875

fbshipit-source-id: 317e897a2b81c3371dbea7eb39b8925570c1d40a
2021-05-21 06:31:04 -07:00
Liubov Dmitrieva
6a4814e664 reduce output of omitted bookmarks
Summary:
this output is not noisy for big workspaces

if a head is omitted, don't warn about the bookmark because it is expected

Reviewed By: markbt

Differential Revision: D28568919

fbshipit-source-id: eb19e1d155f65de411c1dd41a8be6d83ca71c264
2021-05-21 06:31:04 -07:00
Liubov Dmitrieva
bf0dab696c reduce output for listing omitted heads and bookmarks
Summary:
The output is a bit too noisy for large workspaces.

We could skip older commits, we know the list coming ordered from commit cloud service.

All hashes are anyway available via `hg cloud sl`.

Also I fixed several look-ups in the list. Omittedheads are heavily used to check if something is present there.

Reviewed By: markbt

Differential Revision: D28568421

fbshipit-source-id: bcf62522798fed92df7ca546c73aa14da95f1567
2021-05-21 06:31:04 -07:00
Carolyn Busch
4e03bd4021 pull: use bookmark http api
Summary: Add config pull.httpbookmarks to use the edenapi http protocol to fetch bookmarks in the central local repo pull method. This impacts the pull command, as well as other commands that pull bookmarks.

Reviewed By: quark-zju

Differential Revision: D27479112

fbshipit-source-id: 2b9821f458ec0af2579143fb2c2ed7d3ff41878a
2021-05-20 17:28:51 -07:00
Johan Schuijt-Li
daf7eb2138 add decompression support for mononoke
Summary:
Support decompression for mononoke connections. When we request it, Mononoke
can support compression our stream, saving bandwith on low throughput
connections.

Reviewed By: StanislavGlebik

Differential Revision: D28535058

fbshipit-source-id: 7594f72978093a474efd168bb87b41c415310d6c
2021-05-20 10:22:56 -07:00
Jun Wu
6ce450753a commitcloud: add FakeCtx.mutable
Summary: It can be used by `cloud ssl` template after D28000088 (b506eeea0c).

Reviewed By: liubov-dmitrieva

Differential Revision: D28561180

fbshipit-source-id: fb4bf3de85f7c320c13a2a53c6a103e85ebb5425
2021-05-20 09:44:41 -07:00
Thomas Orozco
846a983d67 thrift/lib/rust: update to Bytes 1.x
Summary:
Like it says in the title. The API between Bytes 1.x has changed a little bit,
but the concepts are basically the same, so we just need to change the
callsites that were calling `bytes()` and have them ask for `chunk()` instead.

This diff attempts to be as small as it can (and it's already quite big). I
didn't attempt to update *everything*: I only updated whatever was needed to
keep `common/rust/tools/scripts/check_all.sh` passing.

However, there are a few changes that fall out of this. I'll outline them here:

## `BufExt`

One little caveat is the `copy_to_bytes` we had on `BufExt`. This was
introduced into Bytes 1.x (under that name), but we can't use it here directly.

The reason we can't is because the instance we have is a `Cursor<Bytes>`, which
receives an implementation of `copy_from_bytes` via:

```
impl<T: AsRef<[u8]>> Buf for std::io::Cursor<T>
```

This means that implementation isn't capable of using the optimized
`Bytes::copy_from_bytes` which doesn't do a copy at all. So, instead, we need
to use a dedicated method on `Cursor<Bytes>`: `copy_or_reuse_bytes`.

## Calls to `Buf::to_bytes()`

This method is gone in Bytes 1.x, and replaced by the idiom
`x.copy_to_bytes(x.remaining())`, so I updated callsites of `to_bytes()`
accordingly.

## `fbthrift_ext`

This set of crates provides transports for Thrift calls that rely on Tokio 0.2
for I/O. Unfortunately, Tokio 0.2 uses Bytes 0.5, so that doesn't work well.

For now, I included a copy here (there was only one required, when reading from
the socket). This can be removed if we update the whole `fbthrift_ext` stack to
Bytes 1.x. fanzeyi had been wanting to update this to Tokio 1.x, but was blocked on `thrift/lib/rust` using Bytes 0.5, and confirmed that the overhead of a copy here is fine (besides, this code can now be updated to Tokio 1.x to remove the copy).

## Crates using both Bytes 0.5 & Bytes 1.x

This was mostly the case in Mononoke. That's no coincidence: this is why I'm
working on this. There, I had to make changes that consist of removing Bytes
0.5 to Bytes 1.x copies.

## Misuse of `Buf::bytes()`

Some places use `bytes()` when they probably mean to use `copy_to_bytes()`. For
now, I updated those to use `chunk()`, which keeps the behavior the same but
keeps the code buggy. I filed T91156115 to track fixing those (in all
likelihood I will file tasks for the relevant teams).

Reviewed By: dtolnay

Differential Revision: D28537964

fbshipit-source-id: ca42a614036bc3cb08b21a572166c4add72520ad
2021-05-20 09:44:41 -07:00
Jun Wu
7001f0de8a debugchangelog: add ways to skip migrating from specified format
Summary:
This allows us to do staged rollout where some users are using "lazy" backend
and they won't be migrating down to "doublewrite" backend.

Reviewed By: liubov-dmitrieva

Differential Revision: D28554381

fbshipit-source-id: ebe2e25c96fd3b086a451c3909643d19c64a186c
2021-05-20 09:42:12 -07:00
Jun Wu
5f9559ad99 debugchangelog: migrate from lazy to lazy is not an error
Summary: Migrating from the lazy backend to lazy backend should be a no-op.

Reviewed By: liubov-dmitrieva

Differential Revision: D28554382

fbshipit-source-id: 71c06584f6f7a89096ce4a94843c88cbea542475
2021-05-20 09:42:12 -07:00
David Tolnay
d4f337c889 Resolve bare_trait_objects warnings in path components
Reviewed By: quark-zju

Differential Revision: D28558352

fbshipit-source-id: d4b85716096c43eed8e6172ade3dfe40e277e670
2021-05-19 22:03:56 -07:00
David Tolnay
cf6125221b Regenerate Rust thrift files
Reviewed By: quark-zju

Differential Revision: D28558333

fbshipit-source-id: a6ca6e6cb8b02849b27c53fcc1aa33f464aa0f84
2021-05-19 21:54:41 -07:00
David Tolnay
7354f2b557 Invoke thrift compiler using relative path from fbcode root
Reviewed By: quark-zju

Differential Revision: D28558767

fbshipit-source-id: a2299b374d714129fef7464f783c8cd1747bda68
2021-05-19 21:52:08 -07:00
Meyer Jacobs
156b81f94a scmstore: TreeStore & FileStore pyrevisionstore constructor integration
Summary: Modifies `treescmstore` and `filescmstore` to also construct `TreeStore` and `FileStore` respectively. Currently these newly constructed stores are not used anywhere, no application code behavior should change as a result of this.

Reviewed By: DurhamG

Differential Revision: D28237680

fbshipit-source-id: 2bf3fd4b96be8c26e5c1e55cfd2e865f98e6ba91
2021-05-19 16:48:20 -07:00
Meyer Jacobs
190b95ab57 scmstore: implement legacy storage traits for FileStore
Summary:
Implement `HgIdDataStore`, `RemoteDataStore`, `LocalStore`, `HgIdMutableDeltaStore`, and `ContentDataStore` for `FileStore`.

Currently I've left `RemoteDataStore::upload` unimplemented, as it's a little more complicated than the other functionality (with lots of private field accesses), and is probably worth building a good API for first. As a temporary workaround, I can store an `LfsRemote` (which requires an associated `LfsStore` for cache) and just call upload on that for now, but that's pretty ugly with the current design. I could also construct one on the fly, but it currently stores a bare `LfsRemoteInner`, not an `Arc<LfsRemoteInner>`. I'll take one of these three approaches after getting the integration tests running with the new `TreeStore` and `FileStore`.

Reviewed By: DurhamG

Differential Revision: D28235602

fbshipit-source-id: 13c72cd9379cba70a2ca7038dad419346fe0b14a
2021-05-19 16:48:20 -07:00
Meyer Jacobs
3aa13004a0 scmstore: implement legacy storage traits for TreeStore
Summary:
Implement `HgIdDataStore`, `RemoteDataStore`, `LocalStore`, `HgIdMutableDeltaStore`, and `ContentDataStore` for `TreeStore`.

Also add a `Drop` impl that flushes the local stores, which matches the behavior of `ContentStore` (such as impl does not exist for the underlying stores, but it might be more appropriate there).

Reviewed By: DurhamG

Differential Revision: D28235060

fbshipit-source-id: 5a12d8c2ecff9fcc204cf437bf6f2a98f08645b4
2021-05-19 16:48:20 -07:00
Meyer Jacobs
978f3a9eae scmstore: introduce simplified, non-async, non-generic, non-combinator FileStore
Summary:
Introduce a new, flat, FileStore implementation. This `FileStore`, like the previously submitted `TreeStore`, directly handles all the fallback, local caching, etc, necessary to implement our storage system.

The API supports fetching batches of `Key`s, writing batches of entries (currently only in the "hg file blob" format, with copy header embedded), and querying only the local subset of underlying stores (to allow implementing `get_missing`). Other store subsets and write features will be added in the future.

Reviewed By: DurhamG

Differential Revision: D28138800

fbshipit-source-id: ca5bb91c66fa078019a19180235dd632ea73a0b3
2021-05-19 16:48:20 -07:00
Meyer Jacobs
6db16d4b0b lfs: add some utility methods to LfsPointersEntry and LfsStore for use by scmstore
Summary:
Introduce `from_hg_file_blob` and `from_content` LfsPointersEntry constructors, which are used for creating the correct `LfsPointersEntry` for a `Delta` (HgId + file content).

Add `sha256` accessor to `LfsPointersEntry`. Comments on `LfsPointersEntry` and looking at the construction logic suggest there should always be an associated Sha256 content hash. We use it often, so an accessor is useful to avoid the cumbersome HashMap access + match.

Add `fetch_available` to `LfsStore`, which is used by scmstore for handling cases where either only the pointer, or both the pointer and data are available. Existing LFS code directly accesses the underlying blob and pointer store.

Reviewed By: kulshrax

Differential Revision: D28231747

fbshipit-source-id: e6b1f210605d821f542fcb8e87aea366a0864d44
2021-05-19 16:48:20 -07:00
Arun Kulshreshtha
5ad2c03fb6 http-client: optionally convert certs to PKCS#12
Summary:
Convert client certificates (which are expected to be supplied as PEM files) into an in-memory PKCS#12 archive to pass into libcurl. This is necessary on certain platforms (such as Windows) whose native crypto APIs do not support loading PEM files.

This was previously landed as D27637069 (5b759a2b52), which unconditionally converted the certificates under the assumption that all major TLS backends support PKCS#12. That assumption is still true, but it did not account for the fact that libcurl itself is dynamically linked on some platforms (such as MacOS), and the system libcurl may be too old to support support in-memory certs (via `CURLOPT_SSLCERT_BLOB` added in libcurl version 7.71.0). This diff gates this feature behind the `http.convert-cert` config option, which we can selectively set on platforms where it is needed.

Reviewed By: mzr

Differential Revision: D28524444

fbshipit-source-id: 4af9cdd60b8ef3977ad81abdb8e406c63795e628
2021-05-19 10:39:45 -07:00
Zeyi (Rice) Fan
69573f29d2 windows: fix Windows build for py3 build
Summary:
I forget to add fbclone build rule for the Python 3 build and that's blocking Mercurial release. This diff fixes that.

(Note: this ignores all push blocking failures!)

Reviewed By: DurhamG

Differential Revision: D28541340

fbshipit-source-id: 2c12583b97ccd18e3a4717b63a4680e8a5c3de46
2021-05-19 10:05:41 -07:00
Liubov Dmitrieva
12c4a1bbb1 add a config option to show all bookmarks in output of hg cloud sl
Summary:
add a config option to show all bookmarks in output of `hg cloud sl`

by default local bookmarks pointing to public commits are not returned unless it's a public root of some draft stack

Reviewed By: markbt

Differential Revision: D28537657

fbshipit-source-id: 0287c18b1b6c79b271f8a67f604024086a37ffcf
2021-05-19 10:01:19 -07:00
Liubov Dmitrieva
9f9bcd2c70 check commit cloud workspace for removing irelevant branches
Summary: If you have checked out a shared workspace or other user workspace, this part of hg doctor could hide incorrectly, so, should be skipped.

Reviewed By: markbt

Differential Revision: D28505928

fbshipit-source-id: 65e1b3978a916fad2a33bb4f81ff1b75cd657567
2021-05-19 07:03:21 -07:00
Carolyn Busch
411ed7adf5 infinitepush: use bookmark http api
Summary: Fetch bookmarks via the http edenapi protocol in the bookmark command with the --list-remote option when all bookmark patterns are full bookmark names (not prefixes).

Reviewed By: kulshrax

Differential Revision: D27331526

fbshipit-source-id: 4f4eda255c551c9b55c6966569755f493335b458
2021-05-18 11:10:33 -07:00
Mark Juggurnauth-Thomas
5dafb7333f commitcloud: support --workspace-version in hg cloud sl --history
Summary:
The --workspace-version option is currently ignored by interactive history.
Allow it to be used to specify the initial version.  This makes jumping back to
a much older version easier.

Reviewed By: liubov-dmitrieva

Differential Revision: D28478194

fbshipit-source-id: f4f121d919e89c298677256f227f2e96d63ef644
2021-05-18 09:16:15 -07:00
Liubov Dmitrieva
add020c9f3 increase commit cloud history limit for 12 weeks by default
Summary: increase commit cloud history limit for 12 weeks by default

Reviewed By: markbt

Differential Revision: D28476878

fbshipit-source-id: d66d2bd672232932b698fece143eeac82d426886
2021-05-18 02:11:53 -07:00
Zeyi (Rice) Fan
d78264f594 windows: build Rust fbclone with Mercurial
Reviewed By: genevievehelsel

Differential Revision: D28299629

fbshipit-source-id: 8420054c848fc50e52db1c90ffc4022a858beb43
2021-05-17 15:45:34 -07:00
Liubov Dmitrieva
4fb70336da add an option to show remote bookmarks in commit cloud smartlogs
Summary: if this option is enabled, the server will be asked to add them

Reviewed By: markbt

Differential Revision: D28412810

fbshipit-source-id: d1531ecf97615cdb5e32d72c8c31598e6a406956
2021-05-17 08:39:31 -07:00
Durham Goode
dcc9895392 http-client: backout "pass certs to libcurl as in-memory blobs"
Summary: This diff breaks edenapi tls on Mac.

Reviewed By: kulshrax

Differential Revision: D28451036

fbshipit-source-id: b5451bc1e174aa40acce1e42ef6c130b02f0fb58
2021-05-14 14:01:52 -07:00
Durham Goode
d54ca67554 tests: fix test-merge-tools.t
Summary:
This was broken by my recent change to have mergetools respect HGPLAIN
instead of ui.formatted.

Reviewed By: andll

Differential Revision: D28423783

fbshipit-source-id: 00831a6cc47acc11574fcf67462a1dccdde21fda
2021-05-13 17:44:14 -07:00
Stanislau Hlebik
eab97b6123 mononoke: sync changeset implementation for megarepo
Summary: First stab at implementing sync changeset functionality for megarepo.

Reviewed By: ikostia

Differential Revision: D28357210

fbshipit-source-id: 660e3f9914737929391ab1b29f891b3b5dd47638
2021-05-13 10:04:21 -07:00
Durham Goode
d88b999faf Allow conflict editor prompts during arc pull
Summary:
Mercurial has gotten stricter about respecting interactive vs
non-interactive commands lately, and now is failing to automatically open the
editor for conflicts during arc pull. Let's force Mercurial to treat the
invocation as an interactive one.

Reviewed By: skotchvail

Differential Revision: D28358999

fbshipit-source-id: 551713a78abfe170f04e8e55318af6e157bae7da
2021-05-13 09:40:57 -07:00
Andrey Chursin
b7ec4892d9 commitcloud: fix doctest
Summary: D28351849 (2c3edb0989) broke doctest, this diff attempts to fix it

Reviewed By: quark-zju

Differential Revision: D28392077

fbshipit-source-id: 7f1f7261d8996b2c808399954fc895eccc2c1c06
2021-05-12 18:21:10 -07:00
Durham Goode
1248a276fa build: use the appropriate python version for getdeps builds
Summary:
getdeps builds are failing on certain versions of Mac because they
choose a system python, which causes setup.py to use a hard coded library
location which isn't correct in our environment. Earlier I changed
pick_python.py to prefer the homebrew python, but it turns out getdeps doesn't
actually use pick_python. This diff fixes that and also instructs python3-sys to
use the correct version, by setting the PYTHON_SYS_EXECUTABLE environment
variable.

Reviewed By: quark-zju

Differential Revision: D28388150

fbshipit-source-id: 9b09e7472733f7a779c6212ae012116cad657b5d
2021-05-12 14:24:20 -07:00
Jan Mazur
490cbbf0c3 mocking LFS in revisionstore tests
Summary: Mocking LFS server.

Reviewed By: krallin

Differential Revision: D28093406

fbshipit-source-id: fe6acb2e327ee26dd424d91b66ed725339f19431
2021-05-12 12:05:05 -07:00
Ron Mordechai
77b7617d4b Add myparenttags
Summary: I use tags extensively and I love them to be supported as well.

Reviewed By: asm89

Differential Revision: D28348565

fbshipit-source-id: 7d94d048b734c91e7d74a1c3efeefc87943066ad
2021-05-12 08:20:53 -07:00
Arun Kulshreshtha
5b759a2b52 http-client: pass certs to libcurl as in-memory blobs
Summary: Instead of passing a client certificate path to libcurl, load the certificate into memory and pass it to libcurl as a blob using `CURLOPT_SSLCERT_BLOB`. This allows us to convert the certificate format in-memory from PEM to PKCS#12, the latter of which is supported by the TLS engines on all platform (and notably SChannel on Windows, which does not support PEM certificate).

Reviewed By: quark-zju

Differential Revision: D27637069

fbshipit-source-id: f7f8eaafcd1498fabf2ee91c172e896a97ceba7e
2021-05-11 18:25:13 -07:00
Arun Kulshreshtha
356e56bd4f windows: copy OpenSSL DLLs alongside executable
Summary:
The Rust `openssl` crate will using dynamic linking by default when built with `cargo`. This is a problem on Windows, since we only support cargo-based builds on that platform, but OpenSSL is not present in the system's shared library search paths.

Since we already have a copy of OpenSSL uploaded to LFS, the simplest solution is to just copy the required DLLs right next to the Mercurial executable so that they will be found at launch.

A better solution would probably be to use static linking here. From reading the crate's documentation (and build script), it seems like setting `OPENSSL_STATIC=1` during the build should force static linking, but in practice I have not been able to get this to work.

Reviewed By: DurhamG

Differential Revision: D28368579

fbshipit-source-id: 3fceaa8d081650d60356bc45ebee9c91ef474319
2021-05-11 18:25:13 -07:00
Liubov Dmitrieva
297ab79a2a split full sync into 3 passes
Summary:
split full sync into 3 steps

Commit cloud by default pulls only 30 days of commits.

Users often see some of their commits are missing in their smartlog.

I discovered that most of the users know the '--full' option (`hg cloud sync --full`) but not the 'max_sync_age' config option.

So, they try --full option but it could fail due to very very old commits we haven't migrated to Mononoke.

Users often don't really need those commits but it's not nice that the whole sync run failed.

We know that at least latest 2 years of commits are present in Mononoke.

So if we split a bit how we sync with --full option works, it would at least result in partially successfully sync for the latest 2/3 years of commits.

Reviewed By: mitrandir77

Differential Revision: D28352355

fbshipit-source-id: b5bacd7d5256191528613e3c0bcbb21b0104ac3c
2021-05-11 14:00:16 -07:00
Liubov Dmitrieva
2c3edb0989 deprecate 4 commits at a time limitation for unhydrated pulls
Summary:
deprecate 4 commits at a time limitation for unhydrated pulls

This could speedify cloud join commands significantly (by many X times) and hg cloud sync --full command.

Reviewed By: farnz

Differential Revision: D28351849

fbshipit-source-id: f9f3d7a5c07d61cb51a5bb6284afaad963662c94
2021-05-11 12:40:39 -07:00
Stanislau Hlebik
4e232ea94d mononoke: add mapping for megarepo
Summary:
Adding mappng to keep track of two things:
1) keep track of the latest source commit that was synced into a given target - this will be used during sync_changeset() method to validate if a parent changeset of a given changeset was already synced
2) which source commit maps to what target commit

Reviewed By: ikostia

Differential Revision: D28319908

fbshipit-source-id: f776d294d779695e99d644bf5f0a5a331272cc14
2021-05-11 02:54:01 -07:00
CodemodService Bot
e2a64a3088 Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: krallin

Differential Revision: D28319288

fbshipit-source-id: fc879fab6d7c2abd5184ccfbacf2aa2a8f3d8003
2021-05-10 05:06:45 -07:00
Thomas Orozco
58f7f50188 revisionstore: include version in user agent
Summary: Right now this is not very useful. Let's make it more useful.

Reviewed By: DurhamG

Differential Revision: D28281653

fbshipit-source-id: ef3d7acb61522549cca397048c841d1afb089b9b
2021-05-10 01:36:14 -07:00
CodemodService Bot
0462f803c0 Daily arc lint --take BLACK
Reviewed By: zertosh

Differential Revision: D28282435

fbshipit-source-id: 26037c582a35a958702b5d9f5c371e19664ba3c6
2021-05-07 05:16:05 -07:00
Jun Wu
9013d18a71 edenapi: debug log registered builder function
Summary:
This makes it easier to see what builder functions were registered:

  % EDENSCM_LOG=edenapi=debug lhg log -r .
  May 06 16:40:29.355 DEBUG edenapi::builder: registered eagerepo::api::edenapi_from_config to edenapi Builder

Reviewed By: DurhamG

Differential Revision: D28271366

fbshipit-source-id: f6c7c3aa9f29c3e47c2449e3d5fc16474aa338b0
2021-05-07 01:00:56 -07:00
Marc Fisher
9bdd73be2c Add stables template keyword to hg.
Summary:
Adding support for the stables template keyword in stablerev extension.

This keyword calls out to a script specified in the config stablerev.stables_cmd to get a list of stable aliases for a given revision.

Reviewed By: quark-zju

Differential Revision: D28204529

fbshipit-source-id: 3c5b21846ce6f686afddd00d3326a54b85be87dd
2021-05-06 23:52:32 -07:00
Jun Wu
647ee078d0 dag: actually test server1 in test_sparse_dag
Summary:
The server1 was not used after D27629318 (ba7e1c6952) while the test intentionally wants to
exercise graph isomorphism. So let's revive server1 in the test.

Reviewed By: andll

Differential Revision: D28269926

fbshipit-source-id: 0a04031415f559f8a6eb81f1e2f2530329a2a3bc
2021-05-06 21:15:22 -07:00
Thomas Orozco
ea8332c47d mononokepeer: increment mononoke_read_bytes on read()
Summary:
We were only incrementing this on `readline`, which resulted in very low
numbers. While in there, I also removed `self._totalbytes` as that was unused.

Reviewed By: johansglock

Differential Revision: D28260141

fbshipit-source-id: 6d9008f9342adaf75eecc8ed8c872f64212cd1f7
2021-05-06 13:41:52 -07:00
Jun Wu
f36574ef0f test-eager-exchange: test treemanifest reading
Summary:
Add a subtree to exercise treemanifest logic. Blobs in EagerRepo are verified
so we need to disable flatcompat.

Reviewed By: DurhamG

Differential Revision: D28006550

fbshipit-source-id: ac7157a9c01ed99f703601613fb3cf06add69003
2021-05-06 12:13:17 -07:00
Jun Wu
b6d24fc969 eagerepo: support "test:name" repo URLs
Summary: This makes it easier to use it in tests.

Reviewed By: DurhamG

Differential Revision: D28006549

fbshipit-source-id: 90e29b220453a3d7a260d0a62d697d64363d9a6c
2021-05-06 12:13:17 -07:00
Jun Wu
f23f112dc8 test-eager-exchange: add test showing file content can be read after clone
Summary:
With remotefilelog force enabled, it's now possible to read the file content after
clone. Add a test for it.

Reviewed By: DurhamG

Differential Revision: D28006547

fbshipit-source-id: 5be93e162f352b1264a6c52852c2230726652f9d
2021-05-06 12:13:17 -07:00
Jun Wu
d9b901b22c extensions: always enable remotefilelog
Summary:
This makes it easier to get rid of revlog stores.

`debugindexdot` is no longer supported since it reads revlogs.
Two tests use flat manifest bundles. They are no longer supported
due to remotefilelog today has some assumptions that treemanifest
extension is also being used.

Reviewed By: DurhamG

Differential Revision: D27971126

fbshipit-source-id: fdb992a8d72bbcf562b5cb95b3f29051dd1c9464
2021-05-06 12:13:17 -07:00
Jun Wu
05ae4dd6f8 tests: stop disabling treemanifest for some tests
Summary:
Disabling treemanifest is a tech debt that causes problems, especially when
enabling remotefilelog.

Reviewed By: andll

Differential Revision: D27971120

fbshipit-source-id: 1a50acc23564c2d6bad79a2e99469850b5a7d1f9
2021-05-06 12:13:17 -07:00
Jun Wu
4c214bca8c dag: move some tracing logs from dag::namedag to dag::protocol
Summary:
This makes it easier to filter logs related to remote fetching.

The `DEBUG dag::protocol: resolve ids [0] remotely` means the lazy hash resolution is working.

Reviewed By: kulshrax

Differential Revision: D27971117

fbshipit-source-id: f2492204c70d793997d0c3865e500bbad56b1953
2021-05-06 12:13:17 -07:00
Jun Wu
e0b6773019 eagerepo: write commits to master group
Summary:
Write commit to master group. This provides proper "CloneData" and allows us to
actually test lazy commit hash backend (since only commits in the master group
can have lazy hashes).

Reviewed By: DurhamG

Differential Revision: D27971123

fbshipit-source-id: 4e19486007ddc89de7468be65445559f34d796f5
2021-05-06 12:13:17 -07:00
Jun Wu
6763719506 eagerpeer: add clone support
Summary:
Add clone endpoint so we can clone from an eager test repo.

Note: the master group is empty and "cloneata" does not quite work yet due to
EagerRepo not writing to the master group. It will be fixed later.

Reviewed By: DurhamG

Differential Revision: D27971121

fbshipit-source-id: 0cc35136c6987673c2c4fbbd892c344c3586fcb7
2021-05-06 12:13:17 -07:00
Stefan Filip
8faf9b07c5 edenapi_service: use custom_cbor_stream for trees
Summary:
The trees endpoint is another example where we try to send errors to the
client.  As it was done previously we would fail to log any errors on the
server side.  This diff corrects that by using custom_cbor_stream.

Reviewed By: kulshrax

Differential Revision: D28111102

fbshipit-source-id: 468095d024647f472b8ad9a9e17ca8364605ff98
2021-05-06 09:14:10 -07:00
Digant Kasundra
be43635087 Update rust-ini to 0.17.0
Summary: Updated rust-ini from 0.13.0 to 0.17.0

Differential Revision: D28242794

fbshipit-source-id: 249fc7d2ffdc46c4bfb4b575fb7aa8f5858a6e12
2021-05-06 06:50:28 -07:00
Johan Schuijt-Li
e57f819b6e rage/debug output for schemes
Summary:
Add debug output to rage to make sure we have the relevant information in case
we need to debug issues with schemes.

Reviewed By: quark-zju

Differential Revision: D28222910

fbshipit-source-id: 9499c736d61b2c0e4568e05a3afc0ae9730acedf
2021-05-06 04:39:19 -07:00
Johan Schuijt-Li
c120560edf integrate hgext schemes into fb mercurial
Reviewed By: liubov-dmitrieva

Differential Revision: D28185505

fbshipit-source-id: 1eed74bf492c5f22abb7d616b9492eb2a549aead
2021-05-06 04:39:19 -07:00
Johan Schuijt-Li
395d04cecc import schemes hgext
Summary:
Import from upstream:
https://www.mercurial-scm.org/repo/hg/file/tip/hgext/schemes.py

at revision 47060:fde5bb5d1acf

Reviewed By: mitrandir77

Differential Revision: D28185506

fbshipit-source-id: 651398fb76adf0e05fcd22afd8f39e8f941919d5
2021-05-06 04:39:19 -07:00
Jun Wu
7a0765ab25 edenapi: do not dependent on eagerepo
Summary:
eagerepo -> metalog -> git2 -> libgit2-sys -> libgit2 conflicts with edenfs'
non-Rust libgit2 dependency. Rust git2 crate does not seem to provide a way to
depend on specified libgit2.

Quote https://github.com/rust-lang/git2-rs/issues/263#issuecomment-450934287:

> It's expected that git2-rs builds its own copy of libgit2 and doesn't use the
> system version, as the system version is likely incompatible

It also seems non-trivial to make buck C++ use the libgit2 frm `libgit2-sys` crate.

Let's just avoid depending on eagerepo from edenapi directly for now to solve the
issue. This basically revives D27948369 and D27951632.

Reviewed By: xavierd

Differential Revision: D28243784

fbshipit-source-id: 0c38c20c2d3a80c550732129da572fe26a229799
2021-05-05 18:21:00 -07:00
Jun Wu
2cf4957de0 runtests: expand $TESTTMP in hgrc
Summary:
This makes it easier to use `--keep` to investigate tests by using
`--configfile`.

Reviewed By: kulshrax

Differential Revision: D27971122

fbshipit-source-id: 8adcbeab825155858499c24ca74c2979049adeda
2021-05-05 17:53:39 -07:00
Zeyi (Rice) Fan
9d64cd399d backingstore: fix winhttp linkage issue
Summary:
We have a linker issue on Windows when building EdenFS with CMake:

```
backingstore.lib(winhttp.o) : error LNK2019: unresolved external symbol __imp_WinHttpSetStatusCallback referenced in function winhttp_connect
backingstore.lib(winhttp.o) : error LNK2019: unresolved external symbol __imp_WinHttpOpen referenced in function winhttp_connect
backingstore.lib(winhttp.o) : error LNK2019: unresolved external symbol __imp_WinHttpCloseHandle referenced in function winhttp_close_connection
backingstore.lib(winhttp.o) : error LNK2019: unresolved external symbol __imp_WinHttpConnect referenced in function winhttp_connect
backingstore.lib(winhttp.o) : error LNK2019: unresolved external symbol __imp_WinHttpReadData referenced in function winhttp_stream_read
backingstore.lib(winhttp.o) : error LNK2019: unresolved external symbol __imp_WinHttpWriteData referenced in function winhttp_stream_read
backingstore.lib(winhttp.o) : error LNK2019: unresolved external symbol __imp_WinHttpQueryOption referenced in function certificate_check
```

This fixes that.

Reviewed By: xavierd

Differential Revision: D28230163

fbshipit-source-id: f74e42ee30ec8f3b81c1f80b7cf63a21ea97732c
2021-05-05 15:01:01 -07:00
Jun Wu
f347dc94f9 remotefilelog: do not use f strings
Summary: The syntax is not supported by Python 2.

Reviewed By: DurhamG

Differential Revision: D28233280

fbshipit-source-id: 9f882827b1357cb339e60180acadb38842c3cf8d
2021-05-05 13:30:11 -07:00
Jun Wu
2e07267f2d remotefilelog: do not use **kwargs,
Summary: The syntax is not supported by Python 2.

Reviewed By: DurhamG

Differential Revision: D28232995

fbshipit-source-id: 62058751b4f00b78a2bd56908100a7bb7a3adfde
2021-05-05 13:22:30 -07:00
Jun Wu
60e240b17e eagerepo: fix Windows compatibility
Summary: Windows path like `eagerepo:///C:\foo\bar` needs special handling.

Reviewed By: kulshrax

Differential Revision: D27971119

fbshipit-source-id: 9d4b87782eca2734b708565f0ee22a7495253cff
2021-05-05 12:01:50 -07:00
Genevieve Helsel
100fccc193 retire hg gc
Summary: `hg gc` does not do anything anymore, so in order to reduce confusion, let's just print a message that says it is no longer supported and provide a manual remediation.

Reviewed By: xavierd

Differential Revision: D28164614

fbshipit-source-id: 7ed2392cdb0091cd604a15b4c2382632706981f2
2021-05-05 11:48:58 -07:00
Jun Wu
c793852fba treemanifest: do not bundle trees present on server
Summary:
This avoids issues where the tree is stored without p1, p2. It is similar to
what we do for public commits (in createtreepackpart):

  if sendtrees == shallowbundle.AllTrees or ctx.phase() != phases.public:
      ...

Note: the trees API actually provides p1, p2, but p1, p2 are dropped when
writing to the current data store implementation.

Reviewed By: liubov-dmitrieva

Differential Revision: D28200388

fbshipit-source-id: e1fe93d8ae8576e691077d6db432d55f7b9d498d
2021-05-05 09:48:29 -07:00
Jun Wu
e0f02950ea pyedenapi: add trees API unrelated to store
Summary: Add a way to fetch tree content without going through store.

Reviewed By: liubov-dmitrieva

Differential Revision: D28200387

fbshipit-source-id: 8f5b2214aafba39c7674f0f6b27af0c985f0ea72
2021-05-05 09:48:29 -07:00
Jun Wu
e687a92d10 pyedenapi: rename trees to storetrees
Summary:
The `trees` API is coupled with a store. We're going to add another API that is
not coupled with a store so let's rename `trees` to `storetrees`.

Reviewed By: liubov-dmitrieva

Differential Revision: D28200389

fbshipit-source-id: 826116f0b461873b2f5df07e7fd35e6d1018f929
2021-05-05 09:48:29 -07:00
Andrey Chursin
eec8e784f5 tests: do not test native checkout debug output in test-update-reverse.t
Summary:
This output is non-determenistic, and it does not seem to be important in this test
We could replace HashMap with BTreeMap to make it deterministic, as an alternative, but it is probably not justified for this test

Reviewed By: quark-zju

Differential Revision: D28204050

fbshipit-source-id: 50000671520e3bbf41849dc53c420ccab496dca0
2021-05-05 09:40:29 -07:00
CodemodService Bot
b4afda3890 Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: krallin

Differential Revision: D28216338

fbshipit-source-id: 2384a332505881bbc8cd621694496cf9f37c3bea
2021-05-05 04:03:47 -07:00
Liubov Dmitrieva
b506eeea0c do not perform syncing for public commits
Summary: we display incorrectly 'local changes' for public commits

Reviewed By: DurhamG

Differential Revision: D28000088

fbshipit-source-id: 81bb8926dd7e96bf283eabe2b0aca84a9155fea3
2021-05-05 02:48:19 -07:00
Liubov Dmitrieva
f74c212472 remove dead code
Summary: the option has been deprecated and is not used anywhere

Reviewed By: krallin

Differential Revision: D28191314

fbshipit-source-id: f5f092b93a9644c8249628520d8d707b60854aac
2021-05-05 02:45:45 -07:00
Durham Goode
27d58bbd42 configs: delete applydynamicconfig
Summary: This is no longer used.

Reviewed By: quark-zju

Differential Revision: D26676518

fbshipit-source-id: 1cc9c32e2a95d6db78160f33ab5423338ea82e04
2021-05-04 22:18:55 -07:00
John Reese
9fd86a4fae apply upgraded black 21.4b2 formatting to fbsource
Summary:
This applies the formatting changes from black v21.4b2 to all covered
projects in fbsource. Most changes are to single line docstrings, as black
will now remove leading and trailing whitespace to match PEP8. Any other
formatting changes are likely due to files that landed without formatting,
or files that previously triggered errors in black.

Any changes to code should be AST identical. Any test failures are likely
due to bad tests, or testing against the output of pyfmt.

Reviewed By: thatch

Differential Revision: D28204910

fbshipit-source-id: 804725bcd14f763e90c5ddff1d0418117c15809a
2021-05-04 22:16:51 -07:00
Jun Wu
2400e5c960 pydag: add importclonedata
Summary:
This will consume `CloneData` from EdenApi and write to the graph.

Note `CloneData<Vertex>` and `CloneData<HgId>` has the same mincode
serialization result so there is no need to do extra type conversion.

This can be used like:

  In [1]: v=api.clonedata('fbsource');
  In [6]: d=bindings.dag.commits.openhybrid(None, '/tmp/seg', '/tmp/msg', repo
     ...: .edenapi, repo.name, lazyhash=True)

  In [7]: d.importclonedata(v)

Reviewed By: kulshrax

Differential Revision: D27971125

fbshipit-source-id: 4d420c6ff0495dc184e7c9618b866a69f0a00002
2021-05-04 18:28:45 -07:00
Jun Wu
f1d1862e70 hgcommits: expose import_clone_data API
Summary:
Expose NameDag's `import_clone_data` API so this can be then exposed via
`pydag`.

Reviewed By: kulshrax

Differential Revision: D27971118

fbshipit-source-id: c9d869ffbbc8ba5a7a6ae98d17a2b7ea713bc675
2021-05-04 18:28:45 -07:00
Jun Wu
1b4f6be538 pyedenapi: add clonedata endpoint
Summary: The `CloneData` is currently only exposed in Rust. Expose it in Python too.

Reviewed By: kulshrax

Differential Revision: D27971124

fbshipit-source-id: 1a9c63274b6e2d78a176869b6810acbc191ba314
2021-05-04 18:28:45 -07:00
Jun Wu
fa7ba86bad exchange: skip pull phase if narrow-heads is on
Summary: We skip it in other places but missed this one. Skip it too.

Reviewed By: kulshrax

Differential Revision: D27957853

fbshipit-source-id: 429d25e8b692218c9bae6c10ad76d08495a4bc66
2021-05-04 18:28:45 -07:00
Jun Wu
ae81c8fd34 edenapi: force use edenapi if ui.ssh is false
Summary: If ui.ssh is "false", then ssh cannot be used at all. Force using edenapi.

Reviewed By: kulshrax

Differential Revision: D27957312

fbshipit-source-id: 9860344779e6a6bab557d3f953ee38e40fadb78b
2021-05-04 18:28:45 -07:00