Commit Graph

44560 Commits

Author SHA1 Message Date
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
Jun Wu
950ec8bc4b directaccess: optimize performance
Summary:
The directaccess extension could be smarter to avoid walking through public
commits when marking ancestors as visible.

Reported by simpkins.

Reviewed By: DurhamG

Differential Revision: D12814546

fbshipit-source-id: 712db5b77afbb5108b696e1721d15c26c3a51176
2018-10-27 09:46:37 -07:00
Mark Thomas
8c076978ff revisionstore: handle truncated packfiles better
Summary:
If the rust pack stores are used to access truncated pack files, currently they
panic.  Instead, return a proper error showing what's wrong.

Reviewed By: quark-zju

Differential Revision: D10868299

fbshipit-source-id: 57fe5ec1ee4ee2a7bb10d2d5c5ca7082dc34125d
2018-10-27 08:58:24 -07:00
Mark Thomas
953794365a pyrevisionstore: report pack locations when repacking
Summary:
D10516852 added the name of the pack file that was being scanned to the repack
progress bar.  Implement this in the Rust repacking code.

Reviewed By: quark-zju

Differential Revision: D10557731

fbshipit-source-id: de2f0cc4a40005422235c3bd19d6a78a38ea44f3
2018-10-27 08:58:24 -07:00
Jun Wu
a8fb0739b5 configparser: port mercurial's configlist to Rust
Summary:
The `configlist` function converts a config value to a list of strings.

I have thought about using pest to parse it. However, pest might return errors
(ex. `a,",b` does not parse due to missing end quote), while the original logic
can happily parse everything (`a,",b` gets parsed into `['a', '"', 'b']`).

The code might be simplified to make it more obvious that `unwrap()` cannot
panic. But it handles so many corner cases that I'd like to port as-is for
correctness.

Reviewed By: DurhamG

Differential Revision: D9323743

fbshipit-source-id: 5f8be562b7437260b7551d87d751424558d76e8f
2018-10-26 21:06:18 -07:00
Jun Wu
8c4a52d608 config: enable obsstore by default
Summary:
This makes tests closer to production setup and removes a bunch of "saved
backup bundle to ..." messages.

With D9236657, this should not hurt server-side performance.

Unfortunately a lot tests cannot be migrated easily, mostly because revision
numbers are used. They are left with a TODO.

Reviewed By: DurhamG

Differential Revision: D9237694

fbshipit-source-id: c993fce18f07aba09f6d70964e248af8d501575a
2018-10-26 18:54:40 -07:00
Jun Wu
061ca2cef4 unittestify: treat skip as success by default
Summary:
The test infra does not handle "skip" state gracefully and treats skips as
"failure". That generated scary reports like hundreds of tests are failing.
Stop reporting skips to fix it.

An enivronment variable is added to get the old behavior.

Reviewed By: singhsrb

Differential Revision: D12808196

fbshipit-source-id: 2356a1d6fdfe1d2991d28368787c7d2b7b525b6b
2018-10-26 15:47:07 -07:00
Jun Wu
3adc813687 codemod: add copyright headers
Summary: This is just the result of running `./contrib/fix-code.py $(hg files .)`

Reviewed By: ikostia

Differential Revision: D10213075

fbshipit-source-id: 88577c9b9588a5b44fcf1fe6f0082815dfeb363a
2018-10-26 15:09:12 -07:00
Wez Furlong
adc3c8b775 hg: remove .watchmanconfig from !repo root
Summary:
This was added to rHG but is potentially harmful in fbsource,
leading to overlapping watches (which are exponentially expensive rather
than linear) and this empty config may cause certain features and tunings
to be disabled if you happen to watch this subdir first.
Finally, in Eden, watchman will refuse to watch this location anyway
because it is not at the repo root.

Reviewed By: singhsrb

Differential Revision: D10857366

fbshipit-source-id: 0d63ac60c6c6ca655b0d2df43d566d497520f1c2
2018-10-26 13:26:44 -07:00
Wez Furlong
0146a29a4a progress: avoid unintialized global
Summary:
When the progress extension is not configured, this global
is never assigned.  This caused the eden integration tests to fail.

Reviewed By: phillco, quark-zju

Differential Revision: D12239141

fbshipit-source-id: 84b3bcafa6cf1e2becfcc05a212a880590c598db
2018-10-26 13:06:36 -07:00
Jun Wu
644ec66f6f rebase: add a test showing that copy obsmarkers work
Summary:
With the obsmarker copying feature, rebasing revs containing obsolete
relationship would result in the markers being copied correctly.

Reviewed By: phillco

Differential Revision: D7121486

fbshipit-source-id: a666ad65c2eccbfd26db813d4f792c66489ead8c
2018-10-26 13:00:59 -07:00
Durham Goode
f43c1c0638 hggit: don't scan the entire changelog during hg gexport
Summary:
When exporting hg commits to git, previously it would compute a set of
all nodes in the changelog, and all nodes in the git map, and figure out which
changelog nodes were missing. In a large repository, this is very expensive.

Instead, let's start at the heads and walk backwards.  Usually we're doing an
incremental export, so this very quickly traverse all the missing nodes and
finishes. This saves 10+ seconds off gexport.

Reviewed By: markbt

Differential Revision: D10861851

fbshipit-source-id: c7c7f45d6e60e3ee5ffa27e2d3c5fb705b41b1c1
2018-10-26 11:29:46 -07:00
Durham Goode
bb2e5ba7b2 hggit: don't check for object existence when importing git objects
Summary:
When exporting a hg commit into a git commit we'd check if individual
objects existed before we actually wrote them into git. In the majority case the
object does not already exist, and for very large repositories with lots of pack
files checking this is quite expensive.

Instead, let's just write the blob into the store.  In the unlikely case that
the blob already existed, it will get de-duped during repack. This saves us
50% of time spent in some cases.

Reviewed By: markbt

Differential Revision: D10861852

fbshipit-source-id: 26718bd2e2cf40099ccf5d86e68607cd3dc9dc5a
2018-10-26 11:29:46 -07:00
Durham Goode
7afaf69313 hggit: don't load entire git tree at the beginning
Summary:
When doing a git import, it would load the entire git tree for the
commit into memory at once. In a large repository this can be very expensive,
especially if there are a lot of pack files.

Let's change the structure to dynamically load trees as they're requested. This
makes it O(changes imported) instead of O(trees in master).

Reviewed By: markbt

Differential Revision: D10858958

fbshipit-source-id: 1550acbd409f8b507339a2f123422ac0fbd79215
2018-10-26 11:29:46 -07:00
Mark Thomas
01a7b3fdf7 identity: add templating of program name
Summary:
Add templating for the program name.  This maps:

* `prog@` -> `hg`
* `Product@` -> `Mercurial`
* `LongProduct@` -> `Mercurial Distributed SCM`

It also adds `:prog:command` as an alias for `:hg:command` in the help text definition.

Reviewed By: mitrandir77

Differential Revision: D10461874

fbshipit-source-id: 7006fc9c41ede6b16d9a1a56ed1c99979a5f2f7e
2018-10-26 04:19:01 -07:00