Commit Graph

157 Commits

Author SHA1 Message Date
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
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
330516f923 dagparser: add a binary dag serialization format
Summary:
The binary format allows us to checkin a large repo's dag and use it for
testing. The format is designed to be compat and easy for machine parsing.

`hg debugbindag` was added to generate such format from an existing repo,
and `hg debugpreviewbindag` was added to preview such binary format.

Size of serialized DAGs:

  repo     | method      | size (KB) | size (KB), zstd -19
  --------------------------------------------------------
  mozilla  | debugbindag |    101    |    66
           | debugdag    |    193    |    72
           | changelog.i | 213925    | 80118
  --------------------------------------------------------
  fbsource | debugbindag |   1400    |   700
           | debugdag    |    n/a *  |   n/a
  --------------------------------------------------------
  www      | debugbindag |    5.6    |   3.2
           | debugdag    |    n/a    |   n/a

Note:
`hg debugdag` and `hg debugbuilddag` exist, and they compress
relatively well. However, they have some (critical) issues:

- crashes on fbsource and www (*)
- complex syntax
- does not support selecting a subset of revs (ex. "::master")

Therefore I decided to invent something new.

Reviewed By: sfilipco

Differential Revision: D16294467

fbshipit-source-id: 754ab8942359ef73f5f53c427c7d38d94641fa75
2019-08-09 16:17:49 -07:00
Mark Thomas
80819cbf5b debugexistingcasecollisions: add command to check for existing case collisions
Summary:
Add a new command `hg debugexistingcasecollisions` which checks if any
directories contains two or more entries which may have the same filename on
case-insensitive filesystem.

Reviewed By: suitingtseng

Differential Revision: D16687557

fbshipit-source-id: cb032467e9b8a73fc1f6bf107387bc54c223c2ba
2019-08-08 03:01:44 -07:00
Zeyi (Rice) Fan
a62bf843cf Back out "RFC: hg: make zsh completion to return list of draft commits"
Summary:
Original commit changeset: 3493895a12ae

This is breaking `arc pull` in fbsource S183062

 #commitClose

Reviewed By: mitrandir77, singhsrb, xavierd

Differential Revision: D16441944

fbshipit-source-id: fd3f5c7027be1468bd8194e6b24dd136b9b767d2
2019-07-23 13:07:14 -07:00
Jared Bosco
089e77642a dispatch: replace final fancyopts call with native rust
Summary: Remove final fancyopts call to have all python parsing being done through native rust codepath, as well as clean-up some deprecated flags that would be special handling.

Reviewed By: quark-zju

Differential Revision: D16156284

fbshipit-source-id: ec5ccaeb982c78426e12ff1d7342b4ea6653e98e
2019-07-20 01:06:35 -07:00
Jared Bosco
93949f4629 dispatch: replace alias expansion and fancyopts parsing call with native rust
Summary:
Replace the second to last fancyopts call with pure rust code parsing and error handling.

Make slightly nicer help messages for ambiguous commands instead of just saying every possible command possible.

Reviewed By: quark-zju

Differential Revision: D16063049

fbshipit-source-id: bfd9e58649b1de2d3485069ce8d5646927bc77f4
2019-07-20 01:06:34 -07:00
Zeyi (Rice) Fan
e2655fac28 RFC: hg: make zsh completion to return list of draft commits
Summary:
By default the zsh completion will give me a list of bookmark names which personally I don't think it is useful at all.

I think making it giving me the list of draft commits is much better.

Reviewed By: quark-zju

Differential Revision: D16094724

fbshipit-source-id: 3493895a12ae02df011560b53dd5e55c8d183c79
2019-07-18 22:26:01 -07:00
Brian Strauch
93780344d2 debugedenimporthelper get file size
Summary: `hg debugedenimporthelper --get-file-size PATH:REV` will print the size of the given file

Reviewed By: chadaustin, xavierd

Differential Revision: D16009279

fbshipit-source-id: 6edb01dd154a467cdd26c0ced1d4ae82411088f1
2019-06-26 17:09:14 -07:00
Jun Wu
c754e0147b commands: provide in-core blackbox command
Summary:
The in-core blackbox command displays blackbox entries in the given time range.

The `blackbox` command provided by the blackbox extension was removed. They
can still be accessed via `.hg/blackbox.log`, though.

Tests are updated. Most `| grep` patterns were changed to use structured pattern
matching `--pattern` instead. Tests that are not interesting (ex. bundlebackup,
since we are moving away from bundle files slowly) are just removed.

Reviewed By: markbt

Differential Revision: D15640718

fbshipit-source-id: 7e5da60ca2b15ae9495d0242b340a066979d5a4f
2019-06-26 11:03:27 -07:00
Durham Goode
ad813edcbd treemanifest: enable treemanifest by default in tests
Summary:
Now that all our repos are treemanifest, let's enable the extension by
default in tests. Once we're certain no one needs it in production we'll also
make it the default in core Mercurial.

This diff includes a minor fix in treemanifest to be aware of always-enabled
extensions. It won't matter until we actually add treemanifest to the list of
default enabled extensions, but I caught this while testing things.

Reviewed By: ikostia

Differential Revision: D15030253

fbshipit-source-id: d8361f915928b6ad90665e6ed330c1df5c8d8d86
2019-05-28 03:17:02 -07:00
Jared Bosco
476e71b1cc commands: add root --shared to print the shared root of the current directory.
Summary: When the `--shared` flag is passed to `hg root` i.e. `hg root --shared` - display the shared root of the current directory.

Reviewed By: quark-zju

Differential Revision: D15363157

fbshipit-source-id: 6e6c13f27c624502a83edc1046ae3d4de227b6b8
2019-05-16 11:10:29 -07:00
Mark Thomas
d803ebb3c7 visibility: make enabling or disabling of tracking a command
Summary:
Rather than implicitly upgrading or downgrading a repo based on the
`visibility.tracking` config option, add a new `hg debugvisibility` command to
do this explicitly.

Reviewed By: DurhamG

Differential Revision: D14871231

fbshipit-source-id: 73f4648408b3eca9ac12bd77e54d2d37ee342069
2019-04-11 02:45:15 -07:00
Mark Thomas
2f0922256b mutation: add debugmutationfromobsolete to backfill mutation records
Summary:
Add `hg debugmutationfromobsolete` which backfills mutation information from
obsmarkers.

Reviewed By: DurhamG

Differential Revision: D14603199

fbshipit-source-id: 64458c52ba0e9f7bc9b38abeb94660cd1423fca7
2019-04-11 02:45:14 -07:00
Mark Thomas
fc9106e076 dirstate: add checkoutidentifier to identify and correlate checkouts
Summary:
When the user checks out a new commit (either by updating to it, by
creating a new commit, or by amending or rebasing the current commit), create a
unique identifier for that checkout.

Log this identifier at the start and end of command processing, and allow other
tools to also query and log the identifier.

This allows both Mercurial commands and other commands that log the identifier
to be correlated with a particular checkout.

Reviewed By: quark-zju

Differential Revision: D14648523

fbshipit-source-id: 2fad79c3010f5fad1a0e180e3d3d6d9c0a7f8e85
2019-04-04 11:29:49 -07:00
Jun Wu
9cba88f929 debugprocess: add a --sleep parameter
Summary: This makes it easier to debug real world progress related issues.

Differential Revision: D14691592

fbshipit-source-id: 2a653f657b6ba9f9369f1551845949ac7e4d0b9d
2019-03-29 20:32:22 -07:00
Jun Wu
9e0a7c41a4 subrepo: remove subrepo support
Summary:
Subrepo is another unloved features that we don't want to support.

Aggressively remove it everywhere, instead of just turning off configs.

I didn't spend much time to split this commit so it's smaller and more friendly
to review. But it seems tests are passing.

Reviewed By: sfilipco

Differential Revision: D14220099

fbshipit-source-id: adc512a047d99cd4bafd0362e3e9b24e71defe13
2019-03-11 10:43:55 -07:00
Mark Thomas
c202c9953b fs: add start, stop and restart subcommands
Summary:
Add `hg fs start`, `hg fs stop` and `hg fs restart` subcommands to start, stop
and restart the eden daemon.

Reviewed By: chadaustin

Differential Revision: D13888876

fbshipit-source-id: ab190675d2b2ad56f38d723d1859f516aa3165e8
2019-03-08 06:02:21 -08:00
Mark Thomas
9a19e06fee strip: move extension to core and rename to debugstrip
Summary:
Move the strip extension to core.  Rename the command to `hg debugstrip` as it
is not intended for use by users.  Users should use `hg hide` instead.

Reviewed By: quark-zju

Differential Revision: D14185822

fbshipit-source-id: ef096488cb94b72a7bb79f5bf153c064e0555b34
2019-02-25 03:55:08 -08:00
Jun Wu
f6c3848463 commands: remove more branch related CLI flags
Summary:
Remove:
- log --only-branch
- pull --branch
- push --branch
- record --close-branch
- incoming --branch
- outgoing --branch

Currently, `log --branch` is kept since some arcanist code still uses it.
We can probably remove it after the next arcanist release.

Differential Revision: D14116320

fbshipit-source-id: 50960ae8700200b322f615c4defd9c05353c2435
2019-02-20 20:05:29 -08:00
Jun Wu
dc38aa9d7a commands: remove "clone --branch" flag
Differential Revision: D14076299

fbshipit-source-id: dafbb7866e12e551b162a20ee048264866b67c96
2019-02-14 17:44:40 -08:00
Jun Wu
e257757924 commands: remove "bundle --branch" flag
Summary: Named branches are going away.

Differential Revision: D14076297

fbshipit-source-id: b68356f7075a6a8787cf0d2aa972bb27e1ef9bb1
2019-02-14 17:44:40 -08:00
Jun Wu
37af1cfda3 commands: remove "commit --close-branch" flag
Summary: Without named branch, it is not meaningful to close a branch.

Differential Revision: D14076295

fbshipit-source-id: 527ae457cb14f9415fa7269b7dc123252e7d6867
2019-02-14 17:44:40 -08:00
Jun Wu
9a87d9567c commands: remove "branches" command
Summary:
It seems nobody uses it from dev_commands logging. Search for "allowbranches"
in all internal repos suggests nobody turned it on. The tests were also
migrated to not use the command so let's just remove it.

Reviewed By: ikostia

Differential Revision: D14076298

fbshipit-source-id: a1cb03b2da289c01b15f0580ffe77531941be213
2019-02-14 17:44:40 -08:00
Jun Wu
61b3505e30 test-completion: do not use named branches
Differential Revision: D14059837

fbshipit-source-id: 214e585408c5d11693fd4940f7c8b527f8ed6d51
2019-02-12 21:45:13 -08:00
Jun Wu
64c43d2eab import: remove the --import-branch flag
Summary: Branches are going away.

Reviewed By: singhsrb

Differential Revision: D13978568

fbshipit-source-id: b9b4f3d2755757c0d3780bbb10c4579bf8d15fef
2019-02-12 19:54:31 -08:00
Saurabh Singh
1752853929 commit: remove option to specify secret phase
Summary:
We will probably not be supporting secret phase in the future anyway
so lets get rid of it.

Reviewed By: quark-zju

Differential Revision: D13928907

fbshipit-source-id: 7edcd84d2ee3c37124dcf9d3ba92c0610d074157
2019-02-01 15:36:44 -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
Wez Furlong
30058f0170 eden: port the Eden hg extension to core Mercurial
Summary:
This ports the logic from `eden/hg/eden/` to `scm/hg/mercurial/`.
Note this does not delete the logic from `eden/hg/eden` as part of this
change because we may continue to do Eden releases before we roll out a
version of Hg with this code. Only once Hg has been rolled out everywhere
[that is using Eden] can we consider removing
`/usr/local/fb-mercurial/eden/hgext3rd/eden`.

Reviewed By: quark-zju

Differential Revision: D10316761

fbshipit-source-id: cae1dfad831ad6505590628cf969897167e84b30
2019-01-16 14:37:48 -08:00
Mark Thomas
1fa24ad41e drawdag: add --print option
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
2018-12-13 10:47:28 -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
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
Mark Thomas
92674884fd progress: clear progress bar when locking to suspend
Summary:
The recent changes to the progress engine to work around locking bugs removed
the `clear` step of `progress.suspend`.  This leads to garbled output when
a progress bar is ongoing.  Restore it by adding a new lock method to the
engine.

Also add a `--with-output` option to `hg debugprogress` to test this.

Reviewed By: mitrandir77

Differential Revision: D12838415

fbshipit-source-id: 83ed516b528d0b0bbe37945141d50b50da00ac8e
2018-10-30 07:41: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
Phil Cohen
7bf2e9105a tweakdefaults: port allowbranches to core
Summary:
Note that this is more aggressive than the tweakdefaults version; it doesn't allow named branches to be created or listed at all with the config set. As we want to delete named branches entirely, this seems reasonable.

I ported the `--new` flag, but made it optional, to make it easier to support both the core and tweakdefaults callers.

Saurabh Singh and I chatted with the releng team (Craig).

**tldr:** we can remove named branches from the UI but should keep the innards for now

Today the releng team doesn't make any branches (#continuous), but in the near-term future, they might either:

- create remote bookmarks in hg (similar to fbsource)
- create branches in SVN (which are then synced as hg branches by hgsubversion)
  - We'll leave all the hgsubversion code to do this alone, just remove user-facing entry points
  - They'll also need to be able to query for a commit's branch (`hg log -T '{branch}'` will still work)
  - Once www is on hg, this possibility goes away and we can kill named branches for good

Reviewed By: ikostia

Differential Revision: D10401485

fbshipit-source-id: 6f2f3ae28af249bae1fdf782eb14fe7bfc472bb7
2018-10-16 09:25:04 -07:00
Phil Cohen
ce1ac26a21 perftweaks: move update --inactive to core
Summary:
This greatly simplifies the implementation, too.

*updatetotally() change:*

`hg up` now passes a brev of `None` if the `--inactive` flag was passed. This avoids activating the bookmark if one was passed. However, it still needs to deactivate the active bookmark, if there was one. After looking at the existing code, I think it was just wrong.

The rest of this is just cleanup.

Reviewed By: markbt

Differential Revision: D10376544

fbshipit-source-id: e5ad8aa01acab906db4d3fc09c6450e3c48b59fb
2018-10-15 16:55:34 -07:00
Phil Cohen
1f4999ec75 tweakdefaults: move book -D to core
Summary: Continue to move tweakdefaults functionality to core.

Reviewed By: ikostia

Differential Revision: D10376327

fbshipit-source-id: 79a9d08c74e6ec14c83ae641fa2c3a6619da2f76
2018-10-15 10:34:00 -07:00
Phil Cohen
1d8a354bfb tweakdefaults: move commit -M to core
Summary: Clean it up a bit too.

Reviewed By: ikostia

Differential Revision: D10359624

fbshipit-source-id: 287bd9013fdd6eb33304def7e4f6afdd9f618ef0
2018-10-15 10:34:00 -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
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
Aida Getoeva
346ddf5248 bisect: don't test empty commits in sparse profiles
Summary:
Currently `hg bisect` asks to run test on all commits it picked as a result of bisection, even if the changes between last checked nodes and chosen one relate to the files, which are not in the sparse profile.
And so it updates to the one of such commits, shows that "0 files were updated" and asks to run tests.

In this diff I check next potential node (result of bisecting) if there are changes between last good commit/last bad commit and the node. And go further to the next bisection iteration if the node can be skipped (nothing was changed since last good commit in sparse profile's files, so we can assume that the node is good as well).

If there are changes on both sides: between bad and the node, good and the node, I ask to run tests.

Reviewed By: markbt

Differential Revision: D9629683

fbshipit-source-id: f8c5d82f7b44ac14a9190c846ee65d635e447af1
2018-10-08 06:16:19 -07:00
Jun Wu
fb02b06bab fsmonitor: add 'debugrefreshwatchmanclock' command
Summary: See the command docstring for the use-case.

Reviewed By: phillco, strager, singhsrb

Differential Revision: D9836447

fbshipit-source-id: 22ff603ce3e0cd95ea4e400ed24a96c0ea636e6b
2018-09-14 18:25:52 -07:00
Ryan McElroy
5edc0d3281 resolve: use relative paths with option to override
Summary:
Previously, we would show root-relative paths. Now we show cwd-relative
paths unless the --root-relative flag is passed.

Reviewed By: phillco, farnz

Differential Revision: D9607987

fbshipit-source-id: 6c24c05317c165f88d2a83d6921d1520044a9b6e
2018-09-03 03:05:10 -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
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
Jun Wu
18317cc4b5 posix: improve error message about broken symlinks
Summary:
Improve `makedirs` error message so it would be more helpful when there are
broken symlinks.

Differential Revision: D8108794

fbshipit-source-id: 08013022642efde946ef9d5c6b06b4763f4ad68f
2018-05-23 06:12:45 -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
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