Summary:
Global states (For example, the global blackbox instance, potentially some
logging / tracing libraries) are separate in the Rust and Python worlds.
That is because related code gets compiled separately:
bindings.so (top-level)
\_ blackbox
hgmain (top-level)
\_ blackbox (have a different global instance than the above blackbox)
To address it, make `bindings` a builtin module in `hgmain`.
The builtin module was renamed from `edenscmnative.bindings` to `bindings` so
it does not require importing anything else (For example, `edenscmnative`).
This unfortunately makes `hg` 100+ MB. Fortunately it can be compressed well
(gzip: 31MB).
Reviewed By: singhsrb
Differential Revision: D17429688
fbshipit-source-id: bf16910d7a260ca58db0d272fc95d8071d47bbc6
Summary: This makes the test runner compatible with the next change.
Reviewed By: singhsrb
Differential Revision: D17429690
fbshipit-source-id: 100d2c9f341cfc64be22137b7013f5b234005771
Summary:
In the future `python` will no longer be able to import `bindings`.
Change them to `hg debugpython` so they stay compatible.
I dropped the "custom hghave" feature. It breaks and I don't think there
are users of it.
Reviewed By: singhsrb
Differential Revision: D17429689
fbshipit-source-id: 96e55ef25a027bd4ad33fc279f27c1d5cbed6861
Summary:
We don't care about hgweb / cgi right now. The tests use `$PYTHON` and import
the `bindings` module. In a future diff `$PYTHON` no longer has access to
`bindings`. Remove the tests so the test is compatibile.
Reviewed By: xavierd
Differential Revision: D17429692
fbshipit-source-id: b3d7c7de34bdb7f28d8b7989e9df822435b84fb2
Summary: We don't use clonebundles. Remove the test to reduce support burden.
Reviewed By: singhsrb
Differential Revision: D17483628
fbshipit-source-id: f63070dcd7bb7283d249d33ac760bdebbbc4261a
Summary:
This makes it possible to use `hg debugpython -- ...` to replace `python ...`.
An upcoming change makes `edenscmnative.bindings` non-importable. To continue
support Python tests, we need an alternative way to run Python.
Reviewed By: singhsrb
Differential Revision: D17423797
fbshipit-source-id: 21ece4d35c2fdc09c281b10d5a07ee8af2e78384
Summary:
The eventual goal is to disable repoview filtering once narrow-heads is set.
The repoview layer is using a blacklist approach - scan through all heads (or
all drafts), and figure out what to blacklist. The new dag structure has a
larger constant factor on time complexity when it comes to many heads.
This diff disables repoview filtering entirely if 'narrow-heads' gets turned
on, as the first step moving to the whitelist approach. There are other isues,
which will be fixed in upcoming diffs.
Reviewed By: sfilipco
Differential Revision: D17244557
fbshipit-source-id: 260214378abba4b0ecd0a0407d452352b6dc3c28
Summary: The test contains issues in test-narrow-heads that need fixes.
Reviewed By: sfilipco
Differential Revision: D17244550
fbshipit-source-id: aca6ffa51ab95436a32b3bdf40dbf05a376dbdbe
Summary:
Add a config option `experimental.narrow-heads`. Once set, "heads" get
redefined by a whitelist (visibility heads + remote names).
This is one step towards removing the blacklist (filteredrev) approach,
which does not scale with the new changelog design.
Reviewed By: sfilipco
Differential Revision: D17199845
fbshipit-source-id: 0feb300ad3ad7b2e33dd7781b4fc181233609a10
Summary:
Normally, when you push an lfs blob the server doesn't need to ever
download the lfs blob content because it can just compare the hashes. There's a
special case though, when a commit makes a blob go from lfs to non-lfs and the
previous version of the blob was a rename, then Mercurial must actually read the
file contents and compare it to know if it changed.
This adds a test to cover the case.
Reviewed By: quark-zju
Differential Revision: D17488079
fbshipit-source-id: 4313ee01e103d3ad13463e4774096d866d420b2e
Summary:
Tree manifests want to have a different order than flat manifests.
This difference in orders can cause algorithms like diff to give wrong
results. This test aims to validate that the treemanifest implemetations
work correctly for cases where the orders are different.
Reviewed By: quark-zju
Differential Revision: D17492500
fbshipit-source-id: eabb5d0fed5804b3d81c12667621ec6d38e0bfce
Summary:
This is an attempt to solve issues that watchman state in dirstate stays stale
and users have pretty bad experience.
Normally, `hg status` is a "read-only" operation that works in a lock-free way,
and `status` still work if other hg commands are taking a lock. However,
`hg status` does need to update watchman state (clock, need-check file list) to
stay performant.
In case watchman reports "fresh instance" case, watchman also returns all file
paths in the working copy, which means the current `status` has very bad
performance, and the next `status` call can still be bad if the watchman state
in dirstate does not get updated.
This diff adds special handling of "fresh instance", waits for the lock, and
attempts to update the watchman state. It should reduce user frustration about
continuously slow `hg status` commands. In case it failed to update the
watchman state, also print warning messages so the user is aware of the issue.
For example, if there is an ongoing `hg histedit` that waits for the editor.
Reviewed By: wez
Differential Revision: D17468790
fbshipit-source-id: ad06bb1d5d13c6904db328c42a470112c3ee9940
Summary:
D17277286 changed the error type to SystemExit to swallow the traceback and
make the error cleaner. But that breaks `except Exception` used in `__del__`,
because `isinstance(SystemExit, Exception)` is `False` (surprise !).
Fix it by listing `SystemExit` explicitly.
Also remove the noisy `exception ... in __del__ ignored` message by removing
the `raise`.
Make sure the delayed exception will be handled by adding an `atexit` handler.
Reviewed By: sfilipco
Differential Revision: D17493283
fbshipit-source-id: 2301e318e06708804486d8625118210ae2e42817
Summary:
We're down to just one use of hgsubversion. In that use it's convienent
to skip empty commits when pushing. Let's add logic to bypass empty commits.
Differential Revision: D17452527
fbshipit-source-id: 5ef76df7d0a44f2d43f4ea0d8678e4174c0286ee
Summary: In case run-tests.py prepares $HGRCPATH, it should not be rewritten.
Reviewed By: sfilipco
Differential Revision: D17483075
fbshipit-source-id: d5d32aa65833dde68b37229802a39a75a32b37d0
Summary:
When the rebase destination has renamed a file, and copytrace failed to figure
out anything useful, make it possible to manually input the rename destination.
I'm using it to resolve conflicts caused by landing the bindings rename.
Reviewed By: xavierd
Differential Revision: D17367857
fbshipit-source-id: 55d9ed3a9641e40cc43518e9662fd803cbc00620
Summary:
This is useful when writing merge tools that are checked into the repo. We can now reference a tool in the repo. Suggested use case:
[merge-tools]
mytool =
mytool.executable = scripts/mytool.py
Reviewed By: quark-zju
Differential Revision: D17342897
fbshipit-source-id: ffdb160dfea8404721c4fc94fdfcab2d86cca08d
Summary:
One step towards redefining heads with remote heads.
Debugshell was teached to skip IPython for non-interactive input.
(For some reason most part of this diff got folded into the previous one)
Reviewed By: sfilipco
Differential Revision: D17199842
fbshipit-source-id: 1594658e3e5f2f2c51f817bc1074d28329df7786
Summary:
This provides a way to check if the hg process was gone unexpectedly.
The motivation was to make it less likely that Nuclide shows an hg operation
was ongoing but the process was long gone.
Reviewed By: xavierd
Differential Revision: D17372808
fbshipit-source-id: 19e51f8bbd0fdf14b7e0a4bdb8247d1b4277ee48
Summary:
In the future the changelog would need to access 'remotenames' to figure out
public heads. Move the state file to svfs so it can be read by the changelog
object, which only has access to svfs.
Reviewed By: sfilipco
Differential Revision: D17199834
fbshipit-source-id: 9000e0d8e8bb8d398d6c77b5b395da904fef6418
Summary:
We don't use fncache. It does not scale. The test break with narrow-heads.
This diff just removes the fncache test.
Reviewed By: singhsrb
Differential Revision: D17293478
fbshipit-source-id: b41dba333276ad63973b7556dfc400f4b33f6f5d
Summary:
I hit this when editing the dag stack. This resolves a "BUG" in the
test-amend-nextrebase.t test.
Reviewed By: singhsrb
Differential Revision: D17357387
fbshipit-source-id: 309efe34dee71180abdbdb5a9fe2e7b731230051
Summary:
`ascii` was used as the default / fallback, which is not a user-friendly choice.
Nowadays utf-8 dominates:
- Rust stdlib is utf-8.
- Ruby since 1.9 is utf-8 by default.
- Python 3 is unicode by default.
- Windows 10 adds utf-8 code page.
Given the fact that:
- Our CI sets HGENCODING to utf-8
- Nuclide passes `--encoding=utf-8` to every command.
- Some people have messed up with `LC_*` and complained about hg crashes.
- utf-8 is a super set of ascii, nobody complains that they want `ascii`
encoding and the `utf-8` encoding messed their setup up.
Let's just use `utf-8` as the default encoding. More aggressively, if someone
sets `ascii` as the encoding, it's almost always a mistake. Auto-correct that
to `utf-8` too.
This should also make future integration with Rust easier (where it's enforced
utf-8 and does not have an option to change the encoding). In the future we
might just drop the flexibility of choosing customized encoding, so this diff
autofixes `ascii` to `utf-8`, instead of allowing `ascii` to be set. We cannot
enforce `utf-8` yet, because of Windows.
Here is our encoding strategy vs the upstream's:
| item | upstream | | ours | ours |
| | current | ideal | current | ideal |
| CLI argv | bytes | bytes | utf-8 [1] | utf-8 |
| path | bytes | auto [3] | migrating [2] | utf-8 |
| commit message | utf-8 | utf-8 | utf-8 | utf-8 |
| bookmark name | utf-8 | utf-8 | utf-8 | utf-8 |
| file content | bytes | bytes | bytes | bytes |
[1]: Argv was accidentally enforced utf-8 for command-line arguments by a Rust
wrapper. But it simplified a lot of things and is kind of ok: everything that
can be passed as CLI arguments are utf-8: -M commit message, -b bookmark, paths,
etc. There is no "file content" passed via CLI arguments.
[2]: Path is controversial, because it's possible for systems to have non-utf8
paths. The upstream behavior is incorrect if a repo gets shared among different
encoding systems (ex. both Linux and Windows). We have to know the encoding of
paths to be able to convert them suitable for the local system. One way is to
enforce UTF-8 for paths. The other is to keep encoding information stored with
individual paths (like Ruby strings). The UTF-8 approach is much simpler with
the tradeoff that non-utf-8 paths become unsupported, which seems to be a
reasonable trade-off.
[3]: See https://www.mercurial-scm.org/wiki/WindowsUTF8Plan.
Reviewed By: singhsrb
Differential Revision: D17098991
fbshipit-source-id: c0ff1e586a887233bd43cdb854fb3538aa9b70c2
Summary:
It can fail with:
test-fb-hgext-treemanifest-treeonly-copyamend.t ...
--- test-fb-hgext-treemanifest-treeonly-copyamend.t
+++ test-fb-hgext-treemanifest-treeonly-copyamend.t.err
@@ -124,6 +124,7 @@
adding a/b/c/d/e/f/g/h/i/j/file3
fetching tree '' efa8fa4352b919302f90e85924e691a632d6bea0, found via 9f95b8f1011f
11 trees fetched over *s (glob)
+ 5 files fetched over 1 fetches - (5 misses, 0.00% hit ratio) over 0.00s
or:
--- test-fb-hgext-treemanifest-treeonly-copyamend.t
+++ test-fb-hgext-treemanifest-treeonly-copyamend.t.err
@@ -124,6 +124,7 @@
adding a/b/c/d/e/f/g/h/i/j/file3
fetching tree '' efa8fa4352b919302f90e85924e691a632d6bea0, found via 9f95b8f1011f
11 trees fetched over *s (glob)
+ 12 files fetched over 1 fetches - (12 misses, 0.00% hit ratio) over 0.00s
It fails more easily on Ubuntu. But it's also possible on CentOS.
Stabilize the test by allowing the optional output.
Reviewed By: singhsrb
Differential Revision: D17346110
fbshipit-source-id: ca6d1de5163e1b2bcb7bea5c619220d6f5e2c864
Summary: `scm-prompt` is a bit special. They didn't trigger those tests when modified.
Reviewed By: wez
Differential Revision: D17346163
fbshipit-source-id: ffafc017373031905cbf1fc2f80a3a8e8a606094
Summary:
Change the message so it looks more like a user error, not a crash in the
software. This is motivated by some people reporting `hg rage` crash with
`abort: no repository found` messages.
Reviewed By: sfilipco
Differential Revision: D17292658
fbshipit-source-id: 9988f54f2ff8fd48949bcd35c13309c117f3afc6
Summary:
The `remotefilelog.packlocaldata` has been on for a while now. Instead of
keeping the code around, let's simply remove it and fix all the tests that
assume a commit will generate loosefiles.
Reviewed By: quark-zju
Differential Revision: D17244837
fbshipit-source-id: e65ed16c9818be61be9ccbe19ce3fa18c890d70b
Summary:
The current error message is a bit noisy. Let's just get to the point about the
filename and line number that is interesting without tracebacks. This only
affects functions using the `autofix.eq` API, other kinds of exceptions will
have tracebacks as usual.
Before, run-tests.py (19 lines):
--- test-empty-t.py.out
+++ test-empty-t.py.err
@@ -0,0 +1,14 @@
+Traceback (most recent call last):
+ File "hg/tests/test-empty-t.py", line 71, in <module>
+ """
+ File "hg/tests/testutil/dott/shobj.py", line 89, in __eq__
+ autofix.eq(out, rhs, nested=1, eqfunc=eqglob)
+ File "hg/tests/testutil/autofix.py", line 93, in eq
+ raise AssertionError("actual != expected\n%s" % diff)
+AssertionError: actual != expected
+--- expected
++++ actual
+@@ -1 +1 @@
+-someheads
++allheads
+
ERROR: test-empty-t.py output changed
Before, run directly via python (13 lines):
Traceback (most recent call last):
File "test-empty-t.py", line 71, in <module>
"""
File "hg/tests/testutil/dott/shobj.py", line 89, in __eq__
autofix.eq(out, rhs, nested=1, eqfunc=eqglob)
File "hg/tests/testutil/autofix.py", line 93, in eq
raise AssertionError("actual != expected\n%s" % diff)
AssertionError: actual != expected
--- expected
+++ actual
@@ -1 +1 @@
-someheads
+allheads
After, run-tests.py (8 lines):
--- test-empty-t.py:71 (expected)
+++ test-empty-t.py:71 (actual)
@@ -1 +1 @@
-someheads
+allheads
ERROR: test-empty-t.py output changed
After, run directly (5 lines):
% python test-empty-t.py
--- test-empty-t.py:71 (expected)
+++ test-empty-t.py:71 (actual)
@@ -1 +1 @@
-someheads
+allheads
Reviewed By: xavierd
Differential Revision: D17277286
fbshipit-source-id: a48d4d1e817f67e221a901977e0c0f8bdc1a62ab
Summary:
Previously `python --fix test-foo-t.py` is the only way to autofix the test.
That's a bit annoying because `run-tests.py` has more features (ex. run many
tests together).
This diff changes `run-tests.py` to pass `--fix` to Python `-t.py` tests so
the autofix works in a familiar way. `--fix` was added as an alias to
`--update-output` to make it consistent with the Python UX.
Reviewed By: xavierd
Differential Revision: D17277287
fbshipit-source-id: e815a79895161862d844de165710cc36d6709727
Summary:
Comparing to `.t` tests, `dott` Python tests cannot autofix commands without
outputs. This diff makes it able to do so. It's less strict than the AST
parsing (for example, it does not handle `#` comments precisely). But
practically it might be good enough. We can update it to use real AST parsing
if it becomes an issue.
This should make `dott` Python tests easier to use.
Reviewed By: xavierd
Differential Revision: D17277285
fbshipit-source-id: 11ef6ec4327a6547d49b544c63bc000a3c351947
Summary:
The current `dott` library enforces `sh % "foo"` to output nothing. That's
done by checking in `__del__`. `__del__` is special and cannot raise exceptions
so the current code put exceptions in a "delayed" list and raise it later.
However, the "later" raise uses a new traceback that is useless.
This diff changes it to use `sys.exc_info` to save the traceback information
so we can re-raise with more accurate exception:
For example, the exception before looks like:
% python test-empty-t.py
Traceback (most recent call last):
File "test-empty-t.py", line 71, in <module>
sh % "cd .."
File "fbcode/scm/hg/tests/testutil/dott/shobj.py", line 151, in __mod__
return LazyCommand(command)
File "fbcode/scm/hg/tests/testutil/dott/shobj.py", line 28, in __init__
raise _delayedexception[0]
UnboundLocalError: local variable 'code' referenced before assignment
The `shobj.py` in traceback is pointless.
With the change, it now looks like:
% python test-empty-t.py
Traceback (most recent call last):
File "test-empty-t.py", line 71, in <module>
sh % "cd .."
File "fbcode/scm/hg/tests/testutil/dott/shobj.py", line 153, in __mod__
return LazyCommand(command)
File "fbcode/scm/hg/tests/testutil/dott/shobj.py", line 97, in __del__
autofix.eq(out, "", nested=1, fixfunc=_fixoutput)
File "fbcode/scm/hg/tests/testutil/autofix.py", line 74, in eq
fix = fixfunc(code, parse, lineno, parse(path))
UnboundLocalError: local variable 'code' referenced before assignment
Reviewed By: xavierd
Differential Revision: D17277288
fbshipit-source-id: 91f22b75b2e2efd632f5844b1d2554e7406be926
Summary:
We were still using the Python based repack, let's switch to the Rust one. As
far as I can tell, this code is unused, so the test change should be safe to
do.
Reviewed By: quark-zju
Differential Revision: D17207643
fbshipit-source-id: 89d0ba85327077dfc4e26c55ade3284beeb44b50
Summary:
For Eden we currently have a gap in our post-mount behavior;
we don't perform the update hooks for a freshly cloned and mounted repo.
The thought is that we'll explicitly trigger them by invoking `hg
debugedenrunpostupdatehook` at the end of the mount sequence.
Reviewed By: quark-zju
Differential Revision: D17237197
fbshipit-source-id: 9c2212c61735068c287eb98761503ce31bfee8a6
Summary: Also remove debug commands that are strictly related to remote lfs.
Reviewed By: markbt
Differential Revision: D17184902
fbshipit-source-id: da38a2150212500bab62191ddcfab0990276605e
Summary:
Instead of the lfs remote storage it was chosen to send the snapshot metadata via bundles.
Snapshot metadata consists of: the actual metadata blob + several other blobs (untracked files etc).
If we have several snapshot revisions in a single bundle, the blobs could repeat.
Then we should store each blob as a separate entry in a binary stream, keeping its id and contents.
Here we introduce a new bundle part type `"b2x:snapshotmetadataparttype"`.
```
1 byte of version info
[ # a list of binary entries, each corresponds to a separate file
# (either a metadata file itself or a related -- externally stored -- file)
<oid><length><data>
:oid: is a 64char string with the hash of the file
:length: is an unsigned int with length of the data
:data: is binary data of length <length>, the actual file contents
]
```
So far there is an ongoing discussion on the exact format of serialization.
Actual state is at [the quip doc](https://fb.quip.com/R5OVAzabX8oo).
Reviewed By: markbt
Differential Revision: D17184222
fbshipit-source-id: 90f833ec71556e90d513e3be3f3efa7f870b037d
Summary: In the next diff I will replace remote lfs with bundle2
Reviewed By: markbt
Differential Revision: D17132405
fbshipit-source-id: a0dfff3ebad067abb0231cf31de08ae62affe7ce
Summary:
The `debugmutation` command uses the unfiltered repo to resolve the
user-provided revs. It shouldn't do this unless the user passes `--hidden`.
Reviewed By: mitrandir77
Differential Revision: D17156722
fbshipit-source-id: 5ab7704acc598cf8b7c1640a3096ba0ce6ac73e9
Summary:
Update the debugmutation format to collapse long chains. Add
`hg debugmutation -s` to follow the successor relationship (printing what the
commit became) instead of the predecessor relationship.
Reviewed By: mitrandir77
Differential Revision: D17156463
fbshipit-source-id: 44a68692e3bdea6a2fe2ef9f53b533199136eab1
Summary:
If treemanifest finds there are too many shared packs (more than
`packs.maxpackfilecount`) then it will purge them. This is a shame if there is
currently a repack in progress, as it will purge the packfiles from underneath
the repack, deleting lots of cache data that will be imminently repacked).
Skip the purge if there is a repack ongoing.
Reviewed By: mitrandir77
Differential Revision: D17155854
fbshipit-source-id: 20d46f29c252e508177b1fde08ca7a69841dcd7e
Summary:
Instead of hardcoding `--target <target>` and hardcode `$2` in the script.
Let's just use environment variables so `target` and other things have explicit
names.
Explicit set `REAL_CWD` so the script can learn the current directory before
it gets reset to the repo root.
Reviewed By: xavierd
Differential Revision: D17213186
fbshipit-source-id: 6a4fc4cf2cbf6e2c623400bc6bc13f7758a46c49
Summary:
This makes metaedit support `-M / --reuse-message`, which I found handy when
rewriting prototype commits to formal commits.
Reviewed By: xavierd
Differential Revision: D17168991
fbshipit-source-id: fa768a2916ea3ef4db4c31a48989d10897379e92
Summary:
Change `cmdutil.logmessage` to take a `repo` instead of `ui`. This makes the
next change easier.
Reviewed By: xavierd
Differential Revision: D17168990
fbshipit-source-id: 47c1707e5a9dbf06d07452b4c400903453992379
Summary:
I have seen multiple user complaints about slow hg commands that turned out to
be fsmonitor scanning the whole working copy. Print a warning in those cases.
Hopefully this can reduce our oncall burden a bit.
Reviewed By: xavierd
Differential Revision: D17170520
fbshipit-source-id: 8fd5721d123853136c84229d936c3e0c999f3d87
Summary:
Make sigtrace use smarttraceback so it prints more context.
As we're here, also make it print to stderr so we don't need to find the
traceback from /tmp.
Reviewed By: xavierd
Differential Revision: D17066277
fbshipit-source-id: 9a1000803fed27a71ec381b8ddbd76400dae99c9
Summary: It will be used by snapshot extension too.
Reviewed By: markbt
Differential Revision: D17132134
fbshipit-source-id: 6c9fc285e0f1eb445bfa0abe0b6f4de4a1bd1db0