Commit Graph

12912 Commits

Author SHA1 Message Date
Jun Wu
8a679289b2 tests: fix test-fb-hgext-scm-prompt-hg.t
Summary: Follow up of D7874269.

Reviewed By: singhsrb

Differential Revision: D7921934

fbshipit-source-id: 4aa4fa52e93bf9d21e8369d4c5891d3046af01eb
2018-05-09 11:28:18 -07:00
Durham Goode
0fcd554c57 treemanifest: enable ondemand tree generation when sendtrees is enabled
Summary:
Previously we only enabled on demand tree generation when treeonly was
set, but we also need it when sendtrees is set since we'll need to generate
trees for sending.

Reviewed By: quark-zju

Differential Revision: D7927856

fbshipit-source-id: a69d6c7920a92e4f90bdcd1d04aad9ef59e9c778
2018-05-09 11:28:18 -07:00
Durham Goode
a25ff90a5e clone: disable pull during hgsql streaming clones
Summary:
hgsql depends on repositories being byte for byte identical, but the
current pull after a streaming clone can cause the repository to be different
(like if different delta decisions were made, or the commits were ordered
slightly differently). Let's disable that pull when the repository is an hgsql
repo.

Reviewed By: ryanmce

Differential Revision: D7925300

fbshipit-source-id: 6eba7ad4ccdd37f6d7c5090522867d1a54f722b7
2018-05-09 06:15:20 -07:00
Jun Wu
f7228afd10 chg: drop "sensitive config sections"
Summary:
The "sensitive config sections" was used because "hg serve" loading
different extensions are incompatible with each other. Now we neither load
extensions nor run their uisetups, and just use one chg server.  So
sensitive config sections can be removed.

Reviewed By: singhsrb

Differential Revision: D7847149

fbshipit-source-id: 758c1df21d280bf0f88d91432e1201c8417df532
2018-05-08 17:02:22 -07:00
Alexandre Marin
aed14c5d04 importer - make it ignore p4 reorgs
Summary:
This diff prepares the importer to cleanly handle moving files in perforce while
keeping the structure in hg untouched.

It introduces a magic string that has to be present in the changelist description:
`IMPORTER_IGNORE_REORG@`

When that is present, move/add move/delete actions where hg path is the same are
ignored.

Differential Revision: D7832814

fbshipit-source-id: e8323d0c3cc79ee81cb819bee63435f345069861
2018-05-04 13:36:28 -07:00
Mark Thomas
17c3e2dd8f commitcloud: UX improvements
Summary:
Rework the commit cloud commands:

* Arrange them under a top-level `cloud` command.
* Make `join` call `register` if necessary and `sync`.  This gives one-step
  on-boarding.
* Add help text to all commands; clean up existing help text.
* Simplify output a little.

Differential Revision: D7876295

fbshipit-source-id: 1f7c0cabfa3d426ced34b90bdca64bef78d78211
2018-05-04 08:05:42 -07:00
Martijn Pieters
59b960eade sparse: filter on file containment
Summary: This lets you find profiles that'll include a given filename.

Reviewed By: markbt

Differential Revision: D7876496

fbshipit-source-id: 3b375e5d8257a80853f854a6be27c74f805687e3
2018-05-04 07:31:06 -07:00
Durham Goode
58ac63caab prompt: update tests with prompt change
Summary:
The prompt was recently fixed to work with remotenames and we need to
update the test.

Reviewed By: ryanmce

Differential Revision: D7876171

fbshipit-source-id: 95ebc8d9d598cf943e67e1d38e9d7ee061882cca
2018-05-04 05:00:37 -07:00
Mark Thomas
e049b43113 commands: fix subcommands test for systems with long TESTTMP paths
Summary:
On systems with long TESTTMP paths, the test-subcommands test wraps the
filename in the help output.  This means the TESTTMP matching no longer works,
and the test fails.

Move the alias definitions into the extension, where we can set the origin
manually.

Reviewed By: mjpieters

Differential Revision: D7859229

fbshipit-source-id: a3b62079ec302f7d6de1e4444a3d5bd740b39703
2018-05-03 08:01:03 -07:00
Mark Thomas
7da35d4f22 fbsparse: use new subcommand infra
Summary:
Replace the monkey-patched subcommands in fbsparse with the new subcommand
infra.

Reviewed By: mjpieters

Differential Revision: D7849195

fbshipit-source-id: 7f1fc21f555dc2bea49d3a80efdbfd42a6e70cb5
2018-05-03 04:35:46 -07:00
Mark Thomas
0aab0bd5dd commands: allow commands to have subcommands
Summary:
Add generalised support for subcommands.  This is similar to the monkey-patched
version in `fbsparse`, but fully supported by the command infrastructure.

Subcommands are the same structure as normal commands, but are attached to a
table in the `subcommands` attribute of the main command.  Normally, if no
subcommand is provided, the normal command function is called.  This can be
made into an error by setting `subonly` on the top-level command.

In order to make `fbsparse` continue to work, I've temporarily hacked how it
handles help text.  This will be fixed in a later diff that switches fbsparse
to use this infrastructure.

Reviewed By: mjpieters

Differential Revision: D7849476

fbshipit-source-id: b988edabb17da77bf91a278e0faa2feecd0c1db9
2018-05-03 04:35:46 -07:00
Jun Wu
77638ffcc0 treedirstate: actually enable it in tests
Summary:
Previously it is not actually used.

`test-hgext-repogenerator.t` changed because treedirstate uses random
number to generate file names.

`fakedirstatewritetime.py` was updated to be treedirstate-aware. This
makes test-revert.t test-merge-tools.t test-merge1.t pass.

Reviewed By: singhsrb

Differential Revision: D7844960

fbshipit-source-id: 33a1d0d4a8e22ea5e6bb6454956884571fcf6bab
2018-05-02 17:15:36 -07:00
Jun Wu
b055d6aace cleanup: remove "fb/" from test-check tests
Summary:
Either fix or ignore issues in `fb/` so the test is consistent if run
externally.

Reviewed By: DurhamG

Differential Revision: D7850647

fbshipit-source-id: 0f7faa3be2dff1dcf61a3b765c1827583fafc14f
2018-05-02 14:01:09 -07:00
Jun Wu
3368506521 tests: fix test-check-code.t
Summary:
There is a proper way [1] to skip the dict check-code check. Let's use it.

[1]: a61ed1c2d7

Reviewed By: DurhamG

Differential Revision: D7831336

fbshipit-source-id: a5e654e9e94cbfb1c5a07b047eb6e5451904c48e
2018-05-01 14:17:43 -07:00
Mateusz Kwapich
3e05d1c44a fix test outputs to unbreak the builds
Reviewed By: markbt

Differential Revision: D7831727

fbshipit-source-id: 65b2c5047a6738cda2e07d9bd319cfdc3db20b3f
2018-05-01 11:11:54 -07:00
Jun Wu
67b4301002 extensions: always turn on treedirstate
Summary:
This would make tests run on treedirstate.

To avoid issues with Eden pulling from a non-eden treedirstate repo,
treedirstate is changed to be "always on" and disables itself on an eden repo.

The extension list is changed to a set for efficient `__contains__` test.

Reviewed By: phillco

Differential Revision: D7769804

fbshipit-source-id: d328fe51ef67c4730cfc53f43bdfc48c2765c541
2018-05-01 08:18:36 -07:00
Martijn Pieters
a9f4167218 sparse: add filtering on field contents
Summary: This lets you select on substrings in fields and paths.

Reviewed By: quark-zju

Differential Revision: D7788826

fbshipit-source-id: f92b8cc646fd36f4cb3b8a4dc6116576db80eb42
2018-04-30 14:16:44 -07:00
Martijn Pieters
796523487a sparse: add a hint about using --verbose on hg sparse list
Summary: Calculation on how many profiles were hidden is only done when the hint is actually shown.

Reviewed By: quark-zju

Differential Revision: D7774192

fbshipit-source-id: a7196b2cc5640d0a7cb9c4d572e1a31ebfa41598
2018-04-30 14:16:44 -07:00
Martijn Pieters
2c10ce3145 sparse: add filtering options for fields present or missing
Summary:
This lets us produce a list of profiles with the title set, or find all profiles that are missing a description.

Convert the 'hidden' filter to use this feature, rather than special-case it in `_discover()`.

Reviewed By: quark-zju

Differential Revision: D7774029

fbshipit-source-id: 3bcba75e6da97bf0e560e11ce1ae7cbcee49ee45
2018-04-30 14:16:44 -07:00
Mark Thomas
cec43c1e77 infinitepush: enable compression of bundles
Summary:
Infinitepush stores bundles uncompressed, which can make them quite large.
Enable zstd compression of bundles, both when sending them to the server during
backups, and when storing the bundle in the bundle store on the server.

Reviewed By: quark-zju

Differential Revision: D7777371

fbshipit-source-id: ef9360bf05bf2a6d2b76e26cd40ad1e4ee8ae076
2018-04-30 02:49:18 -07:00
Jun Wu
cfec85ab00 fastannotate: disable forcefollow by default
Reviewed By: sid0

Differential Revision: D7764010

fbshipit-source-id: 16604e9dbeea382bc0e1feb55d30986d0e4ee0d1
2018-04-27 23:40:00 -07:00
Jun Wu
94e0297817 tests: fix test-clone-uncompressed.t
Summary: Got the other output on OSX builders.

Reviewed By: singhsrb

Differential Revision: D7790153

fbshipit-source-id: 913b5cf78c2e90933cb77d14a77e244b1ef063ba
2018-04-27 10:00:40 -07:00
Jun Wu
c0994a212f tests: stabilize test-fastmanifest-blackbox
Reviewed By: mjpieters

Differential Revision: D7729157

fbshipit-source-id: 1d546e974520c76e532152802e22fe01b091a9d2
2018-04-27 09:16:02 -07:00
Kaley Huang
c32047e854 p4syncimport: eliminate "p4 where" calls
Summary:
We currently call "p4 where" on all files in the new client spec, which is roughly O(all files in ovrsource), and it's only going to get worse as ovrsource grows :(
This diff makes the number of calls O(files added & removed between two client specs) by filtering them in the following way:
- get a full list of files from old client (L1)
- get a full list of files from new client  (L2)
- files_added = L2 - L1
- files_removed = L1 - L2
- `p4 where` on (files_added + files_removed)

How much speedup do we get?
from
  [2018-04-25 16:07:27,725]INFO:root: Start sync import in ovrsource-master
  [2018-04-25 17:35:35,873]INFO:root: Finish sync import in ovrsource-master after 5288.147963762283 seconds
to
  [2018-04-26 13:43:28,819]INFO:root: Start sync import in ovrsource-master
  [2018-04-26 13:51:35,575]INFO:root: Finish sync import in ovrsource-master after 486.7560772895813 seconds
on this change D7722798

Differential Revision: D7772403

fbshipit-source-id: 05a16343264007ee3ee466621da9da888c2368d7
2018-04-27 08:33:47 -07:00
Durham Goode
e3f8f7fc38 clone: add stream_clone_options wireprotocol endpoint
Summary:
We want to allow blocking full repo streaming clones in certain
repositories (since they can take the lock and take a very long time) unless the
client has explicitly asked for it. The existing stream_out wire protocol has no
way of passing an option, so let's create a new endpoint.

Reviewed By: quark-zju

Differential Revision: D7763717

fbshipit-source-id: eace47143f8fdcc4c6e302b5c26678ccf56ca5d4
2018-04-25 13:54:54 -07:00
Martijn Pieters
ed857415c5 sparse: allow listing of profiles at a different revision
Summary: This is needed to be able to list profiles via SCMQuery, where there is a working copy at the null revision.

Reviewed By: quark-zju

Differential Revision: D7745434

fbshipit-source-id: b5ac236c36f9bafc9e0f305bc0892e0cd8bec628
2018-04-25 08:50:27 -07:00
Siddharth Agarwal
be7307cb48 hgsql: work around mysql-python-connector null byte mangling
Summary: See the comments for more.

Reviewed By: quark-zju

Differential Revision: D7738340

fbshipit-source-id: 20660c2ff7fdba1850c0fb9f34548db0084abf3d
2018-04-24 11:05:55 -07:00
Martijn Pieters
51dae5969e sparse: ignore non-existing profiles when listing
Summary: If there is a non-existing sparse profile active in .hg/sparse, skip it rather than bail out.

Reviewed By: quark-zju

Differential Revision: D7744957

fbshipit-source-id: 4e6a046c95f5fe6cf49a7093d3443340f70e8e2a
2018-04-24 10:21:22 -07:00
Kaley Huang
e701ca4c6e p4syncimoprter: reimplement
Summary: Curernt sync importer modifies mercurial storage data structures directly, which is error prone and hard to debug. This reimplements the sync importer with a higher level mercurial API (what `p4seqmport` uses).

Differential Revision: D7714322

fbshipit-source-id: 0269839b5ee3a4b45f166dce74dfd29c8ec5135a
2018-04-23 16:32:41 -07:00
Durham Goode
e1ac4b80e0 metrics: add performance logging to important locations
Summary:
This logs timing data for:
- update
  - merge.update
  - mergedriver
  - applyupdates
  - workers
- fetches
  - pulls
  - remotefilelog prefetches
  - treemanifest prefetches
- status
  - dirstate walks
  - fsmonitor walks
  - watchman queries

Hopefully this will let us narrow down where time is going in a number of cases
where the profile data is ambigiuous or hard to come by.

Reviewed By: quark-zju

Differential Revision: D7681026

fbshipit-source-id: e6fe65c9a4d2f4e128f62ccb767a7cbe73b2649a
2018-04-23 10:51:21 -07:00
Liubov Dmitrieva
a0beff1460 commitcloud: use cloudsync related phrases in smartlog
Summary:
when a user is joined to commitcloud workspace, we should provide
commit cloud related messages in the smartlog

Reviewed By: markbt, StanislavGlebik

Differential Revision: D7705709

fbshipit-source-id: ba2c246f115542e4f49446284cd831d8c266245f
2018-04-20 11:29:24 -07:00
Mark Thomas
3902417b93 infinitepush: limit the list of backups to just the most recent few
Summary:
Make `hg getavailablebackups` limit the list to 5 (configurable) backups by
default.  Add a new `--all` option to list them all.

Reviewed By: quark-zju

Differential Revision: D7671210

fbshipit-source-id: 743e0032e11b5d21b1544b695d28e8818c44085e
2018-04-20 10:10:04 -07:00
Mark Thomas
6f3e39c8ee infinitepush: add backupdelete command to delete backups
Summary: Add the `hg backupdelete` commands, that lets users delete their old backups.

Differential Revision: D7670524

fbshipit-source-id: d0a12e1aa7c770cf9313e792d859c9a76ff43d9f
2018-04-20 10:10:04 -07:00
Mark Thomas
1a9ca888a8 infinitepush: don't push empty backups in new clones
Summary:
If the infinitepush backup state is empty (indicating this is probably a new
clone of a repository), and there are no commits or bookmarks to be backed up,
don't push a backupbundle that clears all the heads and bookmarks of any
backups that have the same servername and path.  This might be a reclone of the
repository, and the user might want to restore the backup.

When the first commit or bookmark is made in the new repository, the old
backup will be cleared at that point.

Differential Revision: D7669728

fbshipit-source-id: bec859bbbbee6b631efb4483a8fedbad8f3bcbac
2018-04-20 10:10:03 -07:00
Alexandre Marin
69005698f4 importer - call p4 where with multiple paths
Summary:
We currently call p4 where with one path at a time, but it accepts a list.
This change takes advantage of that, batching p4 where calls, which speeds up
importing.

Differential Revision: D7676378

fbshipit-source-id: 4a6747458555a60dd5f385604f2a25d595af947d
2018-04-19 17:08:30 -07:00
Jun Wu
68e346c962 fsmonitor: send state about filemerge
Summary:
The merge process could be interactive, and tools like Hack wants to
scan changed files when the user is resolving conflicts. There is a
"hg.update" watchman state and "state-enter", "state-exit" events that help
detect the "update" process. However, the interactive "ui.merge" process is
inside the "update" process and cannot be easily decoupled confidently (i.e.
hard to end "update" state before doing the merge).

It's also hard to have a general "merge" state due to the current watchman
design. Because a merge might be across multiple hg processes (ex.
non-interactive ui.merge, hg exits, returns to the shell, and the user invokes
`hg resolve --mark` to end the merge state), and the current watchman
implementation will force end all states associated with a watchman socket
connection. If a hg process exits, it will disconnect from the watchman socket
and the merge state will be forced terminated, although there is still
unresolved conflicts.  Previous attempt on this is D7286181.

This patch adds a "hg.filemerge" watchman state that could make watchman
users aware of ongoing interactive merge resolutions. The event fires when an
external merge tool is called, per conflicted file. It is strictly a sub
interval of an "update" state, which is within a single process. So it does not
have the problem that a "merge" state has.

Differential Revision: D7648929

fbshipit-source-id: 858beba1bff261e8da5bd4d8b08a388dcbc8a9ef
2018-04-19 13:17:08 -07:00
Jun Wu
50fc1b7bc6 tests: add a utility to sort dict outputs
Summary:
Python dict is unordered. This is a naive filter that helps stabilizing the
test output. It's used in the next patch.

Reviewed By: mjpieters

Differential Revision: D7648927

fbshipit-source-id: ad51f83c6f8d3a29cc0ee26afef73669302632c3
2018-04-19 13:17:08 -07:00
Alexandre Marin
537f9b9887 p4fastimport - remove comment/dead code
Summary:
This has been commented out for ages
It is not needed, and it refers to self._parsed which does not exist.

Differential Revision: D7625105

fbshipit-source-id: 908809b5b31e104b01b49558febed5adbfdcd143
2018-04-19 12:21:25 -07:00
Kaley Huang
2b4ab46876 p4syncimporter: fix minors in tests
Summary: D7676184 changes the sync importer tests to use `p4seqimport` instead of `p4fastimport`, but there's one left. This fixes the leftover one.

Differential Revision: D7687451

fbshipit-source-id: a7f4c4fa93f5a2a52a99cd1d8263718fc656f683
2018-04-19 12:21:25 -07:00
Liubov Dmitrieva
0074c0eb26 commitcloud: improve user facing message if there are unbackup changes
Summary: Improve message to suggest user to run the right command

Reviewed By: markbt

Differential Revision: D7668587

fbshipit-source-id: 903d9fc62fb2018847d81112ff62a76f337cdd18
2018-04-18 17:05:32 -07:00
Kaley Huang
97e9e5fa6a p4syncimporter: use p4seqimport instead of p4fastimport in tests
Summary: Since `p4seqimport` reaplces `p4fastimport`, the test for `p4syncimport` (which currently uses `p4fastimport`) should be updated to use `p4seqimport` as well.

Differential Revision: D7676184

fbshipit-source-id: 4273975159190933a71a1fe538dfddfbe4eb8a91
2018-04-18 17:05:32 -07:00
Durham Goode
a4d4fb3e29 metrics: rename logblockedtimes to logmeasuredtimes
Summary:
In an upcoming diff I want to add more timing measurements for various
parts of the Mercurial code (like how long status takes, vs checkout, vs
prefetch, etc). Let's rename the logblockedtimes logic to be more generic, since
it is doing basically the same thing.

Reviewed By: singhsrb

Differential Revision: D7676406

fbshipit-source-id: 9aa8c90ce562fa3ad5b654f7b3191b2c16a440c2
2018-04-18 17:05:32 -07:00
Martijn Pieters
f07e9c14b6 fbsparse: add hint to sparse explain about the verbose flag
Summary:
```
$ hg sparse explain some/profile
[...]
hint[sparse-explain-verbose]: use 'hg sparse explain --verbose some/profile' to include the total file size for a give profile
hint[hint-ack]: use 'hg hint --ack sparse-explain-verbose' to silence these hints
```

Differential Revision: D7669896

fbshipit-source-id: c700fbc2f42044a9b15371278305f03e9e6c989f
2018-04-18 10:38:35 -07:00
Martijn Pieters
0b9356d3f2 sparse: update all subcommands with proper arguments / synopsis info
Summary: Tweak the help output to reflect the now-complete subcommand information.

Differential Revision: D7667900

fbshipit-source-id: a5a04e8bcbfe4a90266c30e25ffd705de0bdc8a9
2018-04-18 10:38:35 -07:00
Kostia Balytskyi
cb1179cccb locks: make sure debuglocks knows about malformed locks and undolog lock
Summary: Let's report that this lock cannot be read by Mercurial

Reviewed By: markbt

Differential Revision: D7653196

fbshipit-source-id: c5b7889cdde9c0ecc03a8c961aeba92f426648b1
2018-04-17 17:42:26 -07:00
Jun Wu
c5985f2ec0 setup: drop install_requires
Summary:
`install_requires` is not well supported. And the subverty detection is not
meaningful - it checks at package build time, not package install time.

```
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
```

Reviewed By: markbt

Differential Revision: D7626055

fbshipit-source-id: 061147f02698ad46561c95d2039f0a8ad26182d2
2018-04-17 16:35:25 -07:00
Jun Wu
2bfa2520b7 test-lock-badness: stabilize the test
Summary: `hg status` won't always take wlock. So let's use `hg add` instead.

Reviewed By: phillco

Differential Revision: D7658239

fbshipit-source-id: c54b1aea61610e605c2967ccabcf594d5cb5b77f
2018-04-17 13:35:24 -07:00
Liubov Dmitrieva
520ffc0cef infinitepush: add unit test for pullbackup when hostname and reporoot are provided together
Summary: The test covers recent bug fix with --reporoot option for hg pullbackup

Reviewed By: ikostia

Differential Revision: D7652464

fbshipit-source-id: 1884d0f3112a7dd1d7b2b0df29738b8760a5697b
2018-04-17 05:55:40 -07:00
Jun Wu
857e9aa714 blackbox: append "\n" automatically
Summary:
Some log messages might not end with "\n". Append it automatically so it
looks good in blackbox.log.

Reviewed By: singhsrb

Differential Revision: D7648930

fbshipit-source-id: f5262e0c77a3bde952c3963ac5298b850f38d9db
2018-04-16 20:53:58 -07:00
Jun Wu
40dd438fc8 blackbox: do not log if msg is empty
Summary:
There are certain code paths that passes an empty `msg` that would crash
blackbox code:

```
error in exit handlers:
Traceback (most recent call last):
  File "mercurial/dispatch.py", line 73, in _runexithandlers
    func(*args, **kwargs)
  File "hgext/sampling.py", line 118, in telemetry
    generaldelta=str('generaldelta' in repo.requirements).lower())
  File "hgext/blackbox.py", line 170, in log
    formattedmsg = msg[0] % msg[1:]
IndexError: tuple index out of range
```

Fix it by ignoring those messages.

Reviewed By: singhsrb

Differential Revision: D7648932

fbshipit-source-id: be9f8327fd476399e4b762c92ea5f31cb174e189
2018-04-16 20:53:58 -07:00