Commit Graph

26 Commits

Author SHA1 Message Date
Xavier Deguillard
a85ba47d9b radixbuf: replace error-chain with failure
Summary:
The former is no longer maintained and throws warnings with recent rust
versions.

Reviewed By: singhsrb

Differential Revision: D15109706

fbshipit-source-id: 94479cdedf42c4dd99e35fa8e337d2fc73f74eb5
2019-04-29 15:36:02 -07:00
Mateusz Kwapich
33cf9ba8ad ignnore draft versions if there's newer attached version
Summary:
a "local changes" was visible in the smartlog even instantly after "jf submit"
because hg was comparing the has in the repo with the latest draft version.

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

Reviewed By: katherinez

Differential Revision: D15098057

fbshipit-source-id: 5ad8e87a802a21ccbb1534c189d4e9de78e29fe7
2019-04-29 03:03:18 -07:00
Mark Thomas
94257a258b blackbox: clean up blackbox logging and log more during rage
Summary:
Clean up some of the calls to `ui.log` and how they appear in blackbox logging.

* Make the names of the events consistently use `snake_case`.
* For watchman, only log once for each watchman command.  Include whether or not it failed.
* Unify `fsmonitor` logging under the `fsmonitor` event.
* Omit the second argument when it is empty - it is optional and does nothing when empty.
* Increase the number of blackbox lines included in rage to 100.

Reviewed By: quark-zju

Differential Revision: D14949868

fbshipit-source-id: a9aa8251e71ae7ca556c08116f8f7c61ff472218
2019-04-23 02:48:50 -07:00
Stefan Filip
a802e610d1 revisionstore: rename Store to LocalStore
Summary:
I want to give Store a more specific name so that it doesn't get
confused with other Store abstractions that we will add in the
future.

Reviewed By: singhsrb

Differential Revision: D15007383

fbshipit-source-id: 499bcda4aecd5389e3bc1eba5206ba72a69c4c3d
2019-04-19 09:51:29 -07:00
Stefan Filip
dd6dd0f998 types: remove deprecated Key.name() and Key.set_name()
Summary: Removing this function in favor of using Key.path

Reviewed By: quark-zju

Differential Revision: D14945331

fbshipit-source-id: 6b6bb70375629edf37b2b04a86545f18e15b33b4
2019-04-16 15:34:31 -07:00
Stefan Filip
9c04803a33 pyrevisionstore: use Key::new instead of Key::from_name_slice
Summary: migration

Differential Revision: D14945334

fbshipit-source-id: 1244f0d4fb6df59ebd3b72c55dbd1e1013531464
2019-04-16 15:34:31 -07:00
Mateusz Kwapich
802213bcbb phabricator: query the draft changes too
Summary: The super-smartlog shows "local changes" even when you have some unattached draft changes associated with the diff. This diff changes that.

Reviewed By: quark-zju

Differential Revision: D14936057

fbshipit-source-id: 32204ef9c5fa862923a165624913ecb344ed4a73
2019-04-16 06:33:30 -07:00
Stefan Filip
7e2b3c256f types: rename Key::new to Key::from_name_slice
Summary:
We should update the builder for Key to take a repo path. We could build
the key directly using the default struct constructor but representing
the two constructors as functions is more clear.

Reviewed By: quark-zju

Differential Revision: D14877543

fbshipit-source-id: 328906521cdbad535e28df22fea82f21e8b5410a
2019-04-14 19:56:50 -07:00
Stefan Filip
78d11002eb types: remove Key::node()
Summary:
This function is difficult to justify in the context of the Rust borrow checker.
The primary concern for this pattern is preventing mutation when the object is
passed around.

We can always add the function back if it has to more than just return the
underlying value.

Reviewed By: quark-zju

Differential Revision: D14877545

fbshipit-source-id: acdd796e1bee5445c1bce5ce0ceb41a7334e4966
2019-04-14 19:56:47 -07:00
Xavier Deguillard
5ddf39f788 remotefilelog: add an indexedlog contentstore
Summary:
While the Rust code can read/write content out of an indexedlog, the Python
code cannot. For now, all the writes will be done in Rust, and the Python code
will only be able to read from it.

Reviewed By: quark-zju

Differential Revision: D14894330

fbshipit-source-id: 5c1698d31412bc93e93dabb93be106a2ef17d184
2019-04-11 12:07:58 -07:00
Xavier Deguillard
543c250138 pyrevisionstore: convert to rust 2018
Summary:
Most of the extern crate are now removed. The cpython one is kept around as it
heavily depends on internal macros that would need to be manually imported.

Reviewed By: quark-zju

Differential Revision: D14864995

fbshipit-source-id: 05405ac7310e4dca65daf230cc8f574da32ed4c9
2019-04-10 10:24:55 -07:00
Mateusz Kwapich
12ad4df265 phabricator: fix the getrevisioninfo for Diffs in reserved state
Summary:
Diffs in reserved state have latest_active_diff=null (but it's present). That's why our current logic failed for it.

=== Query

{P62246960}

=== Query Parameters

```
{
  "params": [
    {
      "numbers": 14814207
    }
  ]
}
```

=== Response

```
lang=json
{
  "data": {
    "query": [
      {
        "results": {
          "nodes": [
            {
              "number": 14814207,
              "diff_status_name": "Reserved",
              "latest_active_diff": null,
              "created_time": 1554501017,
              "updated_time": 1554501017,
              "is_landing": false,
              "differential_diffs": {
                "count": 0
              }
            }
          ]
        }
      }
    ]
  }
}
```

=== Run in GraphiQL

[[https://www.intern.facebook.com/intern/graphiql/intern/?query_paste_id=62246962 | Intern]]

Reviewed By: katherinez

Differential Revision: D14836776

fbshipit-source-id: 213afac5d51bf100973753ef8078ab0dcd18d52f
2019-04-08 13:32:17 -07:00
Zeyi Fan
9277617d1e fix double free in cdatapack
Summary:
Mercurial recently started to generate empty pack files (`0x01`). This will cause this check to fail:

diffusion/FBS/browse/master/fbcode/scm/hg/lib/cdatapack/cdatapack.c;2c4197d003ed906dd8eaf70fbb04aa53440ce681$314-319

This will subsequently result as a double-free error between these two:

**In `error_cleanup`**

diffusion/FBS/browse/master/fbcode/scm/hg/lib/cdatapack/cdatapack.c;2c4197d003ed906dd8eaf70fbb04aa53440ce681$387-389

**In `close_datapack`**

diffusion/FBS/browse/master/fbcode/scm/hg/lib/cdatapack/cdatapack.c;2c4197d003ed906dd8eaf70fbb04aa53440ce681$401

This diff will fix this bug.

Differential Revision: D14759374

fbshipit-source-id: 06f192513a935740c2142b5a2baac87a28903496
2019-04-03 21:13:13 -07:00
Katherine Zak
f88737dd96 migrate to use new names in scm/hg/edenscm
Summary:
The phabricator team is trying to eliminate `DifferentialRevision` in favor of `PhabricatorDiff`
See context here
https://our.intern.facebook.com/intern/wiki/Dev_Tools/Phabricator/GraphQLObjectRename/

I'm using aliases to reduce the number of changes needed (the object from the graphql query will have the same keys)

Reviewed By: quark-zju

Differential Revision: D14703867

fbshipit-source-id: 32204315dc154db7cbff68ee286579c0200f57b2
2019-04-02 23:34:04 -07:00
Xavier Deguillard
880d2f4e13 remotefilelog: handle missing packfiles properly
Summary:
Now that repacks runs more often, it's easier to trigger a race between repack
deleting packfiles, and another mercurial process listing the packfiles and
trying to open them. If the packfiles are deleted after the directory listing,
all the packfiles will fail to be opened and were mis-reported as corrupted.

Reviewed By: quark-zju

Differential Revision: D14648308

fbshipit-source-id: c3b852f669e28db6f622bde217f339533e094223
2019-03-28 10:24:29 -07:00
Jun Wu
d03f2d26c2 manifest: drop manifestv2 support
Summary:
The upstream has removed it in https://phab.mercurial-scm.org/D2393. Do the
same.

The deleted C++ code seems to leak `Py_False` if `usemanifestv2` is not set.

Reviewed By: singhsrb

Differential Revision: D14611525

fbshipit-source-id: d828526c31aaa861d100a846bba79d1f5898e245
2019-03-26 13:32:45 -07:00
Stefan Filip
269f4023c6 build: remove profile.lto setting from crates in workspace
Summary:
```
building 'indexes' library extension
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /data/users/sfilip/fbsource/fbcode/scm/hg/edenscm/hgext/extlib/indexes/Cargo.toml
workspace: /data/users/sfilip/fbsource/fbcode/scm/hg/edenscm/hgext/extlib/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /data/users/sfilip/fbsource/fbcode/scm/hg/edenscm/hgext/extlib/pyrevisionstore/Cargo.toml
workspace: /data/users/sfilip/fbsource/fbcode/scm/hg/edenscm/hgext/extlib/Cargo.toml
```
`profile` settings are ignored for non root packages. I introduced this issue
when I added a workspace for extlib: D14543989.

Reviewed By: kulshrax

Differential Revision: D14606019

fbshipit-source-id: 7ec4743d0913e443c378ae83f392817f6e6d3aab
2019-03-25 16:38:41 -07:00
Stefan Filip
5a8929ed08 extlib: add cargo workspace
Summary: This simplifies testing setup for all crates in CI.

Reviewed By: quark-zju

Differential Revision: D14543989

fbshipit-source-id: 83693fada6e64b7c21fd89a880d6452d811ea90d
2019-03-20 19:56:14 -07:00
Liubov Dmitrieva
93057c645f codeformat - remove weird looking + for string concat on the same line
Summary:
These was probably introduced by moving to black.

The changes in the diff were generated by script.

Reviewed By: mitrandir77, singhsrb

Differential Revision: D14439667

fbshipit-source-id: 54f6e0bdcc59c1c6deb4eea46dc6f865bcd48cf8
2019-03-13 11:40:26 -07:00
Xavier Deguillard
126de4655e revisionstore: add a Store trait
Summary:
A lot of code is duplicated between data stores, and history stores, and one
reason for it is the absence of common trait between these 2. By adding a new
Store trait it will make it easier to write generic code that works accross
data and history store.

Reviewed By: quark-zju

Differential Revision: D14091899

fbshipit-source-id: deef1d43a7d300cb3607c67554ad54f20c870e23
2019-02-19 12:18:27 -08:00
Arun Kulshreshtha
9c6b914a22 types: move Key and NodeInfo out of revisionstore
Summary:
In order to move the types in `edenapi-types` (containing types shared between Mercurial and Mononoke) to the `types` crate, we need to move a few types from the  `revisionstore` crate into this crate first, because `revisionstore` depends on `types`, which would create a circular dependency since `edenapi-types` uses types from `revisionstore`.

In particular, this diff moves the `Key` and `NodeInfo` types into their own modules in the `types` crate.

Reviewed By: quark-zju

Differential Revision: D14114166

fbshipit-source-id: 8f9e78d610425faec9dc89ecc9e450651d24177a
2019-02-15 22:51:04 -08:00
Michael Liu
8747ff025f Apply modernize-use-override
Summary:
Use C++11’s override and remove virtual where applicable.
Change are automatically generated.

Reviewed By: Orvid

Differential Revision: D14052667

fbshipit-source-id: 119e237155a5318e08e31065c8f87e6b7f3f7c52
2019-02-14 11:57:55 -08:00
Durham Goode
5eced4c533 watchman: canonicalize repo root before querying watchman
Summary:
If the repository was mounted into a different directory than the
source of truth, our watchman integration would not work. To fix this, Mercurial
now applies the same canonicalization logic to the path before passing it to
watchman. This logic is stolen verbatim from watchmans integration test path
utility.

This also requires updating our copy of pywatchman to match the upstream
pywatchman.

Reviewed By: quark-zju

Differential Revision: D13886207

fbshipit-source-id: ea72166edf2eb30f2bee992d9aa936e2e9729e63
2019-02-04 10:34:08 -08:00
Jun Wu
9dc21f8d0b codemod: import from the edenscm package
Summary:
D13853115 adds `edenscm/` to `sys.path` and code still uses `import mercurial`.
That has nasty problems if both `import mercurial` and
`import edenscm.mercurial` are used, because Python would think `mercurial.foo`
and `edenscm.mercurial.foo` are different modules so code like
`try: ... except mercurial.error.Foo: ...`, or `isinstance(x, mercurial.foo.Bar)`
would fail to handle the `edenscm.mercurial` version. There are also some
module-level states (ex. `extensions._extensions`) that would cause trouble if
they have multiple versions in a single process.

Change imports to use the `edenscm` so ideally the `mercurial` is no longer
imported at all. Add checks in extensions.py to catch unexpected extensions
importing modules from the old (wrong) locations when running tests.

Reviewed By: phillco

Differential Revision: D13868981

fbshipit-source-id: f4e2513766957fd81d85407994f7521a08e4de48
2019-01-29 17:25:32 -08:00
Wez Furlong
83f00ab318 hg: restore spawning watchman on-demand
Summary:
A while back, as a startup optimization, we started to hard code
the path to the watchman socket in the mercurial config.  This meant
that we could avoid running a subprocess for every command.

Today, a chef configuration change was rolled out that caused watchman
to be stopped on all of the corpnet macs with the result being that
all mercurial commands are slow because it never uses and never restarts
watchman.

This diff adds some fallback logic to allow spawning the server in
the case that we have a connection error.

Reviewed By: DurhamG

Differential Revision: D13855696

fbshipit-source-id: 44c0ad36b6e80520912e42bcea9e04f4f165b588
2019-01-29 15:49:37 -08:00
Jun Wu
c12e300bb8 codemod: move Python packages to edenscm
Summary:
Move top-level Python packages `mercurial`, `hgext` and `hgdemandimport` to
a new top-level package `edenscm`. This allows the Python packages provided by
the upstream Mercurial to be installed side-by-side.

To maintain compatibility, `edenscm/` gets added to `sys.path` in
`mercurial/__init__.py`.

Reviewed By: phillco, ikostia

Differential Revision: D13853115

fbshipit-source-id: b296b0673dc54c61ef6a591ebc687057ff53b22e
2019-01-28 18:35:41 -08:00