Summary:
It makes testing duplicated - now `cargo test` would try running tests on 2 entry points:
lib.rs and indexedlog_dump.rs. Move it to a separate crate to solve the issue.
Reviewed By: markbt
Differential Revision: D13498266
fbshipit-source-id: 8abf07c1272dfa825ec7701fd8ea9e0d1310ec5f
Summary:
When pushing in treeonly mode, we process the manifests to decide what
files to send. In large stacks this can be slow, so let's add a progress bar.
Reviewed By: quark-zju
Differential Revision: D13460745
fbshipit-source-id: b037419e4a5e17c831492768e97064bf635678f6
Summary:
In a number of places, the remotefilelog code needs the information for
a single node but instead fetches the entire ancestor set. Now that we have
getnodeinfo, let's switch to using that. This was a primary hot spot in hg push
of large stacks of commits.
Reviewed By: quark-zju
Differential Revision: D13460746
fbshipit-source-id: 3aa288c70c87dcb32c0404311f27bbc87ddc5267
Summary:
Be compatible with `hgext.` or `hgext/` prefix. But print a warning saying it's
deprecated.
Reviewed By: DurhamG
Differential Revision: D13490362
fbshipit-source-id: ef13bd57a74be810df409af18a6259bc7b2b6dad
Summary: `write!` result needs to be used.
Reviewed By: markbt
Differential Revision: D13471967
fbshipit-source-id: d48752bcac05dd33b112679d7faf990eb8ddd651
Summary:
Many code paths assume 'build' exists. So let's create it on demand.
Use the "scratch" tool to make it more friendly on an Eden checkout.
Reviewed By: markbt
Differential Revision: D13471293
fbshipit-source-id: cce461ab67b984c53a00a98d481a821ad1f11c35
Summary: The former is deprecated and thus compiling revisionstore shows many warnings.
Reviewed By: markbt
Differential Revision: D13379278
fbshipit-source-id: d4b4662a1ad00997de4c46274deaf22f48487328
Summary:
This fixes LFS compatibility with packlocaldata.
Also drop the config as the default version is 1 now.
Reviewed By: DurhamG
Differential Revision: D13469486
fbshipit-source-id: 1dc4a1051667419d7aab97bf95f93cacd166468a
Summary:
Reraising a caught exception loses the context of the original exception, which
makes debugging harder. Instead, just call `raise`, which keeps the context
intact.
Reviewed By: quark-zju
Differential Revision: D13468943
fbshipit-source-id: 091f060327ca732a1534a7730bc6536d9a101865
Summary:
Previously, it would raise `KeyError` if the node requested cannot be found in
the first pack file.
This allows `*` to be used in `.t` tests. So file name changes are still
`run-tests.py -i` friendly.
Reviewed By: DurhamG
Differential Revision: D13469489
fbshipit-source-id: 84349ab1cf963b6d40216cec4de0e8ab10838b97
Summary:
It's meaningless to test the fetch cost in .t tests. So let's just set it to 0.
This also makes the output stable. So `run-tests.py -i` can be used directly.
Reviewed By: DurhamG
Differential Revision: D13469488
fbshipit-source-id: a2cf900531f3ff0f58957bd79d7283928b5da700
Summary: Previously, the test wasn't using a remotefilelog repo.
Reviewed By: DurhamG
Differential Revision: D13469487
fbshipit-source-id: 3c85633b8bfc209fa0d0317ca05247e14faf689d
Summary:
Add a third argument to the `get(dict, key)` template function that serves as a
default.
Reviewed By: DurhamG, quark-zju
Differential Revision: D12980774
fbshipit-source-id: d619275dd3ae880f6aba4c2b3d91aea4b45ea6d6
Summary:
Adds a new crate `cpython-result`, which provides a `ResultExt` trait, which
extends the failure `Result` type to allow coversion to `PyResult` by
converting the error to an appropriate Python Exception.
Reviewed By: quark-zju
Differential Revision: D12980782
fbshipit-source-id: 44a63d31f9ecf2f77efa3b37c68f9a99eaf6d6fa
Summary:
The mutationstore is a new store for recording records of commit mutations for
commits that are not in the local repository.
It uses an indexedlog to store the data. Each mutation entry corresponds to
the information the mutation that led to the creation of a particular commit,
which is recorded as the successor in the entry.
Entries can come from three possible places:
* `Commit` metadata for a commit not available locally
* `Obsmarkers` for repos that have been migrated from evolution tracking
* `Synthetic` for entries created synthetically, e.g. by a pullcreatemarkers
implementation.
The other commits referred to in an entry must predate the successor commit.
For entries that originated from commits, this is ensured, as the successor
commit hash includes the other commit hashes. For other entry types, it is
an error to refer to later commits, and any entry that causes a cycle will
be ignored.
Reviewed By: quark-zju
Differential Revision: D12980773
fbshipit-source-id: 040d3f7369a113e710ed8c9f61fabec6c5ec9258
Summary:
The derived debug for Node prints out each byte as a decimal number. Instead,
make the Debug output for nodes look like `Node("hexstring")`.
Reviewed By: DurhamG
Differential Revision: D12980775
fbshipit-source-id: 042cbf6eade8403759684969e1f69f7f4e335582
Summary:
Add a utility function for tests to generate a vector of random nodes. This
will be used in future tests.
Reviewed By: DurhamG
Differential Revision: D12980784
fbshipit-source-id: 73fc8643503e11a46a845671df94c912a5e49d23
Summary:
Add traits that extend `std::io::Read` and `std::io::Write` to implement new
`read_node` and `write_node` methods, allowing simple reading and writing of
binary nodes from and to streams.
Reviewed By: DurhamG
Differential Revision: D12980778
fbshipit-source-id: fc6751cd43a1693a5a5a3ac93aea74aec5fda4fe
Summary:
Add user's current working directory, which can be relevant when
debugging user issues.
Reviewed By: phillco
Differential Revision: D13426163
fbshipit-source-id: f4c58d15237c188235aad74e82333f58262cbc51
Summary:
The test failed because "hgext" is no longer a namespace package. The check
becomes unnecessary since we almost always use the in-repo modules.
Reviewed By: DurhamG
Differential Revision: D13453160
fbshipit-source-id: 0c5a72b3abeb0a12426d8ed15c045a4ce478a4c6
Summary:
Add a new `--print` option to drawdag which prints the commit hashes and
descriptions of all the nodes that were generated by drawdag.
Reviewed By: quark-zju
Differential Revision: D10149266
fbshipit-source-id: 55b4c133b3c98c0258419811d7c00a3ec73a02cc
Summary:
Update drawdag to generate mutation metadata in commits when mutation recording
is enabled.
In order for this to work, we need to add the mutation relationships as edges
between the commits, so that when walking the DAG the predecessors are already
committed and we can find their hashes.
Reviewed By: ikostia
Differential Revision: D9989024
fbshipit-source-id: 671c1eb6c4ae6e87760efb4d3aa47e5e0585c94d
Summary:
Add support for mutation information being added when commits are histedited.
For the most part, the histedit predecessor and successor have a 1:1
relationship. The special case is for when commits are folded or rolled up.
In this case we act in the same way as a fold.
Reviewed By: quark-zju
Differential Revision: D9975466
fbshipit-source-id: 748040232f49aa87af4e25a97d948995d956f04a
Summary:
Add a convenience function that generates the nodes that match a revset, rather
than the contexts or rev numbers.
Reviewed By: DurhamG, quark-zju
Differential Revision: D10149262
fbshipit-source-id: 5c889b1c7f03e3fcda7dccd297674c40729ccd90
Summary: Add support for mutation information being added when a commit is pushrebased.
Reviewed By: DurhamG, quark-zju, ikostia
Differential Revision: D9975558
fbshipit-source-id: 55444c05df32e5be159fbc19610f7a13ab103109
Summary:
Add support for mutation information being added when a commit is split.
The top of the final stack is the commit that stores the mutation metadata.
The other commits in the stack are just normal new commits, although the final
commit does record their hashes in its metadata.
Determining when the last commit in the stack happens before it is committed is
a little hard, as the code previously relied on the dirstate ending up clean
to detect a finished split. Instead we look at the patches that come out of
the filter function and see if they match the original patches that were sent
in.
Reviewed By: DurhamG, ikostia
Differential Revision: D9975469
fbshipit-source-id: acec485f9b561952f4ccdbaaf9491c9d48a70f58
Summary:
Add support for mutation information being added when a commit is metaedited or
folded.
The folded commit uses the top of the original stack as its predecessor. The
other commits that are folded are also stored in the metadata.
Reviewed By: DurhamG, quark-zju, ikostia
Differential Revision: D9975471
fbshipit-source-id: 92089d14cd5d65df283bbdc80a8b352b5f3982e9
Summary: Add support for mutation information being added when a commit is rebased.
Reviewed By: DurhamG, quark-zju, ikostia
Differential Revision: D9975481
fbshipit-source-id: 02a1ace0d6c80d73b1ab76e4d1b23a8d46ab049b
Summary: Add support for mutation information being added when a commit is amended.
Reviewed By: DurhamG, ikostia
Differential Revision: D9975472
fbshipit-source-id: 57d51823e709f71a88ad0fb86992a0a38541527c
Summary: Add a new command to debug-dump mutation information in commits
Reviewed By: DurhamG, quark-zju
Differential Revision: D9975474
fbshipit-source-id: a9ed1578dffc80da3e375837cede8d8685ee0427
Summary:
This is the first commit in a series that will replace obsolescence markers
with separate tracking of commit mutation and visibility.
Mutation information is metadata about which commit was mutated and in which
way that led to the creation of this commit. It is embedded in the extras of
the commit object.
This commit adds the fields to the commit context. Future commits will create
the mutation information when commits are mutated.
Reviewed By: DurhamG, quark-zju, ikostia
Differential Revision: D9975470
fbshipit-source-id: 0107308731dc021cb72734db8b5dc0a02e6e86e1
Summary:
In order for the help text for aliases to be valid RST, it must be possible to
indent some of the lines. This isn't possible with normal config, as leading
whitespace is stripped. Make it valid for lines in alias documentation to be
quoted, preserving leading whitespace.
Reviewed By: singhsrb
Differential Revision: D13431946
fbshipit-source-id: eefada39bcd92ce5162a0f34027b9380b5a420c9
Summary:
This is subtle.
`.hgignore`'s current behavior: if `^foo$` rule exists, then directory `foo/`
is ignored (ex. 'foo/bar' should be ignored).
However, that imposes problems for the sparse ignore matcher, which is the
"negate" of the "include" matcher. A user can write `[include]` glob patterns
like:
a*{b*,c*/d*}/e*
The ignore matcher will be the negate of the above patterns. Then because
`a1b2` does not match `a*{b*,c*/d*}/e`, the negate matcher returns "True",
and the ignore matcher will ignore the directory. So even if file `a1b2/e3`
should be selected, the parent directory being ignored cause the file to
be ignored.
That is clearly incorrect for sparse's usecase.
I think the issue is fundementally a layer violation - it's the *matcher*'s
responsibility to check whether one of the parent directory is matched (or
ignored), not the directory walker's responsibility.
This diff fixes the walker so it uses the visitdir interface, and moves back
the directory check to hgignore matcher to maintain compatibility. For three
matchers involved in ignore handling:
- hgignore matcher: updated to do the recursive directory handling on its own
- gitignore matcher: work out of box. already consider parent directories!
- sparse matcher: want the new behavior
`test-sparse-issues.t` is now green.
With this change, the `forceincludematcher` subdir hack used in sparse is no
longer necessary. Therefore removed.
Besides, all ignore matchers can handle "visitdir" correctly. That is, if
`visitdir('x')` returns `'all'`, then `visitdir('x/y')` will also return `'all'`.
Therefore the parent directory logic in `dirstate.dirignore` becomes
unnecessary and dropped.
Reviewed By: DurhamG
Differential Revision: D10861612
fbshipit-source-id: aa0c181ae64b361b85f08b8fecfdfe6331e9a4c2
Summary:
The script was used to check dependency on extenral extension. It's no longer
necessary since those "external" extensions are in repo now.
Reviewed By: DurhamG
Differential Revision: D13440398
fbshipit-source-id: 2f228ddee621b84a23f44748d843f29e1f05530e
Summary:
The extension was mainly for users `pip install <3rd-party-hg-ext>`, which
usually installs them into `hgext3rd`. Since we no longer search into
`hgext3rd`, this extension can be removed.
Reviewed By: DurhamG
Differential Revision: D13440401
fbshipit-source-id: d67a655ece9a1f6d5feb18d8aeac84852edfdcb9
Summary:
Our codebase is already unfriendly to 3rd-party extensions and we will likely
break the compatibility as part of revisising / replacing components in Rust
anyway. So just stop supporting `--config extensions.3rdpartyfoo=`.
Note `--config extensions.3rdpartyfoo=foo.py` still works.
This also makes `ImportError` more meaningful. Previously, when `hgext.foo`
imports `bar` which does not exist, the error is "cannot import foo", while
it should really be "cannot import bar". That is because extensions.py falls
back to import `hgext3rd.foo`, and `foo`. Now extensions.py only tries
`hgext.foo` and will suface the right error.
Reviewed By: DurhamG
Differential Revision: D13440400
fbshipit-source-id: c659f6d05abbc0d09f2811f36c0dc31e49491f19
Summary:
hgsubversion was doing one transaction per commit, which is both slow
and also causes a lot of packs to be created when operating on a remotefilelog
client.
Let's make it use a single transaction instead. Unfortunately the svn metadata
is not integrated with Mercurial transactions. If we're using a normal flat-text
revmap, if there is an exception when running pull, it will need to svn rebuild
the metadata to remove the bad data and continue.
If we're using a sqlite revmap, then we've integrated with the sqlite
transaction, so it should work as expected.
Reviewed By: quark-zju
Differential Revision: D13433557
fbshipit-source-id: 809abb57839213302eb856ec19a113097be624e8
Summary:
In an upcoming diff we'll be making hgsubversion pull use a single
transaction. We need the lastpulled file to be part of that transaction. The
easiest way to do that is to store it in the database.
Reviewed By: quark-zju
Differential Revision: D13433558
fbshipit-source-id: 013ce09aa7a7382008979a7f424860fc98dc8b5d
Summary:
The future of mercurial is rust, and one of the missing piece is repacking of data/history packs. For now, let's implement a very basic packing strategy that just pulls all the packs into one, with one small optimization that puts all the delta chains close together in the output file.
At first, it's expected that this code will be driven by the existing python code, but more and more will be done in rust as time goes.
Reviewed By: DurhamG
Differential Revision: D13363853
fbshipit-source-id: ad1ac2039e1732f7141d99abf7f01804a9bde097
Summary:
Fix final pieces to make IPython work on Windows:
- Install `win_unicode_console`. `pip2 download ipython` running on Linux won't
include it. But running on Windows will.
- Make `build_pyzip` command support `-i`.
- Make `Makefile` run `build_pyzip -i` so IPython.zip gets generated under
mercurial/thirdparty properly.
As we're here, also clean up IPython.zip so it no longer contains `setup.pyc`.
Reviewed By: kulshrax
Differential Revision: D13426947
fbshipit-source-id: 91db6cb85de4c689a4e5c10043debbc26bb94c18
Summary:
See the added comment. The stacktrace looks like:
File "hg\hgext\debugshell.py", line 69, in debugshell
IPython.embed(header=bannermsg)
File "IPython\terminal\embed.py", line 383, in embed
frame.f_code.co_filename, frame.f_lineno), **kwargs)
File "traitlets\config\configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "IPython\terminal\embed.py", line 158, in __init__
super(InteractiveShellEmbed,self).__init__(**kw)
File "IPython\terminal\interactiveshell.py", line 441, in __init__
self.init_prompt_toolkit_cli()
File "IPython\terminal\interactiveshell.py", line 273, in init_prompt_toolkit_cli
self._eventloop = create_eventloop(self.inputhook)
File "prompt_toolkit\shortcuts.py", line 95, in create_eventloop
return Loop(inputhook=inputhook, recognize_paste=recognize_win32_paste)
File "prompt_toolkit\eventloop\win32.py", line 39, in __init__
self._event = _create_event()
File "prompt_toolkit\eventloop\win32.py", line 189, in _create_event
return windll.kernel32.CreateEventA(pointer(SECURITY_ATTRIBUTES()), BOOL(True), BOOL(False), None)
ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>: expected LP_c_ulong instance instead of LP_SECURITY_ATTRIBUTES
Reviewed By: DurhamG
Differential Revision: D13422915
fbshipit-source-id: c36fb5ac1fcae6fcf5dc13e13b62e4288587476c
Summary:
Since IPython is now bundled, let's just use it in "debugshell".
This solves nasty issues trying to install IPython on various platforms (esp.
on Windows where we shipped "python.exe" compiled using VC140 without a "pip").
And bump IPython version to 5.x for CentOS 7 (which uses 3.x in its system
package).
As we're here, drop the non-ipython support and make it print a more friendly
banner message.
Reviewed By: DurhamG
Differential Revision: D13352621
fbshipit-source-id: abc6f44b8859343c980014cc56d02361a0cdf713
Summary:
IPython is pretty handy (ex. `%timeit`, `?` etc). It should probably be the
recommended way to explore the code base for new people. This is a step towards
making it available for all platforms.
It's also smaller when compiled directly. The zip file containing all `.pyc`
files is just 8MB. When installed using CentOS's system package, a lot of GUI
dependencies will be installed, which need hundreds of MBs.
Note the zip only contains pure Python modules. The only native dependency
seems to be `scandir`. But `scandir` has a pure Python fallback. So it still
runs, just slower.
Reviewed By: DurhamG
Differential Revision: D13352617
fbshipit-source-id: 2ecbef69438ffc478389c5bec67bec5f83f7edeb
Summary:
To build IPython locally, its dependencies need to be fetched.
The direct motivation behind IPython is, recently when new people tried to hack
on Mercurial, they don't have a great way to understand the dynamic codebase.
Some of them use static code search, which does not work well. IPython's `?`
feature is pretty handy to get the location of related definitions. Together
with `hg dbsh`, it's much easier to explore the code base easily.
So let's just ship hg with IPython bundled.
Note installing IPython is also not very smooth:
- IPython on CentOS 7 is too old (3.x) and installing it brings in too many
GUI dependencies unnecessarily.
- IPython on Windows is not that easy to install, as we shipped our own
python.exe without corresponding pip.
Reviewed By: DurhamG
Differential Revision: D13352616
fbshipit-source-id: 91750664170c99f556ca406e718b030bf509f275