Commit Graph

2456 Commits

Author SHA1 Message Date
Jun Wu
bb461d2240 dag: improve range calculation in repos with many heads
Summary:
If there are too many heads, the current `descendants` algorithm would visit
all "old" heads. For example, with this graph:

      head9999  (N9999)
     /
    Z (master)
    :
    : (many heads)
    :/
    : head2 (N2)
    :/
    C head1 (N1)
    |/
    B head0 (N0)
    |/
    A

`A::head9999` or `Z::head9999` will visit N0, N1, ..., N9999, because
`descendands_up_to` is provided with `max_id = N9999` and Z as a vertex in the
master group, is before N0 in non-master.  The current algorithm also means
`descendands_up_to` gets linearly slower as the user uses the repo more, which
is quite undesirable.

This diff changes `descendands_up_to` to take an `ancestors` set, which is
`::head9999` in this case, and iterate non-master flat segments in it. So it
will skip N0 to N9998 directly by finding the N9999 flat segment and only use
it. The number of heads will have a smaller impact on performance.

Another slowness is `draft::draft_heads`, if there are too many `draft_heads`,
the internal calculation of `::draft_heads` can be slow. Optimize it by
limiting `draft_heads` to `draft:`. Practically this affects `y::` revset as
`y::` is translated to `y::visible_heads` and `visible_heads` can be large.

`cargo bench --bench dag_ops -- '::-master'` shows significant difference:

Before:

  range (master::draft)                              18.112 s
  range (recent_draft::drafts)                        2.594 s

After:

  range (master::draft)                              72.542 ms
  range (recent_draft::drafts)                       14.932 ms

In my fbsource checkout there were 20k+ heads. The improvement of
`master::recent_draft` (`x::y`) is pretty visible, and `y::` is also improved:

    % lhg debugbenchmarkrevsets -m -x 'p1(min(7e8c86ae % master))' -Y 'draft() & 7e8c86ae' -e 'x::y' -e 'y::' --no-default
    # x:  168f5228e570fb6b2ff7f851bd82413102748d84  (p1(min(7e8c86ae % master)))
    # y:  7e8c86aec68ebc6e0b8254afcb381315991fd21c  (draft() & 7e8c86ae)

    # before
    | revset \ backend | segments | revlog | revlog-cpy |
    |------------------|----------|--------|------------|
    | x::y             |     17ms |  0.1ms |      0.5ms |
    | y::              |    3.3ms |  0.7ms |      1.3ms |

    # after
    | revset \ backend | segments | revlog | revlog-cpy |
    |------------------|----------|--------|------------|
    | x::y             |    0.2ms |  0.1ms |      0.6ms |
    | y::              |    1.0ms |  0.7ms |      1.3ms |

Reviewed By: sfilipco

Differential Revision: D23214387

fbshipit-source-id: 4d11db84cd28f4e04e8b991cbc650c9d5781fd27
2020-08-26 15:32:25 -07:00
Jun Wu
a3cbda76bb dag: add a benchmark for x::y with lots non-master heads
Summary:
Lots of non-master heads is not an exercised graph in the benchmarks.
Add it as it practically happens.  This will be used by the next change.

Reviewed By: sfilipco

Differential Revision: D23259879

fbshipit-source-id: 7fe290d14403e42e6d135bde56e2d5c8519ae530
2020-08-26 15:32:24 -07:00
Jun Wu
89570e223a dag: use non-master group in fuzz test
Summary:
Currently the fuzz test only uses the master group. Let it exercise non-master
group too.

Reviewed By: DurhamG

Differential Revision: D23214388

fbshipit-source-id: 7108a1055fbdda2b012f93c5948fb83ef3b9a96f
2020-08-26 15:32:24 -07:00
Jun Wu
293d53c12a repo: cache 'headrevs()'
Summary:
The calculation can take tens of milliseconds. Cache it.
Invalidate the cache on transaction commit.

This will improve perf on revsets like `descendants` that will use
`head()`.

Reviewed By: DurhamG

Differential Revision: D23196412

fbshipit-source-id: 2913310ebb97e1c0346198c1e2738799799c740a
2020-08-26 15:32:24 -07:00
Jun Wu
ded7c2e380 hgcommits: add explain_internals to print human-readable segments
Summary: Provide a way to see segments.

Reviewed By: sfilipco

Differential Revision: D23196408

fbshipit-source-id: b1418f945a5a3364ac73b0f97466d973dd4b6300
2020-08-26 15:32:24 -07:00
Jun Wu
9666dab916 dag: implement Debug for NameDag
Summary:
Provide a way to print out all segments with resolved names. This will be used
in a debug command.

Reviewed By: sfilipco

Differential Revision: D23196410

fbshipit-source-id: 1712bfda0271aa548699fe4a6b8603c5ec07af7f
2020-08-26 15:32:23 -07:00
Jun Wu
5829fc4e20 dag: children(small set) has a fast path
Summary:
Use the parent-child index to answer children query quickly.

`cargo bench --bench dag_ops -- children`:

Before:

  children (spans)                                  606.076 ms
  children (1 id)                                   124.105 ms

After:

  children (spans)                                  602.999 ms
  children (1 id)                                    10.777 ms

Reviewed By: sfilipco

Differential Revision: D23196411

fbshipit-source-id: 37195d5ccaa582d35314e0000352ef477287d38c
2020-08-26 15:32:23 -07:00
Jun Wu
a5a396027d dag: expose API to lookup children by parent
Summary: This will be used to optimize "children(single vertex)" query.

Reviewed By: sfilipco

Differential Revision: D23196409

fbshipit-source-id: 050c0859faf83b909e3174bb7c7bd6e7725165c0
2020-08-26 15:32:23 -07:00
Jun Wu
bad2ae41ef dag: maintain non-master parent-child indexes
Summary:
Update the parent index to store non-master group too. To make
"remove_non_master" work, the index contains a "child group" prefix that
allows efficient range invalidation.

This will allow answering "children(single vertex)" query more efficiently.

This diff does not expose an API to query the index yet.

Reviewed By: sfilipco

Differential Revision: D23196406

fbshipit-source-id: 9137da5ffa8306bdafbcabc06b6f0d23f38dcf57
2020-08-26 15:32:23 -07:00
Jun Wu
6c468b7ac0 dag: add benchmark about children(1 id)
Summary:
Practically, the input of `children` is often one vertex instead of a large set.
Add a benchmark for it.

It looks like:

  children (spans)                                  606.076 ms
  children (1 id)                                   124.105 ms

Reviewed By: sfilipco

Differential Revision: D23196407

fbshipit-source-id: 0645b59ac846836fd061386384f6386a57661741
2020-08-26 15:32:23 -07:00
Jun Wu
6f3616a2b8 nameset: make dag and idmap immutable in hints
Summary: They can be figured out at Hints initialization time. So they don't need to be mutable.

Reviewed By: sfilipco

Differential Revision: D23182518

fbshipit-source-id: 133375fdf27a2546a50b63fb130534acdadc5938
2020-08-26 15:32:22 -07:00
Jun Wu
682365f14d nameset: make Id{Static,Lazy}Set require Dag on construction
Summary:
Both IdSet and IdLazy set require both Dag and IdMap to construct.
This is step 1 torwards making Dag and IdMap immutable in hints.

A misspeall of "lhs" vs "hints" in the union set is discovered by the change
and fixed.

Reviewed By: sfilipco

Differential Revision: D23182520

fbshipit-source-id: 3d052de4b8681d3672ebc45d953d1e784f64b2a4
2020-08-26 15:32:22 -07:00
Jun Wu
3ba655abf3 dag: add DummyDag for testing
Summary:
It will be used in places (ex. tests) where a Dag is required but constructing
a real Dag is troublesome.

Reviewed By: sfilipco

Differential Revision: D23182517

fbshipit-source-id: 736911365778e5071c1e0b9615090a4e960392a0
2020-08-26 15:32:22 -07:00
Jun Wu
bd7769b34a dag: rename snapshot_dag to dag_snapshot
Summary: This is more consistent with `id_map_snapshot`.

Reviewed By: sfilipco

Differential Revision: D23182519

fbshipit-source-id: 62b7fc8bfdc9d6b3a4639a6518ea084c7f3807dd
2020-08-26 15:32:22 -07:00
Jun Wu
4d798c39d9 dag: add new range algorithm
Summary:
Similar to descendants, the new range algorithm avoids potentially expensive
checks about whether high-level segments can be used or not. Practically this
is overall an improvement.

`cargo bench --bench dag_ops -- range`:

Before:

  range (2 ids)                                     115.380 ms
  range (spans)                                     243.666 ms

After:

  range (2 ids)                                     123.274 ms
  range (spans)                                      23.101 ms

It is 100x faster with the range x::y benchmark added later on `git.git`.

Reviewed By: sfilipco

Differential Revision: D23106175

fbshipit-source-id: 691e0418ba2b7ad9f52ac15b5cd6088ec28d5f48
2020-08-26 15:32:22 -07:00
Jun Wu
c2e03b9129 dag: add new descendants algorithm
Summary:
The old algorithm tries to make use high-level segments.
However, the code to test whether a high-level segment can be used is
often too expensive for the benefit. Often, high-level segments cannot
be used most of the time and it's similar to O(flat segments).

This diff adds a simpler algorithm that just iterates through the flat
segments. It's faster in most practical cases.

`cargo bench --bench dag_ops -- descendants` shows improvements too:

Before:

  descendants (small subset)                        436.515 ms

After:

  descendants (small subset)                         33.460 ms

Reviewed By: sfilipco

Differential Revision: D23106174

fbshipit-source-id: e6101483d8539b2b1c881be2ccfd0071f122352f
2020-08-26 15:32:22 -07:00
Jun Wu
e22b816a12 dag: add iddag.iter_segments_ascending API
Summary: This will be used by upcoming changes.

Reviewed By: sfilipco

Differential Revision: D23106177

fbshipit-source-id: 9bf183f7464c06b801be64fd938db0babd544756
2020-08-26 15:32:21 -07:00
Jun Wu
0dcf08e509 dag: add SpanSetAsc struct
Summary: This internal struct will be used by upcoming changes.

Reviewed By: sfilipco

Differential Revision: D23106172

fbshipit-source-id: 6d5b9bc1c810984814d0912100acca38a2565a63
2020-08-26 15:32:21 -07:00
Durham Goode
201f63be32 build: rename third-party rust fbthrift crate
Summary:
Our internal build infra creates a workspace and workspaces don't like
it when two crates have the same name. Eden scm had third-party rust crates that
were simple redirects to the internal location, but had the same name. This
caused breakages once these crates became part of the edenfs open source build.
Let's rename them to avoid this issue.

Reviewed By: kulshrax

Differential Revision: D23252539

fbshipit-source-id: 9ff2fa160a19c6bc54e015c71f9da7044ce659a7
2020-08-26 12:26:21 -07:00
Durham Goode
2ab69d47f0 configs: disable chmod based test on Windows
Summary:
Windows doesn't seem to follow the same write permission rules, so
let's just skip that part of the test for now.

Reviewed By: xavierd

Differential Revision: D23348515

fbshipit-source-id: bfcfa4f8adf94413047b045987e570ba98f9078d
2020-08-26 09:19:35 -07:00
Stanislau Hlebik
d3ae17350c add hgcache size logger
Summary:
We'd like to keep track of hg cache size on users' machines. It's generally
useful, but it will be even more important with megarepo rollout. The job will be triggered by cron.

This is a very simple implementation, most of it was copy-pasted from
https://fburl.com/diffusion/g8ysyxo1.

Note that I intentionally didn't call hg to get hgcache size.
Since this binary will be triggered by cron, it will run as
root without a direct access to user's repository.

A few notes for the future:
1) Currentlly I'm planning to get hgcache path value from opsfiles.
I'm not sure if we'd need to change this  later when dynamic configs are fully
rolled out. CC DurhamG
2) We might want to track size of pack files (are they still used at all?) and
indexed log files separately

Reviewed By: ikostia

Differential Revision: D23341149

fbshipit-source-id: 2a600d7a8034ac887014788f1024fb9866c3ef76
2020-08-26 04:24:50 -07:00
Liubov Dmitrieva
50e7fd7ddd add enablestatus and enableprogress options to commitcloud
Summary:
Some user may think that the progress reporting is spammy, others can like it.
Make it configurable without disabling status completely.

We could explain the new config 'enableprogress' in the wiki for those who would like to disable the messages.

Also add 'enablestatus' under commitcloud section of config.

Reviewed By: markbt

Differential Revision: D23304206

fbshipit-source-id: 7735ae3284d19b9f1ea9da38b705a8932b34f91b
2020-08-26 02:51:37 -07:00
Liubov Dmitrieva
4f233b33f4 improve workspace information in hg cloud status
Summary:
It will be clearer to provide both names because all other commands (like `cloud
sl`, `cloud join`) use short names and if you would like to use the long one you would need to provide
'--raw-workspace' option and this is an advanced option.

Reviewed By: markbt

Differential Revision: D23274288

fbshipit-source-id: d751346a2e49cab21d1054eb196f7977c72c8764
2020-08-26 02:49:02 -07:00
Stefan Filip
72db1cbedb async-runtime: crate for async job scheduling from blocking threads
Summary:
We have a thread blocking application. We have async libraries. This crate
provides common utilities for communicating between the blocking world and the
async world. It is intended to be a guide so that not all developers have to
get in depth understanding of Tokio in order to use async functions.

Reviewed By: quark-zju, xavierd

Differential Revision: D23222876

fbshipit-source-id: b9a61795bc917bfc664c9d6da95c9e5e2d506c79
2020-08-26 00:57:32 -07:00
Arun Kulshreshtha
a99837c818 revisionstore: fix unused variable warnings on EdenApiStoreKind
Summary: The default method implementations on this trait were causing unused variable warnings. Prefix them with underscores to silence the warning and add `#![deny(warnings)]` to `revisionstore` to prevent future warnings from slipping through the cracks.

Reviewed By: singhsrb

Differential Revision: D23334309

fbshipit-source-id: d17b27ca0dd462e1613eac918fb595faa8637741
2020-08-25 21:53:22 -07:00
Durham Goode
8fa5577b30 tests: fix test-debugdynamicconfig.t again
Summary: My OSX fix broke Centos :(

Reviewed By: sfilipco

Differential Revision: D23331182

fbshipit-source-id: 07aa3f67f218e96f0021d10198aa4e0da0f6e2e8
2020-08-25 15:56:40 -07:00
David Tolnay
840e6dd6f6 edenapi: Unmanage Cargo.toml
Reviewed By: quark-zju

Differential Revision: D23329351

fbshipit-source-id: e07440a2ac5f93efda19e7a3c7d5e7ae18598c7d
2020-08-25 15:37:55 -07:00
Zeyi (Rice) Fan
619904bc69 re-implement normalize_windows_path
Summary: This diff fixes the issue that mkscratch does not build on Rust < 1.45.0

Reviewed By: xavierd

Differential Revision: D23325087

fbshipit-source-id: 7e737eb5bc0d75255a84c8ac353bf3a17c269300
2020-08-25 12:38:07 -07:00
Durham Goode
cbd1d445d0 tests: fix test-debugdynamicconfig.t
Summary:
This was just a dumb issue. I added a test that depended on the
previous logic which didn't run on OSX.

Reviewed By: kulshrax, singhsrb

Differential Revision: D23324601

fbshipit-source-id: 259175c91c9eb54e8350f196770ff967b53ee841
2020-08-25 11:59:32 -07:00
Durham Goode
18b20f4b24 configs: move dynamicconfig to be before system configs
Summary:
We want to eventually get rid of system and repo configs, but for now
they should take precedence over the dynamicconfigs. Previously we relied on
validation to remove any entries from dynamicconfig that interferes with a
system rc config, but in some code paths we didn't run that validation (like if
we loaded configs purely from Rust).

Let's just make dynamicconfig load before system configs. If validation doesn't
run, we might miss the case where dynamicconfig sets a value and the system rc
doesn't. But that's probably fine.

Reviewed By: quark-zju

Differential Revision: D23305711

fbshipit-source-id: 77b5f49d348cfa116694a641ed17e6d1184a81ab
2020-08-25 07:33:28 -07:00
Durham Goode
d643f48c8c configs: remove loaddynamicconfig option
Summary:
Dynamicconfigs are now part of our critical path. Let's remove the
option to not load them. This also let's us get rid of a circularl dependency
where loading dynamicconfigs required having already loaded some configs. This
will let us move dynammicconfig loading to be before system rc loading in a
later diff.

Reviewed By: sfilipco

Differential Revision: D23309090

fbshipit-source-id: 5138059a8ed944c3616007e7c1289b6a57be0e65
2020-08-25 07:33:28 -07:00
Durham Goode
a0184dde57 configs: validate config during all load paths
Summary:
An earlier diff moved all dynamicconfig loadding into Rust, but it lost
some of the config validation along the way. This allowed dynamicconfig values
to take precedence over system rcs when they shouldn't yet. Most notably the
remotefilelog.cachepath value.

Let's ensure validation is run on all load paths. A future diff will go a step
farther and move dynamicconfigs to be loaded before system configs so we can
ensure system configs always take precedence, until we can remove them entirely.

Reviewed By: quark-zju

Differential Revision: D23305712

fbshipit-source-id: 33a6b4c56d97fa2e2e8f3acc343a8a8868b797ef
2020-08-25 07:33:27 -07:00
Harvey Hunt
d7f58b3cfc python3: Don't access socket.error using an index to get errno
Summary:
Python 2's `socket.error` type provided a tuple of (errno, error
string) that could be used for identifying the specific error type. In Python 3
this was switched to an object that doesn't expose such an interface. As a
result, accessing `socket.error` using an index will cause an exception, such
as:

```
  File "/opt/fb/mercurial/edenscm/mercurial/keepalive.py", line 608, in safesend
    if v[0] == errno.EPIPE:  # Broken pipe
TypeError: 'BrokenPipeError' object is not subscriptable
```

Replace the use of indexing with accessing `.errno` instead, as this works for
both python 2 and python 3.

Differential Revision: D23294090

fbshipit-source-id: 5f901493c2db270817949d93840c6d469b17a560
2020-08-25 05:21:11 -07:00
Durham Goode
c42a494668 dynamicconfig: don't block read operations on dynamicconfig write permission errors
Summary:
Dynamicconfig was throwing errors if hgrc.dynamic wasn't writable.
Let's eat those errors for normal read operations. We still treat it as an error
for straight hg debugdynamicconfig invocations.

Reviewed By: quark-zju

Differential Revision: D23301100

fbshipit-source-id: ed0bd1282d2c7ee747f0909c238a5fa07b7bc9bc
2020-08-24 21:40:00 -07:00
Durham Goode
9b7b351ed9 configs: introduce test demonstrating permission denied error
Summary:
We've seen user reports of this error. Let's add a test to demonstrate
it. The next diff will fix it.

Reviewed By: sfilipco

Differential Revision: D23309612

fbshipit-source-id: 6fb9e4e65d3351fa29812fc75095d054465cfe13
2020-08-24 21:40:00 -07:00
Zeyi (Rice) Fan
7f0f310af3 handle extended-length on Windows
Summary:
On Windows, Rust's `std::fs::canonicalize` [1] will generate extended-length path that will include a `\\?\` prefix [2]. This has subsequently cause `encode` to generate a path that contains a question mark, which is an invalid path on Windows.

This diff teaches `encode` to handle extended-length path on Windows. It essentially converts the path back so it no longer contains the prefix.

[1] http://doc.rust-lang.org/1.45.2/std/fs/fn.canonicalize.html
[2] https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation

Reviewed By: wez

Differential Revision: D22956659

fbshipit-source-id: 54691e204d7cb481bdb40f62c6520c0f70c3f648
2020-08-24 21:38:12 -07:00
Durham Goode
4a8a5290e8 curses: eat curses error for weird inputs
Summary:
In python 3 curses sometimes throws an error when weird keys are
pressed. I'm not certain exactly what key causes the problem, but let's just
prevent all such errors from crashing the process.

Reviewed By: quark-zju

Differential Revision: D23310301

fbshipit-source-id: a9684ce6f690d0753ff9956ef9f13c330eb0a77b
2020-08-24 20:16:41 -07:00
Jun Wu
7872c44fdf configparser: stabilize tests
Summary:
Add locking for tests reading / mutating global env vars.
Restore HG_TEST_REMOTE_CONFIG after testing.

Reviewed By: DurhamG

Differential Revision: D23269862

fbshipit-source-id: d61141b25c923a059de07c3dc8479f3bee06dce7
2020-08-24 12:36:09 -07:00
Pavel Aslanov
69e57b232d fix panic in slice index
Summary:
Based on [user report](https://fb.workplace.com/groups/scm/permalink/3128221090560823/).
Note that slices in rust behave differently and if index exceeds slice size this will always be panic. My fix was based on assumption that behavior should be similar to python.

Reviewed By: quark-zju

Differential Revision: D23263922

fbshipit-source-id: 3d2a1a1b59f14e43b1f1a2b7102982b11637c0b4
2020-08-24 05:24:58 -07:00
Jun Wu
34df768136 log: add a config to simplify graphs
Summary:
This could help simplify the graph a lot for repos with lots of merges. For
example, logging tags on linux.git looks like:

  o                      fb893de3  Yesterday at 17:28  master
  ├─┬─┬─┬─┬─┬─┬─┬─┬─┬─╮
  ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ o  bcf87687  Aug 02 at 14:21  v5.8
  ╷ ╷ ╷ ╭─────┬─┬───┬─╯
  ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ o  92ed3019  Jul 26 at 14:14  v5.8-rc7
  ╷ ╷ ╷ ╭─────┬─┬─┬─╯
  ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ o  ba47d845  Jul 19 at 15:41  v5.8-rc6
  ╷ ╷ ╷ ╭─┬─┬─┬─┬─╯
  ╷ ╷ ╷ ╷ ╷ ╷ ╷ o  11ba4688  Jul 12 at 16:34  v5.8-rc5
  ╷ ╷ ╷ ╭─┬─┬─┬─╯
  ╷ ╷ ╷ ╷ ╷ ╷ o  dcb7fd82  Jul 05 at 16:20  v5.8-rc4
  ╷ ╷ ╷ ╭─┬─┬─┤
  ╷ ╷ ╷ ╷ ╷ o ╷  9ebcfadb  Jun 28 at 15:00  v5.8-rc3
  ╷ ╷ ╭─┬─┬─╯ ╷
  ╷ ╷ ╷ ╷ o   ╷  48778464  Jun 21 at 15:45  v5.8-rc2
  ╷ ╷ ╷ ╭─╯   ╷
  ╷ ╷ ╷ o     ╷                      b3a9e3b9  Jun 14 at 12:45  v5.8-rc1
  ╭─┬─┬─┼─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─╮
  ╷ ╷ o ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷  3d77e6a8  May 31 at 16:49  v5.7
  ╭─┬─┴───────┬───────────┬─┬───┬─╮
  ╷ o   ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷  9cb1fd0e  May 24 at 15:32  v5.7-rc7
  ╷ ╰─────────┬─────────────┬─┬─┬─╮
  ╷     ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ o  b9bbe6ed  May 17 at 16:48  v5.7-rc6
  ╭───────────┬─────────────┬─┬─┬─╯
  ╷     ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ o  2ef96a5b  May 10 at 15:16  v5.7-rc5
  ╭───────────┬─────────────┬─┬─╯
  ╷     ╷ ╷ ╷ o ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷  0e698dfa  May 03 at 14:56  v5.7-rc4
  ╭───────────┴───────────┬─┬─╮
  o     ╷ ╷ ╷   ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷  6a8b55ed  Apr 26 at 13:51  v5.7-rc3
  ╰─────────────────┬───────┬─╮
        ╷ ╷ ╷   ╷ ╷ ╷ ╷ ╷ ╷ ╷ o  ae83d0b4  Apr 19 at 14:35  v5.7-rc2
        ╷ ╷ ╷   ╷ ╷ ╷ ╷ ╷ ╷ ╭─┤
        ╷ ╷ ╷   ╷ ╷ ╷ ╷ ╷ ╷ o ╷  8f3d9f35  Apr 12 at 12:35  v5.7-rc1
  ╭─┬─┬───────┬─────┬─┬─┬─┬─┼─╮
  ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ o ╷ ╷  7111951b  Mar 29 at 15:25  v5.6
  ╷ ╭─────────┬─────┬─┬─┬─┴───╮
  ╷ ╷ ╷ ╷ ╷ ╷ o ╷ ╷ ╷ ╷ ╷   ╷ ╷  16fbf79b  Mar 22 at 18:31  v5.6-rc7
  ╷ ╷ ╭───────┴─────┬─┬─┬─────╮
  ╷ ╷ ╷ ╷ ╷ ╷   ╷ ╷ ╷ ╷ ╷   ╷ o  fb33c651  Mar 15 at 15:01  v5.6-rc6
  ╷ ╭─┬─────────────┬─┬─┬─────╯
  ╷ ╷ ╷ ╷ ╷ ╷   ╷ ╷ ╷ ╷ o   ╷  2c523b34  Mar 08 at 17:44  v5.6-rc5
  ╷ ╭─┬─────────────┬─┬─╯   ╷
  ╷ ╷ o ╷ ╷ ╷   ╷ ╷ ╷ ╷     ╷  98d54f81  Mar 01 at 14:38  v5.6-rc4
  ╷ ╭─┴─────────────┬─╮     ╷
  ╷ ╷   ╷ ╷ ╷   ╷ ╷ ╷ o     ╷  f8788d86  Feb 23 at 16:17  v5.6-rc3
  ....

And with simplification turned on, it looks like:

  o    fb893de3  Yesterday at 17:28  master
  ├─╮
  o ╷  bcf87687  Aug 02 at 14:21  v5.8
  ╷ ╷
  o ╷  92ed3019  Jul 26 at 14:14  v5.8-rc7
  ╷ ╷
  o ╷  ba47d845  Jul 19 at 15:41  v5.8-rc6
  ╷ ╷
  o ╷  11ba4688  Jul 12 at 16:34  v5.8-rc5
  ╷ ╷
  o ╷  dcb7fd82  Jul 05 at 16:20  v5.8-rc4
  ╷ ╷
  o ╷  9ebcfadb  Jun 28 at 15:00  v5.8-rc3
  ╷ ╷
  o ╷  48778464  Jun 21 at 15:45  v5.8-rc2
  ├─╯
  o  b3a9e3b9  Jun 14 at 12:45  v5.8-rc1
  ╷
  o  3d77e6a8  May 31 at 16:49  v5.7
  ╷
  o  9cb1fd0e  May 24 at 15:32  v5.7-rc7
  ╷
  o  b9bbe6ed  May 17 at 16:48  v5.7-rc6
  ╷
  o  2ef96a5b  May 10 at 15:16  v5.7-rc5
  ╷
  o  0e698dfa  May 03 at 14:56  v5.7-rc4
  ╷
  o  6a8b55ed  Apr 26 at 13:51  v5.7-rc3
  ╷
  o  ae83d0b4  Apr 19 at 14:35  v5.7-rc2
  ╷
  o  8f3d9f35  Apr 12 at 12:35  v5.7-rc1
  ╷
  o  7111951b  Mar 29 at 15:25  v5.6
  ╷
  o  16fbf79b  Mar 22 at 18:31  v5.6-rc7
  ╷
  o  fb33c651  Mar 15 at 15:01  v5.6-rc6
  ╷
  o  2c523b34  Mar 08 at 17:44  v5.6-rc5
  ╷
  o  98d54f81  Mar 01 at 14:38  v5.6-rc4
  ╷
  o  f8788d86  Feb 23 at 16:17  v5.6-rc3
  ....

Under the hood, the difference is how `reachableroots` gets calculated.
See also D22657197 (a5c36fd0b1) and D22368827 (da42f2c17e).

Since the old behavior almost always seems confusing to human. The new
config is turned on by default (but only takes effect if the "segments"
backend is used).

Reviewed By: sfilipco

Differential Revision: D23095468

fbshipit-source-id: f0fc631d2d9a00e3b36744e4236b43d230d10687
2020-08-21 17:10:36 -07:00
Mark Thomas
b9c0772f2f commitcloud: handle missing optional fields
Summary:
The files in commit cloud `References` structures are optional.  Handle them
not being present.

Reviewed By: quark-zju

Differential Revision: D23266786

fbshipit-source-id: ed7128bc7e6b762d3509d77b40a00b77885191b9
2020-08-21 13:52:02 -07:00
Jun Wu
e7f3167810 hgcommands: show milliseconds on RUST_LOG output
Summary: This makes it a bit easier to track down perf issues printed by RUST_LOGs.

Reviewed By: sfilipco

Differential Revision: D23095463

fbshipit-source-id: 78221a1992389f512fac6e6e633be6d19123e04a
2020-08-21 13:00:45 -07:00
Jun Wu
b4c9b6a7a1 test-git-changelog: fix the test on Windows
Summary:
Use `git config core.autocrlf false` to silent warnings like:

```
   $ git add alpha
+  warning: LF will be replaced by CRLF in alpha.
+  The file will have its original line endings in your working directory
```

Reviewed By: sfilipco

Differential Revision: D23270146

fbshipit-source-id: af3bf241edb9f615bcc285b51cc491385f208039
2020-08-21 13:00:45 -07:00
Liubov Dmitrieva
56e9cd9ed7 add undelete workspace command
Summary: The command is needed to restore a deleted workspace

Reviewed By: markbt

Differential Revision: D23250376

fbshipit-source-id: e24a7cbc0aad004291853b4c34d7474789aa9c2b
2020-08-21 13:00:45 -07:00
Jun Wu
d7cbb641ff dag: fix fuzz tests
Summary:
The fuzz tests need `TestContext::id_dag()`, which was removed by D20471712 (1fb5acf242).
Restore it so fuzz tests can run. This is mainly to check the new `range`
function.

The `range` fuzz test does find an issue caused by `>` written as `>=`
relatively quickly.

Reviewed By: sfilipco

Differential Revision: D23106176

fbshipit-source-id: e9540cc932503a9d54246d24c70bac829fcb13df
2020-08-21 13:00:45 -07:00
Jun Wu
60ebf5c2a0 changelog2: add SHA1 verification
Summary: Ensure that the commit text is verified, but do not verify git hashes.

Reviewed By: DurhamG

Differential Revision: D23095464

fbshipit-source-id: e62341f6c7258c6f18b7cc75088c25dfc7040ab1
2020-08-21 13:00:45 -07:00
Jun Wu
0dc28f689f changelog2: initial support for segmented git changelog
Summary:
The immediate goal is to run benchmarks on a commit graph provided by a git
repo without converting a whole (large) repo from git to hg. Note git repos can
be cloned in a shallow way so it only contains the commit graph. For example:

  git clone https://github.com/torvalds/linux --filter=tree:0 -n

Note: The above command writes repositoryformat=1 in `.git/config`
which is not supported by libgit2. Manually editing it to repositoryformat=0
would enable libgit2 to read it for this crate's use-case.

In the longer term we might want to extend the support so refs/trees/files can
be read/written directly via the git repo based on this work. However that's
currently beyond scope.

Reviewed By: DurhamG

Differential Revision: D23095467

fbshipit-source-id: 868beb0c7de60453b47962639863eb8f7e3f5753
2020-08-21 13:00:45 -07:00
Jun Wu
749602e534 hgcommits: add gitsegments backend
Summary:
The backend translates git commit graph to segments. It's useful for
benchmarking on git commit graphs.

Reviewed By: DurhamG

Differential Revision: D23095470

fbshipit-source-id: 21a28869e91ef8f38bbf9925443eb4ac26f05e3d
2020-08-21 13:00:45 -07:00
Jun Wu
d352133d6d hgcommits: use concrete error types
Summary: Migrate to concrete types so it can be typechecked.

Reviewed By: DurhamG

Differential Revision: D23095469

fbshipit-source-id: 27c6da30ca8a1329df544cd2ded7d9734593e48a
2020-08-21 13:00:45 -07:00
Jun Wu
e5527715b7 gitdag: crate to build segmented dag from git history
Summary:
Read git commit graph and migrate them to `dag::Dag`.

This allows using Rust dag abstractions on the git
commit graph.

Reviewed By: DurhamG

Differential Revision: D23095471

fbshipit-source-id: 2163701350ce82ce6e97074e56ad5877f3c9c158
2020-08-21 13:00:45 -07:00