Commit Graph

20 Commits

Author SHA1 Message Date
John Reese
d13e0b137f apply pyfmt with usort to opted-in sources
Reviewed By: zertosh

Differential Revision: D24880203

fbshipit-source-id: 2034cdfc2712209e86d3d05c119c58f979b05c52
2020-11-10 21:25:54 -08:00
Durham Goode
e6af9b25b1 py3: fix globalrevs
Summary: The tests now pass with python 3.

Reviewed By: singhsrb

Differential Revision: D24583278

fbshipit-source-id: 7e0a0805751b1d3f1c77dfcd20df5b460994820a
2020-10-28 08:56:55 -07:00
Jun Wu
88a6d88b90 tests: remove revnum from aliases
Summary: Remove revnum from `showgraph`, `tglog*` aliases.

Reviewed By: singhsrb

Differential Revision: D24191791

fbshipit-source-id: f60c00289a0c6d06101f1c8645fc9d6e0f0c941e
2020-10-08 20:31:41 -07:00
Durham Goode
42b3a1b6bc py3: support outputing bytes via templater
Summary:
The 'diff()' template needs to be able to output non-utf8 patches.
To enable this, let's change the templater to output bytes instead of strings.

Note, the templater supports json output, which requires utf8 encoded values. In
that situation we escape any non-utf8 binary and clients would have to be aware
and unescape them.

Reviewed By: quark-zju

Differential Revision: D24029105

fbshipit-source-id: aa011696c0d97281b91c6871c116037d76c178e0
2020-10-02 07:27:08 -07:00
Mark Thomas
2117806dc7 tests: convert dummyssh and get_free_socket to python3
Summary: Convert dummyssh and get_free_socket to full python3 binaries.

Reviewed By: johansglock

Differential Revision: D23105490

fbshipit-source-id: 6c39c32ba0728cde108b42245acece1d7828ac7c
2020-08-17 02:42:14 -07:00
Jun Wu
ed8fd9202c hgsql: disable modern features more aggressively
Summary:
D21894320 (64585a5895) tries to disable features from hgsql. However tests can
run hg commands with hgsql extension turned on or off, and that
messes up things.

Let's test the hgsql requirement and disable related features unconditionally
so we have more confident that the related features won't be turned on
accidentally.

Previously, the `initclient` helper function will create repos with the `hgsql`
requirement. Since we're using the repo requirement to disable features, disable
`hgsql` temporarily during `initclient` so that the client repos can still have
modern features like visibility and narrow-heads.

The globalrevs test is affected and temporarily disabled. It will be fixed in
follow-ups.

Reviewed By: DurhamG

Differential Revision: D22200507

fbshipit-source-id: 3715464430a9115bb00122a8dfa03b1abf9d03ab
2020-07-02 13:22:34 -07:00
Jun Wu
31b655c656 testutil: make traceback in dott test more useful
Summary:
Without the change the traceback looks like:

```
Traceback (most recent call last):
  File "eden/scm/tests/testutil/dott/shobj.py", line 103, in __del__
    out = self.output
  File "eden/scm/tests/testutil/dott/shobj.py", line 67, in output
    self._output = func(*args[1:], **kwargs) or ""
  File "eden/scm/tests/test-globalrevs-t.py", line 499, in checkglobalrevs
    isgreaterglobalrev("desc('h2')", "desc('g1')") == ""
  File "eden/scm/tests/test-globalrevs-t.py", line 480, in isgreaterglobalrev
    if getglobalrev(left) > getglobalrev(right):
  File "eden/scm/tests/test-globalrevs-t.py", line 469, in getglobalrev
    return int(s)
ValueError: invalid literal for int() with base 10: ''
```

There is no clue about who calls `checkglobalrevs`.

With this change the extra context is provided and it's easy to find out the code is around line 517:

```
Before executing:
  File "eden/scm/tests/test-globalrevs-t.py", line 517, in <module>
    sh % "cd ../master2"
  File "eden/scm/tests/testutil/dott/shobj.py", line 161, in __mod__
    return LazyCommand(command)
  File "eden/scm/tests/testutil/dott/shobj.py", line 38, in __init__
    _checkdelayedexception()
  File "eden/scm/tests/testutil/dott/shobj.py", line 204, in _checkdelayedexception
    traceback.print_stack()
```

Note: before D19649475 (a634526801) the traceback looks like more useful but it's hard to
create that traceback on Python 3:

```
Traceback (most recent call last):
  File "eden/scm/tests/test-globalrevs-t.py", line 517, in <module>
    sh % "cd ../master2"
  File "eden/scm/tests/testutil/dott/shobj.py", line 161, in __mod__
    return LazyCommand(command)
  File "eden/scm/tests/testutil/dott/shobj.py", line 38, in __init__
    _checkdelayedexception()
  File "eden/scm/tests/testutil/dott/shobj.py", line 202, in _checkdelayedexception
    exec("raise exctype, excvalue, tb")
  File "eden/scm/tests/testutil/dott/shobj.py", line 103, in __del__
    out = self.output
  File "eden/scm/tests/testutil/dott/shobj.py", line 67, in output
    self._output = func(*args[1:], **kwargs) or ""
  File "eden/scm/tests/test-globalrevs-t.py", line 499, in checkglobalrevs
    isgreaterglobalrev("desc('h2')", "desc('g1')") == ""
  File "eden/scm/tests/test-globalrevs-t.py", line 480, in isgreaterglobalrev
    if getglobalrev(left) > getglobalrev(right):
  File "eden/scm/tests/test-globalrevs-t.py", line 469, in getglobalrev
    return int(s)
ValueError: invalid literal for int() with base 10: ''
```

Reviewed By: DurhamG

Differential Revision: D22200508

fbshipit-source-id: 07088eac72763f890cc847b9991d79fed18ee0ef
2020-07-02 13:22:34 -07:00
Durham Goode
dab8077917 py3: fix test-command-template-t.py
Summary: It now passes

Reviewed By: quark-zju

Differential Revision: D22193416

fbshipit-source-id: 8c1a783eb9fe46de1773ec3b8c23465cb0c766b0
2020-06-24 01:43:35 -07:00
Durham Goode
96e6337e2a py3: fixes test-export-t.py
Summary: It now passes

Reviewed By: quark-zju

Differential Revision: D22146555

fbshipit-source-id: 97b82a9dcd564a287e590940f6191456ca059868
2020-06-22 11:27:52 -07:00
Durham Goode
41cc67d011 py3: fix remotefilelog repack tests
Reviewed By: quark-zju

Differential Revision: D19751790

fbshipit-source-id: a898a8c37929a73ee2654d2907e9ea5bb2e3fd8a
2020-02-17 14:52:33 -08:00
Durham Goode
e9042dfae4 py3: add test for unicode commit messages
Summary: Test that mercurial can accept a unicode commit message.

Reviewed By: xavierd

Differential Revision: D19838221

fbshipit-source-id: b6333e587004b358a3883db70e40d2f32af4da29
2020-02-12 09:10:12 -08:00
Jun Wu
3e0b781197 py3: only use binary stdin/stdout/stderr
Summary:
Drop stdoutbytes/stdinbytes. They make things unnecessarily complicated
(especially for chg / Rust dispatch entry point).

The new idea is IO are using bytes. Text are written in utf-8 (Python 3) or
local encoding (Python 2). To make stdout behave reasonably on systems not
using utf-8 locale (ex. Windows), we might add a Rust binding to Rust's stdout,
which does the right thing:
- When writing to stdout console, expect text to be utf-8 encoded and do proper decoding.
- Wehn writing to stdout file, write the raw bytes without translation.

Note Python's `sys.stdout.buffer` does not do translation when writing to stdout console
like Rust's stdout.

For now, my main motivation of this change is to fix chg on Python 3.

Reviewed By: xavierd

Differential Revision: D19702533

fbshipit-source-id: 74704c83e1b200ff66fb3a2d23d97ff21c7239c8
2020-02-03 18:26:57 -08:00
Durham Goode
8c211e5224 py3: fix stdout/stderr in dott tests
Summary:
dott tests rig up a custom stdout/stderr. In Python 3 we expect them to
be strings, so we need to use an appropriate io object.

Unfortunatly upstream already created a pycompat.stringio object which uses
bytes for both python 3 and 2, so I had to use a new name for now.

Reviewed By: quark-zju

Differential Revision: D19653469

fbshipit-source-id: a529df5a2ab179c105fa441c4503ed6606e77543
2020-01-30 18:00:34 -08:00
Zeyi (Rice) Fan
a634526801 some fix for run-tests
Summary:
Fix some common errors when run `run-tests` in Python 3.

shlib would be using `str` for stdin/stdout instead of bytes as most of the code in Python 2 operates with that assumption. Getting it to `bytes` will take some work.

Reviewed By: DurhamG, quark-zju

Differential Revision: D19649475

fbshipit-source-id: 1f0190fce4df9a530246774fd17cdfc2d7974a65
2020-01-30 17:24:32 -08:00
Genevieve Helsel
ce2bf270b3 fix_map
Summary: Python 3 map call doesn't return list, so wrap in list.

Reviewed By: mitrandir77, xavierd

Differential Revision: D19588352

fbshipit-source-id: 8556f4783f9bedb8a74ec0e99ff226ff96f387a9
2020-01-28 18:24:56 -08:00
Jun Wu
4a98b00205 changelog: still migrate non-public commits to zstore
Summary:
This makes it safer to do revlog-fallback -> server-fallback switch in the
future, because the server might not know all the draft commits.

Reviewed By: DurhamG

Differential Revision: D19416287

fbshipit-source-id: 8d69c1c5465b50710110370d84d5fb7c8ba6a6c4
2020-01-17 04:01:05 -08:00
Jun Wu
aa64745a35 debugmetalog: add a command to show repo history
Summary:
The command shows how visibility, bookmarks, remotenames change in the repo
over time, using metalog data.

Also add this command to hg rage report.

Reviewed By: markbt

Differential Revision: D19358668

fbshipit-source-id: 9bddc039143b45c29c0c937ee60906ab93a2defe
2020-01-13 14:29:07 -08:00
Durham Goode
e1c73204f6 drawdag: use bookmarks instead of tags
Summary:
A future diff will remove tags entirely, so let's move drawdag to be
bookmark based.

Reviewed By: quark-zju

Differential Revision: D18995059

fbshipit-source-id: 70ef67259b37ef9821009d0145aa1e03c09b1309
2019-12-20 16:14:18 -08:00
Stefan Filip
713dea745c tests: add test-rustmanifest-t
Summary:
This is a test that aims to validate that commit manifest match between the C++
and Rust implementations.

Reviewed By: quark-zju

Differential Revision: D18521823

fbshipit-source-id: 678b82239e9be7ad078f1e04a6467e87adaac966
2019-12-06 13:36:42 -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