Commit Graph

1501 Commits

Author SHA1 Message Date
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
Jun Wu
921fc702ee py3: enable some rebase tests
Reviewed By: xavierd

Differential Revision: D20929674

fbshipit-source-id: d43e7525ce8e4c599c0db962f8e8d64ce955d9d8
2020-04-09 13:20:37 -07:00
Jun Wu
ed8a5b548b py3: fix test-rebase-inmemory-mergedriver-exception.t
Reviewed By: xavierd

Differential Revision: D20929678

fbshipit-source-id: 29d4cf9a65c27b19e8504aa8260da2933aeb8342
2020-04-09 13:20:37 -07:00
Jun Wu
ef96a72aa6 py3: fix test-rebase-inmemory-conflicts.t
Reviewed By: xavierd

Differential Revision: D20929676

fbshipit-source-id: 7fbab661c14a51165959018877cc516512347c85
2020-04-09 13:20:37 -07:00
Jun Wu
ab6c8cf9ac py3: fix test-rebaes-conflicts.t
Reviewed By: xavierd

Differential Revision: D20929677

fbshipit-source-id: 7e1a67b78b6eaaea8edb9a1a1241001d9f57f0f6
2020-04-09 13:20:36 -07:00
Jun Wu
95b639358c tests: fix test-rebase-brute-force.t
Summary: Removing b prefix fixes it.

Reviewed By: xavierd

Differential Revision: D20929675

fbshipit-source-id: b90d863dc4aa28abad89926842541f4d3fe3926f
2020-04-09 13:20:36 -07:00
Jun Wu
30250709b0 py3: fix test-absorb-t.py
Reviewed By: xavierd

Differential Revision: D20928613

fbshipit-source-id: 510b8e833d86399872248859d8910b70d7b2c741
2020-04-09 13:20:36 -07:00
Jun Wu
db7377ae0c py3: fix test-fb-hgext-absorb-filefixupstate.py
Reviewed By: xavierd

Differential Revision: D20928614

fbshipit-source-id: beafe9a1aa260e1ac398056e93795c5231139a06
2020-04-09 13:20:35 -07:00
Jun Wu
224f9f11df py3: fix test-autofix.t
Reviewed By: xavierd

Differential Revision: D20928615

fbshipit-source-id: daec7955957f9995d7ee87378b2e3ddf60932d07
2020-04-09 13:20:35 -07:00
Jun Wu
aefe6291fe py3: fix test-ancestor.py
Reviewed By: xavierd

Differential Revision: D20926780

fbshipit-source-id: 1c09b72c00c690289d707f09a468cc4c0fe56eb1
2020-04-09 13:20:35 -07:00
Jun Wu
0464407c68 py3: fix some absorb tests
Reviewed By: singhsrb

Differential Revision: D20926397

fbshipit-source-id: 264a7a8598b6a59678a2f8cacfe5dae6887bd928
2020-04-09 13:20:34 -07:00
Durham Goode
f31d9f1f89 py3: fix streaming clone and bundle output
Summary: Makes test-bundle.t pass in python3

Reviewed By: quark-zju

Differential Revision: D20923758

fbshipit-source-id: 5e874cedc8419e87d1f9024c575ee6928805fad6
2020-04-09 09:23:54 -07:00
Xavier Deguillard
61e146d2ab patch: fix binhunk
Summary: The binhunk is for binary data, therefore we need to use byte strings.

Reviewed By: xavierd

Differential Revision: D20290069

fbshipit-source-id: 9cd763b76df389a1f7b65aecf0be4aa36a85cf91
2020-04-09 09:23:54 -07:00
Xavier Deguillard
3622204e43 util: keep bytesinput as unicode based
Summary:
On python3, no need to replace stdin/stdout with a bytes based one, keep them
as is.

Reviewed By: xavierd

Differential Revision: D20290068

fbshipit-source-id: b10b69185a52c79e7c67f69f6a8a96937c64a550
2020-04-09 09:23:53 -07:00
Durham Goode
df37fef5b3 py3: fix test-basics.t
Summary: Simple fix to output bytes

Reviewed By: xavierd

Differential Revision: D20921348

fbshipit-source-id: befa8abab0a7943fd2d20614dcacf3ef25f1e9ba
2020-04-09 09:23:53 -07:00
Xavier Deguillard
9583563bf2 tests: fix test-fb-hgext-crdump.t in Python3
Summary: The .encode('hex') isn't available in Python3, codecs.encode needs to be used.

Reviewed By: DurhamG

Differential Revision: D20927989

fbshipit-source-id: cd0ecdbcbf0ab6391b37f44e7b38a3ffabf91340
2020-04-09 09:10:58 -07:00
Xavier Deguillard
19556ad7d7 tests: enable tests that are now passing in python3
Reviewed By: DurhamG

Differential Revision: D20927681

fbshipit-source-id: f94efe77ce2d4b1377f7f210493678858ba5eae1
2020-04-09 09:10:57 -07:00
Xavier Deguillard
935b80f837 templater: diff is returning bytes chunks
Summary:
Not sure if this is the proper solution, but the template engine refuse to work
with anything but utf8 strings, but the diff operation only work on bytes.
Let's convert the return of diff to utf-8.

Reviewed By: DurhamG

Differential Revision: D20927680

fbshipit-source-id: 25c2947cac417448ca3521c2d5478fa8eebef04f
2020-04-09 09:10:57 -07:00
Xavier Deguillard
6dadf6fdd9 node: use binascii.Error in Python3
Summary:
In Python3, the error returned from binascii.unhexlify changed, from a generic
TypeError to a binascii.Error. Therefore, wrap the binascii function and catch
the binascii.Error before raising a TypeError.

Reviewed By: DurhamG

Differential Revision: D20924129

fbshipit-source-id: 33f852ea97396af715ef73630e0dd1b4324eb707
2020-04-08 23:46:09 -07:00
Stefan Filip
25fd8b9034 py3: fix test-hint.py
Summary:
I can't say that I understand `mdiff.splitnewlines`. In my test it does not
behave the way it reads and I don't know why. The stripping that it's supposed
to do doesn't happen for some reason. It behaves like splitlines.
I believe that rcutil used '\n' for line termination because it was relying on
Python to do the conversion to system line end. I updated to use os.linesep
now that we encode the contents.

Reviewed By: quark-zju

Differential Revision: D20935377

fbshipit-source-id: 0958fdff03950ab0a4b2da02e4333b5438ac5c70
2020-04-08 22:00:35 -07:00
Stefan Filip
5afca4fadd py3: fix test-manifest.py
Summary:
Bytes and Str usages mostly. __iter__ seems to have been incorrectly
converted to python 3 previously.

Reviewed By: xavierd

Differential Revision: D20933166

fbshipit-source-id: 10e63e90bd83c70a51dd808e9b5073ab8d766e71
2020-04-08 19:14:15 -07:00
Xavier Deguillard
76ecec0e57 bisect: make it python3 compatible
Summary: We should read/write to it via as utf8.

Reviewed By: DurhamG

Differential Revision: D20923404

fbshipit-source-id: 86cdc329395d60c88637f24d3c7c5caedcc7111a
2020-04-08 19:08:51 -07:00
Jun Wu
0b5a4ae2c3 cpython-ext: infer errno from io::ErrorKind
Summary:
Sometimes the Rust io::Error is generated without an errno (ex. pipe
0.2 would generate BrokenPipe error without an errno). The Python
land uses errno to check error type (Python does not have io::ErrorKind).

Therefore attempt to translate ErrorKind to Python errno. Without this
exiting the rust pager early would crash like:

  StdioError: [Errno None] pipe reader has been dropped
  abort: pipe reader has been dropped

Reviewed By: markbt

Differential Revision: D20898559

fbshipit-source-id: ef863617e0e500d878ea0f9aeac06b4d87ffbcf2
2020-04-08 13:13:08 -07:00
Lukas Piatkowski
c7d12b648f mononoke/mercurial: make revlog crate OSS buildable
Reviewed By: krallin

Differential Revision: D20869309

fbshipit-source-id: bc234b6cfcb575a5dabdf154969db7577ebdb5c5
2020-04-08 09:49:11 -07:00
Mark Thomas
c02f38dfb7 mutation: public commits are never obsolete
Summary:
The computation of commit obsolescence is inconsistent.  If we compute the full
set of obsolete commits in `mutation.obsoletecache.obsoletenodes`, then we
correctly ignore public commits as they cannot be obsolete.

However, if we compute the obsolescence state for a single public commit with
`mutation.obsoletecache.isobsolete`, and that commit somehow has a visible
successor, then we will incorrectly consider the commit as obsolete.

Similarly, `allpredecessors` and `allsuccessors` should stop when they hit a
public commit.

Reviewed By: quark-zju

Differential Revision: D20892778

fbshipit-source-id: 223cb8b2bc9f2f08124df6ff51c2eb208bb8eb5f
2020-04-08 06:33:14 -07:00
Jun Wu
4d951d777b util: add more APIs for pytracing
Summary: This makes the tracing features easier to use.

Reviewed By: DurhamG

Differential Revision: D19797703

fbshipit-source-id: fb5cb17cd389575cf0134a708bcd9df3b90e9ab4
2020-04-07 21:35:31 -07:00
Xavier Deguillard
d5793b1796 colors: do not disable colors in the pager
Summary:
Somehow, enabling VT can fail when writing to the pager, but this doesn't
mean that the pager doesn't support VT mode, so let's just ignore the error
when the pager is active.

Reviewed By: DurhamG

Differential Revision: D20906374

fbshipit-source-id: 7cba52817bc8e4dc91d5d50e856ad8af7fc9542c
2020-04-07 19:36:55 -07:00
Jun Wu
e6fb421769 tests: add a hint about how to set up HGRCPATH for --keeptmp
Summary: Print out a command that can be copied and executed to make `--keeptmp` more handy.

Reviewed By: sfilipco

Differential Revision: D20829140

fbshipit-source-id: 7976e3f64fd423425ec29634a53a34f7b5e091d0
2020-04-07 19:21:06 -07:00
Jun Wu
5a69be9e70 commands: add debugvisibleheads
Summary:
Add a command to print visibleheads. This was part of my attempt to check if
visibleheads can accidentally include public commits and if there are a way
to remove it. I ended up thinking D20808884 might actualy solve the only case
that visibleheads include public heads.

I also tried to add strong verification so that the visibility layer never
writes public nodes. That's for non-narrow-heads use-cases. However, the
phasescache + repoview layer is kind of messy in a way that inside a
transaction there is only one "repo" that has the right in-memory, dirty
"phasescache" and other repos will load the (stale, wrong) phasescache from
disk. That means if we test phases in visibility before transaction flushes,
we won't be able to access the latest phases information correctly. So I
gave up this approach too.

Anyway, I wasn't able to add a new interesting test, but the utility built for
the test seems useful. Therefore this change.

Reviewed By: sfilipco

Differential Revision: D20829136

fbshipit-source-id: 5ebafefac820ebb4044db63b7892ffaa341c0573
2020-04-07 19:10:45 -07:00
Jun Wu
bd55a2e946 phrevset: improve error message if the commit hash is not found
Summary:
Make the error cleaner and more actionable. We don't autopull the commit
because the revset layer might be not ready for it (ex. it expects commit
graph to be immutable and might have done some calculations based on the
old graph already).

Reviewed By: sfilipco

Differential Revision: D20845159

fbshipit-source-id: c51f2f52c612ff14a88fb891c10d1faad1094635
2020-04-07 19:05:05 -07:00
Jun Wu
a06922ec0f phrevset: rename getdiff, finddiff to graphqlgetdiff, localgetdiff
Summary: This makes it easier to reason about.

Reviewed By: sfilipco

Differential Revision: D20845158

fbshipit-source-id: 4220c7790a2d3bb83380b65d3de469b42846b34d
2020-04-07 19:05:04 -07:00
Jun Wu
67bbd46027 phrevset: add a config to enforce querying Phabricator
Summary:
The old linear changelog search does not scale and does not work with segmented
changelog, which makes commit data lazy. The "forksearch" is also problematic as
it can produce non-deterministic results. Let's disable the linear search by
default with the intention to remove it if nobody complains.

Reviewed By: sfilipco

Differential Revision: D20845161

fbshipit-source-id: 6911035f146e15c88925217ee9940db59ea2d1c1
2020-04-07 19:05:04 -07:00
Jun Wu
42b1577340 context: provide what commit it is when we cannot load the manifest
Summary:
The manifest node is hard for debugging. Attach the commit as the context and
print it out.

Reviewed By: sfilipco

Differential Revision: D20829139

fbshipit-source-id: ff65d902f56bc79c2d5f2c3ec9cf79a620fd70fc
2020-04-07 19:05:03 -07:00
Jun Wu
35659be2a5 error: add a way to provide context to errors
Summary:
This allows providing context about errors, similar to Rust's "context"
features.

Reviewed By: sfilipco

Differential Revision: D20845160

fbshipit-source-id: 789a4c1b7356fd6eb4b1bcb71efd205d2d45e984
2020-04-07 19:05:03 -07:00
Xavier Deguillard
018e33237a revisionstore: upload local blobs
Summary:
On upload, read all the local blobs and upload them to the LFS server. This is
necessary to support `hg push` or `hg cloud sync` for local LFS blobs.

One of the change made here is to switch from having the batch method return an
Iterator to having them take a callback. This made it easier to write the gut
of the batch implementation in a more generic way.

A future change will also take care of moving local blobs to the shared store
after upload.

Reviewed By: DurhamG

Differential Revision: D20843136

fbshipit-source-id: 92d34a0971263829ff58e137e9905b527e18358d
2020-04-07 16:53:34 -07:00
Xavier Deguillard
0dca734464 revisionstore: add upload to RemoteDataStore
Summary: This method will be used to upload local LFS blobs to the LFS server.

Reviewed By: DurhamG

Differential Revision: D20843137

fbshipit-source-id: 33a331c42687c47442189ee329da33cb5ce4d376
2020-04-07 16:53:34 -07:00
Xavier Deguillard
80b222c01b revisionstore: use loose files for file backed LFS remote
Summary:
Loose files makes it easier to interact with a Mercurial server for tests, use
it instead of an IndexedLog.

Reviewed By: DurhamG

Differential Revision: D20786432

fbshipit-source-id: 61c1fc601d9a6ed157c5add9748e40840b081870
2020-04-07 16:53:34 -07:00
Jun Wu
6a09828a7f pager: add "internal:streampager" as an option to use the Rust pager
Reviewed By: DurhamG

Differential Revision: D20887175

fbshipit-source-id: 6b4cec2ce83578fe39bc3058d09cbb42b32a9d78
2020-04-07 15:57:07 -07:00
Jun Wu
a4a21b72d1 pager: add bindings to expose Rust's pager features to Python
Summary:
This exposes the Rust's pager to Python. Right now it's using the system
terminal.

Reviewed By: DurhamG

Differential Revision: D20887174

fbshipit-source-id: c72f31a58475e76f8097c515dd29f911d2ac4df1
2020-04-07 15:57:07 -07:00
Jun Wu
817f748113 debugindexedlogdump: output in a streaming way
Summary:
Do not convert the entire output to a string. This makes `debugindexedlog dump`
a good test case for native pager support - it takes a while to write the full
output for a large input.

Reviewed By: DurhamG

Differential Revision: D20885567

fbshipit-source-id: 35ed8f68dff1916f0833577c3cf2a52cbf2a658c
2020-04-07 15:57:06 -07:00
Jun Wu
52bb1ab77e clidispatch: add start_pager API for IO
Summary:
Implement the core API to start pager in native Rust. For now it is only
enabled for the entire command if `--pager=always` is set.

Reviewed By: DurhamG

Differential Revision: D20849644

fbshipit-source-id: 860b4e18d841da607864c3447d78dbac126f5f18
2020-04-07 15:57:06 -07:00
Jun Wu
9715911327 templatekw: fix predecessors with only mutation enabled
Summary: The template should use mutation instead of obsutil if mutation is enabled.

Reviewed By: markbt, simpkins

Differential Revision: D20901109

fbshipit-source-id: a2b587ddf2a03965886f753e54e075d5d9064f05
2020-04-07 15:11:30 -07:00
Stefan Filip
d1ba21803a version: warn users when they are running an old build
Summary:
Old is defined by being based on a commit that is more than 30 days old.
The build date is taken from the version string.
One observation is that if we fail to release in more than 30 days then all
users will start seeing this message without any way of turning it off. Doesn't
seem worth while to add a config for silencing it though.

Reviewed By: quark-zju

Differential Revision: D20825399

fbshipit-source-id: f97518031bbda5e2c49226f3df634c5b80651c5b
2020-04-07 14:25:38 -07:00
Mark Thomas
5499a6cbfd commitcloud: don't add deleted remotebookmarks to the set of new remote bookmarks
Summary:
When syncing, if the local copy of the remote bookmark is `None` then the
remote bookmark has been deleted, and shouldn't be added to the set of new
remote bookmarks.

Reviewed By: DurhamG

Differential Revision: D20855909

fbshipit-source-id: 84a7a78ec0ab179e4a14d946b37f496f3dbde03a
2020-04-07 09:33:05 -07:00
Thomas Orozco
c6aa2d3125 globalrevs: verify that convert_revision is a svnrev when falling back
Summary:
When falling back to convert_revision to get the svnrev for a commit to return
it as a globalrev, it seems like it would make sense to verify that the
convert_revision is indeed a svnrev (and not, say, a git commit hash from
hggit).

Reviewed By: farnz

Differential Revision: D20891268

fbshipit-source-id: 2451ad787fcce7b10b6a405f2855313ca51f5b3e
2020-04-07 06:47:26 -07:00
Jun Wu
5f8e89f1e2 tests: simplify test-commitcloud-sync-rb-enabling2.t
Summary:
Use modern utilities for this test. This makes the setup portion much shorter.

The test content changed a bit as the configuration is changed - both clients
have selectivepull enabled.

Reviewed By: sfilipco

Differential Revision: D20829137

fbshipit-source-id: d2f29d162172e149d7140925e7d3801707484df2
2020-04-06 14:29:57 -07:00
Jun Wu
59f7c9532d tests: add more utilities to tinit.sh
Summary:
This makes writing tests easier.

It was part of D20504732.

Reviewed By: sfilipco

Differential Revision: D20829138

fbshipit-source-id: e9309e099a13d0a509eff707ae229bf8b7a9c231
2020-04-06 14:29:57 -07:00
Jun Wu
ea0ffd3607 treemanifest: make post-pull prefetch non-fatal
Summary:
Similar to D19957251, failing to prefetch trees post-pull is not a fatal error.
This recently became an issue because with these conditions:

- We're migrating a repo from hg to Mononoke, and Mononoke has lagged
  bookmarks, esp. remote/master.
- We're still using Mercurial to serve infinitepush pulls (ex. scratch
  bookmarks). Mercurial will return bookmarks that are not synced to
  Mononoke yet.
- I made a recent change (D20531121) that moves selectivepull logic that
  changes `pull -r HASH` to `pull -r HASH -B master` to core. The CI
  tier didn't have selectivepull enabled that will pull bookmarks, but
  now they also pull bookmarks.
- The tree prefetch logic uses unpatched paths.default to fetch `master`,
   which can be an unknown commit for Mononoke.

Ideally, the final state is to rely on Mononoke for everything. There is
only `paths.default` which points to Mononoke. For now, as a temporary
fix let's just make post-pull tree prefetch non-fatal. Once this happens,
it will be logged to the cloud table with fatal=false.

Reviewed By: krallin

Differential Revision: D20873599

fbshipit-source-id: 291a2dc41c7c602f004ad8df71e19a48a98e9c5e
2020-04-06 14:04:51 -07:00
Jun Wu
a7c7d37443 sparse: print warnings for sparse profile typos
Summary:
This makes it easier to spot typos.

The config sparse.missingwarning affects everytime a sparse profile is used.
In this case we just want to check at "enableprofile" time. So avoid using
that config option.

Reviewed By: DurhamG

Differential Revision: D20846313

fbshipit-source-id: 79f80d5e01abfe1633f2597074e9acb5cda60fec
2020-04-06 13:57:48 -07:00
Xavier Deguillard
ffc487e2de color: do not try to enable VT mode for tests
Summary:
Tests are redirected, but we still want colors in them (to verify that ANSI
escape code works). Since VT mode will always fail, simply do not try to
enable it in this case.

Reviewed By: DurhamG

Differential Revision: D20875423

fbshipit-source-id: bd6b0046de9558d957e0df082d4392ad00e0b551
2020-04-06 13:07:52 -07:00
Xavier Deguillard
46d13ee650 ui: cache formatted
Summary:
Somehow the constant isatty and config reading shows up in my profile. Since
this is not intended to change, just cache it.

Reviewed By: DurhamG

Differential Revision: D20830511

fbshipit-source-id: de36c0a958f6a6046a05db0abf976994435b9e3c
2020-04-06 11:10:53 -07:00
Xavier Deguillard
1ece50fc62 tests: fix test-fb-hgext-remotefilelog-rust-lfs.t on Windows
Summary:
The IndexedLog code uses a lock file to lock a directory on Windows, make
sure we account for that.

Reviewed By: DurhamG

Differential Revision: D20818882

fbshipit-source-id: 7e9aa255354d36899ad57168311a4276d448dc07
2020-04-06 10:18:05 -07:00
Xavier Deguillard
ed68d04942 pyworker: no longer ignore windows file removal failures
Summary:
Now that we have a proper back-channel to retry failures in Python, the
failures will be retried at a later time, when the anti-virus would have
hopefully release any locks it has on the file.

Reviewed By: DurhamG

Differential Revision: D20847006

fbshipit-source-id: 4fad0e773f69ddff27a23bc86dbbd3ce47bb3b46
2020-04-06 09:49:52 -07:00
Xavier Deguillard
d0b63fcd01 color: only warn about VT mode when formatted
Summary: We don't want tests to show this warning.

Differential Revision: D20851847

fbshipit-source-id: bae87a980a2da4088aff6ed0b4a3a85971166817
2020-04-06 08:48:58 -07:00
Thomas Orozco
0565c7e244 hggit: add a external-sync command that does the bare minimum
Summary:
For our HgExternalSync jobs that pull from git, we don't really use most of the
bells and whistles of hggit. Notably, we don't care about bookmarks: we only
ever pull master, we never update to it, we only ever look at `-r tip`.

However, we do care about things that are actually much harder to fit in a
world where we try to pretend the remote git repository is actually a hg
repository we can pull from.

Notably, we'd like to enforce limits on how many commits we pull (and convert)
at a time, so that if we fall behind a little bit, we don't start falling even
more behind by having to convert bigger and bigger batches of commits. If we're
trying to pretend fetching from git and converting commits is actually a pull,
then that seems harder to pull off (we'd need to somehow rewind the remote head
we're pulling before importing it).

So, this adds a new external-sync command to hggit that basically the bare
minimum that we do need. It lets you specify a git remote and a head you care
about, and import up to N commits from it. That's it — no bookmarks are updated
or anything (but the git-mapfile is, of course). The only thing that changes is
your commits.

If you actually want to interact with your git repository on an ongoing basis
as if it were a remote hg repository, this is completely useless, but that
isn't what we actually do, so that should be OK.

As part of this, I've modified a few other parts of git_handler to remove
places where we called a `uri` `remote_name` (which is a bit confusing), and a
place where we were asking for a `remote_name` parameter that I don't have
here, but which we also didn't actually need (in `import_git_objects`).

Reviewed By: farnz

Differential Revision: D20836601

fbshipit-source-id: 96230e6e8269d0472404414948fd2f02aa98d79c
2020-04-06 07:35:36 -07:00
Mark Thomas
5456adefe7 infinitepush: don't create revive obsmarkers if evolution is not enabled
Summary:
Evolution crashes if you try to create obsmarkers in a repo where obsmarkers
are not enabled.  Instead, check before reviving commits with obsmarkers that
it is enabled.

Reviewed By: krallin

Differential Revision: D20868173

fbshipit-source-id: b3a08ef05ddc13e9b78df8ac7c1ca1ef808b7602
2020-04-06 06:43:35 -07:00
Xavier Deguillard
7bcf163d55 color: remove all the win32 terminal handling
Summary:
Let's mandate a 256 color terminal in Windows. We also update less to default
to using VT mode: https://github.com/gwsw/less/pull/29

With this, the colors appears to be working as expected on Windows!

Reviewed By: quark-zju

Differential Revision: D20826922

fbshipit-source-id: 5d2a149e2698b3ccc7bf6388b5cd97da20898eb7
2020-04-03 13:47:32 -07:00
Xavier Deguillard
08984182b9 setup: write the pyc before the py during packaging
Summary:
I'm not exactly sure why, but my guess is that by writing the py files first,
the pyc might be copied and not generated, causing Python to not read the pyc
at import time, leading to slow startup time.

Reviewed By: quark-zju

Differential Revision: D20829130

fbshipit-source-id: e838ff18b9fbf65d1a9437e0a8ef58d57803d2fa
2020-04-03 11:35:29 -07:00
Xavier Deguillard
01e921aa19 crecord: fix windows arrow keys
Summary:
For whatever reason, ncurses doesn't interpret the arrow keys properly... Use
whatever is returned from it instead.

Reviewed By: kulshrax

Differential Revision: D20821432

fbshipit-source-id: 019426a1333538a479fb3dd8d147fb9cb4ba6559
2020-04-03 08:26:26 -07:00
Jun Wu
4ae44e316a remotenames: move repo._accessedbookmarks to core repo._remotenames._accessedbookmarks
Summary:
Move the attribute so it won't cause an AttributeError when remotenames is not
enabled.

As we're here, also move it to repo._remotenames from repo. This makes the repo
object a bit clearner and avoids loading the accessed bookmarks if remotenames
are not accessed at all.

Reviewed By: singhsrb

Differential Revision: D20821070

fbshipit-source-id: b5a01016451ee202f778cadb2dd418400406fa6b
2020-04-02 19:25:33 -07:00
David Tolnay
1a86366f0e third-party/rust: Turn off async-trait/support_old_nightly
Summary:
This diff turns off the support_old_nightly feature of async-trait (https://github.com/dtolnay/async-trait/blob/0.1.24/Cargo.toml#L28-L32) everywhere in fbcode. I am getting ready to remove the feature upstream. It was an alternative implementation of async-trait that produces worse error messages but supports some older toolchains dating back to before stabilization of async/await that the default implementation does not support.

This diff includes updating async-trait from 0.1.24 to 0.1.29 to pull in fixes for some patterns that used to work in the support_old_nightly implementation but not the default implementation.

Differential Revision: D20805832

fbshipit-source-id: cd34ce55b419b5408f4f7efb4377c777209e4a6d
2020-04-02 17:01:24 -07:00
Thomas Orozco
56251513bf git-sl: remove Mercurial import
Summary:
This isn't actually a Mercurial extension, so we can't be importing Mercurial
imports here. I'm not sure this is actually being used because we apparently
have 2 copies of this (see D20793452, which is also how I came upon this), but
it's probably worth not breaking it.

Reviewed By: farnz

Differential Revision: D20794695

fbshipit-source-id: daaf0f5822567b55a787669073421fd1ce604e08
2020-04-02 12:32:34 -07:00
Durham Goode
9976df9010 watchman: keep using watchman even if there are state-enter/leave errors
Summary:
We've seen a number of recent cases where hg stops using watchman for
status because state-enter or state-leave fail because multiple enters or leaves
are called out of order. The root cause needs to be found, but in the mean time
we should not allow such errors to block of from using watchman entirely.

Let's eat these gracefully and just log that the issue happened.

Reviewed By: quark-zju

Differential Revision: D20807004

fbshipit-source-id: 517d9562febc226ce7db836435ca2ca9db1c68fb
2020-04-02 11:42:59 -07:00
Xavier Deguillard
a7e5557baa test: properly set ui.ssh
Summary:
On Windows, we have to do a bit of dance for Windows to stop complaining
about ui.ssh.

Reviewed By: DurhamG

Differential Revision: D20817712

fbshipit-source-id: acbda636fe114fd616dee89b2c4d1c9ff26470bf
2020-04-02 11:26:54 -07:00
Xavier Deguillard
e7c31f21a4 remotefilelog: set umask when creating the rust stores
Summary:
On shared devservers, all users in svnusers should be able to read/write onto
the stores, set the umask to properly reflect this.

Reviewed By: ikostia

Differential Revision: D20817266

fbshipit-source-id: 8a865f499a35313afd3cbeb5f989175862a3549f
2020-04-02 10:42:40 -07:00
Jun Wu
6e7cffbda4 chg: disable chg when file paths like /proc/self/... are used
Summary: This will allow bash users to use things like `hg commit -l <(echo foo)`.

Reviewed By: krallin

Differential Revision: D20810653

fbshipit-source-id: 42e420e608d41704387a9011cf14a28f92192e5d
2020-04-02 10:09:50 -07:00
Thomas Orozco
d225cb2910 remotenames: don't throw on hidden nodes
Summary:
This updates fastheaddiscovery to use an unfiltered repository when it attempts
to check if the nodes the server sent are present locally.

Reviewed By: quark-zju

Differential Revision: D20792006

fbshipit-source-id: 14ba9605d79ba54f3f4143d6d8ec65357e3d8c07
2020-04-02 08:53:48 -07:00
Jun Wu
2aec2dbcb6 commitcloud: migrate to tech-debt-free repo.pull for pulling
Summary:
The new API does nothing that cloud sync does not want: bookmarks, obsmarkers,
prefetch, etc. Wrappers to disable features are removed.

This solves a "lagged master" issue where selectivepull adds `-B master` to
pull extra commits but cloud sync cannot hide them without narrow-heads. Now
cloud sync just does not pull the extra commits.

Reviewed By: sfilipco

Differential Revision: D20808884

fbshipit-source-id: 0e60d96f6bbb9d4ce02c04e8851fc6bda442c764
2020-04-01 19:40:57 -07:00
Jun Wu
22295e45bb tests: add another test demostrating the lagged master issue
Summary:
With selective pull (now in core) enabled and narrow-heads disabled,
there is another way to cause lagged master.

Reviewed By: sfilipco

Differential Revision: D20808885

fbshipit-source-id: ebaed0e203f2f9f981bf141ce6c82af33710ba53
2020-04-01 19:40:57 -07:00
Jun Wu
07fc8adad9 commitcloud: sort hashes being pulled
Summary: This makes the upcoming change easier to verify.

Reviewed By: sfilipco

Differential Revision: D20808883

fbshipit-source-id: 5563601125ef5c961785f7275fd82fc3fefe53ff
2020-04-01 19:40:56 -07:00
Jun Wu
e2af876a45 remotenames: fix pull race conditions
Summary:
We have seen one report that the race condition caused lagged remote/master.

The race condition is:
- pull everything: get all commits, but not remotenames.
- expull: get all remotenames. Some point to new commits received by the
  server that are unknown to the client. The client ignores them.

This diff adds a double check to pull again if it sees remotenames pointing
to unknown nodes.

This won't be necessary if we migrate everyone to selectivepull, and clean up
the pull command to use the race-free repo.pull API. Because the new code path
will first query the bookmarks, then pull the heads explicitly.

Reviewed By: DurhamG

Differential Revision: D20703268

fbshipit-source-id: 42bd0201c3c4f709f25ad0fea3a191db9991e4fc
2020-04-01 19:40:56 -07:00
Jun Wu
5730719bd9 revset: automatically pull remote bookmarks prefixed remote/ or default/
Summary:
This makes it possible to do things like `hg up remote/foo` without having to
`hg pull -B foo` first.

Reviewed By: DurhamG

Differential Revision: D20531122

fbshipit-source-id: e95b2f0a49e4b815c136450d1f352a7973cb72ed
2020-04-01 19:40:55 -07:00
Jun Wu
707b7dea42 localrepo: add a tech-debt-free repo.pull API
Summary:
The new `repo.pull` API aims to be tech-debt free. It does:
- Pull nothing instead of everything if nothing is specified.
- Update remote names that are explicitly specified, not everything the server
  has.
- Do not update local bookmarks.

The direct motivation is to implement autopull `remote/foo` behavior while not relying on the pull command.

Reviewed By: DurhamG

Differential Revision: D20531119

fbshipit-source-id: 80c3bdd5556126d81af099a74f1345ecc94904b7
2020-04-01 19:40:55 -07:00
Jun Wu
bd4ac25e5f infinitepush: move listkeyspatterns to core
Summary: This will be used by the next diff.

Reviewed By: DurhamG

Differential Revision: D20661056

fbshipit-source-id: 3b4793bc0737bd64196da5b99c2d4da6f5e48efb
2020-04-01 16:58:33 -07:00
Stefan Filip
325fed7e50 tests: add histedit test with simple reorder
Summary: Debugging an issue where watchman returns a state error during histedit.

Reviewed By: quark-zju

Differential Revision: D20785858

fbshipit-source-id: 5baf762d1a5588573df9d01c63a24e751e04a811
2020-04-01 14:02:34 -07:00
Mark Thomas
04a400b5eb commitcloud: handle missing remotebookmarks in commitcloud lastsyncstate
Summary:
During the roll-out of commitcloud remotebookmarks sync, some clients may have it enabled, and others may have it disabled.

This can result in some clients having an empty set of remotebookmarks in their sync state for a version which actually
does have remotenames in the cloud workspace.

This becomes a problem when those clients start syncing remotebookmarks, for two reasons:

* They are unable to correctly apply the new cloud remotebookmarks, as they do not have the previous state with which to break ties, and the tie-breaking code doesn't work correctly if the old cloud remotebookmark is `None`.

* When they try to send the remotebookmarks delta to the server, they don't have the old state, and so compute the delta incorrectly.  This results in `Duplicate entry for key` errors in the service.

We can handle this as follows:

* When syncing remote bookmarks from the cloud, ensure we correctly apply the remote bookmark updates, even if the old cloud remotebookmark is `None`.

* If the local repo is up-to-date with respect to the workspace, but the last sync state had no remote bookmarks recorded, sync the remote bookmarks again.  This may involve pulling some more commits if the cloud remote bookmarks are ahead of the local remote bookmarks. If there truly were no remote bookmarks then this will be a no-op.

Reviewed By: quark-zju

Differential Revision: D20792360

fbshipit-source-id: cd1ed371d8d5b1be2767c8a8d4836ea870a4467b
2020-04-01 13:26:27 -07:00
Mark Thomas
245678565c commitcloud: add test demonstrating remotebookmarkssync problems
Reviewed By: krallin

Differential Revision: D20796685

fbshipit-source-id: 0bb0efac14d56b715fb81824956752bef874d2b5
2020-04-01 13:26:26 -07:00
Alden Hu
64b98944d1 git-sl supports worktrees
Summary:
git started printing a "+" sign in front of a branch checked out in another worktree:
ab3138146f

and it breaks "git sl"

removing "+" the same way as "*" when parsing "git branch" result to resolve.

Reviewed By: krallin

Differential Revision: D20793452

fbshipit-source-id: 5c0b6be5afbed607b144c652f68a3ab93052f76a
2020-04-01 09:25:27 -07:00
Mark Thomas
0d4db87a26 cmdutil: add a hint for the new graph renderer
Summary: Add a hint that points to customization and troubleshooting guides for the new graph renderer.

Reviewed By: xavierd

Differential Revision: D20763338

fbshipit-source-id: ee6d2464ae5955f0f0bf52d1994adfa2b74b3367
2020-03-31 09:57:44 -07:00
Xavier Deguillard
2ce3c6784b revisionstore: make ContentStore::sha256 infallible
Summary:
Instead of using Sha256::from_slice, just use Sha256::from with a correctly
sized array.

Reviewed By: quark-zju

Differential Revision: D20756181

fbshipit-source-id: 17c869325025078e4c91a564fc57ac1d9345dd15
2020-03-31 08:12:45 -07:00
Adam Simpkins
b31c991c00 update the hg status fast-path to print errors reported by EdenFS
Summary:
Update `hg status` to print errors that were returned by EdenFS's
getScmStatusV2() call, and to exit unsuccessfully if there were any errors.

Previously errors were silently ignored.

Reviewed By: quark-zju

Differential Revision: D19958503

fbshipit-source-id: cb3109df40eb86a5bf7e3818ddfb8da74d670405
2020-03-30 19:24:22 -07:00
Adam Simpkins
ba42390257 fix hg status path relativization in tests on Windows
Summary:
Fix the `test_status()` function to properly canonicalize the input paths, so
that it works successfully on Windows.  Previously this function would fail on
Windows as some paths would end up as UNC-style paths and some would be plain
paths, causing the equality comparison to fail even though the paths were
equivalent.  This canonicalizes the repo path so that they both use the same
format.

Reviewed By: quark-zju

Differential Revision: D20662921

fbshipit-source-id: fdd36bac755f9694b4a482615d3dca43ff21e05e
2020-03-30 19:24:22 -07:00
Xavier Deguillard
22f524664e revisionstore: use Arc<Self> as receiver for remote store traits
Summary:
All of the callers are already using an Arc, so instead of forcing the remote
store to be cloneable, and thus wrap an inner self with an Arc, let's just pass
self as an Arc.

Reviewed By: DurhamG

Differential Revision: D20715580

fbshipit-source-id: 1bef23ae7da7b314d99cb3436a94d04134f1c0e4
2020-03-30 14:45:49 -07:00
Xavier Deguillard
6b1940f294 revisionstore: add fallback if LFS server is down
Summary:
When LFS will be enabled on fbsource, the enablement will rolled out server,
with the server serving pointers (or not). In the catastrophic scenario where
Mononoke has to be rolled out, the Mononoke LFS server will be unable to serve
blobs, but some clients may still have LFS pointers locally but not the
corresponding blob. For this, we need to be able to fallback to fetching the
blob via the getpackv2 protocol.

Reviewed By: DurhamG

Differential Revision: D20662667

fbshipit-source-id: 4ac45558f6d205cbd1db33c21c6fb137a81bdbd5
2020-03-30 14:45:48 -07:00
Xavier Deguillard
e7b5eb81d9 remotefilelog: add lfs fetching retry logic
Summary:
The LFS server might be temporarily having issues, let's retry a bit before
giving up.

Reviewed By: DurhamG

Differential Revision: D20686659

fbshipit-source-id: 90dabd19e45a681d6eae5cd50c72b635d44c0517
2020-03-30 14:45:48 -07:00
Xavier Deguillard
f06132def2 configparser: add FromConfigValue for floats
Summary:
Since we have all the integer types, let's also allow float types in the
config.

Reviewed By: kulshrax

Differential Revision: D20697007

fbshipit-source-id: 21fa264d24c0f63c233f47c3bcfb2448b4c05c70
2020-03-30 14:45:48 -07:00
Xavier Deguillard
0f3c04abfe remotefilelog: add a remotefilelog LFS test
Summary:
This demonstrates that both the legacy extension and the new implementation can
co-exist, and we can enable/disable the new extension.

Reviewed By: DurhamG

Differential Revision: D20677443

fbshipit-source-id: 10896023f536984645371d557c3ad20daa8526dd
2020-03-30 14:45:47 -07:00
Xavier Deguillard
15c81cd54f revisionstore: repack even when having one packfile
Summary:
When repacking for the purpose of file format changes, a single packfile may
contain data that needs to be moved out of it, and thus, we need to do a repack
then.

Reviewed By: DurhamG

Differential Revision: D20677442

fbshipit-source-id: c621dd2e657f5a4565b37d4b029731415b899117
2020-03-30 14:45:47 -07:00
Xavier Deguillard
e0cfd08e7f revisionstore: properly implement get_missing for remote stores
Summary:
Remotestores can implement get_missing properly by simply querying the
underlying store that they will be writing to. This may prevent double fetching
some blobs in `hg prefetch` that we already have.

Reviewed By: DurhamG

Differential Revision: D20662668

fbshipit-source-id: 22140b5b7200c687e0ec723dd8879dc8fbea6fb9
2020-03-30 14:45:47 -07:00
Xavier Deguillard
e1ccc29eec revisionstore: add an is_local method to the IndexedLog abstraction
Summary:
There are cases where the user of the abstraction needs to know if this is a
local store, this will simplify the caller code.

Reviewed By: DurhamG

Differential Revision: D20662666

fbshipit-source-id: e0bde7eb0dc3484979732a7c4cdf888fedc70e13
2020-03-30 14:45:46 -07:00
Xavier Deguillard
8ed454845a revisionstore: auto-sync the LFS blobs store
Summary:
By regularly flushing the blob store, we avoid keeping too many LFS blobs in
memory, which could cause OOM issues.

The default size is chosen to be 1GB, but is configurable for more control.

Reviewed By: DurhamG

Differential Revision: D20646213

fbshipit-source-id: 12c06fd0212ef3974bea10c82026b6e74fb5bf21
2020-03-30 14:45:46 -07:00
Xavier Deguillard
5ea2e581c6 revisionstore: store LFS blobs in an IndexedLog
Summary:
In the legacy lfs extension, LFS blobs were stored as loosefiles on disk, and
as we saw with loosefiles for remotefilelog, they can incur a significant
overhead to maintain. Due to LFS blobs being large by definition, the number of
loose LFS blobs should be reasonable for repack to walk over all of them to
chose which one to throw away.

A different approach would be to simply store the blobs in an on-disk format
that allows automatic size management, and simple indexing. That format is an
IndexedLog. This of course doesn't come without drawbacks, the main one being
that the IndexedLog API mandate that the full blob is present on insertion,
preventing streaming writes to it, the solution is to simply chunk the blobs
before writing them to it. While proper streaming is not done just yet, the
storage format no longer prevent it from being implemented.

Reviewed By: DurhamG

Differential Revision: D20633783

fbshipit-source-id: 37a88331e747cf22511aa348da2d30edfa481a60
2020-03-30 14:45:46 -07:00
Arun Kulshreshtha
91e76774fe edenapi: fix typo in logging
Reviewed By: sfilipco

Differential Revision: D20744831

fbshipit-source-id: 194e550d88c33ed9601d2f24fea281996696087b
2020-03-30 14:39:42 -07:00
Jun Wu
6bddc1df08 rotatelog: avoid loading broken Logs multiple times
Summary:
RotateLog loads older logs lazily. If an older log is broken, remember that and avoid
loading the broken log again.

Reviewed By: DurhamG

Differential Revision: D20663899

fbshipit-source-id: 7a4b5279cc6387c19329a51048bfe1be2e0bc1f8
2020-03-30 11:34:49 -07:00
Thomas Orozco
250695ba9b rage: disable colors
Summary:
This updates hg rage to disable colors while producing the hg rage. This makes
the pastes a little more readable since they won't contain escape codes.

Reviewed By: farnz

Differential Revision: D20738945

fbshipit-source-id: e323834beb6458083642e34a40afa3d896288b42
2020-03-30 11:31:33 -07:00
Xavier Deguillard
2c052d055d eden: commitpending doesn't exist in ContentStore
Summary:
Instead, it's present in the fileslog. Use that instead.

This is the error I just got while doing a `hg top`:
error updating fbcode/eden/scm/lib/revisionstore/src/contentstore.rs: facebook::eden::HgImportPyError: AttributeError: 'bindings.revisionstore.contentstore' object has no attribute 'commitpending'

Reviewed By: quark-zju

Differential Revision: D20715560

fbshipit-source-id: 59c4b62ae8d0f182824e126e68b174c0ef3cdba0
2020-03-30 09:05:36 -07:00
Xavier Deguillard
fd72344578 revisionstore: feature gate the Mononoke LFS tests
Summary:
Due to the Mononoke LFS server only being available on FB's network, the tests
using them cannot run outside of FB, including in the github workflows.

Reviewed By: quark-zju

Differential Revision: D20698062

fbshipit-source-id: f780c35665cf8dc314d1f20a637ed615705fd6cf
2020-03-30 08:40:43 -07:00
Stefan Filip
ea89b541e1 segmented_changelog: add Dag struct and location_to_name functionality
Summary:
The IdDag provides graph algorithms using Segments.
The IdMap allows converting from the SegmentedChangelogId domain to the
ChangesetId domain.
The Dag struct wraps IdDag and IdMap in order to provide graph algorithms using
the common application level identifiers for commits (ChangesetId).

The construction of the Dag is currently mocked with something that can only be
used in a test environment (unit tests but also integration tests).

This diff also implements a location_to_name function. This is the most
important new functionality that segmented changelog clients require. It
recovers the hash of a commit for which the client only has a segmented
changelog Id. The current assumption is that clients have identifiers for all
merge commit parents so the path to a known commit always follow a set
of first parents.

The IdMap queries will have to be changed to async in the future, but IdDag
queries we expect to stay sync.

Reviewed By: quark-zju

Differential Revision: D20635577

fbshipit-source-id: 4f9bd8dd4a5bd9b0de55f51086f3434ff507963c
2020-03-27 13:48:52 -07:00
Stefan Filip
7502ce31ca dag: add in process stored IdMap constructor
Summary: The interesting observation is that InProcessStore is not public.

Reviewed By: quark-zju

Differential Revision: D20635578

fbshipit-source-id: a0149929c8059ff77f047fd385bf3b26dc738dfd
2020-03-27 13:48:51 -07:00
Jun Wu
9fe0bfd7c8 narrowheads: fix directaccess compatibility
Summary:
Similar to the previous diff.  Sometimes the narrow-heads config is on but the
dependencies are off (ex. remotenames, visibility). In that case narrow-heads
should be considered off. The repo init function takes care of that but code
paths before repo init needs special care.

Reviewed By: simpkins

Differential Revision: D20699684

fbshipit-source-id: befac335bde0be6b8a42a5a9f7cee1edbbef3c55
2020-03-27 12:55:07 -07:00
Jun Wu
ebdc3836b9 narrowheads: fix repo requirements at "hg init" time
Summary:
Some tests fail because `hg init` sets the wrong initial store requirements and
then perform a narrow-head migration down, which prints extra messages. Fix them
by making sure the initial store requirements are the same as what the migration
code path expects.

Reviewed By: simpkins

Differential Revision: D20698637

fbshipit-source-id: 1422a4ea78222617d0e3f9631ad883d5a3fe6bb7
2020-03-27 12:55:06 -07:00
Lukas Piatkowski
bace9bc0ae mononoke: make filenode and mercurial_types OSS buildable
Reviewed By: farnz

Differential Revision: D20281345

fbshipit-source-id: bc4910d3040d74c7ceb4cb825bea6960952f6310
2020-03-27 11:40:13 -07:00
Xavier Deguillard
179caf60dd revisionstore: pass the config when building the LFS stores
Summary: Instead of hardcoding some values, use configured ones.

Reviewed By: DurhamG

Differential Revision: D20633784

fbshipit-source-id: d17657b1fca29280f2d07e8cf824e553ad3704f7
2020-03-26 19:02:49 -07:00
Xavier Deguillard
d404b0a228 revisionstore: revamp repack to ease file format migration
Summary:
One of the main drawback of the current version of repack is that it writes
back the data to a packfile, making it hard to change file format. Currently, 2
file format changes are ongoing: moving away from packfiles entirely, and
moving from having LFS pointers stored in the packfiles, to a separate storage.

While an ad-hoc solution could be designed for this purpose, repack can
fullfill this goal easily by simply writing to the ContentStore, the
configuration of the ContentStore will then decide where this data will
be written into.

The main drawback of this code is the unfortunate added duplication of code.
I'm sure there is a way to avoid it by having new traits, I decided against it
for now from a code readability point of view.

Reviewed By: DurhamG

Differential Revision: D20567118

fbshipit-source-id: d67282dae31db93739e50f8cc64f9ecce92d2d30
2020-03-26 19:02:48 -07:00
Xavier Deguillard
cf650d232a remotefilelog: remove unnecessary argument to the Rust repacks
Summary: There is no need to pass the path twice, once is enough.

Reviewed By: DurhamG

Differential Revision: D20567117

fbshipit-source-id: 169a088aa7558b4c25f8fbdecfe59bdd0d7575ef
2020-03-26 19:02:48 -07:00
Xavier Deguillard
d4780ee322 revisionstore: store a HashMap of ContentHash in LFS pointer
Summary:
While the primary (for now) way of addressing an LFS blob is via its sha256,
being able to address them via different hash schemes (sha1 for Eden/Buck,
blake2, etc) will be helpful down the line. Thus, let's store a HashMap of
ContentHash in the pointer store.

Reviewed By: DurhamG

Differential Revision: D20560197

fbshipit-source-id: 8bdc4fc4cd7fc19c7eed6a27d11953c4eedf9195
2020-03-26 19:02:47 -07:00
Xavier Deguillard
04a09ec571 remotefilelog: adapt tests for remotefilelog to support LFS
Summary:
The hgcache will soon contain an LFS subdirectory, this is uninteresting for
most of the tests, let's change them a bit so they only look at the packs
subdirectory.

With this, enabling remotefilelog.useruststore only has 2 failures. One due a
difference in handling corrupt data, with the ruststore being more explicit
that some data is missing instead of a generic "stream ended unexpectedly". And
the other due to some ordering difference when dealing with LFS data. The
latter will go away with the new LFS implementation.

Reviewed By: DurhamG

Differential Revision: D20543146

fbshipit-source-id: 09c76cacfb4687fd699b82cdf5057665ac6bd521
2020-03-26 19:02:47 -07:00
Xavier Deguillard
2f314fc43c revisionstore: remove unnecessary lock around the LfsBlobsStore
Summary: No locking is required for this one due to being loose files on disk.

Reviewed By: DurhamG

Differential Revision: D20522890

fbshipit-source-id: 72b7ebc063060a89f54976a1128977a3b7501053
2020-03-26 19:02:47 -07:00
Jun Wu
8bd55436a4 pull: automatically pull selective bookmarks unless it's a no-argument pull
Summary:
This enforces certain selective pull logic in core. Namely, rewrite `pull -r X`
to `pull -r X -B master`.

Unlike selectivepull in remotenames, `pull` (pulls everything) won't be
rewritten to `pull -B master` (which pulls less commits and names).

Therefore this change always adds more commits to pull, and therefore should not
break existing users. Eventually we want the "not pulling everything" behavior,
but right now this just fixes `pull -r X` to also update important remote names.

Reviewed By: markbt

Differential Revision: D20531121

fbshipit-source-id: af457b5ddb1265b61956eb2ee6afb7b7208293e0
2020-03-26 10:54:09 -07:00
Jun Wu
e105af5a54 exchange: replace remotenames.important-names with selectivepull names
Summary: Now we have functions to get selectivepull names in core. Use that instead.

Reviewed By: markbt

Differential Revision: D20531118

fbshipit-source-id: a0c20c491baf1b0ad71e80f870703bb4b983f19c
2020-03-26 08:26:27 -07:00
Jun Wu
c7549d5b71 remotenames: move selective pull bookmarks calculation to core
Summary: This makes it possible for core to always pull related bookmarks.

Reviewed By: markbt

Differential Revision: D20531120

fbshipit-source-id: 52f0834b517e03567e240f57616370d79a227abe
2020-03-26 08:26:27 -07:00
Jun Wu
baae0138ff remotenames: move revset and templatekw to core
Summary:
This makes it possible to use template like `{remotenames}` or revset like
`remotenames()` without enabling the remotename extension.

Rarely used revsets like `upstream()` and `pushed()` are not moved.

Reviewed By: markbt

Differential Revision: D20529360

fbshipit-source-id: ea95b3324f974e112909cdd79ce662940a4f9b7c
2020-03-26 08:26:26 -07:00
Jun Wu
cc1b1bd6a9 remotenames: move namespace to core
Summary:
This makes it possible to resolve remotenames without enabling the remotenames
extension.

The config check `if repo.ui.configbool("remotenames", "bookmarks")` is dropped
intentionally as we only use remotenames for bookmarks, not named branches.

Since this only enables resolving more names, without disabling or changing
other features, and the remotename namespace priority is lower than local
bookmarks (ex. if a local `master` exists, then `master` will be using the
local bookmark, not the hoisted remote name), it should not cause breaking
changes.

Reviewed By: markbt

Differential Revision: D20529359

fbshipit-source-id: 4126faee1bb7f43ba547fab05dd6197b2e65c1fc
2020-03-26 08:26:26 -07:00
Jun Wu
a94f29c65a remotenames: move repo._remotenames to core
Summary:
This moves part of remotenames that provides the `repo._remotenames` object to
core.  It should not change behaviors but merely makes `repo._remotenames`
available in core.

Reviewed By: markbt

Differential Revision: D20529358

fbshipit-source-id: 11c8538a0190101b09a4cb082018e73643a257e2
2020-03-26 08:26:26 -07:00
Xavier Deguillard
16f09d25a3 pyworker: add a retry backchannel to Python
Summary:
While failures in the Rust updater aren't expected, at least one valid case
requires requires retrying the operation in Python: old-style LFS pointers.
When these are stored in packfiles/indexedlog, only the Python code knows how
to deal with them, and thus the operation needs to be retried there.

Reviewed By: DurhamG

Differential Revision: D20603709

fbshipit-source-id: 7d24ba573f0ff540906d909f1b4440fd4d3469a6
2020-03-25 12:29:26 -07:00
Xavier Deguillard
226a30236b pyworker: do not try to write LFS pointers to the working copy
Summary:
The ContentStore cannot deserialize LFS pointers stored in packfiles, to avoid
potential damage, let's refuse to update LFS blobs. A proper solution will be
built in a separate diff.

Reviewed By: DurhamG

Differential Revision: D20576575

fbshipit-source-id: 4e4ce6a9432157e2ce69881c0079e943ea3f3acd
2020-03-25 12:29:26 -07:00
Xavier Deguillard
6372a4a4fc revisionstore: add an is_lfs method to Metadata
Summary:
Instead of having the magic number 0x2000 all over the place, let's move the
logic to this method.

Reviewed By: DurhamG

Differential Revision: D20637749

fbshipit-source-id: bf666f8787e37e6d6c58ad8982a5679b7e3e717b
2020-03-25 12:29:25 -07:00
Xavier Deguillard
7a8653cb2e pyworker: integrate with fsinfo
Summary:
On Unix, pretend that NTFS doesn't support symlinks. While this isn't
technically true, NTFS on Linux is only used to alleviate performance issues
with `hg update` on Windows. With the pyworker code, I'm expecting these
performance issues to disappear allowing this code to be removed.

Reviewed By: ikostia

Differential Revision: D20527976

fbshipit-source-id: 4194f4b5af065de2e293b41b9d03e9d4ab6ea006
2020-03-25 12:29:25 -07:00
Xavier Deguillard
fbff2aaf7c pyworker: refactor the update/remove functions
Summary:
Move them into a VFS struct, a future step will move the VFS code into its own
crate.

Reviewed By: DurhamG

Differential Revision: D20527977

fbshipit-source-id: 3250b05840688db72e1c43c72ec6defbc7f20851
2020-03-25 12:29:25 -07:00
Durham Goode
c9c381a744 extras: force commit extras to be type str
Summary:
When we deserialize commit extras they come out as a str->str dict, so
let's make sure clients add values that are also strings. We do this by type
checking a serialization time. This fixes an issue where D19942522 assumed
extras were strings and hit a type error for globalrevs, which were ints.

Apparently the code that reads globalrevs from the extras never treats it as an
int anyway, so none of the reading code needed to be updated to convert the
string back to an int.

Reviewed By: singhsrb

Differential Revision: D20631889

fbshipit-source-id: 8c8b3c9a9f3369376e08146d670f2d6321df141f
2020-03-24 18:30:03 -07:00
Stefan Filip
c400809eba dag: rename child index iteration to iter_master_flat_segments_with_parent
Summary:
`iter_segments_with_parent` has a few more conditions attached to it than the
name would imply. We are renaming it to give a better sense of its true
behavior.

Reviewed By: quark-zju

Differential Revision: D20547631

fbshipit-source-id: 406f46b9de5efc9e8e6a8c4bc22ab18fa5bc54bb
2020-03-24 13:58:07 -07:00
Stefan Filip
59ff2a8571 dag: remove_non_master implementation for
Summary: Also adding better tests for non master entries.

Reviewed By: quark-zju

Differential Revision: D20504483

fbshipit-source-id: 60d4a20aecb00f7750db2fff5d3832aac99d00e2
2020-03-24 13:58:06 -07:00
Stefan Filip
03c1e1cac5 dag: iterator implementations for InProcessStore
Summary:
The main question I had while writing the tests was whether we expect a
specific order for Segments for `iter_segments_with_parent`. `InProcessStore`
will return the segments in the order that they were inserted.

Reviewed By: quark-zju

Differential Revision: D20501401

fbshipit-source-id: 48ceb78f3191c7425c1488a3392cf3167f7e7268
2020-03-24 13:58:06 -07:00
Stefan Filip
5f4e706f81 dag: Add InProcessStore as iddagstore
Summary:
First 6 methods implemented from the IdDagStore trait for the InProcessStore.

Any suggestions welcome.

Reviewed By: quark-zju

Differential Revision: D20499228

fbshipit-source-id: cb536a3a0136077ada78934d82a25d079a5bc809
2020-03-24 13:58:06 -07:00
Stefan Filip
3dcb56535e dag: add descriptions to IdDagStore methods
Summary: Documentation.

Reviewed By: quark-zju

Differential Revision: D20499926

fbshipit-source-id: ebbb7a1249109bd56ff459a659e0c628c2974179
2020-03-24 13:58:05 -07:00
Ratnadeep Joshi
17fd33424d Move py/ directory from eden/ to eden/fs
Summary: [edenfs] Move py/ directory from eden/ to eden/fs

Reviewed By: simpkins

Differential Revision: D20479925

fbshipit-source-id: 36abf7fe208c283f01c9bf415e2fcb1a8f4bdbae
2020-03-24 11:45:37 -07:00
Mark Thomas
2678dd7c2b cmdutil: use the new ascii renderer if HGPLAIN is set
Summary:
If `HGPLAIN` is set, and the non-legacy graph renderer is in use, use the ASCII
renderer to ensure compatible output on all platforms and configurations.

Reviewed By: farnz

Differential Revision: D20622425

fbshipit-source-id: b25a8d0526652bab07059492f7adbb684b5cbee7
2020-03-24 11:38:28 -07:00
Steven Troxler
d90435ced9 Deprecate rust-crypto in eden/scm/lib/revisionstore
Summary:
Replace `rust-crypto` with `hex`, `sha-1`, `sha2`.
 - `crypto::sha1::Sha1` with `sha1::Sha1`
 - `crypto::sha2::Sha2` with `sha2::Sha2`
 - `crypto::digest::Digest` with `sha1::Digest` and `sha2::Digest`
 - `.result_str()` with `hex::encode` and `.result()`

Reviewed By: jsgf

Differential Revision: D20588313

fbshipit-source-id: 75c4342e8b6285f0f960f864c21457a1a0808f64
2020-03-23 16:38:07 -07:00
Xavier Deguillard
730327c29e eden: commit the Rust ContentStore when unable to find a blob
Summary:
The markforrefresh only exist in the legacy Python contentstore, commiting the
current store will have the same effect for the Rust store.

Reviewed By: DurhamG

Differential Revision: D20562032

fbshipit-source-id: de12cfd65d992395c9b9894d1f05cf50d86b0191
2020-03-23 14:33:42 -07:00
Xavier Deguillard
674e9c7900 fsinfo: return an enum instead of a String
Summary:
In a strongly typed langage, using strings should be avoided whenever possible
as they do not provide the safety guarantees that types provide.

I took the liberty of removing all the filesystems that are not relevant for
Mercurial for simplification reasons. If needs arise, we can always add a new
FsType to the enum.

Reviewed By: DurhamG

Differential Revision: D20517138

fbshipit-source-id: 0a38b53c6a87f05f4b2d664038e10c4293de96ae
2020-03-23 14:29:10 -07:00
Jun Wu
beb3d8c692 fsmonitor: make race detector aware of the matcher
Summary:
This makes it so `hg status A` won't complain about race conditions about file
`B`. As we're here, the detector logic was also moved to the filesystem layer.

Reviewed By: DurhamG

Differential Revision: D20568151

fbshipit-source-id: 713e3775a14674fd170df391977d42d9dee0f718
2020-03-23 14:22:02 -07:00
Steven Troxler
b6de099da8 Deprecate rust-crypto in zstore
Summary:
Replace `rust-crypto` with `sha-1`:
 - `crypto::digest::Digest` with `sha1::Digest`
 - `crypto::Sha1` with `sha1::Sha1`

The interface changes slightly - no need to pass a mutable byte array when
getting the result.

Reviewed By: jsgf

Differential Revision: D20587638

fbshipit-source-id: c6c737f3f8eba94b98c728e198eb4fac12c5c80b
2020-03-23 11:29:09 -07:00
Steven Troxler
71279b3916 Deprecate rust-crypto in manifest-tree
Summary:
Replace `rust-crypto` with `sha-1`:
 - `crypto::digest::Digest` with `sha1::Digest`
 - `crypto::sha1::Sha1` with `sha1::Sha1`

Reviewed By: jsgf

Differential Revision: D20587716

fbshipit-source-id: de801c20bffd356eb5b2205a63ec0218b3aca6c0
2020-03-23 11:15:58 -07:00
Steven Troxler
154c458285 Deprecate rust-crypto in eden/scm/lib/types
Summary:
Swap out `rust-crypto` for `sha-1`
 - `crypto::sha1::Sha1` is replaced by `sha1::Sha1`
 - `crypto::digest::Digest` is replaced by `digest::Digest`

Reviewed By: jsgf

Differential Revision: D20587685

fbshipit-source-id: 971fdaa8ce5b3e9e60db219131f6c36dcbc213d9
2020-03-23 11:15:57 -07:00
Steven Troxler
3534ca3bb8 Deprecate rust-crypto in edenfs-client
Summary:
Switched out the `sha` package for the `rust-crypto` package. The
apis aren't an exact match, so I had to insert a clone in place of
a modification to a mutable reference.

Reviewed By: jsgf

Differential Revision: D20585336

fbshipit-source-id: 22245157aea1115ae6f225b17b0346f0696653f7
2020-03-23 11:04:36 -07:00
Xavier Deguillard
767134797c pyerror: stringify Rust errors with "{:?}"
Summary:
According to the anyhow documentation[0], the behavior of `.to_string()` is to
only stringify the top-level errors, hiding all the context of the error.
Instead, the debug format allows all the context to be displayed, and, if
available the backtrace.

This should significantly help debug Rust errors when context is available,
which we should strive to have everywhere!

[0]: https://docs.rs/anyhow/1.0.27/anyhow/struct.Error.html#display-representations

Reviewed By: sfilipco

Differential Revision: D20575944

fbshipit-source-id: 2968d7fb755edec7f7e5151138e8049ded181c1b
2020-03-20 20:22:14 -07:00
Arun Kulshreshtha
d179270444 edenapi: remove unused log fields
Summary:
Originally, we wanted to log EdenAPI batch sizes to Scuba in order to A/B test the effect of batch size on fetching speed. It turns out that the original arbitrary choice of 1000 works pretty well, so there isn't really a need to log this to Scuba anymore.

In addition to removing these fields, this diff moves the "http_enabled" column to be logged from the config by the wrapper instead of being manually logged by hg.

Reviewed By: quark-zju

Differential Revision: D20568104

fbshipit-source-id: 1e113489d005e93e6283f7e4a439b1c78b6f0fb9
2020-03-20 16:53:43 -07:00
Adam Simpkins
f89bfe7670 fix a type-checking error
Summary:
Fix code in `memcommit/serialization.py` that was assigning a `str` to a
`bytes` variable.

Reviewed By: singhsrb

Differential Revision: D20564418

fbshipit-source-id: 578ebe9d2b8823353d5a4727f6ea888678ca881f
2020-03-20 15:32:51 -07:00
Adam Simpkins
46767d9723 add type annotations for a few more edenscmnative modules
Summary:
There isn't really much to annotate here, but this lets us eliminate a couple
`pyre-fixme` comments about not being able to find these modules during type
checkign.

Reviewed By: singhsrb

Differential Revision: D20550267

fbshipit-source-id: 271f8406890787c0613294a9047365fdebcdeda1
2020-03-20 10:41:32 -07:00
Adam Simpkins
66f7b2e813 remove some duplicate .pyx files
Summary:
These were copied into the `edenscmnative` directory in D15798642, but never
removed from their original location.

Reviewed By: singhsrb

Differential Revision: D20550268

fbshipit-source-id: dadce279f1717a66ece86376bd51179b8669cc8a
2020-03-20 10:41:31 -07:00
Lukas Piatkowski
12f639159e cargo_from_buck: get rid of signatures in generated Cargo.toml files
Summary: The signatures were used by the linter to warn if the files require regenerating, since the linter now regenerates the files regardless of the signature it is no longer needed to sign the files.

Reviewed By: krallin

Differential Revision: D20467745

fbshipit-source-id: aff2643f80939d5693e7a30abf07484c9060796f
2020-03-20 08:56:11 -07:00
Mark Thomas
12e94a142a newdoc: Add mutation and visibility documentation
Summary: Add Mercurial Developer Guide documentation for Mutation and Visibility.

Reviewed By: quark-zju

Differential Revision: D20534279

fbshipit-source-id: 3f06de79b5efe3903f4d1baf76fa2030ee58e7f4
2020-03-20 04:09:32 -07:00
Xavier Deguillard
bb68ce52ff remotefilelog: provide fast path for cmp, size and isbinary
Summary: For LFS blobs, these can be obtained very easily by querying the ContentStore.

Reviewed By: DurhamG

Differential Revision: D20504235

fbshipit-source-id: 937ef20184d6524b1355565f9ab81e40b56d7ab0
2020-03-19 16:36:41 -07:00
Xavier Deguillard
68edce4365 lfs: allow the LFS remote to be a local directory
Summary:
This is only intended for Mercurial .t tests and not in any production
environment.

Reviewed By: DurhamG

Differential Revision: D20504236

fbshipit-source-id: 618e17631b73afa650875cb7217ba7c55fb9f737
2020-03-19 14:36:19 -07:00
Xavier Deguillard
9995e95e06 pyrevisionstore: expose ContentDataStore methods to Python
Summary:
This will enables the fast-path for comparing LFS blobs without reading the
entire blob.

Reviewed By: DurhamG

Differential Revision: D20504233

fbshipit-source-id: 446cec57fba77e02cc7070203bd759d341fc01ab
2020-03-19 14:36:19 -07:00
Xavier Deguillard
092cfcec7d revisionstore: add a ContentDataStore trait
Summary:
For now, this is only used for LFS, as this is the only store that can
correctly answer both.

This API will be exposed to Python to be able to have cheap filectx comparison,
and other use cases.

Reviewed By: DurhamG

Differential Revision: D20504234

fbshipit-source-id: 0edb912ce479eb469d679b7df39ba80fceef05f2
2020-03-19 14:36:18 -07:00
Xavier Deguillard
632bd53a02 revisionstore: add a LFS remote store
Summary:
This enables fetching blobs from the LFS server. For now, this is limited to
fetching them, but the protocol specify ways to also upload. That second part
will matter for commit cloud and when pushing code to the server.

One caveat to this code is that the LFS server is not mocked in tests, and thus
requests are done directly to the server. I chose very small blobs to limit the
disruption to the server, by setting a test specific user-agent, we should be
able to monitor traffic due to tests and potentially rate limit it.

Reviewed By: DurhamG

Differential Revision: D20445628

fbshipit-source-id: beb3acb3f69dd27b54f8df7ccb95b04192deca30
2020-03-19 14:36:18 -07:00
Jun Wu
6ffdcebadf tracing: write some blackbox events as tracing events
Summary:
This is the start of migrating blackbox events to tracing events. The
motivation is to have a single data source for log processing (for simplicity)
and the tracing data seems a better fit, since it can represent a tree of
spans, instead of just a flat list. Eventually blackbox might be mostly
a wrapper for tracing data, with some minimal support for logging some indexed
events.

Reviewed By: DurhamG

Differential Revision: D19797710

fbshipit-source-id: 034f17fb5552242b60e759559a202fd26061f1f1
2020-03-19 10:23:24 -07:00
Jun Wu
609330486e smartlog: optimize --all with narrow-heads
Summary:
The `all()` revset is much slower with narrow-heads for correctness. Use an
alternative that is fast.

Reviewed By: markbt

Differential Revision: D20528063

fbshipit-source-id: c8ae35e67e60407406ca81d67878278392626e9a
2020-03-19 10:05:28 -07:00
Arun Kulshreshtha
1e698d4aaf treemanifest: add ondemandfetch parameter to _gettrees
Summary: Based on comments on D20382825, we need to make sure that `_gettrees()` knows for sure whether on-demand tree fetching is in use in order to properly identify missing nodes in the response.

Reviewed By: quark-zju

Differential Revision: D20520439

fbshipit-source-id: ffa6d62dbe8b6f641b1dacebcb6f94ceae714c1b
2020-03-18 18:24:41 -07:00
Jun Wu
8cc30ac302 dag: add Segment::new API
Summary:
Now Segment has no lifetime we can create it directly and return the ownership.

Performance of "building segments" does not seem to change:

  # before
  building segments                                 750.129 ms

  # after
  building segments                                 712.177 ms

Reviewed By: sfilipco

Differential Revision: D20505200

fbshipit-source-id: 2448814751ad1a754b90267e43262da072bf4a16
2020-03-18 15:05:58 -07:00
Jun Wu
1bd54a5971 dag: drop lifetime on Segment<'a>
Summary:
This allows structures like BTreeMap to own and store Segment.

It was not possible until D19818714, which adds minibytes::Bytes interface for
indexedlog.

In theory this hurts performance a little bit. But the perf difference does not
seem visible by `cargo bench --bench dag_ops`:

  # before
  building segments                                 714.420 ms
  ancestors                                          54.045 ms
  children                                          490.386 ms
  common_ancestors (spans)                            2.579 s
  descendants (small subset)                        406.374 ms
  gca_one (2 ids)                                   161.260 ms
  gca_one (spans)                                     2.731 s
  gca_all (2 ids)                                   287.857 ms
  gca_all (spans)                                     2.799 s
  heads                                             234.130 ms
  heads_ancestors                                    39.383 ms
  is_ancestor                                       113.847 ms
  parents                                           251.604 ms
  parent_ids                                         11.412 ms
  range (2 ids)                                     117.037 ms
  range (spans)                                     241.156 ms
  roots                                             507.328 ms

  # after
  building segments                                 750.129 ms
  ancestors                                          53.341 ms
  children                                          515.607 ms
  common_ancestors (spans)                            2.664 s
  descendants (small subset)                        411.556 ms
  gca_one (2 ids)                                   164.466 ms
  gca_one (spans)                                     2.701 s
  gca_all (2 ids)                                   290.516 ms
  gca_all (spans)                                     2.801 s
  heads                                             240.548 ms
  heads_ancestors                                    39.625 ms
  is_ancestor                                       115.735 ms
  parents                                           239.353 ms
  parent_ids                                         11.172 ms
  range (2 ids)                                     115.483 ms
  range (spans)                                     235.694 ms
  roots                                             506.861 ms

Reviewed By: sfilipco

Differential Revision: D20505201

fbshipit-source-id: c34d48f0216fc5b20a1d348a75ace89ace7c080b
2020-03-18 15:05:57 -07:00
Durham Goode
ba122de053 tests: remove platform condition in eolfilename
Summary: Now that we sort the errors, we don't need this condition anymore.

Reviewed By: xavierd

Differential Revision: D20517578

fbshipit-source-id: 7012de387ee8acee1c1b630991f3a289a3fa48d1
2020-03-18 13:59:35 -07:00
Jun Wu
09e92a8d32 fscap: add osxfuse_eden
Summary:
EdenFS is reported as `osxfuse_eden` on OSX after D20313385.
Update the fscap table to avoid slow paths testing fs capabilities.

Without this diff, churns on edenfs OSX will trigger undesirable watchman
events.

Reported by: fanzeyi

Reviewed By: fanzeyi

Differential Revision: D20518902

fbshipit-source-id: 2e8e472df16d08b17834b2c966c065bbaad052fe
2020-03-18 13:14:19 -07:00
Xavier Deguillard
db310fc87f revisionstore: replace lazy_init with once_cell
Summary:
The later is what is now recommended, and no longer requires a macro to
initialize a lazy value, leading to nicer code.

Reviewed By: DurhamG

Differential Revision: D20491488

fbshipit-source-id: 2e0126c9c61d0885e5deee9dbf112a3cd64376d6
2020-03-18 12:20:12 -07:00
Xavier Deguillard
9c8633bb0a revisionstore: address clippy warnings
Summary:
Lots of different warnings on this one. Main ones were:
 - One bug where .write was used instead of .write_all
 - Using .next instead of .nth(0) for iterators,
 - Using .cloned() instead of .map(|x| x.clone())
 - Using conditions as expressions instead of mut variables
 - Using .to_vec() on slices instead of .iter().cloned().collect().
 - Using .is_empty instead of comparing .len() against 0.

Reviewed By: DurhamG

Differential Revision: D20469894

fbshipit-source-id: 3666a44ad05e0fbfa68d490595703c022073af63
2020-03-18 10:16:39 -07:00
Xavier Deguillard
a760c0e672 edenapi: address clippy warnings
Reviewed By: DurhamG

Differential Revision: D20469646

fbshipit-source-id: 222f75196ef140c2e9bdfc0a0500f3fbcffb2309
2020-03-18 10:16:39 -07:00
Xavier Deguillard
121e524df9 blackbox: address clippy warnings
Reviewed By: DurhamG

Differential Revision: D20469649

fbshipit-source-id: 99b0e68259b5e2ed5b1c969d0a5fa8473e899f17
2020-03-18 10:16:39 -07:00
Xavier Deguillard
aae9075762 lz4-pyframe: address clippy warnings.
Reviewed By: DurhamG

Differential Revision: D20469648

fbshipit-source-id: 346c8a23ff2b4a895a066843ebe5341103956e76
2020-03-18 10:16:38 -07:00
Xavier Deguillard
8c1f033f50 indexedlog: address clippy warnings
Summary:
These were from a wide variety of warnings. The only one I haven't addressed is
that clippy complains that Pin<Box<Vec<u8>>> can be replaced by Pin<Vec<u8>>. I
haven't investigated too much into it, someone more familiar with this code can
probably figure out if this is buggy or not :)

Reviewed By: DurhamG

Differential Revision: D20469647

fbshipit-source-id: d42891d95c1d21b625230234994ab49bbc45b961
2020-03-18 10:16:38 -07:00
Xavier Deguillard
42f1213efa util: address clippy warnings
Summary: The lifetime is unecessary.

Reviewed By: DurhamG

Differential Revision: D20452750

fbshipit-source-id: 184f5e109a0ff59931bdddaf611a7581d2255e78
2020-03-18 09:35:36 -07:00
Jun Wu
e48079180f indexedlog: fix a typo in benchmarks
Summary:
This belongs to D20149376. However buck test does not include benchmarks so it
was not noticed.

Reviewed By: DurhamG

Differential Revision: D20505097

fbshipit-source-id: 24daeb17b68808f8e69e18452ab2cf26c7aa10a7
2020-03-18 09:30:31 -07:00