Commit Graph

51638 Commits

Author SHA1 Message Date
Mark Thomas
d06144e957 renderdag: test width correctly matches rendered width
Summary:
Enhance the tests to test whether the width of the graph matches the width that
was given by the `width` method before `next_row` was called.

The width we are interested in is the number of cells the string would occupy,
not the string length, so use the `unicode-width` crate to determine this.

Reviewed By: quark-zju

Differential Revision: D19282571

fbshipit-source-id: d9852c4c9e0f76c78db047f0da5dd34723a62a2a
2020-01-13 10:22:43 -08:00
Mark Thomas
aae60162eb renderdag: switch to . for ancestor lines
Summary: Switch from `:` to `.` for the ancestor lines.  I think they look better.

Reviewed By: quark-zju

Differential Revision: D19371721

fbshipit-source-id: e18f1a62e23620a82007e2c377607a0a61623830
2020-01-13 10:22:43 -08:00
Mark Thomas
4683a72a77 cmdutil: convert to local encoding when drawing rust graph
Summary:
Use `encoding.unitolocal` to convert the Rust-generated unicode strings to the
local encoding.

Reviewed By: quark-zju

Differential Revision: D19371723

fbshipit-source-id: 6b37ef51f37f2212ca2d9ab20f9ed4da29b3d63c
2020-01-13 10:22:42 -08:00
Mark Thomas
f395961e33 renderdag: add additional glyph sets for box-drawing
Summary:
Box-drawing characters with curves aren't reliably renderable on Windows.  Add
a "square" glyph set that uses right-angle characters.  These characters are
available in cp437 and cp850, so should be available on most Windows systems.

For completeness, add a "dec" glyph set that uses DEC line drawing characters,
for use in old terminals like xterm.

Reviewed By: quark-zju

Differential Revision: D19371722

fbshipit-source-id: 35887243cceab66c702e2b5278b572f77946805f
2020-01-13 10:22:42 -08:00
Jun Wu
9f02e24674 run-tests: turn on format.use-zstore-commit-data
Summary:
This applies the new feature to all tests.

The tests do not use revlog fallback but we plan to use revlog fallback
in production for faster migration.

Reviewed By: DurhamG

Differential Revision: D18737259

fbshipit-source-id: 69633c7b2026fb3d19ca16d40368bded972efd86
2020-01-13 10:06:10 -08:00
svcscm
4bae966f47 Updating submodules
Summary:
GitHub commits:

accbe8c3f9
50135cdfdd

Reviewed By: yns88

fbshipit-source-id: e3c13fe02e19acca925cfa6a2dbd5bb6602b1c27
2020-01-13 10:06:10 -08:00
Jun Wu
138ad4961f setup: include pdb and py files on Windows package
Summary: Add hg.pdb and pure Python source code on Windows for easier debugging.

Reviewed By: markbt

Differential Revision: D19351559

fbshipit-source-id: 8515a84dc58df7c44fd324cc69b7b142fd063b8f
2020-01-13 09:43:57 -08:00
Thomas Orozco
6e266973a1 chg: don't preload "rust" extension
Summary:
D19340538 deleted `eden/scm/edenscm/mercurial/rust/__init__.py`, but
chg's `_preimportmodules` still tries to import it, which breaks Mononoke

```
   $ hg init repo-hg
+  Traceback (most recent call last):
+    File "/data/users/torozco/fbsource/fbcode/buck-out/dev/gen/eden/scm/__hg__/runtime_resources/__default__/eden/scm/hglib/edenscm/__init__.py", line 61, in run
+      dispatch.runchgserver()
+    File "/data/users/torozco/fbsource/fbcode/buck-out/dev/gen/eden/scm/__hg__/runtime_resources/__default__/eden/scm/hglib/edenscm/mercurial/dispatch.py", line 336, in runchgserver
+      _preimportmodules()
+    File "/data/users/torozco/fbsource/fbcode/buck-out/dev/gen/eden/scm/__hg__/runtime_resources/__default__/eden/scm/hglib/edenscm/mercurial/dispatch.py", line 319, in _preimportmodules
+      __import__(name)
+  ImportError: No module named rust
+  [1]
```

NOTE: I had a `__init__.pyc` left in the directory removed in D19340538, which
I'm guessing is why was still working on a `make local` build. After removing
that directory, a `make local`-built hg crashes consistently with the same
error for me.

Reviewed By: farnz

Differential Revision: D19371748

fbshipit-source-id: 4f57b5e1f75b2bd6e857303111fc01446124417b
2020-01-13 09:41:00 -08:00
svcscm
2dd031af96 Updating submodules
Summary:
GitHub commits:

70c6ce2500
712ddb5628
3aac4d791f

Reviewed By: 2d2d2d2d2d

fbshipit-source-id: 8428b6f085dfdb6f8fe3eccc139f2d2f1fa13e9d
2020-01-13 04:23:08 -08:00
svcscm
b0062b0a83 Updating submodules
Summary:
GitHub commits:

d9f0942755
4f9a6d23e8
1fb272ae4d
f7def65369
be7703e85a
af57f10ced

Reviewed By: 2d2d2d2d2d

fbshipit-source-id: 4a36353433b9753633cab1bcb9db0a7d1be19d82
2020-01-12 17:22:49 -08:00
svcscm
4b638e682a Updating submodules
Summary:
GitHub commits:

f1709fb5f4
eaf3df607f
cedcd9cb09

Reviewed By: 2d2d2d2d2d

fbshipit-source-id: 3849b33057d2700db6461be30c6b807dd2b75863
2020-01-11 22:23:42 -08:00
svcscm
c8e0efb83d Updating submodules
Summary:
GitHub commits:

087f5273b7

Reviewed By: 2d2d2d2d2d

fbshipit-source-id: 67c5f4f48622d2a4b3724736904bce37fd58e036
2020-01-10 22:10:18 -08:00
Jun Wu
674b592596 clindex: fix error type in partialmatch
Summary:
The expected error type is RevlogError. Previously that RevlogError
was converted from RuntimeError. However, D19169527 stack changed
RuntimeError to RustError, causing clindex partialmatch to raise
RustError instead, which is not handled by the Python layer.

Convert RustError to RevlogError to solve the issue.

Context:
https://fb.workplace.com/groups/scm/permalink/2591821277534143/

Reviewed By: DurhamG

Differential Revision: D19359074

fbshipit-source-id: 7b7b500cdf01272791a73ea0d94397e1397ff80b
2020-01-10 20:36:59 -08:00
Jun Wu
ffc85f7222 changelog: add a way to migrate up and down with zstore-commit-data format
Summary:
This makes it possible to use zstore instead of 00changelog.d to store commit
data. Right now it double writes to zstore and 00changelog.d if turned on.
In the future we can switch to only writing to zstore if 00changelog.i
alternative is available.

Some related configs were added for fallback strategy: revlog or server.
The revlog fallback allows us to do fast migration. The server fallback
(not implemented in this diff) allows us to stop depending on revlog.d.

Reviewed By: DurhamG

Differential Revision: D18737260

fbshipit-source-id: 3c9605f0babd8a215ee74bdf1275cc4e9dbd766c
2020-01-10 19:01:43 -08:00
Jun Wu
cbb65388aa changelog: add a way to write revlog.d to zstore
Summary:
The `00changelog.d` file contains commit data (user, date, message, but no
ordered parents).

By setting the `zstore` attribute on `changelog`, reads from `00changelog.d`
(aka. the `revision` method) are going to use `zstore` instead. Writes will
go to both `00changelog.d` and `zstore`.

Reviewed By: DurhamG, xavierd

Differential Revision: D18737258

fbshipit-source-id: fd1cf52a77fe396df66b77c4df77089326f5d4c2
2020-01-10 19:01:43 -08:00
svcscm
985e737cf1 Updating submodules
Summary:
GitHub commits:

9d5d3572ff
580df286d1
eff5e076f5
ca8733922f
b71bb506c6
7d2807a5e2
04ee36248f

Reviewed By: 2d2d2d2d2d

fbshipit-source-id: 5000cbfa99670c0bceb226bfd3a2f0badc1922f4
2020-01-10 17:41:00 -08:00
Jun Wu
6266e2cad6 tests: improve test reliability for parsing dates
Summary:
We have seen issues parsing '0' as date somehow passes on OSX, and parsing
'Apr 2018' fails on Windows with GitBash. Let's workaround the tests while
I'm going to find better fixes.

Reviewed By: xavierd

Differential Revision: D19353054

fbshipit-source-id: c0302071964191b97eea6572ffd985f831db6791
2020-01-10 15:46:17 -08:00
svcscm
9310643aae Updating submodules
Summary:
GitHub commits:

fc11ff8356
dbec7e7409
0b153ee71a
e9dbd21d73
6548a679a7
772d1e0e30

Reviewed By: 2d2d2d2d2d

fbshipit-source-id: d59e7621ded16afb67e08f989f52833fbc094303
2020-01-10 15:46:17 -08:00
svcscm
6f08cbd328 Updating submodules
Summary:
GitHub commits:

5922872e67
eb1fd069c5
5f89ff6ed3
f62edaf034
a4e4f219e8
51471c3f8a
23960b194b
fd8915edd9

Reviewed By: 2d2d2d2d2d

fbshipit-source-id: 4de07f641c5815402fa4b23bcdb75eb9008eab55
2020-01-10 12:13:19 -08:00
Stefan Filip
98fc586755 types: add helper method for generating repo paths in testutil
Summary:
Using RepoPath::arbitrary() has a high chance or producing a lot of different
top level directories. The helper method added by this change,
`generate_repo_paths` simulates directories having various files and several
directories.

Reviewed By: quark-zju

Differential Revision: D19321366

fbshipit-source-id: 5c1aec78b6157f3cbea3d0673b29b3a676de88c0
2020-01-10 11:12:41 -08:00
Stefan Filip
403e4ae594 manifest-tree: add basic benchmark
Summary: Basic benchmark that covers insert, remove, finalize and iterations.

Reviewed By: quark-zju

Differential Revision: D19204893

fbshipit-source-id: 3aafbf6d94a558d2fd4ae59190f6046dc7c5885e
2020-01-10 11:12:41 -08:00
Stefan Filip
526b029faf manifest: move TestStore to the testutil module
Summary:
The TestStore can be leveraged by methods outside the manifest-tree crate.
Anything that wants to instantiate a manifest for test purposes could
leverage it.

Reviewed By: quark-zju

Differential Revision: D19204894

fbshipit-source-id: 4ac42d09855c70f829feefc6c71dcdbf7211cae3
2020-01-10 11:12:41 -08:00
svcscm
88357d163a Updating submodules
Summary:
GitHub commits:

c1c5426018
42d18a93c4
a4e11e8721
25c971b0c3
b2ea65322f
e86573b6de
31d721301c
687119aeaf
25cad9547d
428862c045
95640f80d8
0e4db05b37
5cb83de9cc
4fdb800074

Reviewed By: 2d2d2d2d2d

fbshipit-source-id: bcd533c540c1170844dbf2b23538d72c95a0d304
2020-01-10 11:00:47 -08:00
Jun Wu
56b1f098dd bindings: move indexes and threading to bindings
Summary:
For some reason, our linker flag `-uinitthreading` no longer works in buck opt
build. This affects the `indexes` and `threading` Python extensions. Move them
to `bindings` to solve the problem.

Reviewed By: fanzeyi

Differential Revision: D19340538

fbshipit-source-id: 0c82b472f2916229d3c5e481954b69415b5b0dc2
2020-01-09 20:02:00 -08:00
Josh Rosenbaum
6239a21832 Add "Diff Number" column to "perfpipe_hg_commit_info"
Summary: I would like to link the Phabricator Diff Number to specific mercurial revisions.  After talking to Durham, the least invasive and best method for accomplishing this is to log the Phabricator Diff Number at runtime. Hence, whenever someone modifies the current commit, log the Phabricator Diff Number (when possible). The resulting table will theoretically have a map from "revision" -> "Phabricator diff number".

Reviewed By: DurhamG

Differential Revision: D19334379

fbshipit-source-id: eb04a8af4dbeb9a7e130a268fce8a6c5d26ebfa9
2020-01-09 17:15:13 -08:00
Durham Goode
3f40eff4b1 tracing: fix threshold check for long commands
Summary:
In the refactor to the new tracing framework, the threshold comparison
got changed and became a seconds-vs-milliseconds check, which therefore almost
never passes. Let's change it back to seconds-vs-seconds.

Reviewed By: quark-zju

Differential Revision: D19322203

fbshipit-source-id: d9cfb3854d3ee6b8c7ab5309544abd64af51027f
2020-01-09 16:04:17 -08:00
Durham Goode
376f5e4be9 split: fix updating back to original commit on exit
Summary:
D19114546 introduced a new rollback mechanism where it updates to the
original commit if the user quits. Unfortunatley it only did the update if the
user had made a commit, so if they exitted immediately before making a commit,
it left them on the wrong commit and all their changes are pending.

Reviewed By: quark-zju

Differential Revision: D19334201

fbshipit-source-id: c959096adfa3563894578436e8252c037b50e32c
2020-01-09 13:55:27 -08:00
Eric Niebler
a338113719 Remove folly's ColdClass, which was of dubious utility
Summary: `folly::cold_detail::ColdClass` was marking things (like `folly::Unexpected`) cold, but at the cost of inhibiting the inliner from doing its job. This is leading to bad codegen, which offsets any small wins we mind get for the `cold` attribute.

Reviewed By: yfeldblum

Differential Revision: D19324159

fbshipit-source-id: 7ed431b6c9d6e963c3bf438c707fa6cf6a38bf9d
2020-01-09 13:09:56 -08:00
Jun Wu
5da0c6903d util: switch to Rust time parsing
Summary:
The Rust bindings now provide a subset of time parsing features.  Replace the
old Python implementation. This has multiple benefits:
- Strong gurarnatee that Rust and Python behave the same.
- Parse relative time (ex. `5 minutes ago`)
- Parse date beyound i32 range (ex. >= year 2038)

Reviewed By: DurhamG

Differential Revision: D18946332

fbshipit-source-id: 721f47bc5b2835d7ca0a05ab34ea4faa1a411a4e
2020-01-09 11:51:31 -08:00
Jun Wu
6249b1713d hgtime: fix timezone handling converting local date
Summary:
If the user specifies a timezone-less date, ex. `2000-7-1`, it's incorrect
to use the same offset of `Local::now()`, because of daylight savings.

Fix it by going through proper type conversion.

Reviewed By: DurhamG

Differential Revision: D19179800

fbshipit-source-id: 6fd433757e7f6e4baf4625944d4061548a436f11
2020-01-09 11:51:30 -08:00
Durham Goode
1a3fe83b62 edenfs: remove automigrate on debugedenimporthelper
Summary:
This is causing a deadlock when an hg process takes the lock, accesses
an edenfs file, then eden launches debugedenimporthelper which also tries to
take the lock. Let's back it out for now.

Reviewed By: krallin

Differential Revision: D19331038

fbshipit-source-id: b8480c2e07079c3babeae8de48c02affa43188fc
2020-01-09 09:44:29 -08:00
Jun Wu
459ae48cef indexedlog: stabilize log::tests::test_repair_and_delete_content
Summary:
Previously, between 100 to 500 runs, the test is likely to fail:

  ---- log::tests::test_repair_and_delete_content stdout ----
  thread 'log::tests::test_repair_and_delete_content' panicked at 'assertion failed: `(left == right)`
    left: `"Verified first 141 entries, 999 of 1400012 bytes in log\nReset log size to 999\nIndex \"c\" is incompatible with (truncated) log\nRebuilt index \"c\""`,
   right: `"Rebuilt metadata\nVerified first 141 entries, 999 of 1400012 bytes in log\nReset log size to 999\nRebuilt index \"c\""`', src/log.rs:3414:9

The "Rebuilt metadata" part is missing.

This is because after D17742003, the end of `meta` is the `epoch`, which is a
random number. The test is rewriting the end of `meta` to corrupt it. That
has a chance to not corrupt the file. Change the test to corrupt the fixed
header of meta so it can always corrupt the file and therefore stabilize
the test.

Reviewed By: xavierd

Differential Revision: D19325087

fbshipit-source-id: 53d46c8a6cb9771582f8f37e27f185d303fde0ce
2020-01-09 08:48:47 -08:00
Xavier Deguillard
4322befcb0 remotefilelog: deduplicate prefetched filenodes
Summary:
The Rust Contentstore code assumes that the prefetch request doesn't contain duplicated
filenodes so let's do it on the Python side.

Reviewed By: quark-zju

Differential Revision: D19318847

fbshipit-source-id: 73375de60f4fb81021eba16506037984eebdf048
2020-01-09 07:47:00 -08:00
Xavier Deguillard
38139a9785 tests: make file fetching messages optional
Summary:
The Rust ContentStore will not print these, and in order to better understand
what tests are broken with it enabled, let's make them optional.

Reviewed By: quark-zju

Differential Revision: D19318848

fbshipit-source-id: 87a1da510b51adc40a0d08157925a990456d3e9c
2020-01-09 07:46:59 -08:00
Wez Furlong
a01a9ce0b2 getdeps: dyndeps: gracefully handle empty files
Summary:
Don't error out if we can't read the ELF/MACH-O header; just treat
it is not an object.

Reviewed By: chadaustin, simpkins

Differential Revision: D19253434

fbshipit-source-id: c5ecc7f0bc7a20e2611b7e2ff754355155f095da
2020-01-09 07:30:32 -08:00
Jun Wu
064068169b dag: rename slice to VertexName
Summary:
Per discussion, we decided to use "VertexName" as the struct name for things
like commit hashes, or the string names in tests (or the Mozilla DAG in tests).
Therefore, introduce a dedicated VertexName type and repalce all callsites to
use it.

`bytes::Bytes` is used so copying the `VertexName` is somewhat considered cheap.

This adds some overhead copying slices (and `Bytes` has some overhead). It
regresses the "building segments" benchmark from 673ms to 773ms, which seems
okay given the cleaner interface.

Reviewed By: markbt

Differential Revision: D19154905

fbshipit-source-id: 4c6d4eca67c11c10ed5f21999ccdc3f1b01695e8
2020-01-08 21:35:28 -08:00
Jun Wu
24f403368b patch: fix applying hunks to renamed files
Summary: Previously the patch logic cannot apply hunks to renamed files. Fix it.

Reviewed By: DurhamG

Differential Revision: D19271024

fbshipit-source-id: 8ba82587dd2f4b84a1d5c7e51c4c86a5e11f0ca0
2020-01-08 19:26:23 -08:00
Jun Wu
6ec68995a3 test-record: add test case for selecting chunks in a renamed file
Reviewed By: DurhamG

Differential Revision: D19271025

fbshipit-source-id: c7d39dc6ecb3bafc304e983366b2b2965e26c472
2020-01-08 19:26:23 -08:00
Jun Wu
94c7fc65d8 run-tests: share chg server for all tests
Summary:
Previously, each test uses a separate chg server, because there are different
states in different tests. So chg servers cannot be reused across tests.

Nowdays chg servers are more stateless, and can be shared for all tests.
Do that to reduce chg server startup overhead.

With this change, `./run-tests.py --time $(rg -l chg-compatible)` went down
from 4:57 to 4:04 on my devserver.

A configuration `--chg-sock-path` is added for advanced use-cases.

Reviewed By: DurhamG

Differential Revision: D18924911

fbshipit-source-id: c2f7d84ee4cbfb5d599cfdc0ab47f922fae4a67e
2020-01-08 19:24:05 -08:00
Jun Wu
232d5047cc dag: fix incorrect gca calculation
Summary: `gca(X) = gca(roots(X))`, not `gca(heads(X))`.

Reviewed By: sfilipco

Differential Revision: D19154907

fbshipit-source-id: 8d54992fbf5b03ce7ab2fbcc689c79351bf75947
2020-01-08 18:46:08 -08:00
Jun Wu
c6c4baa07e dag: redefine Id::{MIN, MAX} using Group
Summary:
Redefine Id::{MIN, MAX} using Group so Id::MAX.group() is a valid group.
Previously Id::MAX has an invalid group.

Reviewed By: sfilipco

Differential Revision: D19154908

fbshipit-source-id: 6108f02da786eb228a7d1b772ca5134c1ebb6f6b
2020-01-08 18:46:07 -08:00
Jun Wu
c4cd7df3b2 dag: extract logic calculating universal commits to a method
Summary:
Address review feedback on D18670160.

This also fixes the definition of "universal" a bit - the new code no longer
assumes there are only one head in the master group.

Reviewed By: sfilipco

Differential Revision: D19154906

fbshipit-source-id: 4fbf080354318300ce09dc7fba2dcc5f942b6308
2020-01-08 18:46:07 -08:00
Jun Wu
bcaff9062c dag: rebuild non-master id and segments if needed
Summary:
Add utilities to rebuild non-master ids and segments if necessary.

The `NamedDag` structure ensures indexes have 1:1 mapping.

Reviewed By: sfilipco

Differential Revision: D18838995

fbshipit-source-id: 4a48b183c182bd5e6336a2ca4973c36091fbbfd8
2020-01-08 18:46:07 -08:00
Jun Wu
28380e0272 dag: fix logic about avoiding unnecessary high level segments
Summary:
The check of "is this high level segment necessary or not" should be done
before dropping the last segment. This fixes an issue discovered in D18838992.

Reviewed By: sfilipco

Differential Revision: D19154904

fbshipit-source-id: fb4c83c39d66215bae168ad98e5cf78de91cc5a3
2020-01-08 18:46:06 -08:00
Jun Wu
d4eddd6b11 dag: use NamedDag in tests
Summary:
NamedDag is the high-level interface that is more interesting to test.

High-level segments are changed subtly because NamedDag syncs them to disk
first.

Reviewed By: sfilipco

Differential Revision: D18838992

fbshipit-source-id: c6a557e0a44a1d24320ea4a9e4283262f6f30f67
2020-01-08 18:46:06 -08:00
Jun Wu
2b4095e3fb indexedlog: fix warnings on Windows
Summary: Those warnings are not seen on POSIX build.

Reviewed By: sfilipco

Differential Revision: D19320441

fbshipit-source-id: feddf728eb9627834559b87d83e20f0afd9080c8
2020-01-08 18:11:38 -08:00
Jun Wu
dd79207c32 indexedlog: fix benchmarks
Summary: The `rand` APIs had changed. Update the benchmark code accordingly.

Reviewed By: sfilipco

Differential Revision: D19320122

fbshipit-source-id: 44c376b17afea52ecc548d79b44cbb50f7e9e567
2020-01-08 18:11:37 -08:00
Jun Wu
cfe135737b indexedlog: fix clippy issues
Summary: Fix issues reported by clippy.

Reviewed By: sfilipco

Differential Revision: D19320121

fbshipit-source-id: 58f6402eb2a4f52914a760299bdfa72e5a63b2e6
2020-01-08 18:11:37 -08:00
Durham Goode
2ad1e0ad7e eden: automigrate during debugedenimporthelper
Summary:
We had eden-backing repos that were using formats from years ago
because they never ran pull to trigger the automigrate. Let's automigrate as
part of debugedenimporthelper to keep these repos up-to-date.

Reviewed By: quark-zju

Differential Revision: D19320510

fbshipit-source-id: 475a6acf8748677de3183dfb5d4c6df7caca606d
2020-01-08 17:31:59 -08:00
Durham Goode
42e6ae2b55 tests: update case collision test for tag deprecation
Summary: The case collision test broke when I disabled tags.

Reviewed By: singhsrb

Differential Revision: D19321272

fbshipit-source-id: d59a0ad38b80f35931bbb4fb52e400d714ebbf37
2020-01-08 17:00:42 -08:00