Commit Graph

44674 Commits

Author SHA1 Message Date
Aida Getoeva
dc09d0c75c move contentstore pending from localrepo to shallow
Summary: Not all of the repos are remotefilellog, so I moved some invocagions of the content store to shallowrepo and added requirements check where the transaction is processsed in localrepo

Reviewed By: quark-zju

Differential Revision: D12881916

fbshipit-source-id: 1119debd1e3d42cdf9513a6cae4bad4c000cc046
2018-11-05 07:53:24 -08:00
Mark Thomas
d15af3f239 cmdutil: remove amend message template
Summary:
Based on discussions about the best approach for solving the amend message
problem, back out the template previously added.  We will use a different
approach.

Reviewed By: mitrandir77, liubov-dmitrieva

Differential Revision: D12921753

fbshipit-source-id: ca760ffe14bfe473b7526a1b84a8cfc6b0257bf2
2018-11-05 06:28:03 -08:00
Mark Thomas
edd88465bd revsets: deprecate allpredecessors and allsuccessors
Summary:
The `predecessors` and `successors` cover all use cases now, so
`allpredecessors` and `allsuccessors` can be deprecated.

Also de-dup entries in the help text.  The addition of the old `precursors`
revset as an alias for `predecessors` makes `predecessors` appear write.

Reviewed By: phillco, mitrandir77

Differential Revision: D12884191

fbshipit-source-id: d87927f498df2296387b4542c4a9b704df334ce3
2018-11-05 02:30:57 -08:00
Jun Wu
f556edd8a4 fsmonitor: add migration to toggle tracking ignored files
Summary:
It turns out tracking ignored files does have an impact on status performance.
Filtering out the ignored directories is not that fast, and ignored files can
be scattered everywhere (like ".pyc", ".iml" files) that makes them harder to
be filtered out efficiently.

Add code paths to migrate between "ignored tracked" and "ignore untracked".
Store the metadata in treestate.

Reviewed By: phillco

Differential Revision: D12916021

fbshipit-source-id: e02d0c6f3b1a036f70703c11f35381c594e2f8e5
2018-11-03 11:12:56 -07:00
Jun Wu
9719d371db treestate: add a debug command to list treestate content
Summary: This is to replace `debugstate -v`. The latter does ont list untracked files.

Reviewed By: DurhamG

Differential Revision: D12906649

fbshipit-source-id: b84f41dfadff4932c0ddd48480a4aa03db88cab0
2018-11-03 11:12:56 -07:00
Jun Wu
3c85a515b1 match: fix visitdir fast path
Summary:
I was not aware that `**.c` is a valid glob pattern in hg when writing the
Python fast path.

`**` in glob patterns should disable fast paths because it can match paths with
`/` in them.

Reviewed By: DurhamG

Differential Revision: D12892725

fbshipit-source-id: b26a57dee57f074b3b8acb9dee95bc74103f4285
2018-11-01 17:07:27 -07:00
Adam Simpkins
640d8f6565 restore part of the mercurial.sparse module
Summary:
D12811551 removed the mercurial.sparse module.  However, actual removal of the
module needs to wait until the changes to the eden dirstate extension get
deployed.

This restores the module until all of the Eden changes have been deployed.
This module only contains a dummy `matcher()` function, which is the only part
of the module that Eden referenced.

This was causing exceptions for users with the a mercurial release from today,
but an Eden release from yesterday.  The exception would normally only occur
when using chg, since chg disables lazyimport.  Without chg, lazyimport would
allow the import to succeed even though the module does not exist.

Reviewed By: DurhamG

Differential Revision: D12877889

fbshipit-source-id: 2c6afd9bcb7031727b40fd32fbc1ba1356eb6e9b
2018-10-31 19:48:30 -07:00
Wez Furlong
caad413499 load blobs using hg's rust config and datapack code
Summary:
This diff implements getBlob on top of the mercurial rust
datapack code.  It adds a C++ binding on top of the rust code to
make it easier to use and hooks it up in the hg backing store.

Need to figure this out for our opensource and windows builds:

* Need to teach them how to build and link the rust code
* need to add a windows version of the methods that accept paths;
  this is just a matter of adding a WCHAR version of the functions.

Reviewed By: strager

Differential Revision: D10433450

fbshipit-source-id: 45ce34fb9c383ea6018a0ca858581e0fe11ef3b5
2018-10-31 17:58:17 -07:00
Phil Cohen
cbf94e4a87 hgsubversion: add SVN error code to "Outgoing changesets parent is not at subversion HEAD"
Summary: We'd like to identify which of the three underlying conditions cases this exception.

Reviewed By: quark-zju

Differential Revision: D12870572

fbshipit-source-id: 45724ad6bb3582c04a6ea3c0b7a748bf72219b93
2018-10-31 14:02:30 -07:00
Saurabh Singh
4a8d3f93e2 test-check-code: fix the test failure
Summary:
D12863838 broke the `test-check-code.t` by using `os.getcwd` instead
of `repo.getcwd`. This commit fixes the same.

Reviewed By: phillco

Differential Revision: D12870782

fbshipit-source-id: 5d9c0af5263fc38ca78526b84aa33a9dd8a6db3d
2018-10-31 13:04:02 -07:00
Saurabh Singh
a761dbd527 test-fb-hgext-tweakdefaults-grep: fix the test
Summary:
This test is broken after D12849852 because the grep outputs the files
in different order during multiple test runs. Let's fix it by sorting the
output from the command.

Reviewed By: phillco

Differential Revision: D12869810

fbshipit-source-id: 49073e83e926e94db5f0bd290d74845ebfde0bb6
2018-10-31 12:09:24 -07:00
Wez Furlong
6a1da8a4b7 hg: constrain biggrep to cwd or provided pattern dirs
Summary:
This helps to avoid over-fetching of results and addresses
some of the user feedback we've gotten.

This is an imperfect constraint because the mercurial matcher doesn't
appear to have a way to return an equivalent regex to us today.

Reviewed By: quark-zju

Differential Revision: D12863838

fbshipit-source-id: ef963455018f9902453e405a1a998d19f7bcde9d
2018-10-31 11:59:25 -07:00
Wez Furlong
e24e242728 hg: make hg portion of biggrep grep output have deterministic ordering
Summary: This is nicer for the user and makes the test not be flakey.

Reviewed By: quark-zju

Differential Revision: D12860852

fbshipit-source-id: 6ccb0ca679dc25a80730e83a26a39dd3becb5c8f
2018-10-31 11:59:25 -07:00
Mateusz Kwapich
c697c8b81a commands: avoid implicit bool cast in "update" parameter validation
Summary: This fixes the "hg prev" targetting the first commit in the repo. The problem was the rev `0` which casted to false in all the checks.

Reviewed By: phillco

Differential Revision: D12840237

fbshipit-source-id: 594a2725fa125ee713f347379c875ec54b80a53d
2018-10-31 10:27:53 -07:00
Mateusz Kwapich
292728707f tests: set disallowemptyupdate in "hg prev" test
Summary:
This brings the config closer to what we use and uncovers some problems with
disallowemptyupdate itself.

Reviewed By: phillco

Differential Revision: D12840239

fbshipit-source-id: 77740b79114c7d901b0181e0e425aea4e9c7c570
2018-10-31 10:27:53 -07:00
Jun Wu
72e559cb76 dirstate: restore "sparsematchfn" argument
Summary:
Before D10316761, we cannot upgrade both Eden and hg atomically. Therefore
restore the API change so newer hg works with older eden, and newer eden works
with older hg.

Reviewed By: wez

Differential Revision: D12855935

fbshipit-source-id: 448a67ee748e39d33a64f62c702e0c45aea2ecae
2018-10-31 02:50:28 -07:00
Jun Wu
5f29ac4c8e hgsql: set client-side timeout
Summary:
Previously there are only server-side timeouts. When the server goes wrong, the
client can hang forever. This diff sets the client-side timeout at the Python
socket object.

Reviewed By: phillco

Differential Revision: D12854064

fbshipit-source-id: 71307b305f8e8e936d7d395c76b5e8ef92c6a089
2018-10-30 19:28:50 -07:00
Jun Wu
78584bd37d sparse: drop mercurial.sparse
Summary: We're using hgext.sparse.

Reviewed By: phillco

Differential Revision: D12811551

fbshipit-source-id: 780ec51350a62f4cfd3a31a0d4a1c61f6f72e38a
2018-10-30 19:22:43 -07:00
Wez Furlong
67f16a7484 hg: fixup biggrep implementation
Summary:
a couple of problems:

* The recent move from tweakdefaults also broke `bin` symbol, rendering
  this feature completely broken for non svn backed repos
* The `bgr` tool knows about fewer corpuses than we do, so go directly
  to the underlying C++ client binary
* Add configuration options for that binary

Reviewed By: phillco, farnz

Differential Revision: D12849852

fbshipit-source-id: 154d4822d097602505349d3f67b45f19c17a7bf8
2018-10-30 19:13:56 -07:00
Jun Wu
467daedf2e osutil: get argv[0] on Linux more reliably
Summary:
`environ` might be changed by `setenv` and would be wrong to locate `argv[0]`.
Linux >= 3.5 provides the `argv[0]` pointer in `/proc/self/stat`. Let's use
that instead.

Reviewed By: ikostia

Differential Revision: D12834877

fbshipit-source-id: d76804e8f4113cdf3adb0cceed817f7e93d1b6de
2018-10-30 14:11:16 -07: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
Aida Getoeva
c6fc789a82 uncommit: remove unused function
Summary: This function is duplicated to `hgext/amend/unamend.py` and is used there but not in the uncommit

Reviewed By: quark-zju

Differential Revision: D10447652

fbshipit-source-id: e6d001ae5f652214c3b1bf3b9f343e7e64874721
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
Mark Thomas
2deae85b42 encoding: use Cow for returned types that may be references
Summary:
I broke the Windows build because the return type of `path_to_local_bytes` is
different on Windows and Unix, and so must be dealt with differently.  They are
different because on Windows we often need to make a copy, whereas on Unix we
can just use references to the byte data.  Cows to the rescue: unify them
behind a Cow type.

While we're here, tidy up and unify the docs.

Reviewed By: quark-zju, ikostia

Differential Revision: D12833091

fbshipit-source-id: e02e308e6f81dd3d8ddf33e76c3073f51d3eccc1
2018-10-30 04:07:02 -07:00
Phil Cohen
de12a9e09c merge: add ancestors as transient propeties to mergestate
Summary:
We need a way for mergedrivers to be able to read ancestor data (to properly detect a backwards merge, such as during `hg backout`).

Passing it directly is tricky since passing a new kwarg to functions without `**args` raises a `TypeError`. We'd have to update the hook framework to catch this `TypeError` and re-run the hook without the kwarg, which would be hard to do cleanly.

Rather, we can just add this as a transient property on `mergestate`, which seems like an appropriate place for it. Any callers trying to read this when it hasn't been set will get an exception. But there aren't any other users of this field since it hasn't existed before.

Reviewed By: quark-zju

Differential Revision: D12827614

fbshipit-source-id: 48dc84f1e60232625c8f2a73e81b5bc223c22bb3
2018-10-29 21:04:02 -07:00
Phil Cohen
7e6feb7d52 merge: pass ancestors to applyupdates
Summary: Ancestors is needed by mergedriver scripts to detect a backout. The first step is to pass them to applyupdates, so it can pass them to mergedriver.

Reviewed By: quark-zju

Differential Revision: D12827615

fbshipit-source-id: 0d92423eeb22d1b42828d61472c87af34e11be4d
2018-10-29 21:04:02 -07:00
Jun Wu
61790b12a9 indexedlog: make it Send
Summary: It needs to be Send to be used in cpython.

Reviewed By: ikostia

Differential Revision: D10250289

fbshipit-source-id: ea57e356a0752764e50db9b6872b5cc4a456303f
2018-10-29 21:02:41 -07:00
Jun Wu
840d242822 indexedlog: revise docs for the index module
Summary:
Make it more detailed for public APIs. Hide too detailed information (file
format).

Reviewed By: DurhamG

Differential Revision: D10250140

fbshipit-source-id: d9d9af9d67984b80f07db13e69bbffdf77e6a30e
2018-10-29 21:02:41 -07:00
Jun Wu
23e41f98a4 indexedlog: revise checksum_table documentation
Summary: Revise ChecksumTable documentation so it's more detailed and accurate.

Reviewed By: DurhamG

Differential Revision: D10250142

fbshipit-source-id: bff89877fb9a65a305e8d8636a200d50c7e2d548
2018-10-29 21:02:41 -07:00
Jun Wu
ecc14e0860 indexedlog: update public documentation for the log module
Summary:
The log module is the "entry point" of other features. Update it so things are
more detailed. I tried to make it more friendly for people without knowledge
about the implementation details.

This could probably be further improved by adding some examples. For now, I'm
focusing on the plain English parts.

To reviewers: Let me know how you feel reading it assuming no prior knowledge
with the implementation. Ways to make sentences shorter, natural to native
speakers without losing important information are also very welcome.

Reviewed By: DurhamG

Differential Revision: D10250141

fbshipit-source-id: 35258c7197c1ce0a1d3d0554fab2f2d2866e123c
2018-10-29 21:02:41 -07:00
Jun Wu
67ff256aa2 indexedlog: revise crate-level document and visibility of modules
Summary:
Make important modules public. Make internal utility (base16) private.  Add
some text to the crate-level document. It just refers to important structures.
Will revise document of those structures.

Reviewed By: DurhamG, kulshrax

Differential Revision: D10250143

fbshipit-source-id: c79859ee7d3d9cc4ee9a093ef5d12ec6599f2a42
2018-10-29 21:02:41 -07:00
Jun Wu
13c490cf4e fsmonitor: use short list when logging notefiles
Summary:
The "fsmonitor returned" file list was made short by D9997658. Do the same
thing for notefiles.

Reviewed By: phillco

Differential Revision: D10865333

fbshipit-source-id: ff31cde04210363e6af04e5578543f1b16310b11
2018-10-29 20:26:34 -07:00
Jun Wu
df9235cb28 dirstate: remove NEED_CHECK state automatically
Summary:
If a "normal" file is clean, drop the "NEED_CHECK" bit.

Not very sure how NEED_CHECK can be set for the entire working copy while
`_poststatusfixup` does get executed. But it happened. Fix it by explicitly
removing NEED_CHECK from clean files.

Reviewed By: markbt

Differential Revision: D10865256

fbshipit-source-id: aafd3195a8acf39178bbc2d5f919345a7320f2b7
2018-10-29 20:06:09 -07:00
Jun Wu
5634fd774d tests: add a test showing NEED_CHECK bit was not removed after accidentally being set
Summary:
If the NEED_CHECK bit was set accidentally (reason yet to know), there is no
way to recover automatically by running "hg status" without touching the files.
Add a test to show that.

Reviewed By: markbt

Differential Revision: D10865255

fbshipit-source-id: 60b6914a9cd778e60815f83ba98c29c9c5f88b34
2018-10-29 20:06:09 -07:00
Wez Furlong
2332c93164 fix usage of re.sub in stripansiescapes
Summary:
This got broken by a recent refactoring because `re` resolves
to `re2` rather than the python `re` flavor.

Reviewed By: phillco

Differential Revision: D12834778

fbshipit-source-id: d67fe751593c423ebf12229cc7719585b46b862a
2018-10-29 18:45:00 -07:00
Saurabh Singh
66b2153f13 test-fb-hgext-remotefilelog-repack-corrupt: fix the test
Summary:
This test still fails on OSX because the messages with prefix
`remote:` are missing. It doesn't seem like we need those messages for the
actual testing. Therefore, adding the `-q` option to the affected commands to
remove the `remote:` messages for all the platforms.

Reviewed By: quark-zju

Differential Revision: D12829679

fbshipit-source-id: e53dca96b5511049ef240ed671705987cdd9eab1
2018-10-29 15:47:14 -07:00
Mark Thomas
a7daef6a18 pyrevisionstore: borrow path when creating the bytes path
Summary:
On Windows the return type of `path_to_local_bytes` is different and requires a
borrow to pass to `PyBytes::new`.

Reviewed By: ikostia

Differential Revision: D12820046

fbshipit-source-id: 166c502598a85c4409f09f44abdf0e45ab45ef67
2018-10-29 05:12:49 -07:00
Mark Thomas
861e5ca8d5 commitcloud: pull unknown public bookmark hashes as well as draft heads
Summary:
When syncing a commit cloud repo, if the user has put a bookmark on a public
commit that we don't have locally, also pull that public commit into the repo
so that we can put the bookmark on it.

Reviewed By: quark-zju

Differential Revision: D12815471

fbshipit-source-id: 080038e4e239170cad994ff4ab9326d787d1c0fa
2018-10-29 04:19:07 -07:00
Mark Thomas
228cf6b027 commitcloud: add a test demonstrating public bookmark sync problem
Summary:
If you put a bookmarks on a public commit that one of your other synced
repos doesn't have, it will delete the bookmark when it syncs.  This deletion
is then propagated to all your other synced repos.  This appears to the user
like the bookmark just vanishing.

Reviewed By: quark-zju

Differential Revision: D12815470

fbshipit-source-id: 802f85433b9ad15db3fb9e82e1222224eff4ca88
2018-10-29 04:19:07 -07:00
Mark Thomas
93a98afbe4 vlqencoding: don't require Sized for Read or Write traits
Summary:
The `VLQEncode` and `VLQDecode` traits erroneously expected the (automatic)
`Sized` marker trait for `Read` and `Write`.  This meant they couldn't be used
for trait object `Read`s or `Write`s without jumping through hoops or extra
`mut` keywords.

By not requiring `Sized` we can remove those workarounds.

Reviewed By: quark-zju

Differential Revision: D12816459

fbshipit-source-id: 16353e8fefff5738bd24a9f41c9d7d250aea56fd
2018-10-29 04:10:46 -07:00
Jun Wu
6074e110cf threading: use safer Rust in threading.Condition
Summary:
Suggested by jsgf, use Condvar to emulate the "blocking" behavior so we do not
need to hold MutexGuard for long. This removes most unsafe Rust and also avoids
leaking Mutex even if the Python world forgets to call `release`.

The only remaining "unsafe" is to bypass a rust-cpython API restriction that is
over strict in this use-case.

Reviewed By: markbt

Differential Revision: D11729852

fbshipit-source-id: 9c914f0769e6903e390982c7aa423bb7e3ae2742
2018-10-27 15:16:25 -07:00
Jun Wu
d10ca7e8d5 rage: include debuginstall
Summary: It includes encoding and python path information that could be interesting sometimes.

Reviewed By: markbt

Differential Revision: D12813630

fbshipit-source-id: 679ae45a2df5d710651009cd71c85e31bbe578c2
2018-10-27 15:14:15 -07:00
Jun Wu
d8bde83566 tests: fix test-extensions-default.t for buck
Summary: On buck build, extension discovery does not work.

Reviewed By: markbt

Differential Revision: D10862029

fbshipit-source-id: b9d5c4edde4d2f8518df47c22099fde29e2a09cc
2018-10-27 15:14:14 -07:00
Jun Wu
6fa42dbb08 serve: change process title to be more meaningful
Summary:
All `hg serve` processes on the server have `hg serve --stdio`, which is not
that useful about what it's doing.

Change it to include wireproto command, ex.
`hg serve (fbsource getfiles client-hostname)`

Reviewed By: markbt

Differential Revision: D10476292

fbshipit-source-id: ce215800d9422995905357d4d5bd79ca5f1d5337
2018-10-27 15:12:03 -07:00
Mark Thomas
7009f7f2b0 cmdutil: add message template for amend -m
Summary:
Introduce a new template config option `amend.messagetemplate`, which, when
set, is applied to the commit message when amend is run with the `-m` option.

The template is provided with the old message, as `oldmessage` as well as the
message provided on the amend command line, as `message`. This can be
configured so that the amend message only overrides part of the old message.

Reviewed By: quark-zju

Differential Revision: D10857454

fbshipit-source-id: 6eb6f33624fae32fc7a344769e39f5c7a78a3604
2018-10-27 11:32:05 -07:00
Mark Thomas
1ac1128def truncate: add truncate implementation
Summary:
The `truncate` tool isn't availble on OSX, so include our own in the test
suite.

Reviewed By: DurhamG

Differential Revision: D12815613

fbshipit-source-id: 510b2936f07c5193671baaeaec6620872c3ec982
2018-10-27 10:59:21 -07:00
Mark Thomas
e130401a2a debugcolor: don't crash if there are no styles to list
Summary:
`hg debugcolor --style --color=no` crashes as the list of styles is empty.  Just
print nothing in that case.

Reviewed By: quark-zju

Differential Revision: D11910780

fbshipit-source-id: bfc29e7e5190b5fede7950874ac7a88be3435b12
2018-10-27 10:32:32 -07:00
Mark Thomas
ac5fca16ae color: support truecolor terminals
Summary:
Add support for colors specified as hex strings (#rgb or #rrggbb, like in CSS),
rendering them if the terminal supports truecolor mode.

True color support can be detected by the `COLORTERM` environment variable
being set to `truecolor` or `24bit` (currently VTE, Konsole and iTerm2 do this).
It can also be enabled by setting `HGCOLORS=16777216`.

Reviewed By: quark-zju

Differential Revision: D11353291

fbshipit-source-id: 9b30df9c7de3bbaa686bc610addfa529775b73cc
2018-10-27 10:32:32 -07:00
Mark Thomas
958b361db9 blame: make blame show how old a line is
Summary:
Add label annotations to the blame template indicating how old the line is
(bucketed into various ranges).  Define colors for these labels so that recent
lines are white, and older lines fade through yellow to black.

Reviewed By: phillco

Differential Revision: D10869068

fbshipit-source-id: 2b99c84c115c3f9e408468f52b5754ff820fcec5
2018-10-27 10:32:32 -07:00
Mark Thomas
c53f941c82 tweakdefaults: make blame phabdiff numbers longer
Summary:
Make the space for Phabricator diff numbers larger, and right-justify the
output.  This makes it look better.

Reviewed By: phillco

Differential Revision: D10868646

fbshipit-source-id: 7cf50677560a15ef77cc3681063e902d8d9e7a18
2018-10-27 10:32:32 -07:00