Commit Graph

334 Commits

Author SHA1 Message Date
Jun Wu
fbccd19ed7 patchbomb: remove the extension
Summary:
`test-patchbomb.t` uses named branches and does not look simple to fix.
We don't use email patches internally, and it's not hard to write scripts
around `hg export`. Therefore drop the extension and its tests.

Reviewed By: singhsrb

Differential Revision: D13978577

fbshipit-source-id: 19867ae68c19c996bfce064eb2234705939db9ea
2019-02-12 21:45:10 -08:00
Durham Goode
163704f80a disablesymlinks: add extension to disable symlinks
Summary:
In some cases we are mounting ntfs in a linux host using ntfs.3g and we
want to prevent it from writing symlinks that can't be read from Windows.

Some background, ntfs.3g supports symlinks, but it produces IntxLNK which cause
problems when mounted into a real Windows machine. We don't support symlinks on
Windows anyway, so we want to just disable this. Unfortunately it's difficult to
detect if we're on a ntfs.3g fuse mount, so instead we're just going to have the
machine set up the repo with this extension enabled.

Differential Revision: D13964546

fbshipit-source-id: 7545538e51be4c986a50161165d7cc2e64280555
2019-02-06 08:41:34 -08:00
Jun Wu
9dc21f8d0b codemod: import from the edenscm package
Summary:
D13853115 adds `edenscm/` to `sys.path` and code still uses `import mercurial`.
That has nasty problems if both `import mercurial` and
`import edenscm.mercurial` are used, because Python would think `mercurial.foo`
and `edenscm.mercurial.foo` are different modules so code like
`try: ... except mercurial.error.Foo: ...`, or `isinstance(x, mercurial.foo.Bar)`
would fail to handle the `edenscm.mercurial` version. There are also some
module-level states (ex. `extensions._extensions`) that would cause trouble if
they have multiple versions in a single process.

Change imports to use the `edenscm` so ideally the `mercurial` is no longer
imported at all. Add checks in extensions.py to catch unexpected extensions
importing modules from the old (wrong) locations when running tests.

Reviewed By: phillco

Differential Revision: D13868981

fbshipit-source-id: f4e2513766957fd81d85407994f7521a08e4de48
2019-01-29 17:25:32 -08:00
Wez Furlong
f517200115 hg: add eden import helper debug command
Summary:
In our linux deployments it was relatively straightforward
to import the mercurial runtime from a python process running the
system python executable.   Our macOS deployments are a lot more
complex because they do not use the system python and do not install
the mercurial python packages in the python path of the target
python executable.

It is simpler to move the import helper functional into a mercurial
command that we can invoke instead of our own helper program.

This diff moves the script to be a debug command and adjusts its
argument parsing to match the mercurial dispatcher requirements.

There are some stylistic mismatches between this code and the
rest of mercurial; I'm suggesting that we ignore those as the
medium term solution is that this command is replaced by eden
directly consuming the rust config parsing code and by native
rust code to perform the data fetching that we need.

Reviewed By: pkaush

Differential Revision: D13522225

fbshipit-source-id: 28d751c5de4228491924df4df88ab382cfbf146a
2019-01-16 19:49:27 -08:00
Marla Azriel
02d41c83e8 commands: help text for update / checkout
Summary: Updated help text for hg update / hg checkout and removed --date option

Reviewed By: ikostia

Differential Revision: D13071724

fbshipit-source-id: 31b51b26f5d199e356f2148353d6714cecc1f632
2018-12-17 14:33:04 -08:00
Mark Thomas
e29647fd94 debugcommands: add debugmutation
Summary: Add a new command to debug-dump mutation information in commits

Reviewed By: DurhamG, quark-zju

Differential Revision: D9975474

fbshipit-source-id: a9ed1578dffc80da3e375837cede8d8685ee0427
2018-12-13 10:47:27 -08:00
Jun Wu
4bfce6446b commands: add "debugstatus"
Summary: Add a dedicated command to debug recent status performance issues.

Reviewed By: DurhamG

Differential Revision: D12910541

fbshipit-source-id: 792bb9bd83e2f43225d9aad4aef64ece45db7ecc
2018-12-13 09:10:21 -08:00
Jun Wu
1ef3e33b69 configwarn: remove the extension
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
2018-12-12 18:54:22 -08:00
Mark Thomas
38cc6a356c help: fix stablerev help summary in test
Differential Revision: D13118834

fbshipit-source-id: 4cbcdf261e145acdfc260f2884d39ca0420b606f
2018-11-19 06:38:28 -08:00
Phil Cohen
4b9fdcd042 stablerev: add getstablerev() revset
Summary:
This allows us to expose `arc pull`'s functionality directly from hg.

There are three parts:

- Create a revset that runs a program, reads the stdout and looks up that commit if it exists
- Auto-pulling if the commit doesn't exist
- Supporting an optional argument (target) that's passed to the script

Reviewed By: DurhamG

Differential Revision: D10524541

fbshipit-source-id: 7493c5592e272f9e8a87f109cec1426d44935ecc
2018-11-12 13:38:49 -08:00
Marla Azriel
4027f3a7e9 commands: update help text for smartlog, show, diff
Summary: Provides updated help text for hg smartlog, hg show, and hg diff

Reviewed By: markbt

Differential Revision: D12950765

fbshipit-source-id: d442079499abada1740760c8b6d0c27bf4a2b2d3
2018-11-09 13:14:20 -08:00
Marla Azriel
96cb1050bc commands: update help summary text
Summary: Updated the global help summaries that are displayed for each command when you run 'hg help' and fixed corresponding tests

Reviewed By: markbt, kulshrax

Differential Revision: D12832280

fbshipit-source-id: 950dad1c805feab573d7d0182da523ae12299d3b
2018-11-07 19:59:47 -08:00
Aida Getoeva
8940a7c464 uncommit: move to core
Summary: Moving extension `uncommit` to the core.

Reviewed By: quark-zju

Differential Revision: D10447651

fbshipit-source-id: 2ccf7db858b78e0811ffef742c82237259492719
2018-10-30 08:00:05 -07:00
Phil Cohen
f2a3798dfa commands: rename hg grep to hg histgrep
Summary:
tweakdefaults renamed core hg's `grep` to `histgrep`, and added a `hg grep` that behaves more like `git grep`, searching the working copy. This diff folds those changes into core.

The config changes from

```
[tweakdefaults]
allowfullrepohistgrep = False
```

to

```
[histgrep]
allowfullrepogrep = False
```

Reviewed By: quark-zju

Differential Revision: D10435279

fbshipit-source-id: ad3d1da5824511a612111715e46119d70066050f
2018-10-25 14:54:22 -07:00
Jun Wu
3c46b25bec hgext: remove unused extensions
Summary:
Remove extensions that are not used in prodution. These extensions are also
unlikely to be used in the future.

Reviewed By: ikostia

Differential Revision: D10473370

fbshipit-source-id: a936e30acd3ec4370434c583447942c6ee8d9b13
2018-10-20 19:08:43 -07:00
Mark Thomas
5f811293e8 help: fix tests
Reviewed By: phillco

Differential Revision: D10447019

fbshipit-source-id: 619508f33ca60ef27228582cc037abff3982fbc0
2018-10-18 11:07:15 -07:00
Mark Thomas
1cc0fedc1c help: reorganise help commands
Summary:
Reorganise the top-level help commands to more useful categories, allowing them
to be listed in a custom order.

Reviewed By: phillco

Differential Revision: D10423184

fbshipit-source-id: 17f02ae201493397a448d108e781eca28a7b1d44
2018-10-17 09:58:06 -07:00
Kostia Balytskyi
c46886e415 obsshelve: remove dummy extension
Summary: After D10407265 this is no longer needed.

Reviewed By: quark-zju

Differential Revision: D10407826

fbshipit-source-id: 5291981637d940a6d19cda1b814b81b745d9ca92
2018-10-16 14:27:29 -07:00
Kostia Balytskyi
86f07601f7 sparse: rename fbsparse into sparse in tests
Reviewed By: phillco

Differential Revision: D10335084

fbshipit-source-id: 91e0a17957561410e397a006f99ebf549d34e1e4
2018-10-16 14:27:29 -07:00
Kostia Balytskyi
e69f2795e4 obsshelve: add dummy extension file as a temporary workaround
Reviewed By: kulshrax

Differential Revision: D10401200

fbshipit-source-id: dc855cfedcba46575f4616a331a5cf8551e27055
2018-10-16 05:33:13 -07:00
Mark Thomas
f18bd9714d help: improve some help messages
Summary: Make a few help messages clearer.

Reviewed By: phillco

Differential Revision: D10356915

fbshipit-source-id: 277d4cecbd17b647d6dd01209ff6f93a926d37d4
2018-10-15 09:37:19 -07:00
Mark Thomas
36c697f8e0 help: new default help
Summary:
Replace the default help for Mercurial with a curated list of interesting
commands, categorized by their use case.

Reviewed By: phillco

Differential Revision: D10356916

fbshipit-source-id: 65e578a4bfde7b0ad04e7107f4e77d8ea882d78a
2018-10-15 09:37:18 -07:00
Saurabh Singh
3d88ec0346 record: move extension into core
Summary:
This extension exposes only the `record` command which can be easily
moved to core. This commit achieves the same.

Reviewed By: ikostia

Differential Revision: D10360759

fbshipit-source-id: 25f0c46aa3fa9b19ab8ba03a6b4e8598bc003c7a
2018-10-12 11:16:46 -07:00
Saurabh Singh
cd49463e2c show: move the extension into core
Summary:
The extension only offers one command i.e. `show` which can move into
core.

Reviewed By: ikostia

Differential Revision: D10302192

fbshipit-source-id: 9473ec8c80e52506e1b7de62b2c90a51c29419c1
2018-10-12 07:03:11 -07:00
Saurabh Singh
d0d21c955f show: replace with the fbshow extension
Summary:
The functionality we care about is provided by the `fbshow` extension.
Therefore, lets replace the `show` extension with the `fbshow` extension.

Reviewed By: ikostia

Differential Revision: D10302193

fbshipit-source-id: e6d137f52427d5e6f124714d06b5b55ef0db7c3c
2018-10-12 07:03:11 -07:00
Kostia Balytskyi
7068d0d8fb shelve: move obsshelve into shelve and fix a bug
Summary:
The bug:
This happens because `repo['']` resolves to a `wctx`. This might be undesirable
in its own right, but before we fix that, we can work it around here.

Reviewed By: singhsrb

Differential Revision: D10261261

fbshipit-source-id: 8cb0e96762ffba24030f9e6bae8b0d0c108e3938
2018-10-12 06:30:04 -07:00
Saurabh Singh
6317ba0ca2 amend: replace with the fbamend extension
Summary:
The functionality we care about is provided by the `fbamend`
extension. Therefore, lets replace the `amend` extension with the `fbamend`
extension.

Reviewed By: farnz

Differential Revision: D10320739

fbshipit-source-id: 5700d39f488777fcc4033f60ce0a51cda15ef2ad
2018-10-11 06:59:23 -07:00
Saurabh Singh
f6e0d2d1ee inhibit: remove the extension
Summary:
The logic we care about has been moved to core so we can delete the
`inhibit` extension.

Reviewed By: markbt

Differential Revision: D10276448

fbshipit-source-id: 44cabe5d561344cf8f196127ce52491e4654b598
2018-10-10 10:01:45 -07:00
Mark Thomas
f47bd8c33d treestate: move treedirstate to core
Summary:
Parts of the treedirstate implementation were left in the extension.  Since
treestate is now in core, and the two are intertwined, treedirstate should be
in core, too.

In doing so:
- Change the garbage collection behaviour to match that of treestate.
- Use the treestate config options for configuring repacking and garbage
  collection.
- Make more of the code common.

Reviewed By: quark-zju

Differential Revision: D10258265

fbshipit-source-id: 89e82bc7662a3d1251fa9886751897cfc46cd66a
2018-10-10 03:53:20 -07:00
Mark Thomas
f353521eb9 revset: move age extension to core
Summary:
The age extension provides a couple of revsets relating to commit ages.  Move
these to core.

Differential Revision: D10239000

fbshipit-source-id: 6ebf3aa263b72e4bbbe25bd516f77b17145e6e7f
2018-10-08 12:01:44 -07:00
Mark Thomas
99b3d7c398 share: remove shareutil and _sharedprimaryrepo
Summary:
These are no longer necessary.  Callers should use the sharedvfs to access the
shared repo's .hg directory.

Reviewed By: quark-zju

Differential Revision: D9699163

fbshipit-source-id: 9b9cd584d721c174a7eab06f6abcedc3a943233b
2018-09-28 07:23:02 -07:00
Jun Wu
3ee1c205cd hgsql: sync repos before acquiring the SQL write lock
Summary:
When entering the critical section (creating a transaction), hgsql might wait
for SQL lock for a long time (minutes). And it currently does nothing during
that wait time. If the lock was acquired after a long time, the work of
catching up with what the database already has might be too much. That is a
waste within the precious hgsql lock held critical section.

Instead of waiting for the lock for N seconds and doing nothing, wait for k
(k < N) seconds and also try to sync with SQL periodically. This makes the
repo closer to what the database has and can reduce work needed to pull from
the database in the critical section.

This adds CPU pressure to the MySQL tier. I added a config option to control
it.  Worse case, we can change `hgsql.syncinterval` to make the sync less
frequent.

As we're here, try document the configs.

Reviewed By: phillco

Differential Revision: D10002578

fbshipit-source-id: bd72d8225c919aa2bc62743de1e1d3f27cba606a
2018-09-25 16:06:20 -07:00
Jun Wu
98c4b5d665 debugcommands: add a "debugprocesstree" command
Summary:
Recently there are a trend of questions about repo being locked. People usually
don't have enough debugging skills to find out what's going on. So let's add a
debug command to help them.

The implementation uses `osqueryi`, which perfectly solves the cross-platform
process handling headache. Note the well-known `psutil` Python library does not
seem to provide parent process information on Windows.

The `_rapply` function was backported from upstream mercurial.

Reviewed By: markbt

Differential Revision: D9443601

fbshipit-source-id: d26b3adfde1045ebd5bca1c6b1c93f0db147f9b0
2018-08-22 21:35:19 -07:00
Jun Wu
4337aee636 mq: remove the extension
Summary:
mq is already somehow problematic at D8907646. Without bandwidth supporting
it, let's remove it.

Alternative to mq would be rebase, shelve, unshelve, histedit.

Maintain "--config extensions.mq=" compatibility by marking it builtin so hg4idea
won't break by this change.

Reviewed By: phillco

Differential Revision: D9039741

fbshipit-source-id: a3a1e48a2a982ff8e8b6a6ce659c906a4e2b2b36
2018-07-30 08:49:26 -07:00
Jun Wu
f3e69ec61a bugzilla: drop the extension
Summary:
It's similar to acl and notify - not used and can be done using hooks
externally.

Note the bugzilla extension actually works with the Rust config parser,
unlike acl and notify.

Reviewed By: DurhamG

Differential Revision: D8953126

fbshipit-source-id: 43b12666e4d9c03f800395613eed06783aac48b3
2018-07-23 18:37:10 -07:00
Jun Wu
95dbb0bca1 notify: drop the extension
Summary:
Similar to the acl extension, notify is not used here and can be implemented
as hooks.

The direct motivation is, it uses weird key in config names that get rejected
by the Rust config parser:

```
  hg: parse error: ".../.hgrc":
    --> 61:4
     |
  61 | */a#branch(test) = will_no_be_send@example.com
     |    ^---
     |
     = expected equal_sign
```

Although the pest syntax can be updated to support this case, by using
different `name`s for sections, and config names. It seems cleaner to
just drop notify, as it's the only trouble maker.

Reviewed By: DurhamG

Differential Revision: D8953127

fbshipit-source-id: fc7760a32b6ea538cb207c860aadac7b4b58027f
2018-07-23 18:37:10 -07:00
Jun Wu
eb67457eba acl: drop the extension
Summary:
It's rarely used here and feels like a burdern to continue support.

It only restricts write access. A well-designed commit hook API should be the
superior solution here.

The direct motivation of the removal is becuase it does not work well with the
Rust config parser. Namely it's the unique extension that treats an empty
section differently from an section that isn't set. That does not play well
with the Rust config parser. While it can be worked around like D8887670, it's
not a very clean soution, and there are other issues making test-acl.t fail.

Therefore, instead of trying to find the remaining weirdness of acl, I figured
it's probably the right call to drop it and redirect users to hooks instead.

Reviewed By: DurhamG

Differential Revision: D8953125

fbshipit-source-id: 209f04423ccdf182b0ba4021b59d26525173d73c
2018-07-23 18:37:10 -07:00
Saurabh Singh
1f24212cb0 globalrevs: introduce extension for strictly increasing revision numbers
Summary:
With the `globalrevs` extension enabled, Mercurial starts adding a
strictly increasing revision number to each commit which is accessible through
the `globalrev` template.

Reviewed By: DurhamG

Differential Revision: D8364387

fbshipit-source-id: 84bd43f56b9cb1c775cffb875501dd64d10ffa42
2018-06-28 08:19:22 -07:00
Jun Wu
64c3b8c2ab run-tests: add --watchman and --with-watchman flags
Summary:
Similar to chg. Add flags to run tests with watchman. This is mostly moving
features from `fsmonitor-run-tests.py`. The blacklist is converted to
`#require no-fsmonitor`.

Reviewed By: phillco

Differential Revision: D8434518

fbshipit-source-id: a8512cd71c1171e9037f36dbef195f1e6210f27e
2018-06-14 18:49:24 -07:00
Jun Wu
d26a9397e6 dirstate: unify format configs
Summary:
Previously, there are 2 configs: `treedirstate.useinnewrepos` and
`format.usetreestate`. They are both related to dirstate format and conflict
with each other. This patch unifies them into a single config
`format.dirstate`.

As we're here, merge `test-fb-hgext-treedirstate-x.t` to `test-dirstate-x.t`
if they were previously copied from `test-dirstate-x.t`

Reviewed By: markbt

Differential Revision: D8393878

fbshipit-source-id: 57abeea22ce732d93205e4d4308923afa90693f4
2018-06-13 18:17:26 -07:00
Jun Wu
992bb85644 treestate: make it an option of dirstate backends
Summary:
Add a config option `format.usetreestate`, which would turn on the new
treestate for new repos.

Treestate does not need manually maintaining "copymap", "otherparentset",
"nonnormalset". The one single tree is the source of truth of everything.
So some code like `copymap.pop` etc. are disabled on treestate path.

Reviewed By: markbt

Differential Revision: D7909175

fbshipit-source-id: 96a405fccd4099cefc152ec17204cb5407efbe7e
2018-06-11 14:32:42 -07:00
Mark Thomas
5180dd5cf2 infinitepush: split backups into infinitepushbackup extension
Summary:
Split the infinitepush backups code into a separate module.

The infinitepush extension is responsible for providing scratch pushes, as well
as the server-side implementation for storing scratch bundles.

The infinitepushbackup extension uses this feature to provide automatic backup
support.  It is an alternative to the commitcloud extension, and the two will
be mutually exclusive.

Reviewed By: DurhamG

Differential Revision: D8204418

fbshipit-source-id: 9279c426da35d451a5e7b39a72f2c91d364e3fd4
2018-06-05 04:36:06 -07:00
Mark Thomas
e28d4a84e0 fix tests after reformat
Summary: The recent reformat caused a few test failures, this should fix them.

Differential Revision: D8207359

fbshipit-source-id: ced37aff3038715e5876fe27b58a60ebe45e4097
2018-05-30 13:47:50 -07:00
Mark Thomas
aa08d92675 debugcheckcasecollisions: add a command to check case collisions
Summary:
Add a new debug command to check whether any of the provided files
casecollide with any file in a revision's manifest.

Reviewed By: quark-zju

Differential Revision: D8165659

fbshipit-source-id: 9315ff052c9996888202961d168d20b834c22834
2018-05-27 05:04:56 -07:00
Michael Bolin
a5e1820702 Split out a new hgevents extension from fsmonitor.
Summary:
This splits out the logic in the `fsmonitor` extension that is responsible for
publishing `hg.filemerge` and `hg.update` state changes to Watchman into
its own extension, `hgevents`. This is because we want the behavior of
`hgevents` when Hg is running in Eden, but we do not want the remaining
behavior of `fsmonitor` when Hg is running in Eden, so splitting the logic
into separate extensions is the most straightforward way to achieve that.

To achieve the split, we move some more logic that is common to both
`fsmonitor` and `hgevents` out of `hgext/fsmonitor/__init__.py` and into
`hgext/extlib/watchmanclient/__init__.py`. Then we move these lines
out of `extsetup()` in `fsmonitor` to create `extsetup()` in `hgevents`:

```
    extensions.wrapfunction(merge, 'update', wrapupdate)
    extensions.wrapfunction(filemerge, '_xmerge', _xmerge)
```

We also have to pull all of the transitive dependencies for this logic
into `hgevents`.

Finally, we also have to define a `reposetup()` function in `hgevents`
that does a subset of what `reposetup()` does in `fsmonitor`. Specifically,
it ensures that a Watchman client is created for a `repo`, as appropriate,
so that it can be used to dispatch state changes to Watchman in
`state_filemerge` and `state_update`.

Note that the utility functions `createclientforrepo()` and
`getclientforrepo()` have been added to ensure that only one
Watchman client is created (and shared) when both `fsmonitor`
and `hgevents` are enabled.

Today, when an Hg repo is created in Eden, we set `extensions.fsmonitor=!`
in the `.hg/hgrc`:

diffusion/FBS/browse/master/fbcode/eden/hooks/hg/post-clone.py$69

Therefore, to get existing repos (both Eden and non-Eden) to pick up
the `hgevents` extension automatically, we add it to the list of
`[extensions]` in `common.rc`:

diffusion/FBS/browse/master/fbcode/scm/hg/fb/staticfiles/etc/mercurial/repo-specific/common.rc$53-60

as this is where `fsmonitor` is configured. We do not enable it in
`scm/hg/fb/staticfiles/etc/mercurial/facebook.rc` because
there is no reason to enable `hgevents` on Hg servers. Therefore, we
also decline to add `hgevents` to the set of `DEFAULT_EXTENSIONS` in
`scm/hg/mercurial/extensions.py`.

Reviewed By: quark-zju

Differential Revision: D8003628

fbshipit-source-id: 4f23881f8c25f4638f5475c292537b0352ae8d15
2018-05-21 09:30:28 -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
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
Jun Wu
0252fce55c hint: add a command to silence hints
Summary:
This allows people to silence hints as they like. It's done by modifying
user hgrc.

Reviewed By: markbt

Differential Revision: D7392133

fbshipit-source-id: 1365294217db92dfb3a0c81332a9fefd164795d4
2018-04-13 21:51:49 -07:00
Phil Cohen
26476a8a58 add megarepo generation script
Summary: This script can be used to generate a large number of commits.

Reviewed By: DurhamG

Differential Revision: D7363243

fbshipit-source-id: 1a1e3ba7fca29dc695446eeffb715474ea2943ad
2018-04-13 21:51:37 -07:00
Phil Cohen
2e5e764e25 a basic perf suite implementation
Reviewed By: DurhamG

Differential Revision: D7341042

fbshipit-source-id: e87bd1bfe198fc4c5e1e2239b761c543d6acbf01
2018-04-13 21:51:36 -07:00