Commit Graph

26 Commits

Author SHA1 Message Date
Jun Wu
a6e3b948c9 chgserver: replace the raw stdio fds (0, 1, 2) directly
Summary:
Previously those fds were obtained via `fp.fileno()`. We're going to replace
the `fp` with something backed by Rust that does not have `fileno()`. Update
chg to replace the raw fds (0, 1, 2) directly. This is enough to affect both
Python and Rust's stdio so there is no need to replace `ui.fout`, `ui.ferr`
again.

Reviewed By: sfilipco

Differential Revision: D26612484

fbshipit-source-id: 5cd89e5955a1dcaad3d3132730354ee67c016bf0
2021-02-23 22:33:48 -08:00
Xavier Deguillard
77f3f239a2 store: replace use of ctreemanifest with small manifest parser
Summary:
The code still took a dependency on Mercurial's old manifest code to parse
manifests. It turns out the manifests have a very simple format that we could
parse directly.

This avoids various copies, conversions, std::list, removes ~1k lines of code,
at the expense of adding ~100 lines of code (some of them being C++
boilerplate).

Reviewed By: fanzeyi

Differential Revision: D25385018

fbshipit-source-id: 90d4cda2b7797584bc48c086d5592a7ecaa05dfc
2020-12-09 08:40:38 -08:00
Xavier Deguillard
b693a4aaba tests: fix test-check-code.t
Summary:
A couple of files were moved but test-check-code.t wasn't updated to reflect
this, causing it to fail.

Reviewed By: DurhamG

Differential Revision: D24113079

fbshipit-source-id: 9a0c0b6f07a6532715bf5ee401036ded0a05b16a
2020-10-05 09:08:37 -07:00
Xavier Deguillard
0967eafcba build: remove portability headers
Summary: These aren't included anywhere, we can remove them.

Reviewed By: DurhamG

Differential Revision: D24062627

fbshipit-source-id: 9ff101eb44965ac3502ada3265ffcc8acc09d2e5
2020-10-02 10:47:24 -07:00
Xavier Deguillard
8cc2738aec clib: remove buffer.[ch]
Summary: These are unused, no need to keep the code around.

Reviewed By: DurhamG

Differential Revision: D24055085

fbshipit-source-id: 6246d746983a575c051ddcb51ae02582a764a814
2020-10-02 10:47:23 -07:00
Xavier Deguillard
a4e27d898d lib: remove portability/dirent.h
Summary: This is unused.

Reviewed By: DurhamG

Differential Revision: D24055083

fbshipit-source-id: bc6bbcf765ccb8c277e4a06e9fc3f033cd01733a
2020-10-02 10:47:23 -07:00
Xavier Deguillard
30ef9bdcf1 extlib: remove large parts of cstore/ctreemanifest
Summary:
This code is effectively unused. The only bit still relevant is that EdenFS
still depends on the Manifest class to parse a manifest.

Reviewed By: DurhamG

Differential Revision: D24037723

fbshipit-source-id: 901ae2ffc8960a95ec655a2e14d79afb8d32dcab
2020-10-02 10:47:22 -07:00
Xavier Deguillard
c16ab69c6a build: remove //eden/scm:cstore
Summary: This is unused, let's remove it.

Reviewed By: DurhamG

Differential Revision: D24037722

fbshipit-source-id: bc8a272809cb1f20f54d651a39ee42ff57169534
2020-10-02 10:47:22 -07:00
Jun Wu
80bf264e24 debugshell: add "api" object
Summary: It is handy to test edenapi methods directly.

Reviewed By: kulshrax

Differential Revision: D23750709

fbshipit-source-id: 33c15cecaa0372ba9e4688502e7d8f3fdda7c3b8
2020-09-18 13:28:33 -07:00
Jun Wu
f271d882e6 hgcommands: make commands! macro define modules
Summary: Similar to D18528858 so module names do not need to be spelled twice.

Reviewed By: markbt

Differential Revision: D23091380

fbshipit-source-id: a2a261abc9c78c8805cea62b38498ba65398796d
2020-08-27 19:02:27 -07:00
Mark Thomas
a25521a48b tests: remove uses of $PYTHON -c
Reviewed By: quark-zju, ikostia

Differential Revision: D23151936

fbshipit-source-id: f5dc1bf1e2007fe82c8ea67fa94c7b5aa3fd9a0c
2020-08-19 00:32:19 -07:00
Durham Goode
7f1588131b py3: set LANG="en_US.UTF-8" for most tests
Summary:
We support unicode file paths, and in python 3 those get passed to
python libraries as unicode strings. The tests set LANG=C which mean the python
library tries to convert the path to ascii, but fails for any non-ascii
characters. Let's switch to LANG="en_US.UTF-8" to match our production
behavior and make tests about unicode paths work.

Reviewed By: xavierd

Differential Revision: D22098359

fbshipit-source-id: c3057edc66e6e32f7b8b49374e622d02bd05711f
2020-06-19 13:40:17 -07:00
Jun Wu
0fbd279db9 test-check-code: skip checking Python code in tests/
Summary: This makes tests more stable when changed.

Reviewed By: markbt

Differential Revision: D21894314

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

Reviewed By: DurhamG

Differential Revision: D21526667

fbshipit-source-id: 40583bfb094e52939130250dd71b96db4d725ad5
2020-05-13 19:27:41 -07:00
Mark Thomas
052e7c3877 check-code: convert to Python 3
Summary:
Update `contrib/check-code.py` to Python 3.

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

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

Reviewed By: quark-zju

Differential Revision: D21427212

fbshipit-source-id: 7461a7c391e0ade947f779a2b476ca937fd24a8d
2020-05-07 09:07:50 -07:00
Durham Goode
a7e62ec3de hggit: add ability to skip commits using hggit.skipgithashes
Summary:
We've had cases where a git commit goes in that shouldn't be translated
to Mercurial. Let's add an option to skip the commit. Instead of skipping it
entirely (which would require complicated logic to then parent the following
commit on the last converted commit), let's just convert the skipped commit as
an empty commit. This should cover the cases we've encountered so far.

Reviewed By: krallin

Differential Revision: D20261743

fbshipit-source-id: da401863b09c2ac727aae1ceef10a0e8d8f98a7e
2020-03-05 15:06:30 -08:00
Xavier Deguillard
467f4aef45 tests: mark python3 tests as passing
Summary:
Ran ./run-tests.py --json and used the following script:

  import json
  import subprocess

  with open("report.json", "r") as f:
      tests = json.load(f)
      for name, t in tests.items():
          if t["result"] == "success":
              print("%s successful" % name)
              subprocess.run("sed -i '/#require py2/d' %s" % name, shell=True)
              subprocess.run("sed -i '/require.*py2/d' %s" % name, shell=True)

Reviewed By: singhsrb

Differential Revision: D19664298

fbshipit-source-id: fa67c7c7abd110c9f0df9345daf09f2792aacd44
2020-01-31 10:13:45 -08:00
Zeyi (Rice) Fan
92f6f35e7a mark all tests requiring Python 2
Summary:
This diff marks **ALL** mercurial tests requiring Python 2 feature.

After you fixes some tests, simply remove the `py2` feature requirement and that tests will be continuously run after your diff is landed.

To bypass this feature requirement, run the tests command with `HGTEST_FORCE_PY2=1`. For example:

```
HGTEST_FORCE_PY2=1 buck test //eden/scm/tests:hg_run_tests
```

or

```
HGTEST_FORCE_PY2=1 python run-tests.py
```

----

Basically this diff are created with the following commands:

```
$ sed -i 's/import feature\(.*\)$/import feature\1\n\nfeature.require(["py2"])/' test-*-t.py
$ sed -i '1s/^/#require py2\n/' test-*.t
$ ls | grep -P "^test.*(?<\!-t)\.py$" > list && vim -p $(cat list)
# manually adding feature requires for these Python tests.
```

(Note: this ignores all push blocking failures!)

ignore-conflict-markers

Reviewed By: singhsrb

Differential Revision: D19655148

fbshipit-source-id: 985e3ccb4010cc559049f1d89f8909bc2d9b5e20
2020-01-30 18:49:21 -08:00
Xavier Deguillard
781d0e04ad test-check-code.t: make it run on python3
Summary:
The sources are opened in byte mode, therefore the regexp needs to be a byte
one.

Reviewed By: singhsrb

Differential Revision: D19655928

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

Reviewed By: DurhamG

Differential Revision: D18946332

fbshipit-source-id: 721f47bc5b2835d7ca0a05ab34ea4faa1a411a4e
2020-01-09 11:51:31 -08:00
Xavier Deguillard
f0bf034842 test-check-code: use glob for st_*time error
Summary: This keep failing due to single line changes. Let's make it more robust.

Reviewed By: kulshrax

Differential Revision: D18963816

fbshipit-source-id: c56748560b619c4c682e8cc9e5710c607aa363fb
2019-12-12 11:41:22 -08:00
Jun Wu
75a8173a10 tests: enable chg for 572 tests
Summary:
Add `#chg-compatible` to 572 tests that seem to pass with chg enabled.
This should make them run faster.

Reviewed By: xavierd

Differential Revision: D18870507

fbshipit-source-id: fe895e733efffc9286cd3d17c7a156c803124395
2019-12-09 15:26:29 -08:00
Xavier Deguillard
24d99a9178 util: remove os.stat_float_times(False)
Summary:
This is not available on Python3, instead stat.ST_MTIME and friends should be
used to get an integer time. This is achieved by wrapping the output of the
stat function and overriding the st_[acm]time properties.

Reviewed By: quark-zju

Differential Revision: D18819679

fbshipit-source-id: 2911f3d47506456e927872d57f69253d903618e2
2019-12-09 13:13:26 -08:00
Mateusz Kwapich
7a0665c9fc remove dead code from fbconduit hg extension
Summary:
Since it's not calling conduit anymore we can remove all conduit related
functions.

Reviewed By: quark-zju

Differential Revision: D18733121

fbshipit-source-id: 20a6022d9ac7ae6e9afea2791a8daac57cefb22c
2019-12-03 05:56:20 -08:00
Mateusz Kwapich
fa8571f49a migrate log_v2 to grpahql
Summary:
conduit is going away, phabricator team wants us to stop using
it in hg.

Reviewed By: quark-zju

Differential Revision: D18732257

fbshipit-source-id: c4faf83e36af80fc616e91adede141ba12de5446
2019-12-03 05:56:20 -08:00
Adam Simpkins
ab3a7cb21f Move fb-mercurial sources into an eden/scm subdirectory.
Summary:
In preparation for merging fb-mercurial sources to the Eden repository,
move everything from the top-level directory into an `eden/scm`
subdirectory.
2019-11-13 16:04:48 -08:00