Summary: Replacing another fancyopts call to be parsed by native Rust code. This diff introduces slightly hacky feeling behavior in order to handle cycles and resolving aliases, but will be fixed in a follow-up diff where Rust will fully expand the aliases completely removing the need for this confusing alias resolving, chaining, and execution.
Reviewed By: quark-zju
Differential Revision: D15902758
fbshipit-source-id: 11d9a479989a23de09bf96f8020d2fded6c06351
Summary:
Copytrace modified the global definitions table which was making it very difficult to keep track of side-effects as the code was executed, as well as making it harder to replace the fancyopts calls with native Rust.
Since the copytrace behavior can be achieved through a configuration, it now will no longer modify the global definitions table, and will display the correct flag for a user to use in order to get this same behavior.
Reviewed By: quark-zju
Differential Revision: D15902449
fbshipit-source-id: 1c254162d56823e65085b7047bb37513f187b487
Summary: Replace the next usage of fancyopts in dispatch.py with native rust code, and ensure all tests pass with this replacement.
Reviewed By: quark-zju
Differential Revision: D15857997
fbshipit-source-id: ec8722bfe661731a14cb324e97846f861bd60bc8
Summary:
The current Python parsing library fancyopts does an early parse for global flags, as well as slightly different logic for parsing out flags.
Switching this fancyopts call should allow fancyopts to be completely replaced by the native code path, and start using Rust parsing for hg.
This enforces command line arguments to be utf8. At Facebook, our `hg` wrapper already crashes if that is not the case. So it shouldn't cause new issues.
Reviewed By: quark-zju
Differential Revision: D15837079
fbshipit-source-id: 95634ebc814f8865960181f23282e5283068057c
Summary: The global flags currently in Python should be ported to Rust definitions
Reviewed By: quark-zju
Differential Revision: D15782273
fbshipit-source-id: 1cfdb3bbab946d18dc3c899163286e30fa69c2c7
Summary:
Flags should be able to be matched partially by a prefix-match.
If a given prefix returns more than one possible Flag, it is therefore ambiguous and should not choose for the user.
An exact match should always take precedence. A partial match should be tried in the event the argument is not an exact match.
Reviewed By: quark-zju
Differential Revision: D15749936
fbshipit-source-id: 26e699616a1b3fa6871fb50cc6914f916701004c
Summary: This makes sure bytes (Python 2 `str`) is returned as expected.
Reviewed By: xavierd
Differential Revision: D16399693
fbshipit-source-id: c299933cfb5ec57bb46fed1f30a9ad07aa043703
Summary:
The `rust-cpython` library tries to be smart about `String` -> `PyObject` convertion.
It creates a unicode object if string is non-ascii:
impl PyString {
...
pub fn new(py: Python, s: &str) -> PyString {
#[cfg(feature="python27-sys")]
fn new_impl(py: Python, s: &str) -> PyString {
if s.is_ascii() {
PyBytes::new(py, s.as_bytes()).into_basestring()
} else {
PyUnicode::new(py, s).into_basestring()
}
}
...
}
...
}
In hg's case, we almost always want Python 2 bytes and never unicode objects.
Provide a new type for that.
Reviewed By: xavierd
Differential Revision: D16399345
fbshipit-source-id: cf47906ea3c871bcd1289239167241dcc3fedd8d
Summary:
The test was flaky:
--- test-fb-hgext-remotefilelog-local.t
+++ test-fb-hgext-remotefilelog-local.t.err
@@ -31,7 +31,6 @@
M x
M y
? a
- 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over 0.00s
$ hg add a
$ hg status
M x
Reviewed By: xavierd
Differential Revision: D16393051
fbshipit-source-id: 3dad1970200388b8339bc2e73b7a092336edc70d
Summary:
We install the python files under `eden/fs/service` in a package named
`eden/thrift` in the built python binaries that use these modules. This
moves the source files into an `eden/thrift` subdirectory so that the source
directory layout more closely matches the final binary layout.
This will make it easier to run several of Eden's Python-based tools directly
from the source tree, without having to do as much directory layout
transformation. This is particularly helpful on platforms like Windows, which
don't currently have an equivalent of "live PARs" which can be run from the
source tree without requiring a rebuild after each file edit.
Reviewed By: chadaustin
Differential Revision: D16354622
fbshipit-source-id: 4b58cc96451b1ee5441714aaf74f5e3b6ada9eaa
Summary:
We install `eden/py/dirstate.py` as `eden/dirstate.py` in built python
binaries that use this module. This moves the source file into an `eden/`
subdirectory so that the source directory layout more closely matches the
final binary layout.
This will make it easier to run several of Eden's Python-based tools directly
from the source tree, without having to do as much directory layout
transformation. This is particularly helpful on platforms like Windows, which
don't currently have an equivalent of "live PARs" which can be run from the
source tree without requiring a rebuild after each file edit.
Reviewed By: chadaustin
Differential Revision: D16354627
fbshipit-source-id: 578748e76b730db33cf3ea555df48aa94d15019f
Summary:
build_nupkg.py test will copy tests/ to build/embedded/tests/ before running
them. That breaks testutil.dott "edenscm" module discovery. Try to fix it by
making "edenscm" module discovery consider "build/embedded/python27.zip".
Reviewed By: xavierd
Differential Revision: D16383017
fbshipit-source-id: 52e19182d3e5e7267221244bd39d9a146928d8df
Summary: This newly added test keeps failing. Let's remove it from now.
Reviewed By: DurhamG
Differential Revision: D16381346
fbshipit-source-id: 11146d44fbbcd1e1c960fe4a0b6e3c28854f456d
Summary:
When rebasing or showing a diff for a commit which moved files, remotefilectx.ancestors (called by _tracefile) calculates the linkrev for each ancestor. Sometimes [1], this is a disaster:
* remotefilectx._linkrev executes its slow path and scans the change log.
* For each entry in the change log, remotefilectx._linkrev downloads trees if needed.
* Hg downloads trees one-by-one (as of D15964145).
remotefilectx.ancestors is only calculating linkrevs so it can sort the ancestors topologically. _tracefile only needs the ancestors to be ordered topologically, not by linkrev. remotefilectx.ancestors's calls to remotefilectx._linkrev are redundant.
Optimize _tracefile's use of remotefilectx.ancestors: order remotefilectx objects topologically (breadth-first) without sorting by linkrev. Create a new function for this purpose (topological_ancestors) to avoid possibly breaking other callers of remotefilectx.ancestors. As a side effect, make this new function return remotefilectx objects lazily, similar to the filectx.ancestors function.
On my machine, with warm caches, this speeds up 'hg diff -c' and 'hg rebase' for a modestly-sized commit. 'hg diff -c' takes 0.64 seconds, down from 65.6 seconds.
[1] Hypothesis: After 'hg amend', 'hg bundle' packages linkrevs which refer to the pre-amend commit (which is not serialized into the bundle) rather than the post-amend commit. 'hg unbundle' thus creates linkrevs referring to a missing commit.
Reviewed By: DurhamG
Differential Revision: D16297426
fbshipit-source-id: 407597d5e36fc06b33719c28f5ea5052e01dc7a3
Summary:
Testpilot can give us a lot of things for free, including the automatic
detection of flaky tests, disabling of them, re-enabling too, easy retries on
failure, timeouts, better tracking, and the list goes on.
At a first step, I'd like to make the testpilot runner the default in hgbuild
to get all the benefits listed above.
Reviewed By: quark-zju
Differential Revision: D16294182
fbshipit-source-id: aadfbac9eb05e9d64336daba7a50a6263e38c162
Summary: When all tests are skipped, run-tests.py no longer return a 80 error code.
Reviewed By: singhsrb
Differential Revision: D16380129
fbshipit-source-id: e84a3558df8c2c4ebef9a382a1172d859a47e220
Summary:
Streaming clone works only if we fetch all data from the server, however with selective pull feature hg specifies the particular heads it needs to pull. It causes downgrade in clone performance.
I decided to disable selective pull just before the clone operation, so the feature will be working everywhere else. Also I still store, even after clone, only "subscribed" remote bookmarks.
There are, however, artifacts of such behaviour, they are shown by changes in `test-commitcloud-sync-remote-bookmarks.t`: the whole tree of commits now is available locally, except of the remote bookmarks.
Reviewed By: simpkins
Differential Revision: D16223458
fbshipit-source-id: 0564ac23a16fe54d245e0a6ce9db5be4b6e3532f
Summary:
If one of the repo checkouts doesn't have remote bookmarks synchronization enabled, it must not affect the Cloud's remote bookmarks state.
I also changed `localserver` (is used for our tests) because Commit Cloud server deletes the "old" bookmark names from the db and inserts "new". However, the `localserver` just set the "new" books dictionary as a new state, which is not quite correct.
Reviewed By: simpkins
Differential Revision: D16338257
fbshipit-source-id: d77d9218b1c35ea1a097bbe7393d0910ce7b4d38
Summary: While checking if one public commit is an ancestor of another public commit, I used string hashes instead of binary nodes. Fixing.
Reviewed By: farnz
Differential Revision: D16338256
fbshipit-source-id: e27ed8d79ec9ed3a188cdee93366ab2f96526152
Summary:
By default the zsh completion will give me a list of bookmark names which personally I don't think it is useful at all.
I think making it giving me the list of draft commits is much better.
Reviewed By: quark-zju
Differential Revision: D16094724
fbshipit-source-id: 3493895a12ae02df011560b53dd5e55c8d183c79
Summary:
This was failing in our contbuild on centos. For some reason the memoization of
repo and ui was what made it fail.
Reviewed By: DurhamG
Differential Revision: D16368137
fbshipit-source-id: c3bec702bfa311f4be438f5aaf4939e6e725c63b
Summary:
As run-tests.py will be used with testpilot and at diff time, we do not
want to fail a run when all the tests were simply skipped. Let's make
that a success instead.
Reviewed By: quark-zju
Differential Revision: D16364297
fbshipit-source-id: ef8e912ddde91bd5be52784fceaf012857841eea
Summary:
The `msg` variable was unintentionally changed in the "killed" case. Use a
different variable name to solve it.
This diff changes:
[legacy][command_finish] killed!
exited -1 after 1.60 seconds
to:
[legacy][command_finish] <command> exited -1 after 1.60 seconds
Reviewed By: singhsrb
Differential Revision: D16360967
fbshipit-source-id: fb52025cd743a49c18116275c2eeac7b5c436e3b
Summary:
This allows us to preserve logs before the blackbox initialization.
In the edenscm usecase, we might want to log a "process start" event before
knowing the location of the blackbox.
Reviewed By: xavierd
Differential Revision: D16044038
fbshipit-source-id: 7f41994989bb3a83e9ded3014e5afeae00f3350c
Summary:
Use the new in-memory features from indexedlog and always create a blackbox
instance. This will allows us to buffer blackbox logs before `init` gets
called.
Reviewed By: xavierd
Differential Revision: D16044034
fbshipit-source-id: d137fdc3af8876c0c3dc3149c7478eb46025f457
Summary: This makes it possible to create RotateLog without writing to filesystem.
Reviewed By: xavierd
Differential Revision: D16044037
fbshipit-source-id: 451adaf8c2f97f0bd46bb2e5f42a33047d2ddfb0
Summary: This allows using the Log without side effects on the filesystem.
Reviewed By: xavierd
Differential Revision: D16044036
fbshipit-source-id: 20182a58a51e61deea87c98b87f5598b98dadbb2
Summary:
Change some functions to support emtpy dir, and create in-memory-only indexes.
This would allow creating in-memory-only Log.
Reviewed By: xavierd
Differential Revision: D16044039
fbshipit-source-id: 278662d3ab0093e4072e9321f3e8d4336b80ddfe
Summary: This allows Log to be constructed without a "dir".
Reviewed By: xavierd
Differential Revision: D16044040
fbshipit-source-id: 035416603f37af09be1ec75d1865e552ced89229
Summary: This allows using the Index without side effects on disk.
Reviewed By: xavierd
Differential Revision: D16044041
fbshipit-source-id: dba6edd76e7e7a09628d836d3aa50b2defcd2555
Summary:
This makes it possible to create an Index instance without providing a
file. It's used in later changes.
Reviewed By: xavierd
Differential Revision: D16044035
fbshipit-source-id: e7b52b9cb342cc82567c6583902eecd003ac0949
Summary:
This starts a series of changes to make indexedlog work in "in-memory-only"
mode. It is useful in 2 cases:
- buffering blackbox writes (short term)
- reused in Mononoke which does not want side-effect on disk (longer term)
Reviewed By: sfilipco
Differential Revision: D16044042
fbshipit-source-id: bdf35a9565e39e65c9ba4ddb949aa86412b4d496
Summary:
`#testcases` was translated to `for testcase in ...`, which is subtly
different since the for loop does not clean up states. Insert `cd $TESTTMP`
to make sure `setconfig` sets the global config, instead of the repo one.
Reviewed By: singhsrb
Differential Revision: D16363261
fbshipit-source-id: ea20c758e9131268f9329b98759e7423d9f1aa87
Summary:
This commit is just a simple refactor of the method for the resolving
the `svnrev` template keyword. In particular, we split the method so that it
can be easily wrapped by other extensions like globalrevs in D16361887.
Reviewed By: quark-zju
Differential Revision: D16361888
fbshipit-source-id: 9f20fb33afd2b286c4f30571fa257b8284f2bb54
Summary:
D16344714 made some rules only apply to edenscm/. Update the test to reflect
the changes.
Some formatting rules (ex. "string join across lines") are less important since
all files are formatted by black.
Reviewed By: xavierd
Differential Revision: D16360508
fbshipit-source-id: 9d38d710501eaf71c033ca49328774b8688fb5e0
Summary:
When we are migrating www to hg as source of truth, we would like to maintain the
reverse sync for some time in case we need to rollback.
In order to achieve that, we need to know the latest svn and hg commit to operate on. We
would like to record this information in the svn commit itself so it doesn't require
extra syncing and transaction.
In ordre to get this info, we can run `svn log -l 1` and parse the commit message from
there.
Reviewed By: quark-zju
Differential Revision: D16337012
fbshipit-source-id: acf66babdb48c07f95e9eb49daac0d3d3e6a96a0
Summary:
Those tests were converted using:
echo *.t | xargs -P20 -n1 python -m testutil.dott.translate --black --verify
They run 5x faster (via run-tests.py), and 10x faster (via python directly).
run-tests.py on old .t files, 652 CPU seconds:
% time ./run-tests.py `cat list-t.txt` --noprogress
.................................................................................................................................
# Ran 129 tests, 0 skipped, 0 failed.
./run-tests.py `cat list-t.txt` --noprogress 505.30s user 146.37s system 1451% cpu 44.899 total
run-tests.py on new py tests, 135 CPU seconds:
% time ./run-tests.py `cat list-py.txt` --noprogress
.............................................................................................................................
# Ran 125 tests, 0 skipped, 0 failed.
./run-tests.py `cat list-py.txt` --noprogress 55.73s user 78.80s system 744% cpu 18.061 total
vanilla python on new tests, 59 CPU seconds:
% time (for i in `cat list-py.txt`; do python $i; done;)
( for i in `cat list-py.txt`; do; python $i; done; ) 41.61s user 17.47s system 90% cpu 1:05.31 total
The new tests also have auto fix ability. `python test-foo-t.py --fix` will
autofix the code.
Reviewed By: xavierd
Differential Revision: D16172902
fbshipit-source-id: dda53990a7dfff5ac214c1237e4206a4d67e8e48
Summary:
Some linters or editers are unhappy with trailing spaces in heredoc.
Workaround it.
Reviewed By: xavierd
Differential Revision: D16344717
fbshipit-source-id: 63be8b992e2e4718faea1a55655c592f0e87b206
Summary: This allows FOO=bar to work in some tests.
Reviewed By: xavierd
Differential Revision: D16344718
fbshipit-source-id: b600d928a42e9e8e36a2ab9f5db97fd489878d02
Summary:
`.t` tests use `hghave` to test features, and can have `#testcases` for
multiple test cases. Implement them.
Reviewed By: xavierd
Differential Revision: D16209201
fbshipit-source-id: 1e8ea32d966f922efcf94e555cc9ab946cc85b27