Commit Graph

1762 Commits

Author SHA1 Message Date
Jun Wu
8213cfd464 autopull: support different sources
Summary:
Make it so that remote bookmarks like `foo/name` or `bar/name` would pull from
different sources `paths.foo` or `paths.bar`.

Reviewed By: DurhamG

Differential Revision: D21526666

fbshipit-source-id: 6791ab047840c6c49df0c96ff1f56ae7bd1aeeba
2020-05-13 19:27:41 -07:00
Jun Wu
39bd5d8634 context: remove "is a remote bookmark or commit, try to 'hg pull' it first" message
Summary:
We now have auto pull logic that covers most unknown rev use-cases. The hint
message is no longer necessary. It's also unclear how to use `hg pull`
correctly. For example, should it be `-r`, `-B remote/foo` or `-B foo`?

Reviewed By: DurhamG

Differential Revision: D21526667

fbshipit-source-id: 40583bfb094e52939130250dd71b96db4d725ad5
2020-05-13 19:27:41 -07:00
Arun Kulshreshtha
d7455ed900 tests: delete test-amend-noinhibit.t
Summary: The original purpose of this test was to verify that `hg restack` would work correctly with the `inihibt` extension disabled. `inhibit` has not been relevant at FB for years, so this test has no value.

Reviewed By: quark-zju

Differential Revision: D21555411

fbshipit-source-id: 475ed37439ed71aee08ad1b23ebe1770c3324890
2020-05-13 18:08:58 -07:00
Kostia Balytskyi
b1d4f6d2a5 debugsendunbundle: add cmd to send unbunble from stdin
Summary:
This is helpful, when we have raw unbundle bytes and a server path and just
want to send these bytes server's way.

Very similar to `sendunbundlereplay`, but does not do anything additional,
and reads from stdin.

Reviewed By: markbt

Differential Revision: D21527243

fbshipit-source-id: 97726cb40a32c7e44f47e0f56d8c8eabc4faf209
2020-05-13 15:34:39 -07:00
Xavier Deguillard
99f74f0155 lfs: move uploaded blobs to the shared store
Summary:
As a developpers is working on large blobs and iterating on them, the local LFS
store will be growing significantly over time, and that growth is unfortunately
unbounded and will never be cleaned up. Thankfully, one the guarantee that the
server is making is that an uploaded LFS blob will never be removed[0]. By using
this property, we can simply move blobs from the local store to the shared
store after uploading the blob is complete.

[0]: As long as it is not censored.

Reviewed By: DurhamG

Differential Revision: D21134191

fbshipit-source-id: ca43ddeb2322a953aca023b49589baa0237bbbc5
2020-05-13 12:50:20 -07:00
Xavier Deguillard
dc589c38e5 revisionstore: don't import unused format_err
Summary: The compiler is warning about it.

Reviewed By: singhsrb

Differential Revision: D21550266

fbshipit-source-id: 4e66b0dda0e443ed63aeccd888d38a8fcb5e4066
2020-05-13 10:44:07 -07:00
Jun Wu
0ac5c6d4f3 pymutationstore: expose the getdag API
Summary: Expose the API that returns a real graph.

Reviewed By: DurhamG

Differential Revision: D21486520

fbshipit-source-id: 4ebdb4011df8971c54930173c4e77503cd2dac47
2020-05-13 09:45:24 -07:00
Jun Wu
4f39a8e5a6 mutationstore: add a method that returns a dag
Summary:
Part of the mutation graph (excluding split and fold) can fit in the DAG
abstraction. Add a method to do that. This allows cross-dag calculations
like:

  changelogdag = ... # suppose available by segmented changelog

  # mutdag and changelogdag are independent (might have different nodes),
  # with full DAG operations on either of them.
  mutdag = mutation.getdag(...)
  mutdag.heads(mutdag.descendants([node])) & changelogdag.descendants([node2]) # now possible

Comparing to the current situation, this has some advantages:
- No need to couple the "visibility", "filtered node" logic to the mutation
  layer. The unknown nodes can be filtered out naturally by a set "&"
  operation.
- DAG operations like heads, roots can be performed on mutdag when it's
  previously impossible. We also get operations like visualization for free.

There are some limitations, though:
- The DAG cannot represent non 1:1 modifications (fold, split) losslessly.
  Those relationships are simply ignored for now.
- The MemNameDag is not lazy. Reading a long chain of amends might be slow.
  For most normal use-cases it is probably okay. If it becomes an issue we
  can seek for other solutions, for example, store part of mutationstore
  directly in a DAG format on disk, or have fast paths to bypass long
  predecessor chain calculation.

Reviewed By: DurhamG

Differential Revision: D21486521

fbshipit-source-id: 03624c8e9803eb1852b3034b8f245555ec582e85
2020-05-13 09:45:24 -07:00
Jun Wu
ff7a6b43d3 pyre2: use Rust regex backend
Summary: Switch from re2 to the Rust regex engine.

Reviewed By: DurhamG

Differential Revision: D20973178

fbshipit-source-id: 2707bfb2120ceb3758a81c01a5a6f4f8c61758bc
2020-05-12 16:32:51 -07:00
Jun Wu
e817197b09 bindings: add bindings to regex
Summary:
This allows us to replace the pyre2 C++ bindings so the fast regex engine can
work with Python 3, and simplify our build steps.

Reviewed By: DurhamG

Differential Revision: D20973179

fbshipit-source-id: e123ac18954991f2c701526108f5c2ecd2b31a3b
2020-05-12 16:32:50 -07:00
Arun Kulshreshtha
647a91647b edenapi: add history support to data_util
Summary: Add the ability to parse EdenAPI history responses to `data_util`.

Reviewed By: quark-zju

Differential Revision: D21489228

fbshipit-source-id: 42dda64273673431a6f3e4d7bd430689c76c387f
2020-05-12 16:26:22 -07:00
Arun Kulshreshtha
40928f027c make_req: take array instead of object as input for data requests
Summary: Change `make_req` to take a JSON array as input when constructing `DataRequest`s instead of a JSON object. This is more correct because DataRequests can include multiple `Key`s with the same path; this cannot be represented as an object since an object is effectively a hash map wherein we would have duplicate keys.

Reviewed By: quark-zju

Differential Revision: D21412989

fbshipit-source-id: 07a092a15372d86f3198bea2aa07b973b1a8449d
2020-05-12 16:26:20 -07:00
Jun Wu
fe3bd0e090 tracing: replace blackbox.logblocked with tracing events
Summary: Migrate those "blocked" events from blackbox to tracing data.

Reviewed By: DurhamG

Differential Revision: D19797704

fbshipit-source-id: 401c1434e1d148956bb572d236d8998d59dfbf39
2020-05-12 10:48:43 -07:00
Jun Wu
dd1ee71afc tracing: write a few more events to tracing data
Summary:
Write commit cloud sync and clienttelemetry blackbox logs to tracing data.
Note: since metalog can answer head changes, I didn't add head changes of
commit cloud sync to the tracing data.

Reviewed By: DurhamG

Differential Revision: D19797700

fbshipit-source-id: b89924a7aa5e6027cad5c8138e8988f6b0ea4b2a
2020-05-12 10:48:43 -07:00
Jun Wu
cb9d8cde50 watchmanclient: write watchman commands to tracing data
Summary: This allows us to query tracing data for watchman commands.

Reviewed By: DurhamG

Differential Revision: D19797711

fbshipit-source-id: 4dfd50fff820da70888faa0fe8f53af25f205137
2020-05-12 10:48:42 -07:00
Jun Wu
1e64eb89b9 pull: skip listkeys bookmarks using the modern pull API
Summary:
The repo.pull API updates remote bookmarks on its own. Therefore do not even
ask the server to listkey (all) bookmarks.

This also removes the need of listkeys(bookmarks) for the new clone API.

Reviewed By: DurhamG

Differential Revision: D21011393

fbshipit-source-id: b10bdbc82563c32626bdcb2632170fd56819e904
2020-05-12 10:23:24 -07:00
Jun Wu
1863edef57 remotenames: disable exclone if core clone.streamclone is used
Summary:
The core `clone.streamclone` is the new clean way to do a streaming clone with
selectivepull. Detect the use of it and skip remotenames' own exclone logic.

Reviewed By: DurhamG

Differential Revision: D21011396

fbshipit-source-id: 50fdbf4c2761a96c50e23f21a87ef636fac74afb
2020-05-12 10:23:24 -07:00
Jun Wu
219554305e clone: add a new clone function with less tech-debt
Summary:
The current `clone --shallow` command has some issues:
- It fetches *all* remote bookmarks, since selectivepull does not work with
  streamclone, then remove most remote bookmarks in a second transaction.
- It goes through remotenames, which is racy, and D20703268 does not fix the
  clone case. Possible cause of T65349853.
- Too many wrappers (ex. in remotefilelog, remotenames, fastdiscovery) wtih
  many configurations (ex. narrow-heads on/off) makes it hard to reason about.

Instead of bandaidding the clone function, this diff adds a new clone implementation
that aims to solve the issues:
- Use streamclone, but do not pull all remote names.
- Pull selectivepull names explicitly with a working "discovery" strategy
  (repo heads should be non-empty with narrow-heads on or off).
- Do clone in one transaction. Outside world won't see an incomplete state.
- Use `repo.pull` API, which is not subject to race conditions.
- Eventually, this might be the only supported "clone" after Mononoke becoming
  the single source of truth.

Note: the code path still goes through bookmarks.py and remotenames.py.
They will be cleaned up in upcoming diffs.

Reviewed By: DurhamG

Differential Revision: D21011401

fbshipit-source-id: d8751ac9bd643e9661e58c87b683be285f0dc925
2020-05-12 10:23:23 -07:00
Jun Wu
1535e0774e changelog: expose rawheadrevs() API
Summary:
In the past we hide the revlog headrevs API with the idea that calculating
heads in the DAG is not going to scale, and heads should be based on references
(remotenames, visible heads). Practically calculating heads in the DAG based
on segmented changelog is not going to be painfully slow so we probably can
afford it.

Therefore let's just re-expose the DAG-based heads API as rawheads. The only
user of it is in dagutil.py.

This will be used in the next diff where streamclone first gets the revlog
changelog copied without remote bookmarks. Then it needs to do a pull
which requires the heads information.

Reviewed By: DurhamG

Differential Revision: D21296530

fbshipit-source-id: a81a61e3b58c921a3390fda8f716bd7ae0e55ed1
2020-05-12 10:23:23 -07:00
Jun Wu
b8f65b13ab clone: write repo hgrc early
Summary:
Move the logic to write repo hgrc ([paths]) and set [paths] config options
earlier, so other logic can use the [paths] config.

Some tests are changed because remotenames can now write bookmarks in more
cases.

Reviewed By: DurhamG

Differential Revision: D21011397

fbshipit-source-id: 4b921a02c20daeef31d44a03264a89b975303aa5
2020-05-12 10:23:22 -07:00
Jun Wu
d175b5c489 hggit: use transaction name to test initial clone
Summary:
"[paths] being empty" will no longer be a way to test initial clone, use
transaction name instead.

Reviewed By: DurhamG

Differential Revision: D21011395

fbshipit-source-id: e257fe8eb2efd45ac52fad7c74363151b0a8c417
2020-05-12 10:23:22 -07:00
Jun Wu
63872cfbae transaction: make transaction name available on transaction object
Summary: This will be used by hg-git to test initial clone.

Reviewed By: DurhamG

Differential Revision: D21011400

fbshipit-source-id: 11a1a41631830273a6407e419ebe5ff21964e7de
2020-05-12 10:23:22 -07:00
Jun Wu
192467dd38 clone: remove share.pool support
Summary: It is not used and makes the already complicated clone logic more complicated.

Reviewed By: DurhamG

Differential Revision: D21011394

fbshipit-source-id: 3620f7372a9f3cefc60618052c768c6c2cbe04f9
2020-05-12 10:23:21 -07:00
Jun Wu
96ebdf59ce remotefilelog: move stream_out wireprotocol to core
Reviewed By: DurhamG

Differential Revision: D21011398

fbshipit-source-id: c47307d06517e145837854db8e6bbec97b17e6bd
2020-05-12 10:23:21 -07:00
Jun Wu
a515f86575 remotefilelog: remove includepattern and excludepattern in wireproto
Summary:
They are not used. Remove it to make it a bit easier to move stream_out_shallow
to core.

Note: this does not remove all include/excludepatterns yet.

Reviewed By: DurhamG

Differential Revision: D21011403

fbshipit-source-id: f6d27a3e2472f6c69f95a958ac99f75a8b8f8b74
2020-05-12 10:23:21 -07:00
Jun Wu
76643816b3 remotefilelog: move "--shallow" command-line flag to core
Summary: It will be used in the next change.

Reviewed By: DurhamG

Differential Revision: D21011399

fbshipit-source-id: 6bdffc79af0474e42562686109417882a8cb2cd6
2020-05-12 10:23:20 -07:00
Mark Thomas
428ba0b5f8 commitcloud: add hg cloud hide command to remove things from cloud workspaces
Summary:
Add the `hg cloud hide` command.  This allows removal of commits, bookmarks and
remote bookmarks from a cloud workspace, even when the items are omitted
locally.

Reviewed By: DurhamG, quark-zju

Differential Revision: D21409384

fbshipit-source-id: 24b64c207c78f9b0258e9cf6a578db7b14c84901
2020-05-12 07:56:50 -07:00
Durham Goode
20c3f8b34d scuba: round bytes to the nearest useful value
Summary: This will reduce the amount of space they take in scuba.

Reviewed By: xavierd

Differential Revision: D21483472

fbshipit-source-id: 9de49dedef480932f8583dd17fe6625d222a3285
2020-05-11 21:31:05 -07:00
Jun Wu
99d288c1bd fsmonitor: write fsmonitor walk events to tracing data
Summary: This allows us to query tracing data for fsmonitor walk events.

Reviewed By: DurhamG

Differential Revision: D19797709

fbshipit-source-id: 1ff76dd6122cf56787e7928711f604f9c3d571cc
2020-05-11 16:56:18 -07:00
Ellis Hoag
1d0d626a36 Pass config object down to repack
Summary:
Pass `configparser::config::ConfigSet` to `repack` in
`revisionstore/src/repack.rs` so that we can use various config values in `filter_incrementalpacks`.

* `repack.maxdatapacksize`, `repack.maxhistpacksize`
  * The overall max pack size
* `repack.sizelimit`
  * The size limit for any individual pack
* `repack.maxpacks`
  * The maximum number of packs we want to have after repack (overrides sizelimit)

Reviewed By: xavierd

Differential Revision: D21484836

fbshipit-source-id: 0407d50dfd69f23694fb736e729819b7285f480f
2020-05-11 16:41:30 -07:00
Stanislau Hlebik
20017e96fe hgsql: check sqlrepolock in memcommit
Summary:
Let's not allow proceeding with memcommit if repo is locked. This what normal
push flow does, so we should allow it here as well.

Reviewed By: markbt

Differential Revision: D21502435

fbshipit-source-id: 80e665f065fb0cd882bc99482769a3de01d3de30
2020-05-11 12:47:10 -07:00
Xavier Deguillard
1cd0bba3fa revisionstore: enable use of proxies for LFS
Summary:
If http_proxy.no is set, we should respect it to avoid sending traffic to it
whenever required.

Reviewed By: wez

Differential Revision: D21383138

fbshipit-source-id: 4c8286aaaf51cbe19402bcf8e4ed03e0d167228b
2020-05-11 10:36:11 -07:00
Xavier Deguillard
2001c3fd69 revisionstore: add translate_lfs_missing to remote store get
Summary:
When Qing implemented all the get method, the translate_lfs_missing function
didn't exist, and I forgot to add them in the right places when landing the
diff that added it. Fix this.

Reviewed By: sfilipco

Differential Revision: D21418043

fbshipit-source-id: baf67b0fe60ed20aeb2c1acd50a209d04dc91c5e
2020-05-11 10:34:01 -07:00
Jun Wu
d8abb30eeb pydag: expose some memnamedag APIs
Summary: Make them reusable in other Python bindings, ex. pymutation.

Reviewed By: sfilipco

Differential Revision: D21486524

fbshipit-source-id: 258455c6a442353c77588fadcb560cb5a170926e
2020-05-11 09:50:01 -07:00
Jun Wu
6835eb4b9d pydag: expose render into string feature for memnamedag
Summary: This makes it easier to visualize a MemNameDag.

Reviewed By: sfilipco

Differential Revision: D21486523

fbshipit-source-id: c65f1fc421bd654dc820faae3c93f2aa57f910d4
2020-05-11 09:50:01 -07:00
Jun Wu
010bcac66a pydag: expose MemNameDag APIs
Summary:
This will allow clients to operate on MemNameDag.

Unfortunately, it isn't that easy to reuse code in `py_class!`. Since they are
just thin wrappers, I live with the copy-paste for now.

Reviewed By: sfilipco

Differential Revision: D21479015

fbshipit-source-id: ddcc7f5c7ede6bb1e9c73d058779805875b09200
2020-05-11 09:50:01 -07:00
Jun Wu
85a60dd9e4 renderdag: provide a method to render MemNameDag directly to a string
Summary: This would be handy to visualize a MemNameDag.

Reviewed By: sfilipco

Differential Revision: D21486522

fbshipit-source-id: c8d7147dc53a1a7c1b8b09ce055493c69cceba2f
2020-05-11 09:50:00 -07:00
Jun Wu
4352be72d3 renderdag: use MemNameDag to simplify tests
Summary:
Use MemNameDag::from_ascii to simplify the tests. This removes the need of:
- using tempdir
- converting between Id and VertexName manually via an IdMap
- depending on drawdag directly

Reviewed By: sfilipco

Differential Revision: D21486519

fbshipit-source-id: f04061d8892f043de40e7e321273acc51e15308a
2020-05-11 09:50:00 -07:00
Jun Wu
60684eb2c5 dag: make ASCII -> MemNameDag a public API
Summary:
It seems handy to construct a Dag just from ASCII. Therefore move it to a
public interface.

Reviewed By: sfilipco

Differential Revision: D21486525

fbshipit-source-id: de7f4b8dfcbcc486798928d4334c655431373276
2020-05-11 09:49:59 -07:00
Jun Wu
a6b7e965f3 dag: remove a TODO comment
Summary: It was done as NameSet.

Reviewed By: sfilipco

Differential Revision: D21479022

fbshipit-source-id: 1c32cabb27d72a6438409ede226104a9ebac6a1d
2020-05-11 09:49:59 -07:00
Jun Wu
4eb9251172 dag: move sort and parent_names to NameDagAlgorithm
Summary:
They are part of the read-only algorithms that are not specific to a certain
type of NameDag.

Reviewed By: sfilipco

Differential Revision: D21479017

fbshipit-source-id: 3fa58071ac43246d3cd45d84384ee93c7385f414
2020-05-11 09:49:59 -07:00
Jun Wu
282e034d30 dag: add MemNameDag
Summary:
Adds an in-memory NameDag so we can construct the DAG and use its algorithms by
just providing parents function and heads.

Reviewed By: sfilipco

Differential Revision: D21479021

fbshipit-source-id: e12d53a97afec77b2307d5efbb280bd506dee0ba
2020-05-11 09:49:58 -07:00
Jun Wu
5cbb99f4eb dag: add MemIdMap
Summary: Adds an in-memory IdMap to be used in an in-memory NameDag.

Reviewed By: sfilipco

Differential Revision: D21479018

fbshipit-source-id: bc702762b059e8659c6ab322f3c39f032e95d5b6
2020-05-11 09:49:58 -07:00
Jun Wu
682e8e96a7 dag: use IdMap traits in NameDag and NameSet
Summary:
This allows them to switch to a different IdMap implementation relatively
easily.

Reviewed By: sfilipco

Differential Revision: D21479023

fbshipit-source-id: 8ecb99cafe2093ec7d14b848ffa08581c5300414
2020-05-11 09:49:57 -07:00
Jun Wu
759f8b35c5 dag: move some IdMap operations to traits
Summary: This will allow different IdMap implementations.

Reviewed By: sfilipco

Differential Revision: D21479016

fbshipit-source-id: 852501896fddcb82624338acd9dceee41150e302
2020-05-11 09:49:57 -07:00
Jun Wu
30163eeb58 dag: update snapshot_map on change
Summary:
`NameDag::add_heads` API changes the internal `dag` state without updating
`snapshot_map`. That will cause queries relying on `snapshot_map` to fail.
Update it so that `snapshot_map` gets updated by `add_heads`.

Reviewed By: sfilipco

Differential Revision: D21479019

fbshipit-source-id: 70528aa4a488cef3dc71bf21dd89e45cfe763794
2020-05-11 09:49:57 -07:00
Jun Wu
f014f86b7a dag: move NameDag algorithms to a trait
Summary:
This makes it easier to add an "in-memory-only" NameDag with all the algorithms
implemented.

Reviewed By: sfilipco

Differential Revision: D21479020

fbshipit-source-id: c1a73e95f3291c273c800650f70db2a7eb0966d7
2020-05-11 09:49:56 -07:00
Mark Thomas
02e35c7039 commitcloud: remove indent from json.dumps args
Summary:
Commit cloud now uses `mercurial.json` rather than `json`.  This doesn't
support the `indent` arg, so remove this from the debug output when
`debugrequests` is enabled.

Reviewed By: farnz

Differential Revision: D21500306

fbshipit-source-id: ae436e9c32d1d2da432eeb93d114115ea80b825b
2020-05-11 09:12:08 -07:00
Mark Thomas
26f6dc8fb3 setup.py: add converter.py to fbsource-thrift blacklist
Reviewed By: farnz

Differential Revision: D21500308

fbshipit-source-id: 663f3d9457a153945f23b8e8bccd16f9c052b2cb
2020-05-11 09:12:07 -07:00
Xavier Deguillard
4e7303efd9 lfs: only upload when LFS blobs are present
Summary: If no LFS blobs needs uploading, then don't try to connect to the LFS server in the first place.

Reviewed By: DurhamG

Differential Revision: D21478243

fbshipit-source-id: 81fa960d899b14f47aadf2fc90485747889041e1
2020-05-08 13:24:21 -07:00
Xavier Deguillard
eb939cff57 remotefilelog: force hg bundle to use bundle version 3 with LFS
Summary:
When LFS is enabled, only bundle3 is supported, so we have to hack the exchange
code a bit in this case to always chose bundle3.

This is copied verbatim from the lfs extension.

Reviewed By: DurhamG

Differential Revision: D21459734

fbshipit-source-id: 41c867cec09e2485ec1e9d91545b61da568f4766
2020-05-07 21:50:00 -07:00
Andrey Tserkus
4334760f27 replaced hg sparse show with hg sparse in hg rage
Summary: This is according to the suggestion in the discussion referenced in the task. Per quark-zju we do need to change `rage` to use `hg sparse` rather than `hg sparse show`.

Reviewed By: quark-zju

Differential Revision: D21422005

fbshipit-source-id: 6dd0e20125635c7fb9b6ea6c9e2b35c8fb517d5d
2020-05-07 14:51:23 -07:00
Andrey Tserkus
ddc889b30a add status field to sparse show output json format
Summary: Added the `status` field to json in order to provide that information to the automated client, as well as match similar output of `hg status`.

Reviewed By: quark-zju

Differential Revision: D21421494

fbshipit-source-id: 2a8b80068f2068b09930b90c43252003421b324e
2020-05-07 14:51:23 -07:00
Andrey Tserkus
2baf56cf50 hg sparse show should not abort on missing profiles
Summary: Fixed that `hg sparse show` failed on missing profiles. Added them to be shown in the output with "!" symbol and in cyan color - which matches output of deleted files in `hg status`.

Reviewed By: quark-zju

Differential Revision: D21419278

fbshipit-source-id: 5581e67774686a5240dceb9aac428fac3b1b73c2
2020-05-07 14:51:22 -07:00
Meyer Jacobs
d49ac73f4c datastore: remove HgIdDataStore ::get_delta and ::get_delta_chain
Summary:
Remove HgIdDataStore::get_delta and all implementations. Remove HgIdDataStore::get_delta_chain from trait, remove all unnecessary implentations, remove all implementations from public Rust API. Leave Python API and introduce "delta-wrapping".

MutableDataPack::get_delta_chain must remain in some form, as it necessary to implement get using a sequence of Deltas. It has been moved to a private inherent impl.

DataPack::get_delta_chain must remain in some form for the same reasons, and in fact both implenetations can probably be merged, but it is also used in repack.rs for the free function repack_datapack. There are a few ways to address this without making DataPack::get_delta_chain part of the public API. I've currently chosen to make the method pub(crate), ie visible only within the revisionstore crate. Alternatively, we could move the repack_datapack function to a method on DataPack, or use a trait in a private module, or some other technique to restrict visibility to only where necessary.

UnionDataStore::get has been modified to call get on it's sub-stores and return the first which matches the given key.

MultiplexDeltaStore has been modified to implement get similarly to UnionDataStore.

Reviewed By: xavierd

Differential Revision: D21356420

fbshipit-source-id: d04e18a0781374a138395d1c21c3687897223d15
2020-05-07 11:04:01 -07:00
Mark Thomas
052e7c3877 check-code: convert to Python 3
Summary:
Update `contrib/check-code.py` to Python 3.

Mostly it was already compatible, however stricter regular expression parsing
revealed a case where one of our tests wasn't working, and as a result lots of
instances of `open(file).read()` existed that this test should have caught.

I have fixed up most of the instances in the code, although there are many
in the test suite that I have ignored for now.

Reviewed By: quark-zju

Differential Revision: D21427212

fbshipit-source-id: 7461a7c391e0ade947f779a2b476ca937fd24a8d
2020-05-07 09:07:50 -07:00
Mark Thomas
49166dbdfd format: apply latest Black formatting
Summary: Reformat using a newer version of Black.

Reviewed By: quark-zju

Differential Revision: D21426337

fbshipit-source-id: 1ac7f6e85a06feec0d41e9509eca09194f421a1d
2020-05-07 09:07:49 -07:00
Mark Thomas
8788654efd i18n: use _x to signal untranslated strings
Summary:
The latest version of Black removes unneccessary parenthesis.  Mercurial's
test-check-code currently uses extra parentheses to signal untranslated strings, so
Black's reformatting breaks this test.

Capitulate to Black by adding a new `_x` translation marker that means "untranslated".

Reviewed By: quark-zju

Differential Revision: D21426335

fbshipit-source-id: a6c26d7c6365c49530a7dee3a5f9ed71ff166835
2020-05-07 09:07:49 -07:00
Jun Wu
ead30c096c phrevset: rewrite pull -r Dxxx into pull -r HASH
Summary: This matches user expectation.

Reviewed By: sfilipco

Differential Revision: D21320629

fbshipit-source-id: 0464b813c01fe31a2ca9473d5b389e563c7a2827
2020-05-06 15:29:57 -07:00
Jun Wu
495bf73f13 phrevset: implement autopull in revset layer
Summary:
Implement autopull so non-automation `hg pull -r Dxxxx`, `hg up Dxxxx` will
pull `Dxxxx` automatically.

Since we now autopull the commits, error messages are removed. The old code
actually causes issues because it will raise at `"D1234" in repo`, which is
a surprise to many code paths, including the revset autopull logic, which
uses `x in repo` to decide whether `x` is unknown.

Note `hg pull -r Dxxxx` is not using the revset layer and needs to be handled
separately. It works for hg servers right now because the server can translate
`Dxxx` to a commit hash. It probably does not work for a Mononoke server.

Reviewed By: sfilipco

Differential Revision: D21320626

fbshipit-source-id: 939abe12e3a9a8ed5ca7ed29bb4f90fb39e7674a
2020-05-06 15:29:57 -07:00
Jun Wu
c08236ccc9 phrevset: make diffid -> node translation infalliable
Summary:
Change the interface to return infallible `Optional[node]` instead of fallible
`List[rev]`.  In the next diff, we're going to use the 'node' information to
implement autopull.

Reviewed By: sfilipco

Differential Revision: D21320628

fbshipit-source-id: 6f7c070faba667cc85313cc78d6149c787ca8593
2020-05-06 15:29:56 -07:00
Jun Wu
cb3b437fe5 phrevset: improve sucessor calculation
Summary:
Currently, phrevset picks the "successor" that has the maximum revision
number. That depends on the assumption that larger revision numbers
are modified last. Howevver, that's not always true with commit cloud sync. For example, in my repo I have D21179514 modified from 63768bf43
to 684612d5d. Phabricator has 63768bf43. Local successor is 684612d5d,
but the revision number of 684612d5d is smaller than 63768bf43:

    quark@devvm1939 ~/hg/edenscm/hgext % hg log -r 'D21179514'
    changeset:   63768bf436d01982a8d42ce97160ac6d9ae2cdad  D21179514
    user:        Jun Wu <quark@fb.com>
    date:        Wed, 22 Apr 2020 09:45:50 -0700
    summary:     [hg] commitcloud: log metalog root during update references

    quark@devvm1939 ~/hg/edenscm/hgext % lhg log -r 'D21179514'
    changeset:   684612d5d606b01c224889f2b3f87aff7b93db49  D21179514  (@)
    user:        Jun Wu <quark@fb.com>
    date:        Wed, 22 Apr 2020 10:10:37 -0700
    summary:     [hg] commitcloud: log metalog root during update references

    quark@devvm1939 ~/hg/edenscm/hgext % lhg log -r 'successors(63768bf436d0198
    2a8d42ce97160ac6d9ae2cdad)' -T '{node} {rev}\n'
    684612d5d606b01c224889f2b3f87aff7b93db49 76718
    63768bf436d01982a8d42ce97160ac6d9ae2cdad 95363

Improve it by actually prefer selecting a non-obsoleted successor.

Reviewed By: sfilipco

Differential Revision: D21267552

fbshipit-source-id: d43d72a7c273c55af70bb41ad967fff0c78a452a
2020-05-06 15:29:56 -07:00
Jun Wu
e1179f695e autopull: pull names in batch
Summary: This is more efficient (if pullattempts have high chance to succeed).

Reviewed By: sfilipco

Differential Revision: D21320627

fbshipit-source-id: a2166f5a59f98c7d705c806b9d152ceb9981f3be
2020-05-06 15:29:55 -07:00
Jun Wu
e89e16d35c autopull: make autopull function declarative
Summary:
Make it so that the autopull functions just describe what to do (using the
`pullattempt` struct) instead of having the side effect directly. This will be
useful in multiple cases:
- The actual autopull logic becomes easier to implement.
- The revset autopull layer can merge `pullattempt`s to fetch things in one go.
- The `pull -r` logic can reuse the `pullattempt`s to translate what to pull
  (ex. from `D1234` to a commit hash).

This has subtle changes that multiple "remote"s are no longer properly
supported.  That is probably fine in our production use-cases but we might
want to revisit if we want to support remotes "properly".  Currently, this
greatly simplifies things due to the fact that "infinitepush" or
"infinitepushbookmark" have to be used in certain cases.

Reviewed By: sfilipco

Differential Revision: D21320633

fbshipit-source-id: e38b68abf69a34a97431685aa7ab0d2fe022fda8
2020-05-06 15:29:55 -07:00
Jun Wu
1ee6f1f91a registrar: add autopullpredicate
Summary: Add a way for extensions to register how to auto pull unknown names.

Reviewed By: sfilipco

Differential Revision: D21320630

fbshipit-source-id: d20e11cff83b8a7e15a5085b0508a3e5bef305c3
2020-05-06 15:29:55 -07:00
Jun Wu
a5c1b003a3 autopull: move to a module
Summary:
We're going to make autopull more complicated. Move it to a separate module as
it is not directly related to revset.

Reviewed By: sfilipco

Differential Revision: D21320631

fbshipit-source-id: fe60bc53ebf1c75f8bf66156805cbe2801fe6532
2020-05-06 15:29:54 -07:00
Jun Wu
a71893676d autopull: analyze unknown names before revset optimization
Summary:
The revset optimization makes unknown names harder to extract.  For example,
`(or (list "a" "b" "c"))` will be optimized to `(_list "a\0b\0c")` and it
becomes harder to extract `"a"`, `"b"`, and `"c"`.

Move the unknown name extraction logic to before the optimization step to solve
it.

Reviewed By: sfilipco

Differential Revision: D21320632

fbshipit-source-id: 3a25f1cf4aab0449be6952113d622f29b1c0b631
2020-05-06 15:29:54 -07:00
Jun Wu
44c8c7a9e3 transaction: write hgrc to metalog
Summary:
This allows us to understand what config is used during a transaction.
For example, is `selectivepull` enabled during a `pull`?

Reviewed By: DurhamG

Differential Revision: D21222146

fbshipit-source-id: a8c82f2b02e9657885947a706f728e28b1bfc1e2
2020-05-06 12:15:36 -07:00
Durham Goode
1fdc23ddf6 progress: invalidate engine on process fork
Summary:
We're seeing deadlocks where if the process forks (like in a update
worker) while a background python thread is holding the progress lock, it can
cause a deadlock in the forked process if the thread ever tries to access the
progress bar.

To fix it, let's invalidate the engine if the process forks.

Reviewed By: xavierd

Differential Revision: D21415152

fbshipit-source-id: 75607dd2c1ed122b3a9df68d359ba9dcdde78a77
2020-05-06 12:01:39 -07:00
Durham Goode
aa99e36327 configs: convert (www|www-merge)_overrides.rc
Summary: Converts (www|www-merge)_overrides.rs to our dynamic config generator

Reviewed By: quark-zju

Differential Revision: D21412128

fbshipit-source-id: d248d3b756e4f59038cb33335ba4a023fe335b2c
2020-05-06 09:03:18 -07:00
Durham Goode
939ff6c956 configs: move repo names to a enum
Summary:
A number of repo names are used quite frequently. Let's use an enum to
prevent typos and make things cleaner.

Reviewed By: quark-zju

Differential Revision: D21365036

fbshipit-source-id: 1d3d681443df181e9076f5ee87029ae61124a486
2020-05-06 09:03:17 -07:00
Mohan Zhang
2ef3e20e4d Run auto cargo locally
Summary: Since thirdpart depedency change on D21341319

Reviewed By: jsgf, wqfish

Differential Revision: D21417890

fbshipit-source-id: 3cc6bafa23512c7ae489513216bcafa46e7a744f
2020-05-05 20:59:02 -07:00
Zeyi (Rice) Fan
952069397c fix get blob local
Summary: This bug got in while iterating the original Diff. It should only be returning empty when the blob does not exist locally.

Reviewed By: xavierd

Differential Revision: D21417659

fbshipit-source-id: 676e22313ab4a024af5341d8c99797fc062bd293
2020-05-05 20:21:21 -07:00
Durham Goode
022196d3b7 configs: convert instagram-server_overrides.rc
Summary: Converts instagram-server_overrides.rc to our dynamic config generator

Reviewed By: quark-zju

Differential Revision: D21339855

fbshipit-source-id: 1cd4709c1f239322de3ccf516c4ebef519ea41ac
2020-05-05 18:19:11 -07:00
Durham Goode
726e3f6a73 configs: convert configerator_overrides.rc
Summary: Converts configerator_overrides.rc to our dynamic config generator

Reviewed By: quark-zju

Differential Revision: D21339856

fbshipit-source-id: 84bd17d04db1a2e6070eb5e75bda668a596822d4
2020-05-05 18:19:11 -07:00
Durham Goode
97d84e3b5d configs: move hgrc.dynamic to always be in the shared repo
Summary:
Instead of trying to maintain two hgrc.dynamic's for shared repositories,
let's just always use the one in the shared repo. In the long term we may be
able to get rid of the working-copy-specific hgrc entirely.

This does remove the ability to dynamically configure individual working copies.
That could be useful in cases where we have both eden and non-eden pointed at
the same repository, but I don't think we rely on this at the moment.

Reviewed By: quark-zju

Differential Revision: D21333564

fbshipit-source-id: c1fb86af183ec6dc5d973cf45d71419bda5514fb
2020-05-05 18:19:10 -07:00
Durham Goode
c326c5fc6b configs: log dynamic config mismatches to scuba
Summary: Let's log the mismatches to scuba so we can track them down.

Reviewed By: quark-zju

Differential Revision: D21313255

fbshipit-source-id: ee79c9504a80ebe5b21849c0eae5993b65eaff28
2020-05-05 18:19:10 -07:00
Durham Goode
b9223b9db6 sampling: move ui.log sampling logic to core
Summary:
In a future diff we want to log information about configuration
mismatches. In order to do that, we need to be able to call ui.log before
extensions are setup. Let's move the ui.log sampling logic into core so it can
be called before extension setup.

Reviewed By: quark-zju

Differential Revision: D21313257

fbshipit-source-id: fe1c0f572720c17e7398f2a4fa7082ef8fb59536
2020-05-05 18:19:09 -07:00
Durham Goode
ece8408993 configs: migrate devserver_no_sandcastle_overrides.rc
Summary:
Moves the conditional configuration from
devserver_no_sandcastle_overrides.rc into our dynamic config fb rules.

Reviewed By: quark-zju

Differential Revision: D21310916

fbshipit-source-id: 116711afbfa9fb9f134bbe55b7b8b302b39dab36
2020-05-05 18:19:09 -07:00
Durham Goode
e67d609e1d configs: validate dynamic configs
Summary:
Adds python logic for validating the dynamic configs. Any dynamic
configs that don't match the given list of rc files will be reported and removed

Reviewed By: quark-zju

Differential Revision: D21310919

fbshipit-source-id: 07f584bba990f1b01347dfbc285e3ca814fe5c5a
2020-05-05 18:19:09 -07:00
Durham Goode
6e7f85b949 config: load .hg/hgrc.dynamic
Summary:
Adds .hg/hgrc.dynamic to the default load path, before .hg/hgrc though,
so it can be override.

Reviewed By: quark-zju

Differential Revision: D21310921

fbshipit-source-id: 288a2a2ba671943a9f8532489c29e819f9d891e1
2020-05-05 18:19:08 -07:00
Durham Goode
dc90e2ca04 configs: add domain, platform, and improve dynamicconfigs
Summary:
Adds dynamic config conditionals for domain, platform, and adds a few
useful helper functions.

Reviewed By: quark-zju

Differential Revision: D21310920

fbshipit-source-id: 58f35e52d6d7a4edae2b3aefff533ef2c021aa57
2020-05-05 18:19:08 -07:00
Durham Goode
8744b81151 git: update git dependency to 0.13.5 to match internal version
Summary:
Our internal git dependency got upgraded, so we need to upgrade our
Cargo.toml version.  Unfortunately this doesn't seem to have any test coverage?

Reviewed By: singhsrb

Differential Revision: D21410241

fbshipit-source-id: 64fe7f39a9c93aa5d97ce095ee1641c1cc6ed365
2020-05-05 15:35:12 -07:00
Durham Goode
1cd598279e backout D21348756 about printing progress of downloads
Summary:
The formatter is broken, it prints to stdout which breaks json output,
and it's questionable whether we want a new line printed to the user for every
200k files downloaded.

Reviewed By: quark-zju

Differential Revision: D21409529

fbshipit-source-id: 2a5d94f8fcc62dbe25f0aae5453e4664c49fdcb2
2020-05-05 14:33:22 -07:00
Chad Austin
8b5c1e66b7 remove stats memory command
Summary:
`eden stats memory` was never useful because it shows system
statistics which you can get better from `top`, `htop`, or `atop`.

Reviewed By: genevievehelsel

Differential Revision: D21392737

fbshipit-source-id: 010021b8a97bd8ba8ac289d906acc3c3ecd10768
2020-05-05 12:09:11 -07:00
Zeyi (Rice) Fan
3baa8cc9b4 check if the blob fetching is present locally
Summary:
Talked with xavierd last week and we can use LocalStore's `get_missing` to determine if a blob is present locally. In this way we can prevent the backingstore crate from accidentally asking EdenAPI for a blob, so better control at EdenFS level.

With this change, we can use this function at the time where a blob import request is created with confidence that this should be short cheap call.

This diff should not change any behavior or performance.

Reviewed By: xavierd

Differential Revision: D21391959

fbshipit-source-id: fd31687da1e048262cb4eae2974cab6d8915a76d
2020-05-05 11:14:40 -07:00
Durham Goode
1da0256921 discovery: use the latest commits for discovery instead of random ones
Summary:
When doing discovery, for repos with long master lines and infrequent
branches, picking a random set of sample commits could result in not picking the
master, and therefore having to do very long commit graph traversals to check
ancestors against the other samples.

To prevent this, let's pick the N most recent commits instead of a random
sample. This should generally get the master commit into our sample.

Reviewed By: quark-zju

Differential Revision: D21394302

fbshipit-source-id: f4b8110cd126b90553ec624e48cab0b590e124fb
2020-05-05 09:56:26 -07:00
Shannon Zhu
83dc7b9129 Custom pyre upgrade for eden
Summary:
Addressing issues simpkins brought up on D21207287 when we upgraded and introduced some pyre bugs.

Temporarily upgrading just this project, once we resolve some sandcastle capacity issues we'll release this via another global upgrade in fbcode.

Reviewed By: simpkins

Differential Revision: D21316793

fbshipit-source-id: f0c79f53d97f7182e7d8fe6e081c58ef53ce0c9a
2020-05-04 21:19:20 -07:00
Zeyi (Rice) Fan
da28f5a5b1 revisionstore: create directory with group share permission in correct places
Summary: When we create directory at certain places, we want these directories to be shared between different users on the same machine. This Diff uses the previously added `create_shared_dir` function to create these directories.

Reviewed By: xavierd

Differential Revision: D21322776

fbshipit-source-id: 5af01d0fc79c8d2bc5f946c105d74935ff92daf2
2020-05-04 19:21:33 -07:00
Shannon Zhu
0b93429dc1 Convert type check targets in eden to use configuration
Summary:
D21316793 is blocked from landing because there are a few targets in eden that are running pyre via buck targets integration.

We can't do custom version overrides for projects that are using a mix of local configurations and buck integration, because buck doesn't provide an interface for setting the equivalent pyre version override.

We're moving away from buck targets integration for pyre across the board, and I've run a codemod over the project to clean up all of the buck typing integration (including some residual mypy) as well as updated type ignores / fixmes accordingly.

Let me know if you have any concerns; upon skimming it looks like most changes are either converting `type: ignore`s into fixmes, or removing `type: ignores`.

Reviewed By: dkgi

Differential Revision: D21343093

fbshipit-source-id: 5ee1436377eb526c0a679fb821c42e07cbca52a5
2020-05-02 21:16:55 -07:00
Jun Wu
6438f28e99 color: detect ConEmu and limit colors to 16
Summary:
ConEmu tries to normalize 256 colors to 16 colors but its normalization logic
is buggy. For example, color196 gets normalized to green instead of red. See
the attached picture of ConEmu and its debug real console.

{F235735030}

Reviewed By: markbt, ikostia

Differential Revision: D21311443

fbshipit-source-id: cb6db07d6b10a7365e33f4aa8f5f3f61f90c8e69
2020-05-01 14:51:51 -07:00
Jun Wu
5b881f086f pyzstore: further reduce cpython_ext::Bytes usage
Summary: This avoids data copies.

Reviewed By: DurhamG

Differential Revision: D21213075

fbshipit-source-id: 9575173f163d71543affabd9861931c11086f40a
2020-05-01 14:24:52 -07:00
Jun Wu
73ff6559e6 zstore: add simple caching
Summary: Add simple caching so zstore can avoid some zstd calculation.

Reviewed By: DurhamG

Differential Revision: D21213076

fbshipit-source-id: 5e3152949cf4e6d6193c3ef3401f24e2efac5620
2020-05-01 14:24:52 -07:00
Durham Goode
3ac2be361a configs: move fbrules to a Facebook only part of the crate
Summary:
We'll be adding a bunch of Facebook specific configuration and values
here. Let's move it to someplace not open source.

Reviewed By: quark-zju

Differential Revision: D21241038

fbshipit-source-id: 2ac9cdce40b1b46f15f171d9d1f6b6692dcd29bf
2020-05-01 13:17:21 -07:00
Durham Goode
b1a2785a19 configparser: add ensure_location_supersets function
Summary:
Implements an ensure_location_supersets function who's goal is to
verify that a given config location specifies the exact same configs as a given
set of other locations. Any inconsistencies are removed from the config and
reported to the caller.

This will be used to ensure our dynamic configs match our existing rc file
configs exactly, before we delete the file configs.

Reviewed By: quark-zju

Differential Revision: D21240837

fbshipit-source-id: e2c8ec054a3696d2cf02e65c212ad886c5117253
2020-05-01 13:17:21 -07:00
Mark Thomas
ed49d36d41 templatekw: parents template should not return null p2
Summary:
The `parents` template currently returns "meaningfulparents".  This sometimes
returns the null revision as the second parent, making templates think this is a
merge commit when it is not.  Make sure we filter this out.

Reviewed By: quark-zju

Differential Revision: D21347776

fbshipit-source-id: af83fd5cff381850ac39d97b5b2f4c77033fe2fb
2020-05-01 12:49:37 -07:00
Jason White
d5b2fb798e Fix outdated Cargo.toml files
Summary: `cargo autocargo` should normally produce no changes on `master`. The features of the `log` crate was updated in D21303891 without re-running autocargo. This fixes it.

Reviewed By: dtolnay

Differential Revision: D21349799

fbshipit-source-id: ce487bc5989e179673297350249593103b4d34dd
2020-05-01 10:29:33 -07:00
Stanislau Hlebik
bec619bc5e remotefilelog: print the progress when downloading files
Summary:
Now we download files in 200K chunks, and it might be confusing - it's unclear
whether hg is making any progress or not.
This diff makes it clearer.

Note I'm not printing progress before first fetch to avoid breaking the tests

Reviewed By: farnz

Differential Revision: D21348756

fbshipit-source-id: 05e5169114adf2b99a74b37d933755a644214a42
2020-05-01 07:56:26 -07:00
Kostia Balytskyi
b17df254d7 infinitepush: do not record crossbackendsync bundles
Summary: Mercurial Infinitepush normally records received bundles into the `forwardfillerqueue`, which is later tailed by the commit cloud `forwardfiller` in order be replayed onto Mononoke. Now I am adding a reverse filler, which means that we will have two such queues and sync in two directions. Therefore, in order to avoid infinite loops we need to distinguish cross-backend bundle replay from genuine pushes. I propose to use `crossbackendsync` bundle2 param to indicate that no recording is needed.

Reviewed By: krallin

Differential Revision: D21255446

fbshipit-source-id: 70f6efe1331bd3c7fd3aca61d486d350d93086dc
2020-05-01 06:46:50 -07:00
Stanislau Hlebik
03023aa095 commit cloud: fix hg cloud --help
Summary:
Previously we weren't showing help at all when running "hg cloud --help". This
diff should fix it

Reviewed By: ikostia

Differential Revision: D21347825

fbshipit-source-id: 1d9d11e2f9fe18a03b5d2cd8bd316fe9a218347c
2020-05-01 06:08:14 -07:00
Adam Kramer
05f7469a84 Make graph renderer link command-clickable
Summary:
In vs-code if you have a well-formed url you can command-click it
to open it, e.g., when you see it in your terminal. But this URL is not
well-formed because it's missing the protocol. So let's add it.

Reviewed By: quark-zju

Differential Revision: D21336742

fbshipit-source-id: dd2de2d5177d3a2542c4a22f0099f28b97c79d06
2020-04-30 23:59:36 -07:00
Kostia Balytskyi
9b914911f6 infinitepush: do not read the whole file to check size
Summary: If the bundle file has 1G in size, we probably don't want to waste 1G of memory just to see that it is too big.

Reviewed By: markbt

Differential Revision: D21177359

fbshipit-source-id: 026b5ab40e6dbddba3d7142a8e34256d127bf82c
2020-04-30 13:00:22 -07:00
Kostia Balytskyi
e016ea16a2 commit cloud forwardfiller: add a test to exercise the flow
Summary:
Building on the previous two commits, this adds a test which performs the following steps:
- does an infintiepush push to a Mercurial server
- looks into the `forwardfillerqueue`
- runs commitcloud forwardfiller's `fill-one` to replay the bundle to Mononoke
- verifies that this action causes the commit to appear in Mononoke

As this test uses `getdb.sh` from Mercurial test suite, it needs to be whitelisted from network blackholing (Note: we whitelist mononoke tests, which run with `--mysql` automatically, but this one is different, so we need to add it manually. See bottom diff of the stack for why we don't use `--mysql` and ephemeral shards here).

Reviewed By: krallin

Differential Revision: D21325071

fbshipit-source-id: d4d6cbdb10a2bcf955ee371278bf2bbbd5f5122c
2020-04-30 13:00:22 -07:00
Kostia Balytskyi
5041433ad6 tests: make hgsql and infinitepush libraries usable from Mononoke
Reviewed By: krallin

Differential Revision: D21303956

fbshipit-source-id: 61c3eaf5235f55636fd5b5c8d9ac899f39691d9d
2020-04-30 13:00:22 -07:00
Mark Thomas
ff08b99c08 remotenames: hide unwanted commits after clone with selectivepull
Summary:
Cloning a repository with selectivepull enabled temporarily disables
selectivepull for the duration of the initial pull so that we can get a
streaming clone.

Once this is done, hide all of the commits in the repository by clearing the
visible heads.  Selective pull will then populate the remote bookmarks with the
public heads that we do want.

Reviewed By: quark-zju

Differential Revision: D21301037

fbshipit-source-id: 565ae50439ed5405ce940a5675caeba912fe7083
2020-04-30 05:44:04 -07:00
Mark Thomas
ac62d5b52c commitcloud: allow omission of remote bookmarks
Summary: If a scratch remotebookmark points to a draft commit that is not available locally (i.e., has been hidden on a different machine), then don't pull it into the local repository.  Instead, just omit the remote bookmark.

Reviewed By: quark-zju

Differential Revision: D21287886

fbshipit-source-id: 84e7c6b52250709f7c88b07fccdbb61e044370c8
2020-04-30 05:44:03 -07:00
Mark Thomas
e025e68e33 commitcloud: allow sync to delete remote bookmarks
Summary:
Rewrite `_processremotebookmarks` to allow sync operations to delete
remote bookmarks.

Reviewed By: quark-zju

Differential Revision: D21283026

fbshipit-source-id: 7ded1d1cfb725f4b60ad2d55cf7d102c91113d6a
2020-04-30 05:44:03 -07:00
Mark Thomas
a4648a7805 remotenames: don't remove selectivepull subscriptions on push
Summary:
Selective pull subscripts are lost during a push.  This is because
`remotenames.expush` calls `selectivepullbookmarknames` with the
remote, not the remote name.

`remotenames.exclone` does the same, but in that case there is
no need for the remote name as the destination can't have any
subscriptions other than the default set.

Reviewed By: quark-zju

Differential Revision: D21283029

fbshipit-source-id: 52c2e7e301b8e95b4a252cbfe2ad9de168e81044
2020-04-30 05:44:02 -07:00
Mark Thomas
da9e7b2264 commitcloud: add test demonstrating bugs in remotebookmarkssync
Summary:
Commit cloud remote bookmarks sync has several edge cases that don't work correctly.

This test demonstrates some that we will fix.

Reviewed By: quark-zju

Differential Revision: D21283028

fbshipit-source-id: 4e746476a0f3bf0ca7d7088f510451632a2ee075
2020-04-30 05:44:02 -07:00
Zeyi (Rice) Fan
8830ed55df util: not try to create the directory when it already exists
Summary: Fix permission issues we are seeing with the latest Mercurial release.

Reviewed By: xavierd

Differential Revision: D21294499

fbshipit-source-id: bcfb13dd005258b2e3b74fa281dbd8df36133ef6
2020-04-28 20:33:59 -07:00
Carolyn Busch
4eeab3b81b Update cpython to 0.5
Summary:
D21270958 updated the cpython, python27-sys, and python3-sys crates to 0.5. Update
the Mercurial cargo dependencies to match.

Reviewed By: xavierd

Differential Revision: D21281875

fbshipit-source-id: ccad68749a25d11240351b5faeef27cb9c693456
2020-04-28 11:47:41 -07:00
Jun Wu
51dde1bcef interactiveui: do not import termios on Windows
Summary: `termios` is not avialable on Windows. Do not import it.

Reviewed By: DurhamG

Differential Revision: D21258999

fbshipit-source-id: f4390b69fe9abceea8b1959e7506c1558778f980
2020-04-28 10:26:21 -07:00
Jun Wu
d479053954 metalog: support exporting to a git repo
Summary:
I wanted to figure out "who added this visible head", "what is the difference
between this metalog root and that root". Those are actually source control
operations (blame, diff). Add a git export feature so we can export metalog
to git to run those queries.

Choosing git here as we don't have native Rust utilities to create a more
efficient hg repo yet.

Ideally we can also make hg operate on a metalog directory as a "metalogrepo"
directly. However that seems to be quite difficult right now due to poor
abstractions.

Reviewed By: DurhamG

Differential Revision: D21213073

fbshipit-source-id: 4cc0331fbad6e1586907c0a66c18bcc25608ea49
2020-04-27 20:25:25 -07:00
Jun Wu
dc8773033e phrevset: use unfiltered repo for lookups
Summary:
This would avoid issues where the Phabricator commit hash points
to a filtered commit locally. There are 2 user complaints already.

Reviewed By: DurhamG

Differential Revision: D21180833

fbshipit-source-id: 7374e236bcf5e3f3e62bae59fa53604869e22c6f
2020-04-27 20:04:18 -07:00
Jun Wu
3df5fcf779 pymetalog: add handy APIs for debugshell
Summary:
This makes metalog easier to use in debugshell context. For example, to
investigate the "bookmarks" in the past, the code gets simplified from:

  roots = b.metalog.metalog.listroots(repo.svfs.join('metalog'))
  past_ml = b.metalog.metalog(repo.svfs.join('metalog'), root[10])
  past_ml.get("bookmarks")

to:

  roots = ml.roots()
  past_ml = ml.checkout(roots[10])
  past_ml.get("bookmarks")

Reviewed By: DurhamG

Differential Revision: D21162568

fbshipit-source-id: 7cc5581afe596a3d2696311a36ac11caa718428a
2020-04-27 20:04:18 -07:00
Jun Wu
838cc44624 commitcloud: log metalog root during update references
Summary: This uploads more details that might be useful for debugging.

Reviewed By: DurhamG

Differential Revision: D21179514

fbshipit-source-id: ba24395fc4fd153c3ceb4957f822aab70821e6ef
2020-04-27 19:50:58 -07:00
Jun Wu
a0207c4542 metalog: expose root id API
Summary: This allows the Python world to obtain the root ID for logging purpose.

Reviewed By: DurhamG

Differential Revision: D21179513

fbshipit-source-id: 3f289c06d3d470ff492de39fa985203b3facbf00
2020-04-27 19:50:58 -07:00
Jun Wu
7a60f8ac27 commitcloud: log update reference calls
Summary:
This would hopefully give us more insights about when and what host uploads
10k+ remote bookmarks.

Reviewed By: DurhamG

Differential Revision: D21179515

fbshipit-source-id: 3e5c5559e2e739268add05e40f71bea08c29662f
2020-04-27 19:50:57 -07:00
Jun Wu
d8bdae0449 indexedlog: remove chown feature
Summary:
We removed the feature in D20704618 and it does not cause complaints.
Let's remove the code supporting the chown feature.

Reviewed By: DurhamG

Differential Revision: D21170307

fbshipit-source-id: c845016219e8c681930bb1780b94e6d31ca99730
2020-04-27 15:47:59 -07:00
Xavier Deguillard
86965b2f80 revisionstore: query store before fetching
Summary:
While the change looks fairly mechanical and simple, the why is a bit tricky.
If we follow the calls of `ContentStore::get`, we can see that it first goes
through every on-disk stores, and then switches to the remote ones, thanks to
that, when we reach the remote stores there is no reason to believe that the
local store attached to them contains the data we're fetching. Thus the
code used to always prefetch the data, before reading from the store what was
just written.

While this is true for regular stores (packstore, indexedlog, etc), it starts
to break down for the LFS store. The reason being that the LFS store is
internally represented as 2 halves: a pointer store, and a blob store.  It is
entirely possible that the LFS store contains a pointer, but not the actual
blob. In that case, the `get` executed on the LFS store will simply return
`Ok(None)` as the blob just isn't present, which will cause us to fallback to
the remote stores. Since we do have the pointer locally, we shouldn't try to
refetch it from the remote store, and thus why a `get_missing` needs to be run
before fetching from the remote store.

As I was writing this, I realized that all of this subtle behavior is basically
the same between all the stores, but unfortunately, doing a:
  impl<T: RemoteDataStore + ?Sized> HgIdDataStore for T
Conflicts with the one for `Deref<Target=HgIdDataStore>`. Macros could be used
to avoid code duplication, but for now let's not stray into them.

Reviewed By: DurhamG

Differential Revision: D21132667

fbshipit-source-id: 67a2544c36c2979dbac70dac5c1d055845509746
2020-04-27 12:53:11 -07:00
Qing Dong
b4edb7ff7f revisionstore: implement the get() functions on the various LocalDataStore interface
Summary: implement the get() functions on the various LocalDataStore interface implementations

Reviewed By: quark-zju

Differential Revision: D21220723

fbshipit-source-id: d69e805c40fb47db6970934e53a7cc8ac057b62b
2020-04-27 12:35:24 -07:00
Jun Wu
90c062ca08 debugshell: accept file name
Summary:
This makes debugshell easier to use. Especially when the script wants to access
`__file__`.

Reviewed By: DurhamG

Differential Revision: D21169556

fbshipit-source-id: 88b3ebb1ca9a39fe26bc7cc5ea8e250c28fa0d6f
2020-04-27 10:58:56 -07:00
Jun Wu
af1ad137bf remotenames: normalize infinitepush/ to default/
Summary:
Similar to part of D20804854, normalize infinitepush/ to default/ in
remotenames code paths.

This might not be strictly necessary, but we never want to write out
infinitepush/ remote bookmarks and we have seen that OnDemand writes out
infinitepush/ remote bookmarks (which got synced to commit cloud and caused
user complaints) recently.

Reviewed By: DurhamG

Differential Revision: D21233658

fbshipit-source-id: cf8c12ac40348c7b475a7f3d5d5223775491650e
2020-04-27 10:37:27 -07:00
Saurabh Singh
79f5217ccc test-bisect-t: use debugshell instead of debugpython
Summary:
The python script run using `debugpython` within the test was importing
Mercurial internal modules which causes failures on some platforms like
Windows. Instead, lets use the `debugshell` command which already imports the
common objects like `repo` correctly.

Reviewed By: xavierd

Differential Revision: D21251818

fbshipit-source-id: db1b9e92df99b736a28bc9e89fb08ae77d6e82fc
2020-04-27 07:55:30 -07:00
Xavier Deguillard
39d49b694a revisionstore: remove memcache dependency on @mode/mac
Summary:
Memcache isn't available for Mac, but we can build the revisionstore with Buck
on macOS when building EdenFS. Let's only use Memcache for fbcode builds on
Linux for now.

Reviewed By: chadaustin

Differential Revision: D21235247

fbshipit-source-id: 5943ad84f6442e4dabbd2a44ae105457f5bb9d21
2020-04-24 17:29:36 -07:00
Zeyi (Rice) Fan
3374b99f28 util: ensure correct permission is set when creating directories
Summary:
When creates directories sometime we want to make sure other users within the same group have the write access to it to enable data sharing. Previously we rely on setting umask for the entire process to make sure the newly created directories have the correct permission bit. This is kind fragile and error-prone when running in a multi-thread environment.

This diff introduces an internal function `create_dir_with_mode` to create directory with specified permission mode. It first creates a temporary directory within the parent of the directory being created, setting up the correct permission bit, then attempts to rename the temporary directory to the desired name. This ensures that we never leave a directory without the correct permission in the place we need and without changing umask for the process.

Reviewed By: xavierd

Differential Revision: D21188903

fbshipit-source-id: 381bff7d3aaca097b9d50150e86cbbf70a90a0a5
2020-04-24 17:17:05 -07:00
Durham Goode
344837cca4 filesystem: python bindings for new rust pending changes
Summary:
Adds initial python bindings for the rust pending changes. This is not
ready for production usage yet, but having the bindings let's me test changes
more easily until we're ready for automated tests.

Reviewed By: xavierd

Differential Revision: D20546896

fbshipit-source-id: c0ad7155e5068f45bf9c987030746e6c5f35c26a
2020-04-24 13:58:53 -07:00
Durham Goode
092d350800 filesystem: add treestate walking logic
Summary:
The second phase of pending changes is to iterate over the treestate
and figure out what files were not seen in the filesystem walk. This diff
implements that.

Reviewed By: xavierd

Differential Revision: D20546899

fbshipit-source-id: 3523fbc7e31ef0ed09c4937c72264b64e2a3db5b
2020-04-24 13:58:53 -07:00
Durham Goode
73a45b695b filesystem: add filesystem walking to PendingChanges
Summary:
The first phase of pending changes is inspecting the filesystem for
changes. This diff adds that logic.

Reviewed By: xavierd

Differential Revision: D20546909

fbshipit-source-id: 1c2c0fa7f700dbff4acfce4d5271b4472a13571f
2020-04-24 13:58:53 -07:00
Jun Wu
3de6513f0e revset: make autopull commit pull seletivepull bookmarks
Summary: This ensures lagged master issue does not happen by pulling a single commit.

Reviewed By: DurhamG

Differential Revision: D20845384

fbshipit-source-id: 3ba16c07fe264fe2b6aecd494bbb832af7b390a0
2020-04-24 11:16:23 -07:00
Jun Wu
3514ac0de8 remotenames: autopullprefix -> autopullpattern
Summary:
Patterns are more powerful than prefixes. Some full revset names are
obviously not valid remote name - for example, `remote/master :: .`.
They cannot be ruled out using prefixes but can using patterns.

As we're here, add some caching for the regex compiler.

Reviewed By: DurhamG

Differential Revision: D20831015

fbshipit-source-id: af8c4eed4a3153fd71480b8972c55feed4641392
2020-04-24 11:16:22 -07:00
Jun Wu
368d59e436 revset: attempt to pull the revset expression as a single name
Summary:
For names like `a-b-c`, it can be parsed in multiple ways:

- `"a-b-c"`
- `"a-b" - "c"`
- `"a" - "b-c"`

Mercurial uses `repo.lookup` in the parser to accept names like `"a-b-c"`.
Do it for the whole revset expression too.

But do not do it for every lookup (ex. testing `"a-b"` or `"b-c"` in the above
case), because that can be exceedingly expensive.

Reviewed By: DurhamG

Differential Revision: D20831014

fbshipit-source-id: f507e04ce24c953b096ccd836c356f50f11d2006
2020-04-24 11:16:22 -07:00
Jun Wu
47f73cc5e8 revset: calculate autopull names before evaluating revset
Summary:
Add a function to figure out unknown symbols of a revset AST without executing
the revset, then try to autopull unknown symbols.

This has pros and cons comparing to the runtime (stringset) approach.

Pros:
- The fullreposet restriction is lifted.
- We can have some ideas about whether the symbols are "probably" locally
  known. If everything is locally known, then we can skip all remote lookups
  (see the next diff for details).
- We can fetch multiple symbols in batch if we want. Although it's difficult
  to do so right now due to different paths (paths.default, infinitepush,
  infinitepushbookmark, etc). Revisit once the paths are unified.

Cons:
- Functions and argument types must be statically known. Might miss
  some functions added by some extensions.

Reviewed By: DurhamG

Differential Revision: D20909535

fbshipit-source-id: a567ca0aa80aa7f2930dd75637ef3ff8cef1bdef
2020-04-24 11:16:22 -07:00
Jun Wu
e26f2eeacb tests: add a test about autopull on remote names with dashes
Summary:
Dashes are also revset operators. Add a test so we can verify if we can also
autopull those special names.

Reviewed By: DurhamG

Differential Revision: D20831016

fbshipit-source-id: 97e772053dae873ebaa529ac9eb84ea9d04f0f63
2020-04-24 11:16:22 -07:00
Jun Wu
a2d9f6604e infinitepush: disable old autopull if the new autopull is enabled
Summary:
Similar to the previous diff, let's use the new autopull logic, which
uses the tech-debt free repo.pull API.

In rare cases this can cause more pulls due to the path selection (ex. use
"infinitepush" for "remote/scratch/x" but "default" for "remote/stable/x").
With Mononoke serving repos, we might be able to remote the special paths,
and just use "default" for all cases.

If it goes well, we can then delete the old code.

Reviewed By: DurhamG

Differential Revision: D20804854

fbshipit-source-id: 75e68582a29b613c8626a119b85064e3c0ba9462
2020-04-24 11:16:21 -07:00
Jun Wu
d90be19909 remotenames: disable old autopull if the new autopull is enabled
Summary:
The new auto pull logic can replace the one in remotenames. It it goes well, we
can then remove the code in remotenames doing the auto pull.

Reviewed By: sfilipco

Differential Revision: D20804853

fbshipit-source-id: c87b6b382f4cce3b306648b305a7b6bbaec05df1
2020-04-24 11:16:21 -07:00
Jun Wu
614b349628 revset: implement auto pull for hoisted remote bookmarks
Summary:
Attempt to auto pull bookmark names without the `remote/` or `default/` prefix
if hoist is set. This would hopefully be enough to allow us to enable
selectivepull globally without breaking existing users.

Reviewed By: sfilipco

Differential Revision: D20804856

fbshipit-source-id: 72601ac5e3545523cbfd7087d1fc822ef33c2f2e
2020-04-24 11:16:21 -07:00
Jun Wu
880b33b0b7 revset: implement auto pull for commit hashes using repo.pull API
Summary: This might remove less clean logic in infinitepush.

Reviewed By: sfilipco

Differential Revision: D20804855

fbshipit-source-id: da5ed24dd912b5f86839e671a9d6b0e9356b7c86
2020-04-24 11:16:20 -07:00
Xavier Deguillard
19bfd35298 revisionstore: multiplex stores should return a path on flush
Summary:
On repack, when the Rust stores are in use, the repack code relies on
ContentStore::commit_pending to return the path of a newly created packfile, so
it won't delete it when going over the repacked ones. When LFS is enabled, both
the shared and the local stores are behind the LfsMultiplexer store that
unfortunately would always return `Ok(None)`. In this situation, the repack
code would delete all the repacked packfiles, which usually is the expected
behvior, unless only one packfile is being repacked, in which case the repack
code effectively re-creates the same packfile, and is then subsequently
deleted.

The solution is for the multiplex stores to properly return a path if one was
returned from the underlying stores.

Reviewed By: DurhamG

Differential Revision: D21211981

fbshipit-source-id: 74e4b9e5d2f5d9409ce732935552a02bdde85b93
2020-04-23 15:14:28 -07:00
Xavier Deguillard
413d2b3aba remotefilelog: enable uploading LFS blobs
Summary:
This adds the proper hooks in the right place to upload the LFS blobs and write
to the bundle as LFS pointers. That last part is a bit hacky as we're writing
the pointer manually, but until that code is fully Rust, I don't really see a
good way of doing it.

Reviewed By: DurhamG

Differential Revision: D20843139

fbshipit-source-id: f2ef7b045c6604398b89580b468c354d14de1660
2020-04-23 14:00:23 -07:00
Shannon Zhu
6ec7546cab Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: grievejia

Differential Revision: D21207287

fbshipit-source-id: ab82cf81690cb847bd130ff3448345f5a0ea19af
2020-04-23 12:09:39 -07:00
Arun Kulshreshtha
6d3cacf9fd edenapi: add utility programs
Summary:
Add two utility programs for ad-hoc debugging of EdenAPI. EdenAPI requests and responses are encoded as CBOR, which is not easy to work with manually on the command line. In order to allow debugging the HTTP API using tools like `curl`, we need tools that can generate raw request payloads and interpret CBOR responses.

The utility programs included in this diff are:

- `make_req` - Can construct EdenAPI request payloads from a human-editable JSON representation.
- `data_util` - Can list, validate, and extract the contents of an EdenAPI data response.

These tools can be used by themselves or as part of a pipeline. See test plan for examples.

Reviewed By: xavierd

Differential Revision: D21136575

fbshipit-source-id: d1ac8d92964614005078a6ac76dd0835c29a80a5
2020-04-23 11:43:51 -07:00
Jun Wu
25ce8b7b9f importhelper: avoid resolving commit hashes as revsets
Summary:
`scmutil.revsingle` resolves the commit using the revset language layer,
which will trigger auto pull logic. The import helper does not want any
kind of auto pull logic. Therefore use `repo[rev]` instead, which resolves
the commit hash directly and bypasses the revset / auto pull logic.

Reviewed By: singhsrb

Differential Revision: D21196495

fbshipit-source-id: 5a51057a731523bbb643c7e264d6902dcfbb9059
2020-04-23 10:10:01 -07:00
Mark Thomas
c05efd8a5c mutationstore: move MutationEntry type to types crate
Summary: Move the MutationEntry type to the Mercurial types crate.  This will allow us to use it from Mononoke.

Reviewed By: quark-zju

Differential Revision: D20871338

fbshipit-source-id: 8de3bb8a2673673bc4c8a6cc7578a0a76358c14a
2020-04-23 08:58:10 -07:00
Durham Goode
dbff6c6b9a filesystem: add initial PendingChanges stubs
Summary:
The part of status that lists what files have changed is called
PendingChanges. This diff introduces the initial stub for PendingChanges. The
pending changes algorithm involves three parts:

1. Looking at files on the filesystem for changes.
2. Looking at files in the dirstate map for changes.
3. Looking at the content for any files that we were unsure of during steps 1
and 2.

This diff puts the basic state machine in place, and accepts the basic
information about the working copy (the root and what type of filesystem it is).
In the future we might have it detect what type of filesystem it is, but for now
this makes it easy.

Reviewed By: xavierd

Differential Revision: D20546898

fbshipit-source-id: a3030b7c846b3cb2fcba805b7fe4744df7c5764e
2020-04-22 19:55:50 -07:00
Durham Goode
701273d08f treestate: trim separators off get_filtered_keys inputs and outputs
Summary:
treestate.get_filtered_keys passes directory paths to the filter
function and returns directory matches with a trailing '/' on the end. This
makes it difficult to act as a path normalization function when the caller
doesn't know if the path is a file or directory.

It seems like we can just strip the trailing '/' before exposing the strings to
the caller (both as filter inputs and as get_filtered_keys outputs).

This is useful in the following diff that adds a case normalization crate.

Reviewed By: xavierd

Differential Revision: D20880881

fbshipit-source-id: 6e9f419178b4e278844244bd6aff2fc10e09d2cd
2020-04-22 19:55:50 -07:00
Durham Goode
e97d8d8895 vfs: move vfs logic into its own crate
Summary:
This logic will be used in a variety of places (update workers, status,
etc). Let's move it somewhere common.

Reviewed By: xavierd

Differential Revision: D20771623

fbshipit-source-id: b4de7c1d20055a10bbc1143d44c55ea1045ec62a
2020-04-22 19:55:49 -07:00
Durham Goode
c1b8f86359 treestate: store TreeState in an Arc<Mutex<_>>
Summary:
In a later diff we'll need to be able to hand a reference to the
TreeState to the pending changes iterator. We'd like to be able to hand a
Rc<RefCell<TreeState>> but cpython requires that its fields implement Send. The
simplest solution is to use Arc<Mutex<_>>. Once we finish Rustifying all of this
code we can drop the cpython requirement that this work across threads and
downgrade this to a Rc<RefCell<_>>.

Reviewed By: xavierd

Differential Revision: D20546904

fbshipit-source-id: a4a1ce6973f53b3bb95f227616149f98fcd780e0
2020-04-22 19:55:49 -07:00
Durham Goode
a6e2b90c2e pathauditor: move into workingcopy crate
Summary:
PathAuditor will be needed for native status soon. Let's move it into
the workingcopy crate.

Reviewed By: xavierd

Differential Revision: D20546906

fbshipit-source-id: ef69f88ee828a72e82b5e944cc7913f391bd8a2f
2020-04-22 19:55:49 -07:00
Jun Wu
ae8046b036 tests: update test-hgsql-strip.t
Summary: Update the test to match the latest output.

Reviewed By: xavierd

Differential Revision: D21181146

fbshipit-source-id: 3b6190c9ae8e73309c0b7cb3c48d8a6646bc7fb4
2020-04-22 16:15:46 -07:00
Durham Goode
faced01356 tracing: add more trace values
Summary: This will help us debug slow commands

Reviewed By: xavierd

Differential Revision: D21075895

fbshipit-source-id: 3e7667bb0e4426d743841d8fda00fa4a315f0120
2020-04-22 15:35:17 -07:00
Mark Thomas
a22fa5a2db localrepo: don't revive if obsmarkers are disabled
Summary:
If a commit operation results in a commit that is already present in the
repository, we must revive the commit, rather than create a new one.  In this
case, if obsmarkers are disabled, we can't create a revive marker.

Reviewed By: quark-zju

Differential Revision: D21179879

fbshipit-source-id: 320c70b0ca1e0f384733e09e0e1dd77ac3a255f9
2020-04-22 13:46:41 -07:00
Andres Suarez
7ebf66c8b8 chg: avoid needless allocations
Summary:
* Unnecessary clone of `osstring_to_local_cstring` value.
* Unnecessary UTF-8 conversion in `file_decision`.
* Neater "debugpython" if.
* Unnecessary `CHGDISABLE` `OsString` allocation.

Reviewed By: quark-zju

Differential Revision: D21171329

fbshipit-source-id: 1241066b4a01600c436709d1a5fe95d6a13634ba
2020-04-22 09:34:27 -07:00
Jun Wu
f8e642092c debugshell: fix global variables
Summary:
Without this change the following code will fail surprisingly:

    In [1]: def f():
       ...:     return m
       ...:

    In [2]: f()
    NameError: global name 'm' is not defined

Reviewed By: singhsrb

Differential Revision: D21140299

fbshipit-source-id: f0a6509badcd9314a33a5ca0c78a60bb847d63c7
2020-04-22 09:21:07 -07:00
Jun Wu
361bd06aac debugshell: make more variables avilable
Summary:
Make `ml`, `serv`, `bin`, `hex`, `util` available as they are handy.

Remove less useful names like `e`.

Reviewed By: singhsrb

Differential Revision: D21140300

fbshipit-source-id: ca012da6e33fad64b352c117595538e10d1fad83
2020-04-22 09:21:07 -07:00
Xavier Deguillard
51438d13e7 revisionstore: write data to store when reading from memcache
Summary:
The Memcache store is voluntarily added to the ContentStore read store, first
as a regular store, and then as a remote one. The regular store is added to
enable the slower remote store to write to it so that blobs are uploaded to
Memcache as we read them from the network. The subtle part of this is that the
HgIdDataStore methods should not do anything, or the data fetched won't be
written to any on-disk store, forcing a refetch next time the blob is needed.

Reviewed By: DurhamG

Differential Revision: D21132669

fbshipit-source-id: 96e963c7bb4209add5a51a5fc48bc38f6bcd2cd9
2020-04-21 18:35:38 -07:00
Jun Wu
9aba51ad82 visibility: avoid calculating realnewheads if len(heads) <= 1
Summary:
realnewheads removes ancestors from the heads list. It is not needed
if len(heads) <= 1.

This is an optimization that makes the following change a bit faster.

Reviewed By: DurhamG

Differential Revision: D21011402

fbshipit-source-id: 308b4b5b6f2b8d6e053e51e4a10e0fda2ac949db
2020-04-21 18:28:31 -07:00
Jun Wu
b72002f91d tests: update tests with bookmarks behavior change
Summary:
Update tests. They are caused by the use of deprecated command "rollback".
Normally this kind of issues shouldn't happen.

Reviewed By: DurhamG

Differential Revision: D21164084

fbshipit-source-id: 7d847166f999e2bc472bb8276c1ebb66ad7c45c2
2020-04-21 14:31:46 -07:00
Adam Simpkins
5ed9871d31 don't print background repack messages to stdout
Summary:
D17677229 unintentionally changed the remotefilelog repack code to print
messages about the fact that it was doing a repack to stdout instead of
stderr.

This results in garbage messages showing up in the output of commands that are
intended for programmatic consumption, like `HGPLAIN=1 hg status -0mardu`

Reviewed By: DurhamG

Differential Revision: D21149364

fbshipit-source-id: 104d719af35835be098a375f9b9aebcd1f7a6eca
2020-04-21 14:15:54 -07:00
Durham Goode
3588633bb7 py3: revert mysql-connector-python upgrade and hgsql tests
Summary:
The tests are broken on non-fbcode builds because
mysql-connector-python is the old version. We're unable to upgrade
mysql-connector-python on centos 7/8 because yummy is broken. This blocks us
from getting a release.

Let's roll back the mysql-connector-python upgrade for now, until yummy is
fixed.

Reviewed By: singhsrb

Differential Revision: D21162119

fbshipit-source-id: 5d0b266d72274540eca5b9a76bf151a0fbbee059
2020-04-21 13:45:23 -07:00
Durham Goode
f764f12f72 tracing: fix function tracing
Summary:
The old pytracing logic walked the stack looking for the most recent
spanid. This was fragile and missed a bunch of spots because the function name
wasn't present in f_globals. Let's make this explicit by tracking the stack of
spanids for each python thread.

Reviewed By: quark-zju

Differential Revision: D21068332

fbshipit-source-id: 98759640fa1081bc5bc0805cc620e35a2de9dae3
2020-04-21 13:23:50 -07:00
Jun Wu
73c5cb89de bookmarks: reload changelog if unknown node is seen
Summary: This mitigates loading order issues demonstrated by the previous diff.

Reviewed By: DurhamG

Differential Revision: D21148446

fbshipit-source-id: 40e4861055822b4676f3ac38d0f004b365efe86d
2020-04-21 09:19:26 -07:00
Jun Wu
b4ff907c2a bookmarks: add tests showing loading ordering issue without metalog
Summary: Demonstrate that bookmark loading order can cause "unknown name" errors.

Reviewed By: DurhamG

Differential Revision: D21148445

fbshipit-source-id: d12417ad150904bda14df47cb6e9fe464f392588
2020-04-21 09:19:26 -07:00
Mateusz Kwapich
7ca58332d0 fix xdiff behaviour for empty files
Summary:
When comparing empty file with file with content our xdiff wrongly included
warning about missing newline, which also made the line counter in the hunk
header off-by-one.

Empty files are quite rare in our repos, that's why I discovered this bug only
now (it broke phabricator parsing of this single commit).

Reviewed By: markedson1024

Differential Revision: D21141341

fbshipit-source-id: 9d3e0d8a61ac4ee2cf27978b99b3a092259ee186
2020-04-21 05:30:21 -07:00
Durham Goode
cc6e9b6ace hgsql: disable ssl
Summary:
We don't use ssl to connect to myrouter, and the fact that we even try
causes things to break because we don't have ssl certs.

Reviewed By: sfilipco

Differential Revision: D21139692

fbshipit-source-id: 4a53de929f0114e4307276b8feffcaafebc5d5ce
2020-04-20 22:23:12 -07:00
Xavier Deguillard
1d231ebac7 revisionstore: return non-uploaded keys
Summary:
Ideally, either the ContentStore, or the upper layer should verify that we
haven't missed uploading a blob, which could lead to weird behavior down the
line. For now, all the stores will return the keys of the blobs that weren't
uploaded, which allows us to return these keys to Python.

Reviewed By: DurhamG

Differential Revision: D21103998

fbshipit-source-id: 5bab0bbec32244291c65a07aa2a13aec344e715e
2020-04-20 21:02:35 -07:00
Xavier Deguillard
af1ab52527 merge: add a "rg" merge action
Summary:
When a file goes from being a symlink to a regular file, a regular update
action ("g") is used, and the Python code implicitely remove the symlink before
writing to it. In the Rust code, we don't and as a consequence write through
the symlink, not the intended behavior.

An alternative way of fixing this would be to perform an lstat(2) before
writing to a file, but the cost of doing that will be fairly high for a very
unlikely situation especially since the manifest diff can give us exactly this
information.

This whole merge code feels extremely fragile, so I'm definitively not sure if
I got all the places that needs updating :(.

Reviewed By: DurhamG

Differential Revision: D21082733

fbshipit-source-id: 4f36a67363915c9b67d5a0b290a226075a9f1d31
2020-04-19 22:48:19 -07:00
Durham Goode
7edc29d07c filesystem: move rust walker to it's own file
Summary:
We'll be adding more data to the filesystem layer, so let's move this
out of lib.rs.

Also made a slight tweak to expose File metadata in the walk results, which will be used by the future pending changes logic to avoid re-stating the file.

Reviewed By: xavierd

Differential Revision: D20546903

fbshipit-source-id: 70456055b0da601990e6d6ff535678d2df6c50ba
2020-04-16 16:51:21 -07:00
Xavier Deguillard
10e9a56434 treemanifest: do a repack instead of purging treemanifest
Summary:
Purging treemanifest packfiles always made little sense to me, as the reason we
have tons of them, is because we fetched tons of them. Remove all of them would
just lead to the same situation again. Let's just do a repack instead.

Reviewed By: markbt

Differential Revision: D21065723

fbshipit-source-id: a7cdee1de1d7897481f75c13d8aceeb8c1a68550
2020-04-16 13:06:50 -07:00
Durham Goode
856262080e py3: enable a number of hgsql related tests
Summary:
Now that we've upgraded mysql-connector-python, we can enable these
tests.

Reviewed By: quark-zju

Differential Revision: D21009185

fbshipit-source-id: e9ae62cadcc8d0a291381ab2cfb5c7bc04606d9e
2020-04-16 12:24:41 -07:00
Xavier Deguillard
4973c55030 exchange: always call prepushoutgoing hooks
Summary:
Previously, an extension adding the "changeset" pushop might forget to call the
prepushoutgoing hooks, preventing them from being called.

Reviewed By: DurhamG

Differential Revision: D21008487

fbshipit-source-id: a6bc506c7e1695854aca3d3b2cd118ef1c390c52
2020-04-15 20:22:18 -07:00
Jun Wu
f1c9a39922 doctor: check and hide less relevant branches
Summary:
Sometimes due to wrong configuration, branches that are not relevant to the
user become visible. Detect that and provide a way to hide them.

Reviewed By: xavierd

Differential Revision: D21055464

fbshipit-source-id: 19da498a137fdd08e363d6f689b6de31bc884dbd
2020-04-15 19:21:13 -07:00
Jun Wu
c0b5ad2294 doctor: fix too many remotenames
Summary:
Sometimes due to wrong configuration, cloud sync or legacy pull without
selectivepull will pollute the remote bookmark namespace with too many remote
bookmarks.  Detect that and provide a way to reset remotenames to selected
bookmarks.

Reviewed By: xavierd

Differential Revision: D21055466

fbshipit-source-id: f96c6ba79dd8646fa017947e48e80259ed77de67
2020-04-15 19:21:12 -07:00
Jun Wu
491279b140 doctor: fix incorrect visibility header
Summary:
This is rare. But if visibleheads has a broken header, attempt to fix instead
of skipping.

Reviewed By: xavierd

Differential Revision: D21055468

fbshipit-source-id: 8907c84b69eadb50afae1940862db01a926a38f5
2020-04-15 19:21:12 -07:00
Jun Wu
065ca1b066 doctor: add checks about lagged remote/master
Summary: Trigger a `hg pull` if the remote bookmark appears to be lagging.

Reviewed By: xavierd

Differential Revision: D21055465

fbshipit-source-id: e5ea33ca15f50b504368bec0f349a4abe895eee0
2020-04-15 19:21:12 -07:00
Jun Wu
7cf55dceda doctor: be less verbose
Summary: Remove "looks okay" messages. Only report issues and what changed.

Reviewed By: xavierd

Differential Revision: D21055467

fbshipit-source-id: ee7e732934b88bcdead8cb34ac4cd26b9c7aab42
2020-04-15 19:21:11 -07:00
Jun Wu
ebef9f0ab9 tests: remove test-check-config
Summary:
It was for preventing undocumented configs. Practically it does not achieve the
goal and we might prefer not documenting some of the advanced features to reduce
support burden of unusual configs. Therefore remove it.

We can revisit once we want to improve the documentation of the product.

Reviewed By: xavierd

Differential Revision: D21055469

fbshipit-source-id: 2c26791d2284071b1ac26d1190ec5c4876546f77
2020-04-15 19:21:11 -07:00
Jun Wu
2883e9e20d pushrebase: correctly detect the "rebased / obsolete" case
Summary:
`obsolete()` alone shouldn't prevent push. Check if a successor in the
destination branch instead.

Reviewed By: DurhamG

Differential Revision: D20911924

fbshipit-source-id: 0f983f3440a5bcff13e1a98b28aac2df80b419e0
2020-04-15 19:02:36 -07:00
Jun Wu
ed78133581 phrevset: use GraphQL result if possible
Summary:
Change the fork search to always respect GraphQL if possible. This will result
in more deterministic result, and can avoid full changelog scan if the diff
points to public commits.

Reviewed By: DurhamG

Differential Revision: D21045430

fbshipit-source-id: 2e2b13f5aad3670b9018e5c4ce769b330d14531e
2020-04-15 18:37:18 -07:00
Jun Wu
11a733e700 phrevset: split changelog scan into draft + full scans
Summary:
The local draft scan turns out to be needed by cfgr `jf land` for reasons like
callsign not set (s199694). The whole changelog scan is already slow and will
be slower with segmented changelog so let's log it and see if we can remove it.

Reviewed By: DurhamG

Differential Revision: D21045429

fbshipit-source-id: 999c8479662b3476a09ec852de98cbecebd7f31a
2020-04-15 18:37:18 -07:00
Jun Wu
4ea261914c pager: replace fout and ferr of all ui objects
Summary:
The `ui` object is a bit messy - there are repo specific ui, and non-repo ui,
and ui can be copied around.

This diff changes `fout` and `ferr` to an indirect type that can be mutated
globally so the streampager can affect the `fout` and `ferr` of all related `ui`
objects instead of just one single `ui`.

Reviewed By: DurhamG

Differential Revision: D20903568

fbshipit-source-id: b2f139b91a39c20c22261e03ce50f3cc59074291
2020-04-15 18:23:12 -07:00
Jun Wu
c2ffda7622 pager: configure streampager using hg configs
Summary:
This allows the streampager to be configured via hgrc files.

Default are picked so the behavior is closer to the current default pager
(`less -FRX`).

Reviewed By: DurhamG

Differential Revision: D20902034

fbshipit-source-id: 994ab963ceace02eeb1d18cfa5768e411ca3610b
2020-04-15 18:23:11 -07:00
Jun Wu
08d893fbf0 clidispatch: change pager to use stdio
Summary: This makes it work with chg, since `/dev/tty` is not available for chg.

Reviewed By: DurhamG

Differential Revision: D20936967

fbshipit-source-id: f3ded1aa5552f321ff7043a039f4e35a88160a51
2020-04-15 17:12:47 -07:00
Xavier Deguillard
5184a72b56 merge: only enable rustworkers when remotefilelog is enabled too
Summary:
The Rust worker code will only work with remotefilelog, and when the Rust
ContentStore is enabled, make sure to not enable it if these 2 conditions
aren't met.

Reviewed By: quark-zju

Differential Revision: D21033428

fbshipit-source-id: c34c1b39ddb81be399463712216fa2cd68771f41
2020-04-15 16:16:30 -07:00
Durham Goode
6078dad33e py3: fix more hggit tests
Summary: These tests now pass with python 3.

Reviewed By: xavierd

Differential Revision: D21011004

fbshipit-source-id: 65ac8f864f6eaf24fa7d3c8b25a013b5e9f28ffe
2020-04-15 11:35:39 -07:00
Xavier Deguillard
643e69e045 remotefilelog: do not write delta in bundle2
Summary:
Computing delta force the client to have the previous version locally, which it
may not have, forcing a full fetch of the blob, to then compute a delta. Since
delta are a way to save on bandwidth usage, fetching a blob to compute it
negate its benefits.

Reviewed By: DurhamG

Differential Revision: D20999424

fbshipit-source-id: ae958bb71e6a16cfc77f9ccebd82eec00ffda0db
2020-04-15 10:26:39 -07:00
Durham Goode
bfe0c8d7ab configs: add dynamic config generator
Summary:
We want Mercurial to become more responsible for it's own
configuration, instead of relying on chef and other means. To do so, let's
introduce a new `hg debugdynamicconfig` that can generate dynamic configs for
a given repository based on various states, like what tier it's in or what shard
that machine is in.  By default it generates to '.hg/hgrc.dynamic' for the given
repository.

Currently it just sets the hostgroup config.

Future diffs will make Mercurial consume this config, and possibly have Mercurial
call this command asynchronously when it notices the file is out-of-date.

Reviewed By: quark-zju

Differential Revision: D20828132

fbshipit-source-id: 6f5bf749f5b04e0a5989d6dc19ee788c2e47f88f
2020-04-14 21:22:26 -07:00
Durham Goode
232658cc81 configparser: add function for serializing configs
Summary:
A future diff will want to generate configs programmatically and write
them to a file. Let's add write support to ConfigSet.

Reviewed By: quark-zju

Differential Revision: D20828133

fbshipit-source-id: 702f6f9bdfdf99ef25c6e1c0ab33373a4b6508fe
2020-04-14 21:22:26 -07:00
Durham Goode
910ff8f180 py3: redisable failing py3 tests
Summary: These tests are breaking hgbuild.

Reviewed By: xavierd

Differential Revision: D21029157

fbshipit-source-id: cafcc74a646e18ec531a8f29dc791fa4837bb7eb
2020-04-14 15:49:55 -07:00
Arun Kulshreshtha
845bbc45c7 arcdiff: delete reference to removed since-last-arc-diff flag
Summary: D21017515 removed the `since-last-arc-diff` flag; this was the last reference to it in the hg codebase.

Reviewed By: singhsrb

Differential Revision: D21025752

fbshipit-source-id: 083cb821263fa844ec74773d8636e19a6e82c550
2020-04-14 15:45:20 -07:00
Chad Austin
77d8cd3aae remove a dead eden thrift client method
Summary:
I noticed we removed the call to getManifestEntry, but didn't remove
the method from the EdenThriftClient.

Reviewed By: singhsrb

Differential Revision: D21025523

fbshipit-source-id: 409eb52bad08b305ecfd0f8918cb71fec6a71aab
2020-04-14 15:13:24 -07:00
David Pletcher
147de1f274 Eliminate obsolete since-last-arc-diff flag
Summary:
This flag is an obsolete duplicate of since-last-submit.
Eliminate it to facilitate convenient tab autocompletion and make
the world less complicated.

Reviewed By: xavierd

Differential Revision: D21017515

fbshipit-source-id: f3e4db602a69f1c7da886d455ac36c4a2ddb6b01
2020-04-14 09:09:12 -07:00
Lukas Piatkowski
6afe62eeaa eden/scm: split revisionstore into types and rest of logic
Summary:
The revisionstore is a large crate with many dependencies, split out the types part which is most likely to be shared between different pieces of eden/mononoke infrastructure.

With this split it was easy to get eden/mononoke/mercurial/bundles

Reviewed By: farnz

Differential Revision: D20869220

fbshipit-source-id: e9ee4144e7f6250af44802e43221a5b6521d965d
2020-04-14 07:50:19 -07:00
Jun Wu
4413d92cad pushrebase: add a test showing suboptimal abort
Reviewed By: simpkins

Differential Revision: D20911925

fbshipit-source-id: 81c7fe27b5cb85d6bdf5be385d3f1db84ed1b73b
2020-04-13 20:46:21 -07:00
Genevieve Helsel
a98dd1fa6b suggest graceful restart in hg status / old edenfs warnings
Summary: Since the old Edenfs warning is usually for simply picking up new eden releases, we can suggest the user runs a graceful restart instead of a normal restart to avoid them running into `Transport not connected` errors. This path is only hit in unix environments, so windows users will not see this (since graceful restart isn't supported there yet). Since this is a manual step as well, it will be easier for a user to see if they run into an issue here. This can also enable us to get more telemetry from users running graceful restarts.

Reviewed By: wez

Differential Revision: D20901597

fbshipit-source-id: 9e5c9a90313901be159f66afcbbadc5d7af4fe28
2020-04-13 16:25:58 -07:00
Durham Goode
955013fdbc py3: fix test-bundle2-format.t
Summary: It now passes

Reviewed By: xavierd

Differential Revision: D20995130

fbshipit-source-id: c262cd8f3ef1c41cd52fd5ec5894be145059f045
2020-04-13 15:28:25 -07:00
Durham Goode
2f8cb4b6ec py3: fix test-bundle2-exchange.t
Summary: It now passes

Reviewed By: xavierd

Differential Revision: D20971712

fbshipit-source-id: d962c5f0171c056edfadb5cc795d1c8662456afa
2020-04-13 15:28:25 -07:00
Durham Goode
d9a508dfba py3: fix various wireprotocol related tests
Summary: They now pass

Reviewed By: xavierd

Differential Revision: D20970190

fbshipit-source-id: 8610e0877181c5e8b8842559f7a3e4a943c0c3fe
2020-04-13 15:28:24 -07:00
Xavier Deguillard
69ad493984 color: always specify alternate colors
Summary:
Having some colors, even dull is better than no colors. For every "bright"
color found in the repo, also specify their non-bright variant.

Reviewed By: DurhamG

Differential Revision: D20972198

fbshipit-source-id: ca10c0eac13129f120fc45623d134f279a75b3c2
2020-04-13 15:04:16 -07:00
Xavier Deguillard
b6cb2f37f2 tests: fix test-parse-date.t in python3
Reviewed By: DurhamG

Differential Revision: D20972880

fbshipit-source-id: 6436fb9af8bb8adf48d6c23a0e8cc453d9336c47
2020-04-13 14:59:41 -07:00
Xavier Deguillard
e8c2e7a280 tests: fix test-perftweaks-remotenames.t in python3
Summary: Reading needs to be done via readutf8.

Reviewed By: DurhamG

Differential Revision: D20972835

fbshipit-source-id: 0705c04f1db8b20cc4679852d75ea1790a5cf5f9
2020-04-13 14:59:41 -07:00
Xavier Deguillard
6b85ee4edb remotenames: decode the content of selectivepullenabled
Summary: We're writing utf-8 data to it, decode it before returning it.

Reviewed By: DurhamG

Differential Revision: D20972741

fbshipit-source-id: fb23a6d1c3188e10598b839639cdd5e74322089a
2020-04-13 14:59:41 -07:00
Xavier Deguillard
d2c56495e4 metalog: fix for python3
Summary:
While keys are strings, values are bytes buffer and thus needs to be converted
sometimes.

Reviewed By: DurhamG

Differential Revision: D20974484

fbshipit-source-id: 13394f5dc43191e85e4b1d350cc4fbbd8489572a
2020-04-13 14:55:11 -07:00
Xavier Deguillard
8178dfd89b context: fix symlink validation
Summary:
Symlinks are pointers to path, that are required to be utf-8, thus we can
decode the data.

Reviewed By: DurhamG

Differential Revision: D20973701

fbshipit-source-id: 8399dfb3462fea907758a01ed2fcea508833fbaa
2020-04-13 14:55:11 -07:00
Xavier Deguillard
ffd876d967 tests: fix test-filelog.py for python3
Reviewed By: DurhamG

Differential Revision: D20973502

fbshipit-source-id: dc3201dcc25509d569442a240fa8361a819f1f5f
2020-04-13 14:55:11 -07:00
Xavier Deguillard
17855deb17 tests: fix test-extdiff.t for python3
Reviewed By: DurhamG

Differential Revision: D20973286

fbshipit-source-id: 3a2d3cfc61567934d53e58ce561c367746c02403
2020-04-13 14:55:10 -07:00
Xavier Deguillard
4d5515e6ef tests: fix test-revlog.t for python3
Reviewed By: DurhamG

Differential Revision: D20973212

fbshipit-source-id: 1535d50a0cb2a7350083600e4e6c6506e0749072
2020-04-13 14:55:10 -07:00
Xavier Deguillard
5f4d53cb54 tests: fix test-hggit-illegal-contents.t
Summary:
With the upgraded git, some error message aren't the same as before, update the
test to reflect that.

Reviewed By: quark-zju

Differential Revision: D20993735

fbshipit-source-id: d9b8bfc9c6d10f7c0898299659e4322589ea8077
2020-04-13 14:25:35 -07:00
Nitzan Shaked
7833fd08d5 fix "empty link" bug in hyperlink
Summary: `hyperlink(url, title)` returns a terminal escape sequence for the url even if the title provided is empty. While the terminal displays nothing, the actual string in hg-template-land is non-empty (it contains a url), and all the template functions that check for empty strings don't see it as empty.

Reviewed By: fanzeyi, xavierd

Differential Revision: D20970733

fbshipit-source-id: 04436714f3827b98b8fb249b3eb1da82f366807c
2020-04-13 11:45:39 -07:00
Xavier Deguillard
cdb0fbdb71 convert: do not try to re-encode in python3
Summary: The encoding is utf-8 already.

Reviewed By: sfilipco

Differential Revision: D20966808

fbshipit-source-id: ade012588bf14df07772db0819be8670ecdb3b09
2020-04-13 08:53:51 -07:00
Xavier Deguillard
aa836d38ea tests: enable histedit for python3
Summary: These are now passing

Reviewed By: sfilipco

Differential Revision: D20966083

fbshipit-source-id: c9a34ee23a1552200756a4e1f75a29574c37960d
2020-04-13 08:53:51 -07:00
Xavier Deguillard
c256ee21ef treemanifest: fix flat manifest conversion
Summary: In Python3, str is not a byte string, but a unicode one. Use bytes instead.

Reviewed By: sfilipco

Differential Revision: D20965794

fbshipit-source-id: b04ff004aac87fd3afc8070fc8d1d849ad48d0d3
2020-04-13 08:53:51 -07:00
Xavier Deguillard
9d1a53ef48 shelve: make it python3 compatible
Reviewed By: sfilipco

Differential Revision: D20965583

fbshipit-source-id: c1cfc9c8ecfa8681ddb46cbfa8b71c3da591f265
2020-04-13 08:53:50 -07:00
Xavier Deguillard
5aed0fe552 tests: fix test-important-remote-names-t.py for python3
Reviewed By: sfilipco

Differential Revision: D20965390

fbshipit-source-id: 790a712c8cc44d6a634ca4bfa7c37f9034a3f571
2020-04-13 08:53:50 -07:00
Xavier Deguillard
6939c33e06 tests: fix test-revlog-mmapindex.t for python3
Reviewed By: sfilipco

Differential Revision: D20965267

fbshipit-source-id: c75601f0cddec0a8388adca3d522d668b7b2a787
2020-04-13 08:53:50 -07:00
Xavier Deguillard
56c0cdb002 histgrep: fix for python3
Summary:
In order to grep, the body of the file is decoded to utf8 with the error
handling "replace". This is probably OK as I would expect histgrep to be used
on text files, not random binary ones where grepping would probably not make a
lot of sense.

Reviewed By: sfilipco

Differential Revision: D20965178

fbshipit-source-id: 9ba234f33e801a78537c22b61dee434625449c01
2020-04-13 08:53:49 -07:00
Xavier Deguillard
ed8875ce70 tests: fix test-obsmarker-template-t.py for python3
Reviewed By: sfilipco

Differential Revision: D20964714

fbshipit-source-id: c92708336a6d75a645bd7725bf3dcca9abbe7029
2020-04-13 08:53:49 -07:00
Xavier Deguillard
e6f3aca0b0 cleanobsstore: write to the file with bytes
Reviewed By: sfilipco

Differential Revision: D20964696

fbshipit-source-id: 3dc81cfaa2172b494e89503e50b3c2d69ef153b4
2020-04-13 08:53:49 -07:00
Xavier Deguillard
a800e3e4ce tests: enable bunch of tests
Summary: These appear to pass now.

Reviewed By: quark-zju

Differential Revision: D20954747

fbshipit-source-id: ffd4dd4dc4832ed7cf84815ff1af9dad4361b26a
2020-04-13 08:53:48 -07:00
Xavier Deguillard
d17f3e417c morestatus: read from updateargs as utf8
Summary: The file is already written with writeutf8, read should use readutf8 too.

Reviewed By: sfilipco

Differential Revision: D20949694

fbshipit-source-id: cb00f45313ba8f78197d2344db7adc787b13ee4d
2020-04-13 08:53:48 -07:00
Xavier Deguillard
fee55b5c0d commands: read/write the graftstate as utf8
Reviewed By: sfilipco

Differential Revision: D20949689

fbshipit-source-id: 8541e9869dc0f4f9e595e011a3109d1cfb539a1a
2020-04-13 08:53:48 -07:00
Xavier Deguillard
e61591decc hggit: bunch of fixes for python3
Summary:
Dulwich expects pretty much everything to be bytes, thus we have to convert a
lot of stuff to bytes from unicode. This only fixes one test, but makes
progress on all of them.

Reviewed By: sfilipco

Differential Revision: D20949172

fbshipit-source-id: 44cd0c5136b3d224f7eb81e48ec98fed60c8b390
2020-04-13 08:53:47 -07:00
Jun Wu
7a6b2864b5 tests: fix test-absorb-t.py on Windows
Reviewed By: xavierd

Differential Revision: D20973246

fbshipit-source-id: de6048829626f415df8ddcc2e16471cb2c0414a4
2020-04-10 22:48:04 -07:00
Xavier Deguillard
cb97048edf tests: update output of test-convert-git.t
Summary: The output was added in a recent git release, update the test to reflect that.

Reviewed By: DurhamG

Differential Revision: D20968427

fbshipit-source-id: 7fed6232723151adefe8329d8a98a314f04f222e
2020-04-10 19:35:38 -07:00
Xavier Deguillard
dd81246300 tests: enable more python3 tests
Reviewed By: DurhamG

Differential Revision: D20931013

fbshipit-source-id: 018a5268ad9fd59030c06217e7f7e6eee000ece6
2020-04-10 11:22:59 -07:00
Durham Goode
59eb475f74 py3: enable more tests that are now passing
Summary: Not sure what fixed them, but now they pass.

Reviewed By: xavierd

Differential Revision: D20933992

fbshipit-source-id: ece47486df17fd5d9303a98bc3b63a429972e73f
2020-04-10 11:04:39 -07:00
Durham Goode
f5c2b60756 treemanifest: delete upstream treemanifest implementation
Summary:
These classes were used for upstream's treemanifest implementation. At
one point we partially used it for our server side tree logic, but these days we
don't use any of it except for the revlog layer. Let's delete the context and
treemanifest layers and tests.

Reviewed By: sfilipco

Differential Revision: D20953163

fbshipit-source-id: 952063e4e0cf74e2da740bf91a70e1714a9ad9b5
2020-04-10 10:59:51 -07:00
Durham Goode
6678f088c8 hgweb: disable hgweb
Summary:
Disables 'hg serve' being able to start a web server. This can be
worked around temporarily by setting web.allowhgweb=True, but we should remove
that workaround soon so we can deleted all the code.

Reviewed By: xavierd

Differential Revision: D20951800

fbshipit-source-id: e0d5017647a073b5ede3b0bbc4dd745fabeac816
2020-04-10 10:59:51 -07:00
Durham Goode
cf4a93bfa0 py3: fix test-wireproto.py
Summary: Makes it pass

Reviewed By: xavierd

Differential Revision: D20933051

fbshipit-source-id: e32ff04597a86fb9674b5a734acc856456f48033
2020-04-10 10:59:50 -07:00
Durham Goode
b2c2642e82 py3: fix pushrebase tests
Summary: Makes more pushrebase tests pass in Python 3

Reviewed By: xavierd

Differential Revision: D20930691

fbshipit-source-id: 1190ebdb77ef06066d6d07441584bb6fb1c1375e
2020-04-10 10:59:50 -07:00
Durham Goode
8ff3a8cbd5 py3: fix commit cloud tests
Summary: Makes all the commit cloud tests pass

Reviewed By: quark-zju

Differential Revision: D20927720

fbshipit-source-id: a863dc1b06258ac8d0ee907f51948c012a23dddc
2020-04-10 10:59:50 -07:00
Xavier Deguillard
4e561ade89 manifest: fix test-treemanifest.t
Summary: The .keys() in Python3 returns an iterator, hence '+' doesn't work on these.

Reviewed By: quark-zju

Differential Revision: D20956491

fbshipit-source-id: 15c74bfcfe6d27dff5018fdf71e61bb747daf2d8
2020-04-10 10:10:17 -07:00
Xavier Deguillard
a50dae72b7 linkrevcache: fix debugverifylinkrevcache in Python3
Summary: Paths are unicode, not bytes.

Reviewed By: quark-zju

Differential Revision: D20955487

fbshipit-source-id: b3e20f238bfc2a444553ba5786fbfa90006f3567
2020-04-10 10:06:33 -07:00
Xavier Deguillard
48234d3be3 copytrace: use mercurial.json instead of json
Summary: Also, use codecs instead of .decode("base64").

Reviewed By: quark-zju

Differential Revision: D20953704

fbshipit-source-id: c5931ba0653acea2fa1de40abfb897437a773f09
2020-04-10 10:01:49 -07:00
Xavier Deguillard
c552dd8af8 bookmarks: add the items method to lazyremotenamedict
Summary:
The iteritems method doesn't exist in Python3, add the items one and remove the
pycompat.itermitems wherever we iterate over the lazyremotenamedict.

Reviewed By: quark-zju

Differential Revision: D20926027

fbshipit-source-id: de9d297126e8190f008cb5d09cc5a128d68c2213
2020-04-10 09:55:57 -07:00
Jun Wu
d588fe8a35 py3: enable test-import-unknown-t.py
Reviewed By: xavierd

Differential Revision: D20952869

fbshipit-source-id: 10cbe7fc1e7cc18270c7b320156325cc48dc58f3
2020-04-09 18:44:07 -07:00
Jun Wu
63a594cee3 py3: fix test-import-merge.t
Reviewed By: xavierd

Differential Revision: D20952871

fbshipit-source-id: 52c299fbdfc3fda8f0b5b2704e7e6bc6eb90342d
2020-04-09 18:44:06 -07:00
Jun Wu
fe3be0bddd py3: fix test-import-t.py
Reviewed By: xavierd

Differential Revision: D20952872

fbshipit-source-id: bea03953576a76f6f65f908f4ce12f3082d02871
2020-04-09 18:44:06 -07:00
Jun Wu
05cd3783ba py3: fix test-import-git.t
Reviewed By: xavierd

Differential Revision: D20952870

fbshipit-source-id: a5b58195b7efa924f1e8806f920671dbaab1e724
2020-04-09 18:44:06 -07:00
Jun Wu
1fbbf9488e py3: fix test-import-context.t
Reviewed By: xavierd

Differential Revision: D20952874

fbshipit-source-id: 18e2db7a35612f9f33fbc49f0703b20abb880938
2020-04-09 18:44:05 -07:00
Jun Wu
4841a5c8cc py3: fix test-import-eol.t
Reviewed By: xavierd

Differential Revision: D20952875

fbshipit-source-id: ad85c492929b39757e255c1aedcb2bbaa582fce2
2020-04-09 18:44:05 -07:00
Jun Wu
470dfdc8f5 py3: fix test-import-bypass.t
Reviewed By: DurhamG

Differential Revision: D20952873

fbshipit-source-id: 3282c757830460b3e683958f09fe6e6870b4fb9a
2020-04-09 18:44:05 -07:00
Jun Wu
73f93a438b py3: fix test-help.t
Reviewed By: xavierd

Differential Revision: D20953745

fbshipit-source-id: 7d6dd303e5789ae8c0a6a32ed40d884aa1f24803
2020-04-09 18:25:54 -07:00
Jun Wu
3e38bb9b6a py3: remove test-dispatch.py
Summary: The test is less relevant as our entry point is now in Rust (and via bindings).

Reviewed By: xavierd

Differential Revision: D20953331

fbshipit-source-id: 0f80befb761d81389924bee23a683d9fb05d13db
2020-04-09 18:25:54 -07:00
Jun Wu
2517a36153 py3: fix test-zstdelta.py
Reviewed By: xavierd

Differential Revision: D20952953

fbshipit-source-id: 6bc01485b830189423c68f4b8edffcf915ab7e02
2020-04-09 18:25:54 -07:00
Jun Wu
514f0141f8 patch: use diffhelpers from Rust bindings
Summary:
Drop other diffhelpers implementations.
The Rust implementation does a better job on type checks and won't segfault.

Reviewed By: xavierd

Differential Revision: D20935367

fbshipit-source-id: f59240f3a661efe1ca6e451922bcb3ca6ee6ae22
2020-04-09 18:25:53 -07:00
Jun Wu
49acaf17b3 bindings: implement diffhelpers
Summary:
The diffhelpers.c lacks of type checks and segfaults on Python 3:

  (gdb) r --config patch.eol=auto import -d '0 0' -m 'test patch.eol' --bypass ../test.diff --debug --traceback
  Program received signal SIGSEGV, Segmentation fault.
  0x00007ffff7263016 in __strcmp_sse42 () from /lib64/libc.so.6
  (gdb) bt
  #0  0x00007ffff7263016 in __strcmp_sse42 () from /lib64/libc.so.6
  #1  0x00007fffee5e3d3b in testhunk (self=<optimized out>, args=<optimized out>) at edenscm/mercurial/cext/diffhelpers.c:151

Looking at the diffhelpers usage, it seems to be using the `bytes` type
(bytes on Python 2, str on Python 3). Let's implement it in Rust so `rust-cpython`
will complain if the type is not `bytes`.

Reviewed By: xavierd

Differential Revision: D20935366

fbshipit-source-id: 8b474555b52caeab4175d7dad44c4c4e7097e557
2020-04-09 18:25:53 -07:00
Jun Wu
ccb8237545 py3: fix updatestate for eden update
Summary:
Solves the following issue.

  Traceback (most recent call last):
    File "eden_update.py", line 93, in update
      vfs.write("updatestate", destctx.hex())
      # destctx = <changectx 1364fe9f6141>
    File "vfs.py", line 142, in write
      return fp.write(data)
      # data = '1364fe9f61411a001b78bd2bb4bf556e0fdfb4d6'
  TypeError: a bytes-like object is required, not 'str'

Reviewed By: simpkins

Differential Revision: D20957027

fbshipit-source-id: f9d55b005c1686064278d22634f0b6ca9d8d8f86
2020-04-09 18:12:45 -07:00
Xavier Deguillard
ad34cc5476 bundle2: bunch of fixes for Python3
Reviewed By: DurhamG

Differential Revision: D20930267

fbshipit-source-id: 5df5f7d1fbcd4875b4ee93be8ff84f8190972770
2020-04-09 16:27:43 -07:00
Adam Simpkins
e8fea00489 rage: report the full config
Summary:
This largely reverts the changes in D9443604, to make `hg rage` report the
full configs again.

Our configs vary from tier to tier and repository to repository.  The override
settings alone don't seem like enough to try and figure out what the actual
settings are that the user is using.

I retained the behavior of reporting the source file and line number for each
config item, which wasn't present before D9443604.  I also still excluded
config values from the "builtin" config source.  Currently this only excludes
the handful of merge-tools defined in
`eden/scm/edenscmnative/bindings/modules/pyconfigparser/src/lib.rs`

Reviewed By: quark-zju

Differential Revision: D20927599

fbshipit-source-id: 8b5b5bf8b7871b85bd0fe5cd179f16693e4fbb2a
2020-04-09 14:13:31 -07:00