Commit Graph

46637 Commits

Author SHA1 Message Date
Jun Wu
ec304e1d1e commands: assign 'd' alias to 'diff'
Summary:
Git does not have command name prefix matching. We now use `commands.names`
config options as a hint to avoid going to the Python land for command
prefix matching. It works but is not "correct". If we drop the prefix matching
feature, then the problems are gone - fast paths won't need prefix matching
aka. the command name list, and slow path (ex. wrong command) can afford
loading Python for all command names.

`hg d` is the single most used prefix matching command. Assign an explicit
alias to it to avoid regression if we do drop prefix matching (or, make
that more expensive than resolving commands direcly).

Reviewed By: sfilipco

Differential Revision: D16733274

fbshipit-source-id: 8904288b8a1ddf1fc6e6ec54ffaa36e503ebdb77
2019-08-19 19:27:29 -07:00
Jun Wu
b79b41cd7f dispatch: remove fancyopts
Summary: Remove the dependency from dispatch.py to fancyopts.

Reviewed By: sfilipco, singhsrb

Differential Revision: D16733267

fbshipit-source-id: 9b64c700d28118740c5485cb2df94b6a380b0efe
2019-08-19 19:27:29 -07:00
Jun Wu
d0cf5aacfa dispatch: remove Python alias handling
Summary:
This removes Python alias handling so the alias handling is done entirely in
Rust.

There are some subtle changes - alias using prefix mathcing to ambiguous
commands will not show other aliases. Hopefully that won't be a big issue.
Users can always avoid prefix matching in alias to solve the issue.

Reviewed By: sfilipco

Differential Revision: D16733270

fbshipit-source-id: 54a4915d49c2b2f6e8664a225a9c0f25e1c38d17
2019-08-19 19:27:29 -07:00
Jun Wu
42e4cc19fc test-lfs-test-server: disable the test
Summary:
This test is currently broken if lfs-test-server is installed. Disable it
instead of relying on the test system does not have lfs-test-server.

Reviewed By: sfilipco

Differential Revision: D16733271

fbshipit-source-id: de0c9beb8e981e33e32e43435e2d06181cbae70e
2019-08-19 19:27:29 -07:00
Jun Wu
2f3cf9b23b dispatch: do not show help on UnknownCommand
Summary:
Similar to D14151200, instead of printing a long help that might flush out
important messages, make the error short but still point the user to `hg help`.

This makes the error message much shorter, and make the test change by the
upcoming diff smaller.

Besides, we no longer check disabled extensions, as we don't expect users to
tweak extension config by themselves.

Reviewed By: sfilipco

Differential Revision: D16733273

fbshipit-source-id: b39bd4b2af6f315273484ec582094609b8e331ae
2019-08-19 19:27:28 -07:00
Jun Wu
37b7928dc8 help: resolve aliases using Rust
Summary:
Resolve aliases directly in command help. This removes the dependency of the
Python alias handling.

There are some minor behavior changes. But they look reasonable.

Reviewed By: sfilipco

Differential Revision: D16733276

fbshipit-source-id: ad97def2c60828236bbd8784ffd8202abfdeeb15
2019-08-19 19:27:28 -07:00
Jun Wu
38a0a8ff95 dispatch: translate shell aliases to hg commands
Summary:
Translate alias like `echo = !echo foo` to `echo = debugrunshell '--cmd=echo
foo'`.  This enables the Rust shell alias handling code path. The Python
shell alias handling was removed.

The majority part of `test-alias.t` still passes. That includes some "weird"
shell alias features.

This has some test changes, through:

- `$HG_ARGS` is no longer supported. And tests depending on it are changed.
  `$@` will be the alternative for most cases.
  Practically, our `$HG_ARGS` users seem to come from
  https://stackoverflow.com/a/833387, which does not seem to use `$HG_ARGS`
  correctly (since `$HG_ARGS` includes the command name).
- Early-parse commands (ex. `hg log -b '--config=alias.log=!echo
  howdy'`) no longer works.
- The warning `--repository ignored` now shows up, since `debugrunshell`
  is a "no-repo" command.
- Global flags can no longer be used after shell aliases. Supporting them
  is a head-ache.
- `circular alias` error message changed because it's now reported by the Rust
  code, which does not report all alias names right now.

Reviewed By: sfilipco

Differential Revision: D16733266

fbshipit-source-id: b06bc7f8fc2f1c2701a17407d6a1656e17e4ba55
2019-08-19 19:27:28 -07:00
Jun Wu
53e9fbd706 test-alias: make shell alias tests easier to read
Summary:
The shell alias tests are hard to read because:

- It uses `cat << EOF`, which will escape the heredoc block.
- It uses `sh -c`, which adds another layer.

Change `EOF` to `'EOF'` to prevent escaping heredoc, and remove `sh -c` to make
the test easier to read. The `escaped3` test now works as expected.

Reviewed By: sfilipco

Differential Revision: D16819451

fbshipit-source-id: 687e9ce78dfed7d76b53cf90e6d871dffd3ab84d
2019-08-19 19:27:28 -07:00
Jun Wu
7b96c8d292 cliparser: support shell alias
Summary:
Alias starting with `!` are considered shell commands. The entire command
string should be passed roughly as-is to the shell.

The current alias handling uses shlex::split to split the alias into arguments,
then replaces things like `$1` in arguments. The problem is, escaping
shlex::split a complex shell alias, then unesape (shlex::quote) it is not
loseless.

To maintain compatibility for existing complex shell alias configuration,
add a new code path that imitates the Python code behavior.

Reviewed By: sfilipco

Differential Revision: D16814144

fbshipit-source-id: 0e5e95f99bf8b8b16bd8d0cbcadd6760f7f77ebb
2019-08-19 19:27:27 -07:00
Jun Wu
399556389a commands: add a way to run shell commands
Summary: This will make shell aliases fit in the normal hg command framework.

Reviewed By: sfilipco

Differential Revision: D16530521

fbshipit-source-id: c1b158bc2895add03fa92099564830e55e02f1b7
2019-08-19 19:27:27 -07:00
Stefan Filip
c527354cc8 help: fix test-check-help.t to recognize fold
Summary:
The latest update in the documentation references the `hg fold` subcommand
from the "core" mercurial files. This makes the `test-check-help.t` test
want to verify the `help` for `fold`. The problem is that the test does not
enable the `amend` extension that provides the fold command.

Following a previous fix to this test, I am enabling the amend extension for
the test. It makes sense to me given the current setup.

Reviewed By: singhsrb

Differential Revision: D16907781

fbshipit-source-id: b0ba31518b6d4c210eb5b8cc7985a945ab1180e4
2019-08-19 16:59:05 -07:00
Jun Wu
e2a7b872ba demandimport: make sqlite3 non-lazy
Summary:
IPython has fallback code for `import sqlite3`. Make it non-lazy so IPython can
detect missing sqlite3 (on our Windows distribution) and continue working.

Reviewed By: ikostia

Differential Revision: D16897722

fbshipit-source-id: f7d312e10b9806498a03ce0788d436f6d72ddae8
2019-08-19 12:26:21 -07:00
Marla Azriel
b5cc850992 commands: help text for redo, metaedit
Summary: Updated help text for hg redo and hg metaedit

Reviewed By: markbt

Differential Revision: D16723556

fbshipit-source-id: 9859d921f8e39880a0edc28c87f66d48268069dd
2019-08-19 11:34:26 -07:00
Saurabh Singh
76b785da63 hgsubversion: fix the tests
Summary:
Essentially the commit hashes changed and thats fine. See D16836997
for more context.

Reviewed By: quark-zju

Differential Revision: D16860590

fbshipit-source-id: ddd82dfbcdfbea9d5ace68adaedeb05bda6e3d7a
2019-08-16 13:27:04 -07:00
Mark Thomas
43bc04968a commitcloud: backup and sync all non-public commits
Summary:
Commit cloud and infinitepush currently only back up draft commits, omitting
secret ones.  However, commit cloud sync with visibility enabled will try to
sync all visible commits, including the secret ones.  This means users with
secret commits won't be able to sync them to their other machines as they won't
have been backed up.

We eventually want to get rid of the secret phase, which means all non-public
commits should be synced.  Update commit cloud to backup and sync all
non-public commits, including secret ones.

Currently secret commits become draft when they are received by the other
machine.  Since we're planning to get rid of the secret phase, this should be
fine.

Reviewed By: mitrandir77

Differential Revision: D16830832

fbshipit-source-id: 2ce4447ffa750a2edcb194cdf92321c1393ff805
2019-08-16 10:24:44 -07:00
Mark Thomas
94ff729e43 commitcloud: close connection between cloud sync pulls
Summary:
Connecting to large workspaces can result in many pulls within a single sync.
This re-uses the connection to the server.  We have seen instances where the
server can't serve all of these pulls and crashes with a MemoryError.

Pragmatically close the connection between each pull to prevent this.

Reviewed By: farnz

Differential Revision: D16858728

fbshipit-source-id: 7561c6f01c38df2706bd7fd76f5a7387e9728dc8
2019-08-16 10:19:25 -07:00
Aleksei Kulikov
0f11c07409 snapshot: fix windows tests and make hashes deterministic
Summary:
So far the hashes of manifest/commits may vary, mostly because of
different path separators on different platforms (`/` vs `\\`) and its serialization to string in the snapshot manifest.

Reviewed By: markbt

Differential Revision: D16856130

fbshipit-source-id: a19dff113b9b24f1c7f387b9bc5a5e39e83ef8af
2019-08-16 10:15:05 -07:00
Shu-Ting Tseng
150798aac8 translate from hg to git hash should use the extras
Summary:
Now that we are writing the git hash inside the commit itself, if we are translating
from hg to git hash, we should just use that rather than loading the entire map and
build a dict and look it up.

The performance of this translation will also improve quite a lot.

Some small sample benchmarking:

```
suiting@devvm5006:configerator  (659199b|remote/master)$ time ~/fbcode/scm/hg/hg log -r master -T '{node} || {gitnode}\n' --config exte
nsions.fbconduit=! --config extensions.hggit=
659199bf7c7850ea9ffa9e0ad50eb84597977dea || 69f05aeec13f09c44dd00d2a85fe9d461ba6841e

real    0m0.563s
user    0m0.004s
sys     0m0.007s
suiting@devvm5006:configerator  (659199b|remote/master)$ time ~/fbcode/scm/hg/hg log -r master -T '{node} || {gitnode}\n'
659199bf7c7850ea9ffa9e0ad50eb84597977dea || 69f05aeec13f09c44dd00d2a85fe9d461ba6841e

real    0m14.706s
user    0m0.006s
sys     0m0.006s
```

Reviewed By: quark-zju

Differential Revision: D16833526

fbshipit-source-id: 7d3096649cf24967d13596e70463bc125081ba4f
2019-08-16 07:09:31 -07:00
Carolyn Busch
09ceebfcac Debugstore command
Summary: New degbugstore command prints contents of blob in store give filenname and hash.

Reviewed By: xavierd

Differential Revision: D16791780

fbshipit-source-id: d4529f3f368677b4f65a5772f82a1655552fefa5
2019-08-15 19:36:31 -07:00
Jun Wu
917d75c85a rotatelog: make indexes of immutable Logs up-to-date
Summary:
The indexes are lagging by design to reduce space overhead. For immutable Logs
(esp. used by RotateLog), the indexes no longer need to be lagging.

Make it so to reduce overhead opening RotateLog.

As we're here, also fix an issue where `rotate_assume_locked` was not really
protected by a lock.

Reviewed By: sfilipco

Differential Revision: D16587181

fbshipit-source-id: 3cf81864e90c875ee661dbd994bcd3ebc4b55322
2019-08-15 16:32:55 -07:00
Xavier Deguillard
8a27f4d915 tests: fix hgsubversion tests
Summary:
Since D16681230, a commit made with no file changes will re-use it's parent
manifest. This can trigger the commit hash to be different, which broke some
subversion tests. Since hgsubversion will be going away soon, I took the
approach of using run-tests.py -i and in test-hgsubversion-custom-layout.py to
not run the test that fails.

Reviewed By: sfilipco

Differential Revision: D16836997

fbshipit-source-id: 58e50a9147c8c263fca74158af120ec8ec5d8c52
2019-08-15 15:47:49 -07:00
Jun Wu
bf056a2962 revset: start deprecating revision number resolution
Summary:
The upcoming changelog change will *have to* use a different set of numbers.
Some of the numbers might be generated on demand, which has difficulity
resolving a number to a commit hash.

There are a lot of internal (especially, tests) usecases of revision numbers.
The deprecation message is only shown for user-provided inputs (ex. things
that go through `scmutil.revrange`).

This does not affect the use of `{rev}` template yet.

Reviewed By: sfilipco

Differential Revision: D16795522

fbshipit-source-id: 7a5578ecc0afdcc86830238471ff95203c96dc3f
2019-08-15 13:24:56 -07:00
Jun Wu
c1813286a7 bindings: remove underscores from dag
Summary: We follow the Python code-style for APIs exposed to the Python world.

Reviewed By: sfilipco

Differential Revision: D16683786

fbshipit-source-id: 5bc6e76cb621ec93cce6711e794d032857702629
2019-08-15 12:47:35 -07:00
Jun Wu
8b4c670550 changelog: get access to config options
Summary: Pass `uiconfig` to changelog so it can read config options.

Reviewed By: sfilipco

Differential Revision: D16683785

fbshipit-source-id: a64cfbe2cefa6b20ec695d2766bcfe878c764323
2019-08-15 12:47:35 -07:00
Jun Wu
6d7c287ab2 ui: split config handling to a separate class
Summary:
A large portion of `ui` is config handling. Split it to a separate class so we
can pass that separate class to places that need pure configuration.

Some `develwarn`s are skipped since the new class does not have access to fout
or ferr.

Reviewed By: DurhamG

Differential Revision: D16683787

fbshipit-source-id: d823b9e5fc6f8ed08fff3401ab3502ad3c434f00
2019-08-15 12:47:35 -07:00
Adam Simpkins
ce3bf61c80 fix copyright headers in a few files
Summary: Fix copyright headers to pass our lint rules.

Reviewed By: xavierd

Differential Revision: D16824227

fbshipit-source-id: f9bc74f42e2c9d5c112f527eec479da9e1ce56fb
2019-08-15 11:33:07 -07:00
Aleksei Kulikov
ad771fcaec snapshot: minor codestyle fixes
Summary: Minor changes.

Reviewed By: mitrandir77

Differential Revision: D16829944

fbshipit-source-id: 08876408bab9a367b852e85e1d7ca86dc0da08a3
2019-08-15 10:48:42 -07:00
Aleksei Kulikov
97c6c6ddaf snapshot: add debugcheckoutsnapshot command
Summary:
Allow the user to check out on the snapshot by its revision id.
Snapshot == "a commit with extra containing a key `snapshotmanifestid`".
This corresponding value can be `None`, that would mean that snapshot does not contain untracked/missing/merge files.

Reviewed By: mitrandir77

Differential Revision: D16788479

fbshipit-source-id: bf4a9508acc940290b18123d3dd7b7fefae83782
2019-08-15 10:48:41 -07:00
Aleksei Kulikov
b45ba7a551 snapshot: add --force option to manifest checkout
Summary:
Now `hg debugcheckoutsnapshotmanifest` overwrites files if given the `--force` flag.
It also gives a more detailed output on the changes it makes.

Reviewed By: mitrandir77

Differential Revision: D16786334

fbshipit-source-id: b41d6241ffb478bd6c30a01c154b095d1ea92d78
2019-08-15 10:48:41 -07:00
Aleksei Kulikov
169465460a snapshot: add debugsnapshot command
Summary:
Add the `debugsnapshot` command, which will be renamed to `snapshot` later.

It creates a snapshot manifest that features information about
* untracked files,
* missing files,
* merge state artifacts from `.hg/merge` and `.hg/rebasestate`.
The snapshot manifest is stored in local lfs.

Then it creates the actual snapshot -- a fake commit, which has the snapshot oid in extra data.
It does not handle unresolved merge conflicts and other difficult states on this stage.

~~Finally, it restores the working copy and dirstate to status quo.~~
It doesn't need to be done, now we create only the commitctx, which does not wreck the dirstate.

Reviewed By: mitrandir77

Differential Revision: D16716359

fbshipit-source-id: 743f7427ce89c3fca6f844487bac1c456338e613
2019-08-15 10:48:41 -07:00
Jun Wu
37bf3cd1eb dispatch: remove 2 calls to fancyopts
Summary: clidispatch replaces them.

Reviewed By: sfilipco

Differential Revision: D16733263

fbshipit-source-id: 32e6cef0ec289a47969b75c332a3117591862ce0
2019-08-15 10:08:36 -07:00
Jun Wu
d2e169b097 cliparser: remove ParseOptions::ignore_errors
Summary: It's not actually used anywhere.

Reviewed By: sfilipco

Differential Revision: D16715452

fbshipit-source-id: ea3e1411b38220f7555de11fa71da258c1c9d0d7
2019-08-15 10:08:36 -07:00
Jun Wu
f49868e6e7 cliparser: add a test demostrating incorrect behavior
Summary: `--no-foo` should only work if `foo` is a boolean flag.

Reviewed By: farnz

Differential Revision: D16715454

fbshipit-source-id: 9a8183586aa50fb55f30e19276bd60ebcc23a5fb
2019-08-15 10:08:36 -07:00
Jun Wu
bdd108a854 cliparser: remove create_args in tests
Summary: The helper function is no longer necessary.

Reviewed By: sfilipco

Differential Revision: D16715455

fbshipit-source-id: 3bf528d3c9f18418724793edebf298425a3bba87
2019-08-15 10:08:36 -07:00
Mohammad Ayoub
075801c976 sync checkout locations on update
Summary:
Whenever a checkout is done, the new commit is sent to commitcloud.
This currently works with the hook on update, but the hooks on commit are not working

Reviewed By: mitrandir77

Differential Revision: D16687423

fbshipit-source-id: a0b861d301c84764f31787454cdec594b0519fa3
2019-08-15 08:37:14 -07:00
Stefan Filip
135670fdc3 encoding: fix empty path handling on windows
Summary:
The Windows API `MultiByteToWideChar` will fail when given an empty bytearray to convert.
https://docs.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-multibytetowidechar

Reviewed By: quark-zju

Differential Revision: D16820239

fbshipit-source-id: 3234c3246c0d07277968dac1ac9ee864b016a40f
2019-08-14 19:01:34 -07:00
Jun Wu
2ee74da41f cliparser: rename ParseOutput::get to pick and make it do the unwrap
Summary:
Previously, `get` returns an `Option<T>`. Almost all callers use `unwrap`
immediately, since they know what flag names are available. Let's just
move the `unwrap` inside the function. `get` in the Rust (and Python)
eco-system is considered nullable and panic-free. Rename it to `pick`
to make the difference more obvious.

I considered using the `Index` trait, but it has to return a reference,
which does not fit into this use-case.

Reviewed By: sfilipco

Differential Revision: D16715453

fbshipit-source-id: f754d208c4a1b0adeddaee82c7db82c790d6436c
2019-08-14 16:58:29 -07:00
Jun Wu
9fbefb5981 cliparser: remove ParseOutput::get_or_default
Summary:
The default value of a flag is already provided with the flag. Therefore
`get_or_default` requiring another `default` does not make much sense.
Remove it.

Reviewed By: farnz

Differential Revision: D16713531

fbshipit-source-id: 95a55289077b7308083b6685f013d1058419a675
2019-08-14 16:58:29 -07:00
Jun Wu
f5cba1eeff cliparser: make ParseOutput::get typed
Summary:
This simplifies a lot of code. For example:

    - let config_path: Vec<String> = result.get("config").unwrap().clone().try_into().unwrap();
    + let config_path: Vec<String> = result.get("config").unwrap();

Also, the use of `TryInto` does not make sense - the code only implements
`Into`, and `TryInto` will panic. Therefore remove `TryInto`.

Reviewed By: farnz

Differential Revision: D16713534

fbshipit-source-id: 29dc71881dd844fa87e086543fb0a3bb5d8837a1
2019-08-14 16:58:28 -07:00
Jun Wu
4a585cf0f3 cliparser: support underscore names in define_flags macro
Summary:
Replace `_` in field names to `-` as long flag name. That is consistent with
the current hg behavior.

Reviewed By: sfilipco, farnz

Differential Revision: D16713530

fbshipit-source-id: ce36caebc6b3131cb418d86ca0fdc507d2d8f17f
2019-08-14 16:58:28 -07:00
Jun Wu
c9b69cdf2a cliparser: support defining short names in define_flags macro
Summary: Add rules to match `#[short('x')]` attributes.

Reviewed By: sfilipco

Differential Revision: D16713537

fbshipit-source-id: eaefd34ef51e64a755920feb402547adf9de96f8
2019-08-14 16:58:28 -07:00
Jun Wu
ca432367ca cliparser: support implicit default in define_flags macro
Summary: Add a rule to match implicit default value.

Reviewed By: sfilipco

Differential Revision: D16713533

fbshipit-source-id: 168fb59ee5607d5ae2c0d848943cbc8f55bdfb82
2019-08-14 16:58:27 -07:00
Jun Wu
11b414bccf cliparser: make define_flags stateful
Summary:
Change the macro to have state so we can parse fields one by one with different
syntax.

Reviewed By: sfilipco

Differential Revision: D16713536

fbshipit-source-id: 7f8cb63cfa0ea000c2c2a431454c2d88d49b9187
2019-08-14 16:58:27 -07:00
Jun Wu
6c3314110c cliparser: add define_flags macro
Summary:
This macro provides `Vec<Flag>` and implements `From<ParseOutput>` for a
struct intended to be used as command options.

The core macro is just 21 lines. Both structopt-derive and gumdrop_derive have
1000+ lines.

Of course, it lacks of features.  Some of those features are:

- No way to provide a "short flag".
- Default values have to be explicitly written.
- No way to compose structs (ex. reuse DiffOpts)
- Should "args" be part of the structure?
- Should "command help" be part of the structure?

Reviewed By: sfilipco

Differential Revision: D16713535

fbshipit-source-id: e8137e5f110ebb280fc40f84dace7b1d3a346c82
2019-08-14 16:58:27 -07:00
Stefan Filip
7904ebcfe0 dirstate: fix special handling of root directory
Summary:
D16716743 breaks the Windows build. One of the breakages is that `hg status`
stops working and crashes with `RuntimeError: invalid encoding`. This is
because dirstate has special treatment for root directories. Changing the
representation of the root directory stopped the special treatment.

Reviewed By: quark-zju

Differential Revision: D16812743

fbshipit-source-id: 49f96c87f471876993aec332e032ffcd619d268b
2019-08-14 15:47:25 -07:00
Adam Simpkins
bc17aecb54 fix a typo in an error message
Summary: mispelling

Reviewed By: xavierd

Differential Revision: D16811713

fbshipit-source-id: 26df600dd028d2c36fc8993c2b281db8310b890a
2019-08-14 14:28:48 -07:00
Thomas Orozco
e4b3f59969 mononoke: getpackv2 LFS support (+ getfiles / getpack / eden_get_data refactor)
Summary:
This updates Mononoke to support LFS metadata when serving data over getpackv2.

However, in doing so, I've also refactored the various ways in which we currently access file data to serve it to clients or to process client uploads (when we need to compute deltas). The motivation to do that is that we've had several issues recently where some protocols knew about some functionality, and others didn't. Notably, redaction and LFS were supported in getfiles, but neither of them were supported in getpack or eden_get_data.

This patch refactors all those callsites away from blobrepo and instead through repo_client/remotefilelog, which provides an internal common method to fetch a filenode and return its metadata and bytes (prepare_blob), and separate protocol specific implementations for getpackv1 (includes metadata + file content -- this is basically the existing fetch_raw_filenode_bytes function), getpackv2 (includes metadata + file contents + getpackv2 metadata), getfiles (includes just file content, and ties file history into its response) and eden_get_data (which uses getpackv1).

Here are a few notable changes here that are worth noting as you review this:

- The getfiles method used to get its filenode from get_maybe_draft_filenode, but all it needed was the copy info. However, the updated method gets its filenode from the envelope (which also has this data). This should be equivalent.
- I haven't been able to remove fetch_raw_filenode_bytes yet because there's a callsite that still uses it and it's not entirely clear to me whether this is used and why. I'll look into it, but for now I left it unchanged.
- I've used the Mercurial implementation of getpack metadata here. This feels like the better approach so we can reuse some of the code, but historically I don't think we've depended on many Mercurial crates. Let me know if there's a reason not to do that.

Finally, there are a couple things to be aware of as you review:

- I removed some more `Arc<BlobRepo>` in places where it made it more difficult to call the new remotefilelog methods.
- I updated the implementation to get copy metadata out of a file envelope to not require copying the metadata into a mercurial::file::File only to immediately discard it.
- I cleaned up an LFS integration test a little bit. There are few functional changes there, but it makes tests a little easier to work with.

Reviewed By: farnz

Differential Revision: D16784413

fbshipit-source-id: 5c045d001472fb338a009044ede1e22ccd34dc55
2019-08-14 08:49:22 -07:00
Mateusz Kwapich
e7b71bf029 compute the status manifest only once per amend
Summary:
D15668362 fixed the O(working copy size) behaviour of amend but accidentally
introduced one that's proportional to number of files changed. This fixes the
problem

Reviewed By: markbt

Differential Revision: D16803076

fbshipit-source-id: ad8983c8dfbd28b1958220f8786b8071f50cd0fb
2019-08-14 05:22:53 -07:00
Jun Wu
ea0bdc4d23 ui: disable pager with --debugger
Summary:
`--debugger` starts an interactive REPL. It's incompatible with pager.
Therefore disable pager automatically.

Reviewed By: singhsrb

Differential Revision: D16786806

fbshipit-source-id: a4a219461385f472943e60ba3c2a3b3fefd09e46
2019-08-13 19:12:17 -07:00
Jun Wu
2dad4c70d1 fastlog: add an option to use fastlog for files
Summary:
The fastlog code says it cannot handle file renames, which is not true as far
as I know. Therefore, try use it for files. This affects the `follow()` revset.

I picked a random file, and fastlog is faster than the alternative code path
even with warm cache:

With fastlog:

  % ./hg log edenscm/mercurial/smartset.py --time --pager=off -T '.' --debug --config fastlog.files=1
  found common parent at a320f95a23716d0d106d922fa07ffcf0f838d3ff
  starting fastlog at a320f95a23716d0d106d922fa07ffcf0f838d3ff
  .............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
  time: real 2.060 secs (user 1.870+0.000 sys 0.290+0.000)

Without fastlog, cold cache:

  % sudo rm /var/cache/hgcache/fbsource/packs/*.hist*; ./hg log edenscm/mercurial/smartset.py --time --pager=off -T '.' --debug --config fastlog.files=0
  fastlog: not used because fbcode/scm/hg/edenscm/mercurial/smartset.py is not a directory
  .fetching content for 1 file over HTTPS
  35.56 kB downloaded in 147 ms over 1 request (0.24 MB/s; latency: 147 ms)
  fetching history for 1 file over HTTPS
  445 B downloaded in 56 ms over 1 request (0.01 MB/s; latency: 56 ms)
  running ssh -oControlMaster=no hg.vip.facebook.com 'hg -R '\''/data/scm/fbsource?stage1_read'\'' serve --stdio'
  sending hello command
  sending between command
  remote: 713
  remote: capabilities: unbundlehash gettreepack pushkey getfile getflogheads listkeyspatterns knownnodes getbundle lookup treeonly stream_option remotefilelog known unbundle=HG10GZ,HG10BZ,HG10UN clienttelemetry branchmap changegroupsubset unbundlereplay batch bundle2=HG20%0Ab2x%253Ainfinitepush%0Ab2x%253Ainfinitepushmutation%0Ab2x%253Ainfinitepushscratchbookmarks%0Ab2x%253Arebase%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps%0Atreemanifest%3DTrue%0Atreemanifestserver%3DTrue%0Atreeonly%3DTrue streamreqs=generaldelta,lz4revlog,revlogv1 getannotate stream-preferred
  remote: 1
  sending clienttelemetry command
  connected to hg020.prn2.facebook.com
  sending getpackv2 command
  ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
  876 files fetched over 876 fetches - (1 misses, 99.89% hit ratio) over 5.98s
  (running background incremental repack)
  time: real 11.920 secs (user 5.050+0.000 sys 0.470+0.000)

Without fastlog, warm cache:

  quark@devvm33994 ~/fbcode/scm/hg % ./hg log edenscm/mercurial/smartset.py --time --pager=off -T '.' --debug --config fastlog.files=0
  fastlog: not used because fbcode/scm/hg/edenscm/mercurial/smartset.py is not a directory
  .............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
  time: real 2.530 secs (user 2.050+0.000 sys 0.070+0.000)

This is one step forward getting rid of the legacy filenode / ancestormap
logic. It regresses on offline experience, but we can build simple caches
around the `follow()` revset later.

Reviewed By: markbt

Differential Revision: D16365331

fbshipit-source-id: 16ffd6c3ec2daa5530fed94fb9c41fe75efd6182
2019-08-13 19:12:17 -07:00