Commit Graph

547 Commits

Author SHA1 Message Date
Xavier Deguillard
a7e5557baa test: properly set ui.ssh
Summary:
On Windows, we have to do a bit of dance for Windows to stop complaining
about ui.ssh.

Reviewed By: DurhamG

Differential Revision: D20817712

fbshipit-source-id: acbda636fe114fd616dee89b2c4d1c9ff26470bf
2020-04-02 11:26:54 -07:00
Jun Wu
6e7cffbda4 chg: disable chg when file paths like /proc/self/... are used
Summary: This will allow bash users to use things like `hg commit -l <(echo foo)`.

Reviewed By: krallin

Differential Revision: D20810653

fbshipit-source-id: 42e420e608d41704387a9011cf14a28f92192e5d
2020-04-02 10:09:50 -07:00
Thomas Orozco
d225cb2910 remotenames: don't throw on hidden nodes
Summary:
This updates fastheaddiscovery to use an unfiltered repository when it attempts
to check if the nodes the server sent are present locally.

Reviewed By: quark-zju

Differential Revision: D20792006

fbshipit-source-id: 14ba9605d79ba54f3f4143d6d8ec65357e3d8c07
2020-04-02 08:53:48 -07:00
Jun Wu
2aec2dbcb6 commitcloud: migrate to tech-debt-free repo.pull for pulling
Summary:
The new API does nothing that cloud sync does not want: bookmarks, obsmarkers,
prefetch, etc. Wrappers to disable features are removed.

This solves a "lagged master" issue where selectivepull adds `-B master` to
pull extra commits but cloud sync cannot hide them without narrow-heads. Now
cloud sync just does not pull the extra commits.

Reviewed By: sfilipco

Differential Revision: D20808884

fbshipit-source-id: 0e60d96f6bbb9d4ce02c04e8851fc6bda442c764
2020-04-01 19:40:57 -07:00
Jun Wu
22295e45bb tests: add another test demostrating the lagged master issue
Summary:
With selective pull (now in core) enabled and narrow-heads disabled,
there is another way to cause lagged master.

Reviewed By: sfilipco

Differential Revision: D20808885

fbshipit-source-id: ebaed0e203f2f9f981bf141ce6c82af33710ba53
2020-04-01 19:40:57 -07:00
Jun Wu
07fc8adad9 commitcloud: sort hashes being pulled
Summary: This makes the upcoming change easier to verify.

Reviewed By: sfilipco

Differential Revision: D20808883

fbshipit-source-id: 5563601125ef5c961785f7275fd82fc3fefe53ff
2020-04-01 19:40:56 -07:00
Jun Wu
5730719bd9 revset: automatically pull remote bookmarks prefixed remote/ or default/
Summary:
This makes it possible to do things like `hg up remote/foo` without having to
`hg pull -B foo` first.

Reviewed By: DurhamG

Differential Revision: D20531122

fbshipit-source-id: e95b2f0a49e4b815c136450d1f352a7973cb72ed
2020-04-01 19:40:55 -07:00
Jun Wu
707b7dea42 localrepo: add a tech-debt-free repo.pull API
Summary:
The new `repo.pull` API aims to be tech-debt free. It does:
- Pull nothing instead of everything if nothing is specified.
- Update remote names that are explicitly specified, not everything the server
  has.
- Do not update local bookmarks.

The direct motivation is to implement autopull `remote/foo` behavior while not relying on the pull command.

Reviewed By: DurhamG

Differential Revision: D20531119

fbshipit-source-id: 80c3bdd5556126d81af099a74f1345ecc94904b7
2020-04-01 19:40:55 -07:00
Stefan Filip
325fed7e50 tests: add histedit test with simple reorder
Summary: Debugging an issue where watchman returns a state error during histedit.

Reviewed By: quark-zju

Differential Revision: D20785858

fbshipit-source-id: 5baf762d1a5588573df9d01c63a24e751e04a811
2020-04-01 14:02:34 -07:00
Mark Thomas
04a400b5eb commitcloud: handle missing remotebookmarks in commitcloud lastsyncstate
Summary:
During the roll-out of commitcloud remotebookmarks sync, some clients may have it enabled, and others may have it disabled.

This can result in some clients having an empty set of remotebookmarks in their sync state for a version which actually
does have remotenames in the cloud workspace.

This becomes a problem when those clients start syncing remotebookmarks, for two reasons:

* They are unable to correctly apply the new cloud remotebookmarks, as they do not have the previous state with which to break ties, and the tie-breaking code doesn't work correctly if the old cloud remotebookmark is `None`.

* When they try to send the remotebookmarks delta to the server, they don't have the old state, and so compute the delta incorrectly.  This results in `Duplicate entry for key` errors in the service.

We can handle this as follows:

* When syncing remote bookmarks from the cloud, ensure we correctly apply the remote bookmark updates, even if the old cloud remotebookmark is `None`.

* If the local repo is up-to-date with respect to the workspace, but the last sync state had no remote bookmarks recorded, sync the remote bookmarks again.  This may involve pulling some more commits if the cloud remote bookmarks are ahead of the local remote bookmarks. If there truly were no remote bookmarks then this will be a no-op.

Reviewed By: quark-zju

Differential Revision: D20792360

fbshipit-source-id: cd1ed371d8d5b1be2767c8a8d4836ea870a4467b
2020-04-01 13:26:27 -07:00
Mark Thomas
245678565c commitcloud: add test demonstrating remotebookmarkssync problems
Reviewed By: krallin

Differential Revision: D20796685

fbshipit-source-id: 0bb0efac14d56b715fb81824956752bef874d2b5
2020-04-01 13:26:26 -07:00
Mark Thomas
0d4db87a26 cmdutil: add a hint for the new graph renderer
Summary: Add a hint that points to customization and troubleshooting guides for the new graph renderer.

Reviewed By: xavierd

Differential Revision: D20763338

fbshipit-source-id: ee6d2464ae5955f0f0bf52d1994adfa2b74b3367
2020-03-31 09:57:44 -07:00
Xavier Deguillard
0f3c04abfe remotefilelog: add a remotefilelog LFS test
Summary:
This demonstrates that both the legacy extension and the new implementation can
co-exist, and we can enable/disable the new extension.

Reviewed By: DurhamG

Differential Revision: D20677443

fbshipit-source-id: 10896023f536984645371d557c3ad20daa8526dd
2020-03-30 14:45:47 -07:00
Xavier Deguillard
5ea2e581c6 revisionstore: store LFS blobs in an IndexedLog
Summary:
In the legacy lfs extension, LFS blobs were stored as loosefiles on disk, and
as we saw with loosefiles for remotefilelog, they can incur a significant
overhead to maintain. Due to LFS blobs being large by definition, the number of
loose LFS blobs should be reasonable for repack to walk over all of them to
chose which one to throw away.

A different approach would be to simply store the blobs in an on-disk format
that allows automatic size management, and simple indexing. That format is an
IndexedLog. This of course doesn't come without drawbacks, the main one being
that the IndexedLog API mandate that the full blob is present on insertion,
preventing streaming writes to it, the solution is to simply chunk the blobs
before writing them to it. While proper streaming is not done just yet, the
storage format no longer prevent it from being implemented.

Reviewed By: DurhamG

Differential Revision: D20633783

fbshipit-source-id: 37a88331e747cf22511aa348da2d30edfa481a60
2020-03-30 14:45:46 -07:00
Jun Wu
ebdc3836b9 narrowheads: fix repo requirements at "hg init" time
Summary:
Some tests fail because `hg init` sets the wrong initial store requirements and
then perform a narrow-head migration down, which prints extra messages. Fix them
by making sure the initial store requirements are the same as what the migration
code path expects.

Reviewed By: simpkins

Differential Revision: D20698637

fbshipit-source-id: 1422a4ea78222617d0e3f9631ad883d5a3fe6bb7
2020-03-27 12:55:06 -07:00
Xavier Deguillard
d404b0a228 revisionstore: revamp repack to ease file format migration
Summary:
One of the main drawback of the current version of repack is that it writes
back the data to a packfile, making it hard to change file format. Currently, 2
file format changes are ongoing: moving away from packfiles entirely, and
moving from having LFS pointers stored in the packfiles, to a separate storage.

While an ad-hoc solution could be designed for this purpose, repack can
fullfill this goal easily by simply writing to the ContentStore, the
configuration of the ContentStore will then decide where this data will
be written into.

The main drawback of this code is the unfortunate added duplication of code.
I'm sure there is a way to avoid it by having new traits, I decided against it
for now from a code readability point of view.

Reviewed By: DurhamG

Differential Revision: D20567118

fbshipit-source-id: d67282dae31db93739e50f8cc64f9ecce92d2d30
2020-03-26 19:02:48 -07:00
Xavier Deguillard
04a09ec571 remotefilelog: adapt tests for remotefilelog to support LFS
Summary:
The hgcache will soon contain an LFS subdirectory, this is uninteresting for
most of the tests, let's change them a bit so they only look at the packs
subdirectory.

With this, enabling remotefilelog.useruststore only has 2 failures. One due a
difference in handling corrupt data, with the ruststore being more explicit
that some data is missing instead of a generic "stream ended unexpectedly". And
the other due to some ordering difference when dealing with LFS data. The
latter will go away with the new LFS implementation.

Reviewed By: DurhamG

Differential Revision: D20543146

fbshipit-source-id: 09c76cacfb4687fd699b82cdf5057665ac6bd521
2020-03-26 19:02:47 -07:00
Jun Wu
8bd55436a4 pull: automatically pull selective bookmarks unless it's a no-argument pull
Summary:
This enforces certain selective pull logic in core. Namely, rewrite `pull -r X`
to `pull -r X -B master`.

Unlike selectivepull in remotenames, `pull` (pulls everything) won't be
rewritten to `pull -B master` (which pulls less commits and names).

Therefore this change always adds more commits to pull, and therefore should not
break existing users. Eventually we want the "not pulling everything" behavior,
but right now this just fixes `pull -r X` to also update important remote names.

Reviewed By: markbt

Differential Revision: D20531121

fbshipit-source-id: af457b5ddb1265b61956eb2ee6afb7b7208293e0
2020-03-26 10:54:09 -07:00
Jun Wu
baae0138ff remotenames: move revset and templatekw to core
Summary:
This makes it possible to use template like `{remotenames}` or revset like
`remotenames()` without enabling the remotename extension.

Rarely used revsets like `upstream()` and `pushed()` are not moved.

Reviewed By: markbt

Differential Revision: D20529360

fbshipit-source-id: ea95b3324f974e112909cdd79ce662940a4f9b7c
2020-03-26 08:26:26 -07:00
Jun Wu
cc1b1bd6a9 remotenames: move namespace to core
Summary:
This makes it possible to resolve remotenames without enabling the remotenames
extension.

The config check `if repo.ui.configbool("remotenames", "bookmarks")` is dropped
intentionally as we only use remotenames for bookmarks, not named branches.

Since this only enables resolving more names, without disabling or changing
other features, and the remotename namespace priority is lower than local
bookmarks (ex. if a local `master` exists, then `master` will be using the
local bookmark, not the hoisted remote name), it should not cause breaking
changes.

Reviewed By: markbt

Differential Revision: D20529359

fbshipit-source-id: 4126faee1bb7f43ba547fab05dd6197b2e65c1fc
2020-03-26 08:26:26 -07:00
Jun Wu
a94f29c65a remotenames: move repo._remotenames to core
Summary:
This moves part of remotenames that provides the `repo._remotenames` object to
core.  It should not change behaviors but merely makes `repo._remotenames`
available in core.

Reviewed By: markbt

Differential Revision: D20529358

fbshipit-source-id: 11c8538a0190101b09a4cb082018e73643a257e2
2020-03-26 08:26:26 -07:00
Jun Wu
beb3d8c692 fsmonitor: make race detector aware of the matcher
Summary:
This makes it so `hg status A` won't complain about race conditions about file
`B`. As we're here, the detector logic was also moved to the filesystem layer.

Reviewed By: DurhamG

Differential Revision: D20568151

fbshipit-source-id: 713e3775a14674fd170df391977d42d9dee0f718
2020-03-23 14:22:02 -07:00
Xavier Deguillard
bb68ce52ff remotefilelog: provide fast path for cmp, size and isbinary
Summary: For LFS blobs, these can be obtained very easily by querying the ContentStore.

Reviewed By: DurhamG

Differential Revision: D20504235

fbshipit-source-id: 937ef20184d6524b1355565f9ab81e40b56d7ab0
2020-03-19 16:36:41 -07:00
Jun Wu
6ffdcebadf tracing: write some blackbox events as tracing events
Summary:
This is the start of migrating blackbox events to tracing events. The
motivation is to have a single data source for log processing (for simplicity)
and the tracing data seems a better fit, since it can represent a tree of
spans, instead of just a flat list. Eventually blackbox might be mostly
a wrapper for tracing data, with some minimal support for logging some indexed
events.

Reviewed By: DurhamG

Differential Revision: D19797710

fbshipit-source-id: 034f17fb5552242b60e759559a202fd26061f1f1
2020-03-19 10:23:24 -07:00
Durham Goode
ba122de053 tests: remove platform condition in eolfilename
Summary: Now that we sort the errors, we don't need this condition anymore.

Reviewed By: xavierd

Differential Revision: D20517578

fbshipit-source-id: 7012de387ee8acee1c1b630991f3a289a3fa48d1
2020-03-18 13:59:35 -07:00
Xavier Deguillard
20029d1bdc merge: disable Rust workers if in-memory merge is in progress
Summary: We don't really need the Rust workers for this, as we do not expect thousands of files to be changed during an in-memory merge.

Reviewed By: DurhamG

Differential Revision: D20495141

fbshipit-source-id: e72f8c4b01deee46ee72364dcd6716692c4103ab
2020-03-17 16:01:49 -07:00
Xavier Deguillard
499a67a417 tests: add a test using the Rust workers
Summary: Basic test to validate that updating files works as expected.

Reviewed By: DurhamG

Differential Revision: D20450123

fbshipit-source-id: 3ce09e1f72fe00052b86eec07668f3aa45824725
2020-03-17 16:01:48 -07:00
Adam Simpkins
3723a1a0b1 fix invalid buffering setting in some tests
Summary:
Update a test that was attempting to call `os.fdopen()` in binary mode with
line buffering.  Line buffering is only valid on files opened in text mode.
Python 3.8 now emits a warning about this invalid call, which causes the test
to fail.  Switch the test to use unbuffered mode.

Reviewed By: pixelb

Differential Revision: D20484844

fbshipit-source-id: 3bedfa3f0fb7926ad3ab3b6ea85716d0e1b603c3
2020-03-17 11:07:50 -07:00
Durham Goode
ceca615943 workingcopy: enable rust walker by default in tests
Summary: Let's enable it for tests. We'll slow roll it in production.

Reviewed By: quark-zju

Differential Revision: D19543790

fbshipit-source-id: be7d18dd8ffe51615a27c39ebf4247ec405b4097
2020-03-17 10:39:15 -07:00
Mark Thomas
5666399fcf mutationstore: switch mutation entry timestamp from f64 to i64
Summary:
The mutation store stores entries with a floating-point timestamp.  This
pattern was copied from obsmarkers.

However, Mercurial uses integer timestamps in the commit metadata (the
parser supports floats for historical reasons, but only stores integer
timestamps).   Mononoke also uses integer timestamps in its `DateTime`
type.

To keep things simple, switch to using integer timestamps for mutation
entries.  Existing entries with floating point timestamps are truncated.

Add a new entry format version that encodes the timestamp as an integer.
For now, continue to generate the old version so that old clients can
read entries created by new clients.

Reviewed By: quark-zju

Differential Revision: D20444366

fbshipit-source-id: 4d6d9851aacb314abea19b87c9d0130c47fdf512
2020-03-17 04:18:44 -07:00
Mark Thomas
ac80212e8f mutationstore: remove mutation entry origins
Summary:
Tracking the origin of mutation entries did not prove useful, and just creates
an un-necessary overhead.  Remove the tracking and repurpose the field as a
version field.

Reviewed By: quark-zju

Differential Revision: D20444365

fbshipit-source-id: 65ff11ee8cfe77d5e67a83d03a510541d58ef69b
2020-03-17 04:18:44 -07:00
Durham Goode
cb2e471763 treestate: make treestate a hard requirement
Summary:
We want to delete all the non-treestate dirstate implementations. Let's
start throwing an exception if treestate is not enabled. We temporarily have a
bypass in case we break an important usecase in the process.

This also sets the standard new repo to be created in treestate mode, but adding
treestate to newreporequirements.

This was landed once as D19204621 but was backed out because eden backing repos
were using the odl formats and hadn't been upgraded. We fixed that, and now the
data shows ~10 people still using repos in this condition
(https://fburl.com/scuba/dev_command_timers/zxb5hsg2). Some of them are broken
repos, some are ancient eden repos and a simple eden rm and eden clone should
fix them, some are simply old non-eden repos that no one has run commands in in a while.

Reviewed By: xavierd

Differential Revision: D20472234

fbshipit-source-id: 509b4f22b6ac4741b205ef69decfb26e56aebaf8
2020-03-16 18:39:52 -07:00
Jun Wu
1734cfe169 metalog: allow overridding root using HGFORCEMETALOGROOT
Summary:
Together with `debugmetalogroots`, this allows some kind of "time travel" to
investigate repo states in the past.

Reviewed By: sfilipco

Differential Revision: D20449409

fbshipit-source-id: ed5c134f9e9ee235b24f45c1aa35867a55a71fe5
2020-03-16 10:21:48 -07:00
Jun Wu
d7fd7c15d6 metalog: add debugmetalogroots
Summary: The command lists all metalog roots. It's useful for debugging purpose.

Reviewed By: sfilipco

Differential Revision: D20449408

fbshipit-source-id: 206573b20c7740b6e536bf5d97276175c684959a
2020-03-16 10:21:47 -07:00
Durham Goode
1b892e1d50 tests: don't test \1 character in hgsql tests
Summary:
\1 is not a valid character in our new RepoPath's, so let's remove it
from the tests.

Reviewed By: quark-zju

Differential Revision: D19543793

fbshipit-source-id: 383a4b3f5c54b47180fe667f234a43eda22f91b6
2020-03-16 10:15:24 -07:00
Xavier Deguillard
eaf2f2e9f0 tinit: fix a typo in newserver
Summary: treemanifest was misspelled.

Reviewed By: quark-zju

Differential Revision: D20449488

fbshipit-source-id: 91a3e6533d177083af5c46c09ad09b1a51d8ece5
2020-03-13 17:36:50 -07:00
Jun Wu
f6f5649b46 test-configparser: migrate to Python unit test
Summary:
This makes the test compatible with Python 2, 3 and Windows.
It also looks easier to read.

Reviewed By: xavierd

Differential Revision: D20444919

fbshipit-source-id: c897e9abc8a5d6d98ff1fc526e2484720fb73bb1
2020-03-13 12:01:00 -07:00
Jun Wu
7a7f98f1b2 configparser: migrate from Bytes to Text
Summary:
Since configparser enforces utf-8 config files (because pest wants Rust strings),
let's migrate from Bytes to Text to remove extra encoding conversions.

Previously this was blocked by the lack of ref-counted text (since the "source"
of each config location is the entire config file). Now minibytes provides Text
so we can use it.

This unfortunately requires dependent code to be updated. The pyconfigparser
interface is in theory wrong - it shouldn't return utf-8 bytes but
local-encoded bytes. I think it's cleaner to make pyconfigparser unaware of
HGENCODING, so I changed pyconfigparser to use unicode, and add compatibility
layer in uiconfig.py.

This also fixes non-ascii encoding issues on user name (especially on Windows).
The hgrc config file should be in utf-8 and the config parser returns explicit
unicode types, and Python code round-trip them with local encodings.

Reviewed By: markbt

Differential Revision: D20432938

fbshipit-source-id: b1359429b8f1c133ab2d6b2deea6048377dfeca1
2020-03-13 10:51:41 -07:00
Jun Wu
e5ef3a81b2 changelog: do not treat draft remove heads as unconditionally visible
Summary: This makes it possible to hide draft branches using `hg hide`.

Reviewed By: markbt

Differential Revision: D20403505

fbshipit-source-id: d316e02c24ce636fdc6593f95a5d974b1ba0fc85
2020-03-12 13:02:44 -07:00
Mark Thomas
d4cfd6f918 commitcloud: store cloud sync status in the store vfs
Summary:
Commit cloud sync works at the store granularity, so the status should be
stored in the store vfs.  Move it there.

Improve the output of `hg cloud status` by logging more information about the workspace.

Reviewed By: quark-zju

Differential Revision: D20419223

fbshipit-source-id: 4f0d6b9aab55d2bbeaf89b489606f0bc25400de5
2020-03-12 12:58:17 -07:00
Jun Wu
6908bc874c pytracing: support basic filtering in treespans
Summary:
Expose the "TreeSpans" type from tracing-collector so filtering can be done on
them.

Reviewed By: DurhamG

Differential Revision: D19797707

fbshipit-source-id: 56b63c8fb79865666ce923612dbd5a9cc512dce6
2020-03-12 12:19:39 -07:00
Kostia Balytskyi
30e39de418 edenscm: add a separate path type for infinitepush writes
Summary:
In order to support gradual rollout of infinitepush for other backends (e.g. Mononoke), we need the ability to route read vs write requests separately. To achieve this, we need a separate path type: `infinitepush-write` (kind of like `default-push`, the naming inconsistency is a little unfortunate, as I don't want to use `infinitepush-push`).

The desired behavior of the new path type is as follows:
- takes precedence over `infinitepush` path when the user does `hg push -r . --to scratch/bla`
- replaces `infinitepush` path when the user does `hg push infinitepush -r . --to scratch/bla`
- absence of this path means draft pushes will go to `infinitepush` path
- draft pulls always go to `infinitepush` path, and *there's no fallback to `infinitepush-write`*
- commit cloud always talks to `infinitepush-write`, if it is present (meaning that commit cloud pulls do go to `infinitepush-write` path
  - this is done, as commitcloud uses infinitepush paths to also check whether something is backed up
  - and also, commitcloud may need to pull very soon after something has been pushed

Reviewed By: quark-zju

Differential Revision: D20368158

fbshipit-source-id: 59db174cebbf2b48765dff37bc93aad176c2d7c1
2020-03-12 03:22:12 -07:00
Adam Simpkins
55a2324219 skip automigration if the repository has an abandoned transaction
Summary:
A common cause for automigration failure is if the repository has an abandoned
transaction.  Just ignore the error and skip migration if this happens.
Otherwise important read-only commands (like `hg debugedenimporthelper`)
refuse to even start in this situation.

Reviewed By: farnz

Differential Revision: D20394546

fbshipit-source-id: abb75fe455e9ee815032431705df7f38ee50283a
2020-03-11 16:25:50 -07:00
Adam Simpkins
8e78254e55 fix a ProgrammingError bug in visibility migration
Summary:
The code to disable visibility was writing to files without a transaction,
which causes a `ProgrammingError` to be thrown when using metalog.

Reviewed By: farnz

Differential Revision: D20394547

fbshipit-source-id: c529de84ed7b127df18e7f60572cece2169dc520
2020-03-11 16:25:50 -07:00
Jun Wu
9bff661020 commands: add debugdifftree
Summary:
This command can be used to diff two trees and only print changed paths,
without changed file contents.

With a customized template it can also print changed flags, which can be useful
for watchman use-cases.

Reviewed By: sfilipco

Differential Revision: D20377436

fbshipit-source-id: dad79f1b891182fa612c446114f9daceb4ec5881
2020-03-11 10:42:21 -07:00
Jun Wu
48a3a695df revset: remove _destupdate and _destmerge
Summary: Those experimental revsets are not used in the past month. Remove them.

Reviewed By: sfilipco

Differential Revision: D20355671

fbshipit-source-id: 22d6053af01a56f23b7227b86ebe271aa2b42f41
2020-03-11 10:42:21 -07:00
Xavier Deguillard
40bbe7b4da merge: add a Rust threaded file updater
Summary:
During `hg update`, Mercurial forks multiple processes to write files on disk
concurrently, this is done as fetching blobs from the content store, and
writing them to disk is CPU bound. Usually, threads would be the preferred way
of speeding up such process, but unfortunately, Python has GIL that severely
limit the available concurrency. So, multiple processes were chosen.

Unfortunately, the multi-process solution also brings a lot of other issues,
more recently, we've had cases where the connections to the server and memcache
had to be dropped after the fork. In some other cases, this caused deadlocks.
And the solution is not effective on Windows.

Now that Mercurial is getting more and more Rust, we could instead go back to
the threads solution by using them in Rust, and have Python just push work to
them, this is exactly what this change does.

Things that are left to be done, but I wanted to get a diff out first:
 - no file path audit
 - no file backup
 - no symlink creation
 - probably other things I'm missing

Reviewed By: quark-zju

Differential Revision: D20102888

fbshipit-source-id: d47829fd7818b97710586b9851880f178048e27b
2020-03-11 01:13:54 -07:00
Mark Thomas
f54c43c22f debugnetwork: add command for debugging network connection problems
Summary:
Add a command that performs various network tests to check the connection to
the Mercurial server for SSH peers.

These tests are:

* Check we can look up the server name in DNS.
* Check we can make a TCP connection to the SSH server.
* Check we can connect and authenticate over SSH and run `hostname`.
* Check we can make a Mercurial wireproto connection and find the `master` bookmark.
* Check the download and upload speed to the server.

Checking the speed requires a companion speed test program on the server.

Reviewed By: mitrandir77, farnz

Differential Revision: D20305227

fbshipit-source-id: adba02a6a1c40ffc20d7bf9d962a5fcf85e06544
2020-03-06 12:27:49 -08:00
Xavier Deguillard
bfae923336 changelog: the _delaybuf is a byte list
Summary: Make a bytestring with 'b""' to fix Python3

Reviewed By: DurhamG

Differential Revision: D20287313

fbshipit-source-id: 7455d1509684bfb0857a3b060bdcca7e658343fd
2020-03-06 10:29:33 -08:00
Xavier Deguillard
2a47ead18d debug: fix _quasirepr
Summary: Just remove the b.

Reviewed By: DurhamG

Differential Revision: D20286947

fbshipit-source-id: dabdf39fc7f8efa271059e9f179d7417a03f820a
2020-03-06 10:29:32 -08:00
Xavier Deguillard
36ff5d6a7d remotenames: fix expaths
Summary: We need to encode/decode utf8 when reading/writing to the hgrc file.

Reviewed By: DurhamG

Differential Revision: D20286068

fbshipit-source-id: b1d6828fb62a83ad22414de6883004411f302142
2020-03-06 10:29:32 -08:00
Xavier Deguillard
b43f9b8d14 remotefilelog: retry fetches on dropped connections
Summary:
On bad network link (such as on VPN), the reliability of the connection to
Mercurial might be fairly flaky. Instead of failing fetching files, let's retry
a bit first, in the hope that the connection will be back by then.

Reviewed By: quark-zju

Differential Revision: D20295255

fbshipit-source-id: d3038f5e4718b521ae4c3f2844f869a04ebb25e3
2020-03-06 08:32:16 -08:00
Durham Goode
a7e62ec3de hggit: add ability to skip commits using hggit.skipgithashes
Summary:
We've had cases where a git commit goes in that shouldn't be translated
to Mercurial. Let's add an option to skip the commit. Instead of skipping it
entirely (which would require complicated logic to then parent the following
commit on the last converted commit), let's just convert the skipped commit as
an empty commit. This should cover the cases we've encountered so far.

Reviewed By: krallin

Differential Revision: D20261743

fbshipit-source-id: da401863b09c2ac727aae1ceef10a0e8d8f98a7e
2020-03-05 15:06:30 -08:00
Jun Wu
3e80ba4f99 repo: skip data migrations if repo lock cannot be taken
Summary: This avoids deadlock with edenfs-triggered debugimporthelper.

Reviewed By: simpkins

Differential Revision: D20270678

fbshipit-source-id: 6d3e7664b375d10ad2a8caeecaef5fa895264472
2020-03-05 11:42:19 -08:00
Jun Wu
33d65ac5eb test-doctor: fix test on filesystems without symlink
Summary:
On filesystems without symlinks, the test fails because ln prints errors.

Fix the test by using `#if symlink`.

Reviewed By: DurhamG

Differential Revision: D20260904

fbshipit-source-id: 1d0ffcc7e95d2718087fb01297369ca276b59013
2020-03-04 15:52:53 -08:00
Jun Wu
49464342fd indexedlog: try to use symlink for atomic_write on unix
Summary:
The change is in theory not necessary. However it improves the reliability on
OS crashes a bit, and can potentially workaround some bugs in filesystems
(as we saw in production where the atomic-written files are empty and the
system didn't crash).

The idea is, the `symlink` syscall does the file creation and "content" writing
together, while there is no way to create a file and write specific content
in one syscall. Note that the C symlink call uses 0-terminated string, and
the Rust stdlib exports it as accepting `Path`. To be safe, we encode binary
or non-utf8 content using `hex`.

For downgrade safety, the write path does not use symlink by default unless
format.use-symlink-atomic-write is set to true. This makes downgrade possible:
the read path is rolled out first, then we can turn on and off the write path.

The indexedlog Rust unit tests and test-doctor.t are migrated to use the new
symlink code paths.

Reviewed By: DurhamG

Differential Revision: D20153864

fbshipit-source-id: c31bd4287a8d29575180fbcf7227d2b04c4c1252
2020-03-04 07:23:48 -08:00
Jun Wu
ea7a8b68a5 run-tests: fail instead of skipping tests for unknwon hghave features
Summary:
If hghave fails to check a feature because the feature name is unknown, treat
it as a test failure instead of skipping the entire test. This is especially
useful since `#if feature-name` only affects part of the test and failing to
test the feature should not skip the entire test. It also allows us to capture
issues about mis-spelled feature names or stale feature tests.

This has bitten us twice in the past:

- D18819680 removed `pure` and accidently disabled tests including
  `test-install.t`, `test-annotate.t` and `test-issue4074.t`. Those tests got
  re-enabled as part of D20155399, while they pass Python 2 tests,
  the Python 3 tests were failing.

- D18088850 removed svn related feature checks, which has caused some issues
  that got fixed by D18713921 and D18713922.<Paste>

Reviewed By: xavierd

Differential Revision: D20231782

fbshipit-source-id: 6adf99bd79b2a295d4e84ce4da5f9425a100936a
2020-03-03 19:17:59 -08:00
Jun Wu
73f0525b89 test-issue4074: fix py3 compatibility
Summary: There are multiple issues. Fix them.

Reviewed By: kulshrax

Differential Revision: D20231783

fbshipit-source-id: fc6be43fda088822fe8ff9dbd32410aa616c1772
2020-03-03 17:46:34 -08:00
Jun Wu
96ef84b2d4 test-install: fix py3 compatibility
Summary: The test should not assert Python version is "2.*".

Reviewed By: kulshrax

Differential Revision: D20231781

fbshipit-source-id: 2e10c37bb4b665bc4d5d4b27329c4c2cb23d54e3
2020-03-03 17:46:33 -08:00
Jun Wu
5ba323af16 doctor: skip unknown visibleheads format
Summary:
When I run `hg doctor` in my www checkout it fails the assertion check of the
first line of visibleheads is "v1". Make it graceful so doctor can check and
fix other components.

Reviewed By: DurhamG

Differential Revision: D20147969

fbshipit-source-id: 6aee2cab962fcd0ef06a0611d288021e86621249
2020-03-03 13:41:27 -08:00
Jun Wu
10bb5a144e revset: replace some repo.revs with repo.nodes
Summary:
Migrate away from some uses of revision numbers.
Some dead code in discovery.py is removed.

I also fixed some test issues when I run tests locally.

Reviewed By: sfilipco

Differential Revision: D20155399

fbshipit-source-id: bfdcb57f06374f9f27be51b0980652ef50a2c8e0
2020-02-28 17:45:26 -08:00
Jun Wu
5d253a75df amend: remove hiddenoverride
Summary:
`hiddenoverride` is a hacky implementation that preserves part of another hacky
`inhibit` extension. With our modern setup (inhibit or narrow-heads),
`hiddenoverride` is less useful. Therefore just remove it.

Reviewed By: sfilipco

Differential Revision: D20148011

fbshipit-source-id: f4a5f05b67ae6f315e9b07d50ef03018d6d05df5
2020-02-28 17:45:26 -08:00
Durham Goode
a50d0da7fe py3: fix blame tests
Summary:
Blame can use a templater which doesn't support bytes. Let's just force
all blame output to be unicode, since it doesn't make a ton of sense to blame
binary files anyway.

Also fix test-annotate.py

Reviewed By: quark-zju

Differential Revision: D19907530

fbshipit-source-id: a7a47246368ed50f65486e824f93552872adc09a
2020-02-28 11:32:16 -08:00
Durham Goode
54484268fb py3: more commit cloud fixes
Summary:
Notably, we drop all the encoding business when dealing with json
objects, and instead use mercurial.json.

Reviewed By: sfilipco

Differential Revision: D19888130

fbshipit-source-id: 2101c32833484c37ce4376a61220b1b0afeb175a
2020-02-28 11:32:16 -08:00
Durham Goode
98ed0fc5b0 py3: fix a few test-dirstate* tests
Reviewed By: xavierd

Differential Revision: D19888129

fbshipit-source-id: 947ea1bd9c5425fe3babcc60d6b885bde8fc4e2f
2020-02-28 11:32:15 -08:00
Jun Wu
a1601bfdd9 indexedlog: bump index filename
Summary:
Change index filename and metadata name. This makes sure the new format and old
format are separate so upgrading or downgrading won't have issues.

Reviewed By: DurhamG

Differential Revision: D19851355

fbshipit-source-id: 25dee018073a90040f5818b32b753a3f589c10e0
2020-02-28 09:23:56 -08:00
Jun Wu
b1f8456309 phabdiff: allow reviewers to be used as a string
Summary: It was a list. Make it possible to use it as a string.

Reviewed By: xavierd

Differential Revision: D20144811

fbshipit-source-id: b280c0344215a4c23ab9c63d89f47adf34fb06f3
2020-02-27 19:21:44 -08:00
Jun Wu
ae8f6ff8e8 tests: opt-in DUMMYSSH_STABLE_ORDER for more tests
Summary: This should help reduce test flakiness.

Reviewed By: xavierd

Differential Revision: D19872952

fbshipit-source-id: d66f6c404534b3f47903b478e3cdfdda5ed46284
2020-02-27 17:54:08 -08:00
Jun Wu
2996eeb273 test-commitcloud-backup-all: opt-in DUMMYSSH_STABLE_ORDER
Summary:
Stabilize the test. Without the change it's relatively easy to reproduce
test breakage. For example, the following command reproduces the breakage
within 20 seconds:

```
% ./run-tests.py test-commitcloud-backup-all.t --loop
 --- test-commitcloud-backup-all.t
+++ test-commitcloud-backup-all.t.err
@@ -45,10 +45,10 @@

   $ hg cloud backup --traceback
   backing up stack rooted at 64164d1e0f82
+  backing up stack rooted at d0d71d09c927
   remote: pushing 2 commits:
   remote:     64164d1e0f82  A1
   remote:     796f1f48de85  B
-  backing up stack rooted at d0d71d09c927
   remote: pushing 2 commits:
   remote:     d0d71d09c927  A2
   remote:     daeeb2f180d6  C

ERROR: test-commitcloud-backup-all.t output changed
[====================] 47 Passed. 1 Failed. 0 Skipped. -48 Remaining        16.2s
[------------>       ] test-commitcloud-backup-all.t                        1.8s
```

Reviewed By: xavierd

Differential Revision: D19872613

fbshipit-source-id: 4b6a48e2c8987ec0fded73a5b88430c1df1f6fb7
2020-02-27 07:24:37 -08:00
Jun Wu
a5066dd552 dummyssh: add a way to stabilize stdout, stderr order
Summary:
The ssh output order issue is a large contributor to test flakiness.
Example test failures are:

```
 --- test-unbundlereplay.t
+++ test-unbundlereplay.t.respondfully.err
@@ -154,9 +154,9 @@
   remote: [ReplayVerification] Expected: (master_bookmark, c2e526aacb5100b7c1ddb9b711d2e012e6c
69cda). Actual: (master_bookmark, 893d83f11bf81ce2b895a93d51638d4049d56ce2)
   remote: pushkey-abort: prepushkey hook exited with status 1
   remote: transaction abort!
+  replay failed: error:pushkey
+  unbundle replay batch item #0 failed
   remote: rollback completed
-  replay failed: error:pushkey
-  unbundle replay batch item #0 failed
   [1]
   $ cat $TESTTMP/reports.txt
   unbundle replay batch item #0 failed

 --- test-commitcloud-backup-all.t
+++ test-commitcloud-backup-all.t.err
@@ -59,9 +59,9 @@
   remote: pushing 1 commit:
   remote:     eccc11f58a56  D3
   backing up stack rooted at 42952ab62cec
+  backing up stack rooted at 4903fdffd9c6
   remote: pushing 1 commit:
   remote:     42952ab62cec  E1
-  backing up stack rooted at 4903fdffd9c6
   remote: pushing 1 commit:
   remote:     4903fdffd9c6  E2
   commitcloud: backed up 8 commits

test-fb-hgext-lfspushrebase-verify-blobs.t

 --- test-fb-hgext-treemanifest-pushrebase.t
+++ test-fb-hgext-treemanifest-pushrebase.t.err
@@ -127,9 +127,9 @@
   $ hg push --to master -B master --config treemanifest.sendtrees=True
   pushing to ssh://user@dummy/master
   searching for changes
-  remote: baz
   remote: prepushrebase.cat hook exited with status 1
   abort: push failed on remote
+  remote: baz
   [255]

 - Disable the hook
 ```

The order is nondeterministic because the stderr reading thread can read the
content before or after ui.write or ui.write_err in the main thread.

This diff introduces an optional feature in dummyssh that buffers all stderr
output and only write them after the wrapped hg serve process has exited, at
which time the hg client should also have completed its operations and has no
reason to ui.write or ui.write_err anything nondeterministically. Then the
dummyssh wrapper writes out the buffered stderr so the output order becomes
well defined.

Reviewed By: xavierd

Differential Revision: D19872612

fbshipit-source-id: 84710f98a8e6b4a1c283ffecf008585cca12be0a
2020-02-27 07:24:37 -08:00
Jun Wu
c8157cc25a dummyssh: format it
Summary: This makes the next change easier to see.

Reviewed By: xavierd

Differential Revision: D19872609

fbshipit-source-id: 9263a246258ffd18d8d883da7ced435a91fb5ced
2020-02-27 07:24:37 -08:00
Michael Devine
0a46a14017 Repo converter: New class "repomanifest"
Summary:
Right now, all of our manifest parsing and evaluation is in the repo() class, but this is a design mistake. Over a repo's convert lifetime, a single repo will have many different manifests, based on branch, and location in the commit history. What's worse is that the current design makes it hard to build unit tests and new features like include evaluation.

This commit creates a whole new class called repomanifest, that represents a specific manifest (and its included files). It also has unit tests to test the various operations that the manifest performs, such as path and revision mapping. This commit does not modify the existing converter code outside of the class to use this new implementation.

Reviewed By: tchebb

Differential Revision: D19402995

fbshipit-source-id: b97dadcc595c6332f4495460618317194873a780
2020-02-26 17:25:22 -08:00
Durham Goode
430f047eda py3: fix flat dirstate parsing/packing
Summary: Updates the C code to support unicode filenames and states.

Reviewed By: simpkins

Differential Revision: D19786275

fbshipit-source-id: e7aeb029b792818b1b1a9c5d3028640b56522235
2020-02-26 12:53:25 -08:00
Durham Goode
f188acb4e0 recover: don't verify the repo
Summary:
Verifying the changelog is quite slow and we've had more users needing
to run hg recover these days. Let's finally get rid of the verify step.

Reviewed By: simpkins

Differential Revision: D20109706

fbshipit-source-id: a512d9e11716514bce986b0e3a26347fe6afd955
2020-02-26 09:07:08 -08:00
Aida Getoeva
8f09d5a51b hg-py3: fix the last amend commands
Summary: Most of the fixes related to encoding in `patch.py`

Reviewed By: DurhamG

Differential Revision: D19713378

fbshipit-source-id: 66ccbd0fc7826ab2d4c05173c7e9edb96700d106
2020-02-26 08:26:13 -08:00
Adam Simpkins
0bc787c4c0 remove the mercurial.policy module
Summary:
This module previously used to handle deciding how a particular module should
be imported if it had multiple versions (e.g., pure Python or native).
However, as of D18819680 it was changed to always import the native C version.

Lets go ahead and remove it entirely now.  Using `policy.importmod` simply
makes it harder for type checkers to figure out the actual module that will be
used.

The only functionality that `policy.importmod()` still provided was verifying
that the module contained a "version" field that looked like what was
expected.  In practice these version numbers are not bumped often, so this
doesn't really seem to provide much value in checking that we imported the
correct version that we expected to be shipped with this release.

Reviewed By: xavierd

Differential Revision: D19958227

fbshipit-source-id: 05f1d027d0a41cf99c4aa93cb84a51e830305077
2020-02-21 13:54:19 -08:00
Durham Goode
fc12041053 unicode: fix non-fsmonitor encountering non-utf8 paths on disk
Summary:
The last diff fixed this for fsmonitor. Let's skip these same paths for
non-fsmonitor.

Reviewed By: quark-zju

Differential Revision: D20014808

fbshipit-source-id: 02e3cd9aa29d9c024ba3e8e42a46e21a7c8dfc30
2020-02-21 11:52:41 -08:00
Durham Goode
fa31ef23e0 utf8: skip invalid utf-8 filenames from watchman
Summary:
Watchman may report invalid utf-8 filenames, even after they've been
deleted. Let's skip them, and print a warning.

Reviewed By: sfilipco

Differential Revision: D20012187

fbshipit-source-id: b13550918a8330ef3eb5c546105d1e054dcb7724
2020-02-21 08:05:08 -08:00
Durham Goode
78ada1f780 utf8: use cpython_ext::Str for error strings
Summary:
Error strings were being converted to unicode if they contained certain
characters. This caused python 2 Mercurial to throw various errors when it tried
to turn them into strings to report errors.

Let's return cpython_ext::Str instead of String.

Reviewed By: sfilipco

Differential Revision: D20012188

fbshipit-source-id: af6fa7d98d68e3c188292e4972cfc1bdb758dbdf
2020-02-21 08:05:08 -08:00
Adam Simpkins
aea44066d4 remove verbose KeyError handling in filectx.data()
Summary:
This error handling can be extremely slow: calling `self.node()` can end up
triggering a linkrev scan of the changelog, which can take over 5 minutes.

If we did want to add this back in the future we would need some sort of API
on `filectx` to try and get the node ID only if it was cheap, and that would
fail fast if this is using remotefilelog and trying to get the node ID will
require scanning the changelog.

Note that KeyError can occur fairly regularly when invoked in long-lived
commands like `hg debugedenimporthelper`.  If we are asked about data in a new
commit that was added since this repository was originally opened a KeyError
will be thrown here (in which case `debugedenimporthelper` will call
`repo.invalidate()` and then retry).

Reviewed By: quark-zju

Differential Revision: D20010279

fbshipit-source-id: 0e9b4c163cb9256de57daa91eed70a3736cb1075
2020-02-20 17:43:48 -08:00
Durham Goode
51720717d8 sparse: add config for warning for full checkouts
Summary:
Some of our upcoming repo merges will make it infeasible for someone to
use a full checkout. Let's add a config that will warn users of this. It has a
few levels, starting with a suppressable hint, then a non-suppressable warning,
then a suppressable exception, then a non-suppressable exception.

Reviewed By: ikostia

Differential Revision: D19974408

fbshipit-source-id: bad35a477ad8626dbc0977465368f5d71007e2d5
2020-02-20 10:58:53 -08:00
Mark Thomas
5168c29e12 encoding: use correct output encoding on windows
Summary:
On Windows, there are *two* 8-bit encodings for each process.

* The ANSI code page is used for all `...A` system calls, and this is what
  Mercurial uses internally.  It can be overridden using the `--encoding`
  command line option.

* The OEM code page is used when outputing to the console.  Mercurial has no
  concept of this, and instead renders to the console using the ANSI code page,
  which results in mojibake like "Θ" instead of "é".

Add the concept of an `outputencoding`.  If this differs from `encoding`, we
convert from the local encoding to the output encoding before writing to the
console.

On non-Windows platforms, this defaults to the same encoding as the local encoding,
so this is a no-op unless `--outputencoding` is manually specified.

On Windows, this defaults to the codepage given by `GetOEMCP`, causing output
to be converted to the OEM codepage before being printed.

For ordinary strings, the local encoded version is wrapped by `localstr` if the
encoding does not round-trip cleanly.  This means the output encoding works
even if the character is not represented in the local encoding.

Unfortunately, the templater is not localstr-clean, which means strings can get
flattened down to the local encoding and the original code points are lost.  In
this case we can only output characters which are in the intersection of the
encoding and the output encoding.

Most US English Windows systems use cp1252 for the ANSI code page and cp437 for
the OEM code page.  These both contain many accented characters, so users with
accented characters in their names will now see them correctly rendered.

All of this only applies to Python 2.7.  In Python 3, everything is Unicode,
the `--encoding` and `--outputencoding` options do nothing, and it just works.

Reviewed By: quark-zju, ikostia

Differential Revision: D19951381

fbshipit-source-id: d5cb8b5bfe2bc131b2e6c3b892137a48b2139ca9
2020-02-20 04:28:48 -08:00
Thomas Orozco
de9b3cdc83 run-tests: encode diff in utf-8
Summary:
See later in this stack for motivation. This seems to work fine, and it allows
characters that don't fit latin1 when rendering diffs.

Reviewed By: markbt

Differential Revision: D19969743

fbshipit-source-id: 79c4afce5a19822d9b075d23ff4c88aa76ce2f42
2020-02-20 02:49:38 -08:00
Jun Wu
1fead58252 cmdutil: remove allcmds from UnknownCommand
Summary:
This makes the backtrace much shorter.

Before:

	Traceback (most recent call last):
	  File "edenscm/mercurial/cmdutil.py", line 876, in findsubcmd
	    aliases, entry = findcmd(cmd, table)
	    # cmd = 'foo'
	  File "edenscm/mercurial/cmdutil.py", line 871, in findcmd
	    raise error.UnknownCommand(cmd, allcmds)
	    # allcmds = ['debuggentrees', 'debugsuccessorssets', 'branch', 'br', 'bra', 'bran', 'branc', 'show', ...]
	    # cmd = 'foo'
	UnknownCommand: ('foo', ['debuggentrees', 'debugsuccessorssets', 'branch', 'br', 'bra', 'bran', 'branc', 'show', 'rename', 'move', 'mv', 'ren', 'rena', 'renam', 'mo', 'mov', 'commit', 'ci', 'com', 'comm', 'commi', 'debugremotebookmark', 'gc', 'debugindexedlogdatastore', 'debugexistingcasecollisions', 'debugshell', 'dbsh', 'debugsh', 'debugpython', 'debugpy', 'debugfileset', 'debugdata', 'debugundohistory', 'debugprogress', 'config', 'showconfig', 'debugconfig', 'conf', 'confi', 'paths', 'path', 'bisect', 'bi', 'bis', 'bise', 'bisec', 'debugcheckcasecollisions', 'add', 'debugrename', 'annotate', 'blame', 'blam', 'an', 'ann', 'anno', 'annot', 'annota', 'annotat', 'journal', 'j', 'jo', 'jou', 'jour', 'journ', 'journa', 'parents', 'par', 'pare', 'paren', 'parent', 'rollback', 'debugmergestate', 'identify', 'id', 'ide', 'iden', 'ident', 'identi', 'identif', 'debugformat', 'bookmarks', 'bookmark', 'bo', 'boo', 'book', 'bookm', 'bookma', 'bookmar', 'debugrevspec', 'debugwalk', 'amend', 'am', 'ame', 'amen', 'debughttp', 'hide', 'strip', 'hid', 'str', 'stri', 'tip', 'ti', 'debugcommitmessage', 'hint', 'hin', 'locate', 'loc', 'loca', 'locat', 'debugfilerevision', 'debugfilerev', 'incoming', 'in', 'debugdag', 'next', 'n', 'ne', 'nex', 'unshare', 'rebase', 'unhide', 'unh', 'unhi', 'unhid', 'grep', 'gre', 'archive', 'ar', 'arc', 'arch', 'archi', 'archiv', 'debugmarklanded', 'debugpushkey', 'debugdatapack', 'debugtreestate', 'debugtreedirstate', 'debugtree', 'debuglocks', 'debuglock', 'revert', 'rev', 'reve', 'rever', 'export', 'e', 'ex', 'exp', 'expo', 'expor', 'repack', 'shelve', 'she', 'shel', 'shelv', 'log', 'history', 'debugwaitbackup', 'debugnamecomplete', 'diff', 'd', 'di', 'dif', 'debugdrawdag', 'debugcheckoutidentifier', 'debugdate', 'debuggethistory', 'debugssl', 'init', 'ini', 'debuggetbundle', 'summary', 'sum', 'su', 'summ', 'summa', 'summar', 'unbundle', 'unb', 'unbu', 'unbun', 'unbund', 'unbundl', 'debugwaitonrepack', 'backfilltree', 'debugcrdump', 'outgoing', 'out', 'debugupgraderepo', 'debugmovescratchbookmark', 'debugrebuilddirstate', 'debugrebuildstate', 'debugancestor', 'remove', 'rm', 'rem', 'remo', 'remov', 'debugfillinfinitepushmetadata', 'sparse', 'tags', 'debugcolor', 'debugrunshell', 'debugpathcomplete', 'purge', 'clean', 'undo', 'debugindexedlog-dump', 'debugcheckstate', 'metaedit', 'met', 'meta', 'metae', 'metaed', 'metaedi', 'debugcommands', 'convert', 'debugmutationfromobsmarkers', 'graft', 'gra', 'graf', 'root', 'uncommit', 'unc', 'unco', 'uncom', 'uncomm', 'uncommi', 'verifyremotefilelog', 'copy', 'cp', 'cop', 'debugpreviewbindag', 'files', 'fi', 'fil', 'file', 'debugprocesstree', 'debugproc', 'debugdeltachain', 'fold', 'squash', 'debughistorypack', 'debug-args', 'debugcapabilities', 'debugindexedloghistorystore', 'debuggetfiles', 'debuggetfile', 'debugapplystreamclonebundle', 'redo', 'cloud', 'debugremotefilelog', 'debugsetparents', 'debugmetalog', 'debugindexedlog-repair', 'debugbindag', 'version', 'vers', 'versi', 'versio', 'status', 'st', 'sta', 'stat', 'statu', 'debugmutation', 'debugignore', 'debugobsolete', 'debugupdatecaches', 'debugwaitonprefetch', 'merge', 'mer', 'merg', 'addremove', 'addr', 'addre', 'addrem', 'addremo', 'addremov', 'share', 'debugmanifestdirs', 'serve', 'fastannotate', 'fastblame', 'fa', 'debugdiscovery', 'debugwireargs', 'push', 'debugpickmergetool', 'debugstrip', 'debugbuildannotatecache', 'isbackedup', 'reset', 'debugcomplete', 'debugfsinfo', 'debugfs', 'prune', 'rage', 'unamend', 'una', 'unam', 'uname', 'unamen', 'previous', 'prev', 'previ', 'previo', 'previou', 'continue', 'cont', 'debugsvnlog', 'debugvisibility', 'cat', 'record', 'debugrevlog', 'unshelve', 'unshe', 'unshel', 'unshelv', 'debugrebuildfncache', 'debugdirs', 'import', 'patch', 'im', 'imp', 'impo', 'impor', 'patc', 'backfillmanifestrevlog', 'debuglabelcomplete', 'split', 'spl', 'spli', 'smartlog', 'sl', 'slog', 'sm', 'sma', 'smar', 'smart', 'smartl', 'smartlo', 'debuggettrees', 'debugedenrunpostupdatehook', 'debugstatus', 'manifest', 'mani', 'tag', 'bundle', 'bu', 'bun', 'bund', 'bundl', 'debugtemplate', 'phase', 'ph', 'pha', 'phas', 'dump-trace', 'debugstore', 'rebase', 'reb', 'reba', 'rebas', 'recover', 'debugrefreshwatchmanclock', 'doctor', 'verify', 'forget', 'for', 'forg', 'forge', 'debugextensions', 'pushbackup', 'absorb', 'ab', 'abs', 'abso', 'absor', 'sf', 'debuginstall', 'histgrep', 'debugreadauthforuri', 'prefetch', 'fs', 'blackbox', 'clone', 'histedit', 'histe', 'histed', 'histedi', 'debugpvec', 'resolve', 'reso', 'resol', 'resolv', 'debugcreatestreamclonebundle', 'debugserialgetfiles', 'debugbuilddag', 'debugindex', 'debugcreatescratchbookmark', 'heads', 'hea', 'head', 'debugedenimporthelper', 'githelp', 'git', 'pull', 'pul', 'chistedit', 'debugindexdot', 'debugdirstate', 'debugstate', 'debugknown', 'backout', 'backo', 'backou', 'update', 'up', 'checkout', 'co', 'upd', 'upda', 'updat', 'che', 'chec', 'check', 'checko', 'checkou', 'help', 'hel', 'debugbundle'])
	unknown command 'foo'
	(use 'hg help' to get help)

After:

	Traceback (most recent call last):
	  File "edenscm/mercurial/cmdutil.py", line 876, in findsubcmd
	    aliases, entry = findcmd(cmd, table)
	    # cmd = 'foo'
	  File "edenscm/mercurial/cmdutil.py", line 871, in findcmd
	    raise error.UnknownCommand(cmd)
	    # cmd = 'foo'
	UnknownCommand: foo
	unknown command 'foo'
	(use 'hg help' to get help)

Reviewed By: xavierd

Differential Revision: D19959205

fbshipit-source-id: e3fa6de8edfec7510ecd29defe538dddf8b563a2
2020-02-19 20:12:57 -08:00
Durham Goode
e25f679318 hggit: fix path handling
Summary:
As of 63c471ad8a4ba0bebd1acf70569bcdcefc3fffbf in upstream Dulwich, it
now turns commands into unicode.  Unfortunately, _ssh.py in hggit sees that the
type is no longer str or bytes and thinks it's an array and puts spaces between
every letter, causing it to break.

Let's allow unicode. This broke because dulwich was recently upgraded.

Reviewed By: sfilipco

Differential Revision: D19983215

fbshipit-source-id: 059756905bf4b2c73009001b078c8723ae378246
2020-02-19 17:46:33 -08:00
Jun Wu
3a5b53134e hint: update revnum deprecation message
Summary: It's 2020 now.

Reviewed By: xavierd

Differential Revision: D19958630

fbshipit-source-id: 143d57e060acb150461151b31d82bb6bfefe3c91
2020-02-18 18:06:26 -08:00
Liubov Dmitrieva
3163d20016 commitcloud: log errors to scuba
Summary:
This will allow us to improve our dashboards filtering out errors we are
responsible for, like missing certs on the machines.

Reviewed By: mitrandir77

Differential Revision: D19950614

fbshipit-source-id: 73503e984dfe8513a700fdcb2fc36b1618c20a4f
2020-02-18 14:28:33 -08:00
Mark Thomas
0387f1c67e localrepo: add configurable limits for description and extras
Summary:
Commit messages and extras can be unbounded in size.  This can cause problems if users create commits with exceptionally large messages or extras.  Mercurial will commit these to the changelog, increasing its size.  On Mononoke, large commit messages may go over the cacheing threshold, resulting in poor performance for requests involving these commits as Mononoke will need to reload on every access.

Commit messages should not usually be that large.  Mostly likely it will happen by accident, e.g. through use of `hg commit -l some-large-file`. Prevent this from happening by accident by adding configuration for soft limits when creating commits.

If a user really does need to create a commit with a very large message or extras, they can override using the config option.

Reviewed By: xavierd

Differential Revision: D19942522

fbshipit-source-id: 09b9fe1f470467237acc1b20286d2b1d2ab25613
2020-02-18 13:12:58 -08:00
Jun Wu
795b679d60 doctor: support efficient treestate (dirstate) repair
Summary:
Sometimes the treestate points to an unknown commit (ex. aborted transaction
might strip commits). While `debugrebuilddirstate -r HASH --hidden` is able to
fix it, it is too slow.

This diff adds treestate repair logic to the `doctor` command. It scans through
the treestate files, find a most recent `Root` entry with `p1` pointing to a
known commit.

This can be much faster than `debugrebuilddirstate` in some cases, because the
watchman clock might still be valid, and the NEED_CHECK file list might still
be small. In that case, `status` can still be fast.

Since treestate atomically updates all information needed for `status`
calculation (parents, need-check-files (or, "non-normal files"), watchman-clock
(only with fsmonitor), and stat for clean files). Reverting to a previous state
is still atomic. Correctness-wise, this is equivalent to aborting a "large"
transaction, and restoring treestate data to the state before the transaction.
It should be consistent, and the next `status` call won't mis-report files like
the dangerous `debugsetparents` command.

Reviewed By: DurhamG

Differential Revision: D19864422

fbshipit-source-id: d5d2f8b43a0c15ea2ac0e3c164edec7deeb8451f
2020-02-18 09:41:32 -08:00
Jun Wu
bc7c3c1e24 doctor: remove invalid commits in visibleheads
Summary:
See the test change. Without this change repairing the changelog won't give the
user back a working repo.

Reviewed By: markbt

Differential Revision: D19864421

fbshipit-source-id: b84582c5302469828c8cfcb3db362ea82f2eea63
2020-02-18 09:41:31 -08:00
Jun Wu
febe96048e doctor: integrate fixcorrupt logic to repair changelog
Summary:
Reuse utilities in the fixcorrupt extension to repair changelog.

This is better than fixcorrupt because `hg doctor` does not require a repo
object. Some messages are updated so they become more consistent with the
rest of `hg doctor`.

The main motivation is to get changelog fixed early, so other repair logic can
check if a commit hash is known by changelog or not.

Reviewed By: markbt

Differential Revision: D19864418

fbshipit-source-id: 6f95c6c6191d7db2a474a07a5278a857cf41d8e2
2020-02-18 09:41:31 -08:00
Jun Wu
6f2b529e94 doctor: run 'edenfsctl doctor' on edenfs repos
Summary:
Run 'edenfsctl doctor' on an edenfs repo. If there is no current repo, it might
be caused by edenfs daemon stopped running. So let's also run edenfsctl doctor
in that case.

Reviewed By: markbt

Differential Revision: D19864419

fbshipit-source-id: d2a49a126a040845b88b4883d214162326d08d8d
2020-02-18 09:41:30 -08:00
Durham Goode
09de146878 py3: fix archive
Reviewed By: quark-zju

Differential Revision: D19802024

fbshipit-source-id: 714f1a3af7f62c8215310fe95ac4de28f9b10f1d
2020-02-17 14:52:40 -08:00
Durham Goode
c9b1fee40f py3: fix eol
Reviewed By: markbt

Differential Revision: D19802025

fbshipit-source-id: f6e6c03ea2d64500b92bcf8b97c9ddedb83fd3c0
2020-02-17 14:52:40 -08:00
Durham Goode
c4f7d32501 py3: enable more tests
Summary: Not sure what fixed these, but let's enable them.

Reviewed By: quark-zju

Differential Revision: D19800696

fbshipit-source-id: 2536a121ae37d4b23ef09dcfee8d92ccbbef3af6
2020-02-17 14:52:39 -08:00
Durham Goode
a6353c55f5 py3: fix sparse
Reviewed By: quark-zju

Differential Revision: D19800699

fbshipit-source-id: 7cf86d0ab9a0efc96966ac3747f56b229251fb0d
2020-02-17 14:52:38 -08:00
Durham Goode
00d72e96bf py3: fix gitlookup
Reviewed By: xavierd

Differential Revision: D19800701

fbshipit-source-id: ecc918a0ef7358a29789f0ab6ca50337bec9edf1
2020-02-17 14:52:38 -08:00
Durham Goode
f05a9d79bb py3: fix test-flagprocessors.t
Reviewed By: xavierd

Differential Revision: D19800697

fbshipit-source-id: a785a4a04ce627257993d83197fec270a8688b7d
2020-02-17 14:52:37 -08:00
Durham Goode
fdbaaeeff9 py3: fix treedirstate unicode handling
Summary:
There was a spot where we returned bytes for a filepath. Fix this to
make dirstate tests pass more.

Reviewed By: quark-zju

Differential Revision: D19786274

fbshipit-source-id: 7465cae8bb2e3be7758abc6279ed3f5f59581732
2020-02-17 14:52:37 -08:00
Durham Goode
4f8c30b04e py3: enable 92 py3 tests
Summary: These now pass

Reviewed By: singhsrb

Differential Revision: D19785175

fbshipit-source-id: bf92757e3fe0753e1b61ffddfd30a37fb40a642f
2020-02-17 14:52:37 -08:00
Durham Goode
c2f42204cc py3: fix some mutation tests
Reviewed By: quark-zju

Differential Revision: D19772615

fbshipit-source-id: 93bcefb6d911941a9e46107f124730279398ceff
2020-02-17 14:52:36 -08:00
Durham Goode
5f46843003 py3: get several infinitepush tests passing
Reviewed By: quark-zju

Differential Revision: D19772622

fbshipit-source-id: c0b64e3a22c085656dbff5526765020b64cc73f5
2020-02-17 14:52:36 -08:00
Durham Goode
56f4d5ae18 py3: enable a few tests that got fixed along the way
Summary: Not sure where these got fixed.

Reviewed By: quark-zju

Differential Revision: D19772617

fbshipit-source-id: 7bebd15ad080e1fc224d8c1e78f645877551ac92
2020-02-17 14:52:35 -08:00
Durham Goode
2c18b7521a py3: make test-fb-hgext-remotefilelog-clone-tree.t pass
Reviewed By: quark-zju

Differential Revision: D19772620

fbshipit-source-id: 26d1ae840e1e19c7dabbdf7a71e2d4b0d265e141
2020-02-17 14:52:35 -08:00
Durham Goode
255b677f91 py3: fix test-fb-hgext-remotefilelog-lfs.t
Reviewed By: quark-zju

Differential Revision: D19772621

fbshipit-source-id: 25fda0f356129b27413b25cfb70e9d08bbc56263
2020-02-17 14:52:35 -08:00
Durham Goode
2b0c3ec119 py3: fix test-fb-hgext-remotefilelog-histpack.py
Reviewed By: quark-zju

Differential Revision: D19772616

fbshipit-source-id: 443527d37aa87c1802323aa6edf863beb497a327
2020-02-17 14:52:34 -08:00
Durham Goode
a5ba21d4d4 py3: codemode assertEquals to assertEqual
Summary:
assertEquals is deprecated and shows warnings in the tests in python 3

ignore-conflict-markers

Reviewed By: quark-zju, sfilipco

Differential Revision: D19907385

fbshipit-source-id: 7d261489856a4eeb6719eae581ed986d0415d99e
2020-02-17 14:52:34 -08:00
Durham Goode
41cc67d011 py3: fix remotefilelog repack tests
Reviewed By: quark-zju

Differential Revision: D19751790

fbshipit-source-id: a898a8c37929a73ee2654d2907e9ea5bb2e3fd8a
2020-02-17 14:52:33 -08:00
Durham Goode
3a5728b32f py3: fix archive
Summary:
archive uses a formatter to produce it's metadat file. We need to use a
string io stream instead of bytes.

Reviewed By: quark-zju

Differential Revision: D19748163

fbshipit-source-id: fbd8c32066cfc4a234d9b51691717c7fce4c7c9a
2020-02-17 14:52:33 -08:00
Durham Goode
48aec8ca41 py3: misc fixes to remotefilelog and treemanifest
Reviewed By: quark-zju

Differential Revision: D19747715

fbshipit-source-id: da6716ff46342d777d45bec8e560ab41d544645f
2020-02-17 14:52:33 -08:00
Durham Goode
a3ec80f7f5 py3: various fixes to move bundle2 tests foward
Reviewed By: quark-zju

Differential Revision: D19717253

fbshipit-source-id: 3f07a3c6ff09c1f7081d2dd15659505b4a07a91a
2020-02-17 14:52:32 -08:00
Durham Goode
4d4274ce53 py3: make conduithttp.py python 3 compatible
Reviewed By: quark-zju

Differential Revision: D19717252

fbshipit-source-id: 075aaed642898a3649d40f9cdc9752539b0970aa
2020-02-17 14:52:31 -08:00
Durham Goode
734ce7959f py3: fix various lfs encoding issues
Reviewed By: quark-zju

Differential Revision: D19717255

fbshipit-source-id: d435a65e566b3a74399632e52c7cd99d0bba7f0a
2020-02-17 14:52:30 -08:00
Durham Goode
9d09b429f0 py3: migrate treedirstate to use utf8 for state and files
Summary:
treedirstate was using bytes for state and for file paths. This does
the appropriate conversions. Note, I don't use strings for all state in rust,
because it's a pain in the butt in some places. We're going to delete
treedirstate eventually anyone, so just I'm getting the test to pass for now.

Reviewed By: quark-zju

Differential Revision: D19715102

fbshipit-source-id: 4f9eac372bee7884d36aa19e3a3ed253392fa7dd
2020-02-17 14:52:29 -08:00
Mark Thomas
3690e8ab44 debugmutation: add time range limiting
Summary:
Make it possible to limit the time range of mutation info being displayed by hg
debugmutation.

Reviewed By: DurhamG

Differential Revision: D19904000

fbshipit-source-id: 365f54fdd861661961bba1a0ea96fce772623a23
2020-02-17 06:41:03 -08:00
Jun Wu
a8874af094 run-tests: clear RUST_BACKTRACE and RUST_LIB_BACKTRACE
Summary:
Some Mononoke tests test about the backtrace. Having the environment variables
set break those tests. Clear them.

Reviewed By: xavierd

Differential Revision: D19887219

fbshipit-source-id: 529a17282c40730ee95bffbed00070edd1f0823a
2020-02-13 14:50:51 -08:00
Jun Wu
4ec1633c15 test-fb-hgext-treemanifest-server: attempt to fix '[[' not found error
Summary:
This is an attempt to fix the following error:

```
 --- test-fb-hgext-treemanifest-server.t
+++ test-fb-hgext-treemanifest-server.t.simplecachestore.err
@@ -167,8 +167,9 @@
   $ hg push --to mybook
   pushing to ssh://user@dummy/master
   searching for changes
-  remote: prepushrebase.myhook hook exited with status 1
+  remote: prepushrebase.myhook hook exited with status 2
   abort: push failed on remote
+  remote: $TESTTMP/myhook.sh: 2: $TESTTMP/myhook.sh: [[: not found
   [255]
```

which I suspect is caused by a non-bash default shell.

Reviewed By: xavierd

Differential Revision: D19887222

fbshipit-source-id: b6fe5d89e4c41ff49fca86da927c4e702ed1e7c1
2020-02-13 14:50:51 -08:00
Jun Wu
594f668295 connectionpool: add a debug note saying connection being reused
Summary:
I'm going to change the connection pool logic but I'm not sure where it gets
used. This change exposes at least one test using it.

Reviewed By: xavierd

Differential Revision: D19872614

fbshipit-source-id: 4921b92c3fe3fd7ba1a72de17eef92604964eb2e
2020-02-13 12:16:21 -08:00
Jun Wu
004ebb0ddc tests: fix test-fb-hgext-lfspushrebase-verify-blobs
Summary:
Regressed since D19702533.  This test breakage is only visible if
lfs-test-server exists.

Reviewed By: farnz

Differential Revision: D19872608

fbshipit-source-id: 74ace3eb7363bb1bb773e6b448685e9a3874086f
2020-02-13 07:51:26 -08:00
Jun Wu
60e4f31be9 test-ssh: run contrib/hg-ssh with hg debugpython
Summary: The script does not run with the stock python since it depends on edenscm.

Reviewed By: farnz

Differential Revision: D19872953

fbshipit-source-id: 4c5b2d2935a0c9e8cf0a654f541600d7a4fd7211
2020-02-13 07:51:25 -08:00
Kostia Balytskyi
a3f1d6ae64 clienttelemetry: report multiple server_hostnames
Summary:
Right now, if the client establishes connection to more than one peer, the
last one to proces `clienttelemetry` wireproto command gets the honor to set
`server_realhostname`. This is not desirable. Specifically, when we have
`fallbackpath` set up for remotefilelog/treemanifest and the prefetch happens
after pulling a commit, we get the hostname of the fallbackpath server,
while losing the hostname of the original `getbundle` server.

Reviewed By: DurhamG

Differential Revision: D19837570

fbshipit-source-id: fdc41565a5dfe670df3caf3b034196c4b7bdf6d9
2020-02-13 00:48:25 -08:00
Durham Goode
e9042dfae4 py3: add test for unicode commit messages
Summary: Test that mercurial can accept a unicode commit message.

Reviewed By: xavierd

Differential Revision: D19838221

fbshipit-source-id: b6333e587004b358a3883db70e40d2f32af4da29
2020-02-12 09:10:12 -08:00
Jun Wu
1714cef464 remotefilelog: remove bgprefetch feature
Summary:
We don't use the feature in production. The main motivation is to remove the
flaky test. People wanting this feature can use normal hooks instead.

Reviewed By: xavierd

Differential Revision: D19830033

fbshipit-source-id: 0b1df7bb6c5de116ee27df4c38071912568d893e
2020-02-11 10:25:34 -08:00
Jun Wu
3279babd74 nointerrupt: remove the extension
Summary:
We never actually enabled it in production, and our new storage (ex. metalog,
indexedlog) are SIGKILL-safe. Only the changelog (revlog) might be subject to
double Ctrl+C issues. And we have debugfixcorrupt which can fix changelog
corruptions. So nointerrupt becomes less important.

The direct motivation is the test has been too flaky recently (and it's hard to
reproduce locally).

Differential Revision: D19830032

fbshipit-source-id: 87722d730fab49efbfd231772b1a5dddf8ec0d7b
2020-02-11 10:25:34 -08:00
Lukasz Piatkowski
542d1f93d3 Manual synchronization of fbcode/eden and facebookexperimental/eden
Summary:
This commit manually synchronizes the internal move of
fbcode/scm/mononoke under fbcode/eden/mononoke which couldn't be
performed by ShipIt automatically.

Reviewed By: StanislavGlebik

Differential Revision: D19722832

fbshipit-source-id: 52fbc8bc42a8940b39872dfb8b00ce9c0f6b0800
2020-02-11 11:42:43 +01:00
Jun Wu
3ac689c81f context: do not print verbose KeyError context if the exception is handled
Summary:
Attach the content to the exception object directly so if the exception is
handled, no verbose message will be printed.

Reviewed By: DurhamG

Differential Revision: D19817404

fbshipit-source-id: 9b79952559d07eb62bd7eb2398c6dd022ffe7b28
2020-02-10 22:21:44 -08:00
Durham Goode
f77ea84dda tests: update sparse tests
Summary:
D19776181 added more details, which breaks the tests. Let's update the
tests

Reviewed By: quark-zju

Differential Revision: D19795728

fbshipit-source-id: 80f6a47da1dd12c5d092d1f6e798a6c43eb02311
2020-02-07 12:45:29 -08:00
Jun Wu
3a8e77f15e run-tests: add --debug support for Python tests
Summary:
In D19581174 I made `--debug` trigger ipdb session for `.t` tests.
This diff adds similar feature for `.py` tests.

Reviewed By: DurhamG

Differential Revision: D19784795

fbshipit-source-id: 9118c74ea465320f15aa6ad5e1e04d8bc1a49966
2020-02-07 11:03:45 -08:00
Genevieve Helsel
0a2fd56bba py3 blame
Summary: plain hg blame for non-binary files

Reviewed By: quark-zju

Differential Revision: D19676073

fbshipit-source-id: 203b0421c6279ea1ca6bb6e253e7952e64b5edeb
2020-02-07 03:19:41 -08:00
Jun Wu
787cebfe91 context: print more details on fctx.data() key error
Summary:
Print out the name of the commit and the stack.
Hopefully this can help making debugging KeyErrors easier.

Reviewed By: DurhamG

Differential Revision: D19776181

fbshipit-source-id: 2eb985dd5355732a4d7728af68eb16173c48caa5
2020-02-06 15:56:26 -08:00
Xavier Deguillard
b192e0b54b demandimport: re-enable
Summary:
Partially backport upstream
https://www.mercurial-scm.org/repo/hg/rev/f81c17ec303c to enable lazy loading
of python code contained in edenscmdeps3.zip.

Also, temporarily disabling the demandimport on Python3 is a bit tricky, for
the reasons mentioned in the deactivated function. Thus, instead of using the
disabled function, let's use the deactivated one.

Reviewed By: DurhamG

Differential Revision: D19672866

fbshipit-source-id: c9e39ed044121d962af1cc46745bdec72629c579
2020-02-05 11:23:29 -08:00
Michael Devine
0dceab8e95 New custom immutable revision object to track commit conversions: conversionrevision
Summary:
The Mercurial convert extension passes around parameters to indicate a commit that needs to be converted from source to sink. For existing converters like Git, this is a simple 1:1 conversion: a commit in the source gets mapped to a commit in the sink, and so they use the source commit hash (sometimes called rev or version in the API) to represent the commit to be converted.

Our converter is much more complicated. Source commits get converted multiple times to account for different ways of mounting it into the destination file system and commit history. The commits are also coming from multiple source Git projects. This means that we need multiple pieces of data to represent a single commit conversion action.

Thus far, we've been trying to meet part of this need by using concatenated strings of (variant, commithash). This logic is breaking down as we add more fields. This commit adds a new immutable object called "conversionrevision" that represents the (variant, source commit hash, source project name, destination path) that is the unique identifier for the individual commit conversions we need to perform. This commit also includes logic for serializing and deserializing these objects as strings (useful because the converter seems to require commit IDs to be strings) and unit tests for all of the new logic.

Reviewed By: tchebb

Differential Revision: D19606867

fbshipit-source-id: 77815ca858f841d452874e95dfa3b351bafde306
2020-02-05 10:20:19 -08:00
Saurabh Singh
cbf6db3c58 py3: mark tests failing for Python 3 as requiring Python 2
Reviewed By: xavierd

Differential Revision: D19744346

fbshipit-source-id: b9defccfb396218b2d2fc4d4a2aee438468dcc60
2020-02-05 09:41:55 -08:00
Durham Goode
d0e41ff822 py3: fix test-remotenames-basic.t on Windows
Summary:
When I removed an hggit test case from this test last week, it caused
it to stop being skipped and therefore runs on Windows. The filterpwd magic
doesn't work there, and it's unnecessary, so let's just drop it.

Reviewed By: singhsrb, xavierd

Differential Revision: D19744329

fbshipit-source-id: 21f5c67d4fa7a61f14bbacd78756e5397fd6c819
2020-02-05 09:32:36 -08:00
Saurabh Singh
de006ecee1 test-rebase-inmemory-mergedriver: make the test output more stable
Summary:
Write output using `ui` object instead of using `print` to improve
robustness.

Reviewed By: xavierd

Differential Revision: D19743159

fbshipit-source-id: d0e8d581c65a79784b9843d691c4802ec37d5933
2020-02-05 08:50:54 -08:00
Saurabh Singh
8f5ec4b183 test-status-inprocess: make the test output more stable
Summary:
Write output using `ui` object instead of using `print` to improve
robustness.

Reviewed By: quark-zju

Differential Revision: D19738486

fbshipit-source-id: 4da80ce7efef44e9c5694ed71a55b7d64629166c
2020-02-04 20:36:42 -08:00
Durham Goode
d3227d34c2 py3: remove forced decoding of environment variable
Summary:
On python 2, os.environ is expected to be bytes, so let's remove the
forced decoding. This broke run-tests.py on Windows.

Reviewed By: singhsrb

Differential Revision: D19737218

fbshipit-source-id: d4782eea279275f57cc91bc412a2d74857002cc1
2020-02-04 17:31:45 -08:00
Carolyn Busch
d49c251d13 py3 iteritems -> pycompat.iteritems
Summary: More replacements of dict.iteritems with pycompat.iteritems(dict) for py3 compatibility.

Reviewed By: singhsrb

Differential Revision: D19704211

fbshipit-source-id: 544cb292c0241a293fc4ab83c3d9472dcf4328b6
2020-02-04 15:29:39 -08:00
Saurabh Singh
3d78cca814 util: remove redundant 'timed' function
Summary:
`timed` has been replaced by the `timefunction` in util.

I have also removed the existing usages because they seemed relevant only
during the development.

Reviewed By: quark-zju

Differential Revision: D19727919

fbshipit-source-id: 58c466f02ac2a5bf7096948b17b49ceb26fc1fd9
2020-02-04 12:33:40 -08:00
Jun Wu
3e0b781197 py3: only use binary stdin/stdout/stderr
Summary:
Drop stdoutbytes/stdinbytes. They make things unnecessarily complicated
(especially for chg / Rust dispatch entry point).

The new idea is IO are using bytes. Text are written in utf-8 (Python 3) or
local encoding (Python 2). To make stdout behave reasonably on systems not
using utf-8 locale (ex. Windows), we might add a Rust binding to Rust's stdout,
which does the right thing:
- When writing to stdout console, expect text to be utf-8 encoded and do proper decoding.
- Wehn writing to stdout file, write the raw bytes without translation.

Note Python's `sys.stdout.buffer` does not do translation when writing to stdout console
like Rust's stdout.

For now, my main motivation of this change is to fix chg on Python 3.

Reviewed By: xavierd

Differential Revision: D19702533

fbshipit-source-id: 74704c83e1b200ff66fb3a2d23d97ff21c7239c8
2020-02-03 18:26:57 -08:00
Aida Getoeva
38fca29eaf hg-py3: fix restack-multidest/t and fold
Reviewed By: xavierd

Differential Revision: D19700265

fbshipit-source-id: 557cec8388d5c7759d24e1b995f971e72f925a30
2020-02-03 17:05:35 -08:00
Aida Getoeva
acc0425925 hg-py3: make amend-next/prev work
Reviewed By: xavierd

Differential Revision: D19700028

fbshipit-source-id: 9aaab361058a2dfa34f4d0c9218c71c1654aaa8a
2020-02-03 17:05:34 -08:00
Aida Getoeva
201a17ca37 hg-py3: make amend-to work
Reviewed By: quark-zju

Differential Revision: D19673900

fbshipit-source-id: cfdc985716aec23335eeddef517855be65505576
2020-02-03 10:04:38 -08:00
Jun Wu
a8f232e0ab py3: drawdag: fix some types
Summary: This fixed using drawdag to create merge commits.

Reviewed By: xavierd

Differential Revision: D19697893

fbshipit-source-id: fac4278a54d2cf2eb2b9d8154a13edd29e1a510a
2020-02-03 09:54:12 -08:00
Simon Farnsworth
ad40d8567f py3: fix up matchers to exclusively use unicode
Summary: Matchers were mixing str and bytes - use decodeutf8 on the place using bytes, and enable all the tests that now pass.

Reviewed By: quark-zju

Differential Revision: D19679076

fbshipit-source-id: 2b90cfbf690b2365a1302efd9db72347a295c977
2020-02-03 08:00:11 -08:00
Durham Goode
14ec2d4b34 py3: enable more tests
Summary: These now pass

Reviewed By: farnz

Differential Revision: D19678869

fbshipit-source-id: 68601ff6a6d33b13947210eecfecd999aa2ddb1a
2020-02-01 10:39:39 -08:00
Simon Farnsworth
eb5e4fb57e py3: fix share command
Summary: The share command was reaching into the filesystem directly - use the right utility functions instead

Reviewed By: quark-zju

Differential Revision: D19672980

fbshipit-source-id: a14323fd5419c3ea00d9c009b9a77f63862a7b2a
2020-01-31 22:13:04 -08:00
Mark Thomas
a6b159822f py3: fix escaping test-unified-test.t
Summary:
Python 3 is more strict about bad escape characters.  As far as I can tell,
this was always wrong, and when corrected, works both in Python 2 and Python 3.

Reviewed By: quark-zju

Differential Revision: D19673184

fbshipit-source-id: b8b358327db8ce2e51761f8f98784bdd4b396423
2020-01-31 22:00:59 -08:00
Durham Goode
d37a246d60 py3: use bytes for stdin for hg serve
Summary: hg serve works strictly with bytes, so let's expose it for stdin.

Reviewed By: quark-zju

Differential Revision: D19672836

fbshipit-source-id: 6abc5385daea81c584a89f19a568e42e4afad48a
2020-01-31 18:39:41 -08:00
Carolyn Busch
ba8ac287b8 py3 sshserver-test
Summary: Translate between bytes and unicode in sshserver to make test-sshserver pass.

Reviewed By: farnz

Differential Revision: D19672378

fbshipit-source-id: 7e1c0bc2d6fc03fac6ebcf54764862e3ed743f7e
2020-01-31 18:39:40 -08:00
Aida Getoeva
ad097305f5 hg-py3: make metaedit command work
Reviewed By: quark-zju

Differential Revision: D19666536

fbshipit-source-id: e8d02dd6ff6ab73efd94002b83319cbfe506c21f
2020-01-31 18:29:01 -08:00
Simon Farnsworth
d1268e8871 py3: ratchet up passing tests
Summary: These four tests pass on master. Let's enable them so that CI keeps us honest

Reviewed By: markbt

Differential Revision: D19672282

fbshipit-source-id: 2d45c3f9840c7323b7bfae8bbd89c4b7ec95f49d
2020-01-31 18:23:58 -08:00
Xavier Deguillard
db4849a0d6 tests: enable passing tests in python3
Summary: These are passing, let's enable them.

Reviewed By: quark-zju, singhsrb

Differential Revision: D19676094

fbshipit-source-id: bcb363382d48a93ac62dceab2dd6349b910bb51a
2020-01-31 18:12:14 -08:00
Xavier Deguillard
fd2c463b9a rebase: decode rebasestate before parsing it
Summary:
This file contains text data, let's decode it before doing anything else with
it.

Reviewed By: quark-zju

Differential Revision: D19675385

fbshipit-source-id: 8aae08c2400dd7d76c8678d5312bab060563e0ba
2020-01-31 18:12:14 -08:00
Xavier Deguillard
06fa75f637 tests: use vfs.writeutf8
Summary: This is the right method to write plain strings data to files.

Reviewed By: quark-zju

Differential Revision: D19675386

fbshipit-source-id: 1f939f79294cbc45f56944058649c384b674b880
2020-01-31 18:12:14 -08:00
Saurabh Singh
1891591abc unicode: consistently use 'utf-8' everywhere
Summary:
We generally use 'utf-8' but are using 'utf8' at some places. This
diff changes to using 'utf-8' consistently everywhere.

Reviewed By: farnz

Differential Revision: D19674111

fbshipit-source-id: 3be42859a180ded1c234b805259f086f9531ba18
2020-01-31 17:34:53 -08:00
Xavier Deguillard
6f3af2ab10 tests: remove iteritems
Summary: The method doesn't exist in python3, let's simply replace it with items.

Reviewed By: quark-zju

Differential Revision: D19673674

fbshipit-source-id: b17eef7d820ae38db3fea1d457b0b8bb409f1b86
2020-01-31 17:31:23 -08:00
Zeyi (Rice) Fan
fa54b36b93 fix Windows tests
Summary: This fixes the Windows build failure we are seeing. Apparently Python 2 on Windows does not like unicode type in `os.environ`

Reviewed By: markbt

Differential Revision: D19672308

fbshipit-source-id: b45c1ccf47bdd46dc31d6c980d0e70dd2e084c8f
2020-01-31 16:53:12 -08:00
Saurabh Singh
2f3657f342 test-unbundlereplay: fix the test
Reviewed By: farnz

Differential Revision: D19673662

fbshipit-source-id: e2b05e9efb449ffa1af24c5b221eca1e97873b13
2020-01-31 16:47:43 -08:00
Simon Farnsworth
9266779248 py3: tools to quickly remove the py2 only marking from tests
Summary:
Simple tools, based on D19664298, that use the JSON report to enable py2 only tests for py3 testing, and revert the changes to those tests that fail.

update-successes.py is just xavierd's original code

Use as needed to enable tests on py3 after debugging, A recommended workflow is in the test plan

Reviewed By: singhsrb

Differential Revision: D19670838

fbshipit-source-id: fc525941cb010c9038c1f73d89913420e0c79981
2020-01-31 16:35:39 -08:00
Mark Thomas
df702d9cb6 py3: encode communication with the worker
Reviewed By: quark-zju

Differential Revision: D19665152

fbshipit-source-id: d4cda1e48bdf0fe64047e12d3011c81b501df113
2020-01-31 15:57:38 -08:00
Mateusz Kwapich
d5a207cf18 py3: fix more diff tests
Summary: This diff enables more test while hopefully not breaking anything

Reviewed By: markbt

Differential Revision: D19671316

fbshipit-source-id: 76ecd22a094c0a40b9724a3070a01e5d294888f3
2020-01-31 15:40:54 -08:00
Xavier Deguillard
179aa8ac28 tests: make test-dispatch.py python3 compatible
Summary: Writing to a file opened in "b" mode needs byte strings.

Reviewed By: sfilipco

Differential Revision: D19668666

fbshipit-source-id: 9e8670fa080cc2a7fc611083a4ee2305d8262a3a
2020-01-31 15:31:03 -08:00
Mark Thomas
f00c23e42e py3: fix encoding in test-visibility.t
Summary: The test itself needs to ensure it decodes the visibleheads file.

Reviewed By: quark-zju

Differential Revision: D19666640

fbshipit-source-id: 999ab3396b0afc7bd86db9ae1ba126730ee3f02d
2020-01-31 15:27:31 -08:00
Xavier Deguillard
299212da50 checkmessagehook: make it python3 compatible
Summary:
The commit message should already be a utf8 string. Make sure that when it is
read from a file, we decode it properly.

Reviewed By: sfilipco

Differential Revision: D19666371

fbshipit-source-id: ee24fe33b5aaf1ede54286979c9523cedd901b3a
2020-01-31 15:21:55 -08:00
Simon Farnsworth
ee586e769a fix test-unified-test.t on python 2
Summary: D19663298 changed the return code, making this test fail

Reviewed By: singhsrb

Differential Revision: D19669105

fbshipit-source-id: c105cd130dcae3889946180761b1f51f4daae527
2020-01-31 14:20:54 -08:00
Durham Goode
1e3ec1859e py3: enable some -t.py tests
Summary: These now pass.

Reviewed By: xavierd

Differential Revision: D19669905

fbshipit-source-id: b141ea6baefa6a6eb92a0c8d70c46214ea24446d
2020-01-31 13:55:11 -08:00
Durham Goode
aac5ebea17 py3: remove #require py2 from passing tests
Summary: These now pass

Reviewed By: xavierd

Differential Revision: D19669584

fbshipit-source-id: dd4d374c3b373367138408ae86563ae44849690c
2020-01-31 13:46:59 -08:00
Xavier Deguillard
182e362070 tests: enable some test on Python3
Summary: These are newly passing, let's enable them.

Reviewed By: quark-zju

Differential Revision: D19668516

fbshipit-source-id: d979631203e14ce6e2ec0ab0c45773ee4846ba71
2020-01-31 13:27:46 -08:00
Durham Goode
e985d51e02 py3: update simplemerge conflict logic to use bytes
Summary: Patches are bytes, so the lines we add to them need to be bytes

Reviewed By: mitrandir77

Differential Revision: D19668850

fbshipit-source-id: cb521f71d927dbe1cbe3287be37123b609889846
2020-01-31 13:12:15 -08:00
Durham Goode
a876c6a13b py3: fix pushkey encoding by removing local encoding
Summary:
Now that bundle2 has strings everywhere, pushkey needs to also handle
encoding correctly. Previously it used local encoding, which seems strange.
Let's drop the encoding entirely since we're only dealing with since we're only dealing with utf8 string and bytes.

Reviewed By: farnz

Differential Revision: D19665894

fbshipit-source-id: ed054ab25636ac52de646329f26681ae843b6de3
2020-01-31 13:12:13 -08:00
Mateusz Kwapich
ad3f789bf9 py3: supress the write return value
Summary:
`>>> open(file).write(data)` is a common patten for writing files across the
tests. In py3 such statement return the number of bytes written in py2 the
output is none. Let's make it None in py3 as well.

Reviewed By: xavierd

Differential Revision: D19666339

fbshipit-source-id: 5424287f85f34f3aef2d1596bb476d622464564a
2020-01-31 13:00:23 -08:00
Mateusz Kwapich
e2dc4e8014 diff: update for py3
Summary:
All diff functions are (bytes, bytes) -> bytes to preserver
the original file encoding.

Because of that I had to add ui.writebytes output function that accepts
bytes for terminal output.

Reviewed By: farnz

Differential Revision: D19656673

fbshipit-source-id: b9a1e4361e825fc8c2313e8402c2bbe00f490dd4
2020-01-31 13:00:23 -08:00
Xavier Deguillard
bf8fbe7d7f grep: make it run with python3
Summary:
The input/output of a subprocess is bytes, let's encode/decode when
writing/reading from it.

Reviewed By: farnz

Differential Revision: D19665636

fbshipit-source-id: 840f6b7a0edbedb7e7de5a65eacab9e1a7f78864
2020-01-31 12:47:04 -08:00
Durham Goode
c572f1e344 py3: update test-argspans.py
Summary:
test-argspans is an awful test that includes it's own line numbers in
the test assertions. When the imports were changed in D19655148, these needed to
be updated.

Reviewed By: quark-zju

Differential Revision: D19664131

fbshipit-source-id: cdd03be2fbbc9d13ac3047f9565a1f68284e9cf0
2020-01-31 10:56:31 -08:00
Durham Goode
850c78d8c9 errors: drop quotes around OSError paths
Summary:
Python 3 has changed which errors are OSError vs IOError. We have
slightly different formatting which makes the test awkward to be py2 and 3
compatible. Let's make the formats the same.

Reviewed By: quark-zju

Differential Revision: D19663964

fbshipit-source-id: 892461049b61d648431f300bea0da2f6f1c70066
2020-01-31 10:56:30 -08:00
Xavier Deguillard
77e09b4e47 test-fb-hgext-extutil.py: fix some python3 warning
Summary:
This is reported while running with buck. assertEquals is renamed to
assertEqual

Reviewed By: quark-zju

Differential Revision: D19665159

fbshipit-source-id: cb7c25901005c6a97f2c703c4773ea01232943b1
2020-01-31 10:53:52 -08:00
Xavier Deguillard
e0e01cbc81 bundle2: backout D19656773
Summary: This broke a bunch of tests. Revert it and re-enable all the tests.

Reviewed By: DurhamG

Differential Revision: D19665042

fbshipit-source-id: c3c17e3ac7e2ea028be5b5836bc8349cdf56184e
2020-01-31 10:48:19 -08:00
Xavier Deguillard
467f4aef45 tests: mark python3 tests as passing
Summary:
Ran ./run-tests.py --json and used the following script:

  import json
  import subprocess

  with open("report.json", "r") as f:
      tests = json.load(f)
      for name, t in tests.items():
          if t["result"] == "success":
              print("%s successful" % name)
              subprocess.run("sed -i '/#require py2/d' %s" % name, shell=True)
              subprocess.run("sed -i '/require.*py2/d' %s" % name, shell=True)

Reviewed By: singhsrb

Differential Revision: D19664298

fbshipit-source-id: fa67c7c7abd110c9f0df9345daf09f2792aacd44
2020-01-31 10:13:45 -08:00
Xavier Deguillard
3545d26208 tests-rustthreading.py: the thread is renamed to _thread
Summary: The module no longer exist in Python3, it has been renamed.

Reviewed By: quark-zju

Differential Revision: D19663426

fbshipit-source-id: a805e7fa3d15335a0be4f6a8d8ae096328470728
2020-01-31 10:13:45 -08:00
Xavier Deguillard
9643c72d6e run-tests.py: exit 80 on skip
Summary: This allows unittestify to properly report skipped tests.

Reviewed By: quark-zju

Differential Revision: D19663298

fbshipit-source-id: a95d28731fbf324a6f772e9d0b1dd84f2d5968d6
2020-01-31 10:13:44 -08:00
Simon Farnsworth
5232dcf9d1 py3: make .py tests continue to run on python 2
Summary:
Use sed to convert testutil.ddot requires to hghave.

ignore-conflict-markers

for test-simplemerge.py

Reviewed By: simpkins

Differential Revision: D19658355

fbshipit-source-id: afae73eb1e43ead79514dfaf9f911f51ac25972e
2020-01-31 00:18:22 -08:00
Zeyi (Rice) Fan
92f6f35e7a mark all tests requiring Python 2
Summary:
This diff marks **ALL** mercurial tests requiring Python 2 feature.

After you fixes some tests, simply remove the `py2` feature requirement and that tests will be continuously run after your diff is landed.

To bypass this feature requirement, run the tests command with `HGTEST_FORCE_PY2=1`. For example:

```
HGTEST_FORCE_PY2=1 buck test //eden/scm/tests:hg_run_tests
```

or

```
HGTEST_FORCE_PY2=1 python run-tests.py
```

----

Basically this diff are created with the following commands:

```
$ sed -i 's/import feature\(.*\)$/import feature\1\n\nfeature.require(["py2"])/' test-*-t.py
$ sed -i '1s/^/#require py2\n/' test-*.t
$ ls | grep -P "^test.*(?<\!-t)\.py$" > list && vim -p $(cat list)
# manually adding feature requires for these Python tests.
```

(Note: this ignores all push blocking failures!)

ignore-conflict-markers

Reviewed By: singhsrb

Differential Revision: D19655148

fbshipit-source-id: 985e3ccb4010cc559049f1d89f8909bc2d9b5e20
2020-01-30 18:49:21 -08:00
Zeyi (Rice) Fan
cdd601bfac change py3k feature to py2
Summary:
This is used in D19655148 to skip all the tests that are not passing in Python 3.

(Note: this ignores all push blocking failures!)

Reviewed By: farnz

Differential Revision: D19655164

fbshipit-source-id: 1a0d26926aa1b764077fa1e5bdddf853621a54f1
2020-01-30 18:49:20 -08:00
Adam Simpkins
ebf7df9c50 fix the relpath() template to work in hg status
Summary:
When used in an `hg status` command the `relpath()` template function would
throw an unhandled `KeyError` when it tried to access `ctx` in the template
mapping.  This field is only present in `hg log` templates, and is not present
in `hg status` templates.

This updates the `relpath()` template function to look for `repo` in the
template mapping instead.  I also updated the `hg status` code to pass in the
`repo` value now.  The `hg log` code already passes in this field.

Reviewed By: quark-zju

Differential Revision: D19568463

fbshipit-source-id: 3e1c1d6571c73e4b24bfce22ea28f57679d39846
2020-01-30 18:26:36 -08:00
Xavier Deguillard
781d0e04ad test-check-code.t: make it run on python3
Summary:
The sources are opened in byte mode, therefore the regexp needs to be a byte
one.

Reviewed By: singhsrb

Differential Revision: D19655928

fbshipit-source-id: 79b54cc5016dc47aee4fe6cf053f28bf04ba630c
2020-01-30 18:12:30 -08:00
Xavier Deguillard
1ddfa14e5a tests: fix encoding issue in test-commit-multiple.t
Summary: The file is opened in binary mode, we need to write bytes into it.

Reviewed By: quark-zju

Differential Revision: D19655103

fbshipit-source-id: a2d059adff72db6c65e2933b3c64804325e51a71
2020-01-30 18:12:28 -08:00
Durham Goode
8c211e5224 py3: fix stdout/stderr in dott tests
Summary:
dott tests rig up a custom stdout/stderr. In Python 3 we expect them to
be strings, so we need to use an appropriate io object.

Unfortunatly upstream already created a pycompat.stringio object which uses
bytes for both python 3 and 2, so I had to use a new name for now.

Reviewed By: quark-zju

Differential Revision: D19653469

fbshipit-source-id: a529df5a2ab179c105fa441c4503ed6606e77543
2020-01-30 18:00:34 -08:00
Zeyi (Rice) Fan
a634526801 some fix for run-tests
Summary:
Fix some common errors when run `run-tests` in Python 3.

shlib would be using `str` for stdin/stdout instead of bytes as most of the code in Python 2 operates with that assumption. Getting it to `bytes` will take some work.

Reviewed By: DurhamG, quark-zju

Differential Revision: D19649475

fbshipit-source-id: 1f0190fce4df9a530246774fd17cdfc2d7974a65
2020-01-30 17:24:32 -08:00
Zeyi (Rice) Fan
92e9ae6eea convert print statements in tests
Summary: These are Python 2 style print statements not surfaced during the tests. Mostly because they are used in `hg dbsh` or invoked with Mercurial's Python interrupter. So I did a ripgrep to find these statements and convert them into functions.

Reviewed By: farnz

Differential Revision: D19612968

fbshipit-source-id: 1b07e9c789ab834be692ba00fd58c575bc4a17bf
2020-01-30 17:24:32 -08:00
Xavier Deguillard
cb64df7197 tests: @command expects str command names
Summary: This change all the tests to use strings as the command names.

Reviewed By: simpkins

Differential Revision: D19649479

fbshipit-source-id: 4b2cb9b3af73a7508ef359ee3c407d04a39c7893
2020-01-30 14:55:55 -08:00
Xavier Deguillard
b863a561a4 pytreestate: use PyPath where necessary
Summary:
A previous diff missed these PyPath. As a bonus, replace most of the PyObject
into proper Rust types.

Reviewed By: quark-zju

Differential Revision: D19646139

fbshipit-source-id: a3b55e5a802d8bbef86e9a9431f605bb4e284b32
2020-01-30 14:55:54 -08:00
Zeyi (Rice) Fan
b58fe35549 make run-tests.py py3 compatible
Summary: This diff makes `run-test.py` compatible with Python 3, so we can run this tests both in Python 3 and 2.

Differential Revision: D19611680

fbshipit-source-id: 97571cca7e1310e482ac8c03af73eb345ab825c1
2020-01-29 17:07:33 -08:00
Zeyi (Rice) Fan
e214ad8df9 testing utilities py3 compatibility
Summary:
We temporarily pin these test tools to run with Python 2 so the tests can pass no matter if it is run with 3 or 2.

This diff also makes the fake biggrep client to be Python 3 compatible.

Reviewed By: farnz

Differential Revision: D19611681

fbshipit-source-id: 0c980165934899902b152e27a0a444d6a6c9eb2f
2020-01-29 17:07:32 -08:00
Zeyi (Rice) Fan
f0e50448b4 make the rest of the tests py3 compatible
Summary: This diff converts the rest of our tests to be compatible with Python 3. There are still a few tests are not fully compatible with Python 3 yet and I'll address these individually as they require major modifications.

Reviewed By: markbt

Differential Revision: D19608299

fbshipit-source-id: 3779dd0d4641ce8470598fa4909306317cf777d8
2020-01-29 17:07:32 -08:00
Jun Wu
c642e72b3e test-rebase-moved: fix up the test
Summary: I think my editor eat the spaces incorrectly. Fix it.

Reviewed By: xavierd

Differential Revision: D19630482

fbshipit-source-id: 3a8b94cdb269b045f678e07d0f21975effbaf7f9
2020-01-29 16:25:02 -08:00
Durham Goode
654ed5e4b1 remotenames: prefer picking default paths
Summary:
S194477 was caused by a config change adding a custom path to
repositories, where the path had the same url as default. This caused all the
remotebookmarks to be associated with the new path instead of default.

This is subtle and undesirable. Let's make it so that the default path takes
precedence.

I also deleted a hggit test because it was causing the entire test to be skipped
when dulwich wasn't available.

Reviewed By: quark-zju

Differential Revision: D19627711

fbshipit-source-id: 55b3ce94f18a26ccb9471c8e96a584d3087dbb82
2020-01-29 15:31:16 -08:00
Jun Wu
77a51f0e3b merge: allow specifying a customized rename script
Summary:
Provide an option to run an external script that calculates the rename
destination. This is especially helpful for cases where development happened in
another branch and *directory* and want to merge changes back.

For example, we recently had an experimental `scm3` branch that copies files
from `scm` to `scm3` to try out changes:

  o master <-- rebase destination
  |
  o (changes in scm/)
  :
  | o (changes that need to backport to scm/) <-- rebase source
  | |
  | o (changes in scm3/ that got implemented differently in scm/)
  | :
  | o (copy scm/ to scm3/ for experiments)
  |/
  o

This allows `--config experimental.rename-cmd='sed "s#scm3/#scm/#"'` to be
used for the above case.

While working on this feature, I noticed a bug that if the "copy" information
is recorded, rebase might lose changes. I added a test to track that bug.

Reviewed By: mitrandir77

Differential Revision: D19609868

fbshipit-source-id: 94462889d3ce9214b48fac793852d16aeacecc77
2020-01-29 14:27:11 -08:00
Mateusz Kwapich
13aee5fa2a make all config function params strings
Summary: We want unicode configs.

Reviewed By: quark-zju

Differential Revision: D19612400

fbshipit-source-id: ec9f863c3203be7c956dcd97c735d74a11adce35
2020-01-29 12:09:37 -08:00
Durham Goode
a4453150d0 py3: migrate unittestify to python3
Summary: Fixes some minor issues with unittestify to make it work in python 3.

Reviewed By: quark-zju

Differential Revision: D19613469

fbshipit-source-id: 00ae212d606fbef298eb5467e225341512db1290
2020-01-29 10:11:25 -08:00
Jun Wu
4ef1f31745 py3: util: fix some encoding issues
Summary:
Make sure file content and wireproto buffers are using bytes.
Added a utf8 helper function.

Reviewed By: farnz

Differential Revision: D19613686

fbshipit-source-id: 5d67ce48246dc8c3cc47041f461e454c46bc67f9
2020-01-29 07:45:12 -08:00
Jun Wu
21b2a06c6f py3: vfs: add helper functions to get utf-8 content directly
Summary: Those will simplify some use-cases.

Reviewed By: farnz

Differential Revision: D19613121

fbshipit-source-id: 85ac4fa0c86afb84e0c9fb78950d3da2c93aa967
2020-01-29 07:45:10 -08:00
Genevieve Helsel
ce2bf270b3 fix_map
Summary: Python 3 map call doesn't return list, so wrap in list.

Reviewed By: mitrandir77, xavierd

Differential Revision: D19588352

fbshipit-source-id: 8556f4783f9bedb8a74ec0e99ff226ff96f387a9
2020-01-28 18:24:56 -08:00
Zeyi (Rice) Fan
09d7bb259c make part of the tests Python 3 compatible
Summary:
Most of these tests use `file` instead of `open` for opening files, which is removed in Python 3. And when we open files in byte mode, Python disallows writing `str` into such files, so we add `b` prefix to write actual bytes instead.

There are some other minor problems like reading from `sys.stdin` gives you `str` while expecting `bytes`. The solution is to use `sys.stdin.buffer` instead. However, Python 2 does not have `sys.stdin.buffer` so we have to do a version check to provide compatibility.

Reviewed By: quark-zju

Differential Revision: D19606357

fbshipit-source-id: e9177134294f03af8b581230a57902c3435b319a
2020-01-28 16:42:11 -08:00
Mark Thomas
82715fd2ea py3: iter{keys,values,items} -> pycompat.iter{keys,values,items}
Reviewed By: quark-zju

Differential Revision: D19608323

fbshipit-source-id: dd186ef16d6422a56af41fcaa850d9838ae9a240
2020-01-28 16:27:28 -08:00
Genevieve Helsel
e0fac9b23c import print_function to use print as function in python2
Summary: in python3, print becomes a function, import print_fuction to use in python 2.(ran fix_print_with_import)

Reviewed By: lisroach, quark-zju, sfilipco

Differential Revision: D19588356

fbshipit-source-id: b7cf519058ae3909ba7813618719bbd09800e73a
2020-01-28 13:57:59 -08:00
Xavier Deguillard
d087e39a34 pypathmatcher: use PyPath instead of PyByte
Reviewed By: DurhamG

Differential Revision: D19592136

fbshipit-source-id: 5db6ca629cd920d52ffbf7f10963c44c8f7b203d
2020-01-28 12:40:48 -08:00
Zeyi (Rice) Fan
8eca037626 make test-commit-interactive.t py3 compatible
Summary: This test tests Mercurial printing the correct encoding when the system is set to Japanese locale (CP932). The escape.py used in this test isn't Python 3 compatible due to byte-related operations. This diff makes it Python 3 compatible.

Reviewed By: quark-zju

Differential Revision: D19592535

fbshipit-source-id: 114dfcb004805045163be4a636ac703b4d24ea32
2020-01-28 11:24:25 -08:00
Zeyi (Rice) Fan
26859e4907 make test-check-execute.t py3 compatible
Summary: Apparently we tried to open an image file directly with `open()`. This does not work in Python 3 as it tries to read the file as string instead of bytes.

Reviewed By: farnz

Differential Revision: D19589327

fbshipit-source-id: 9c6388b704860f1f5dec199562741ac6e191d928
2020-01-28 11:24:24 -08:00
Zeyi (Rice) Fan
9015eda650 make test-help.t py3 compatible
Reviewed By: quark-zju

Differential Revision: D19589104

fbshipit-source-id: 0db455b2939643c6aa2d7b1ba68ad4bae376bbf4
2020-01-28 11:24:24 -08:00
Zeyi (Rice) Fan
76e325e30d make f py3 compatible
Reviewed By: sfilipco

Differential Revision: D19588237

fbshipit-source-id: 12130d67e59d8d488afb244c89673bd6c0075181
2020-01-28 11:24:24 -08:00
Zeyi (Rice) Fan
c0772d015f make printenv.py py3 compatible
Reviewed By: sfilipco

Differential Revision: D19588063

fbshipit-source-id: 78f2b433bb6a065e63241912b4cc0cf78bcbdd13
2020-01-28 11:24:23 -08:00
Zeyi (Rice) Fan
a334e11c88 make test-clone.t py3 compatible
Reviewed By: sfilipco, singhsrb

Differential Revision: D19587714

fbshipit-source-id: 574e6b7236b0954b621a8e15a36f2f1e50243418
2020-01-28 11:24:23 -08:00
Zeyi (Rice) Fan
f2690f21eb make dummyssh py3 compatible
Summary: This makes the `dummyssh` script Python 3 compatible so we can run it with Python 3 in tests

Reviewed By: sfilipco

Differential Revision: D19587078

fbshipit-source-id: 134b01f4d5e968cd9600c9358c7230a56e11f163
2020-01-28 11:24:23 -08:00
Genevieve Helsel
f0a27646b5 change maxint -> maxsize
Summary: ran print_function, maxint -> maxsize (maxint depreciated)

Reviewed By: lisroach, quark-zju

Differential Revision: D19588359

fbshipit-source-id: fc66b388a1775553a4b8e30a56fd1483800693d6
2020-01-28 10:37:53 -08:00
Jun Wu
a0bd794d55 run-tests: make --debug add debugger settings
Summary: This makes --debug more useful - crashes in tests trigger ipdb sessions.

Reviewed By: mitrandir77

Differential Revision: D19581174

fbshipit-source-id: 770c7b054dfce88082b67a9347ecaeb24d8583bc
2020-01-27 19:37:21 -08:00
Kostia Balytskyi
6bf47a9f5a hgtime: fix corner case of date range parsing
Summary: The docs promise that both `<` and `>` bounds are inclusive, so let's fix that.

Reviewed By: markbt

Differential Revision: D19580840

fbshipit-source-id: 13770a8e9351fe62f58e9a701b526a167752543a
2020-01-27 09:37:00 -08:00
Mark Thomas
d35692711e tests: convert test-rebase-obsolete to mutation
Summary:
Add `test-rebase-mutation.t`, based on `test-rebase-obsolete.t`, but instead
testing specifically for mutation and visibility behaviour.

Reviewed By: xavierd

Differential Revision: D19549473

fbshipit-source-id: c993686eab47985737eef17ab0f52f31d0929159
2020-01-24 14:47:39 -08:00
Mark Thomas
c0e72db0ad tests: enable mutation and visibility in some rebase tests
Summary:
Enable mutation and visibility for the existing tests that use evolution.

Excludes `test-rebase-obsolete.t` which specifically targets obsmarkers - this
will be converted to a new test in D19549473.

Reviewed By: quark-zju

Differential Revision: D19502220

fbshipit-source-id: 70b2828b60220c6887a6210e91bed01c2809cc51
2020-01-24 14:47:39 -08:00
Mark Thomas
398e175762 visibility: ensure visibleheads and store requirements are copied on clone
Summary:
When cloning a repo, ensure the store requirements and visibleheads files are
included in the clone.

Reviewed By: quark-zju

Differential Revision: D19502224

fbshipit-source-id: e3ead586fb1fe10def02d55e33810643c0c78bc8
2020-01-24 14:47:38 -08:00
Mark Thomas
39f8b3109f visibility: add visibleheads to journaled files
Summary:
The visibleheads file should be journaled like the other state files, so that
it is rolled back if a transaction aborts.

Reviewed By: quark-zju

Differential Revision: D19502226

fbshipit-source-id: c2b8d926ce97211411ca01f05e83e62cb77625b9
2020-01-24 14:47:37 -08:00
Lukas Piatkowski
8c7de41d8c arc/licenselint: add license linting for lua and sql
Summary: The fbcode/linttool has been updated to support lua and sql here D19467627, so updating arc rules to cover the new extensions

Reviewed By: zertosh

Differential Revision: D19534326

fbshipit-source-id: 4e615653acedcdf2da88e7dc4b443ad22af1324f
2020-01-24 06:13:28 -08:00
Stefan Filip
2dc14cf9a6 manifest: use Rust Tree Manifest by default
Summary:
The Rust Manifest is deployed practically everywhere.
Removing the C++ code from being compiled in Mercurial along with all of the cstore extension.

Reviewed By: quark-zju

Differential Revision: D19543248

fbshipit-source-id: d632e171175e6866563c1aa0808a099b67bd937d
2020-01-23 16:06:51 -08:00
Xavier Deguillard
8041ff9e82 bisect: remove revision number in output
Summary: Revision numbers are deprecated, let's not print them in the bisect output.

Reviewed By: DurhamG

Differential Revision: D19539678

fbshipit-source-id: 29bca3ee38cb390bdef8dd88cb912aa3dc452065
2020-01-23 15:54:00 -08:00
Xavier Deguillard
31b266d32c graft: remove revision number in output
Summary: Revision number are deprecated, remove it from the user output.

Reviewed By: DurhamG

Differential Revision: D19539679

fbshipit-source-id: 7fc618e832e0e5bb3464d2ed04967b062b6f182a
2020-01-23 15:53:59 -08:00
Xavier Deguillard
fe8855e9fb hgmain: initialize fbinit
Summary:
The memcache code assumes it's initialized, let's actually do it.

The test change is required due to fbinit installing its own SIGTERM handler
that shows a backtrace. Installing our own SIGTERM handler makes it closer to
what Mercurial does already.

Reviewed By: quark-zju

Differential Revision: D19518698

fbshipit-source-id: bc8c2311e65c9c00678756abae3979ccda4453ea
2020-01-23 08:57:22 -08:00
Stanislau Hlebik
f8ba0c99a5 infinitepush: introduce infinitepushbookmark path
Summary:
Previously we had infinitepush path which was preferred over a default path when a
specific revision was pulled or updated to (i.e. "hg pull" would use
paths.default, but "hg pull -r HASH" would use paths.infinitepush if this path
is set in the config).

I'd like to have infinitepushbookmark path which will be preferred for all
cases except for a single commit pulls.

Reviewed By: mitrandir77

Differential Revision: D19513490

fbshipit-source-id: 7f8b809f937aa2e082c2e9cd382709c6db619a4f
2020-01-22 14:05:38 -08:00
Jun Wu
fcaef9ed7e sparse: make sparse profile tracking cheaper
Summary:
Reading all the sparse profiles can be very expensive.
This changes the format we log to the cloud. It seems nobody is depending on the old format.

Reviewed By: wlis

Differential Revision: D19517306

fbshipit-source-id: 256e78acd4c24aceb533aa4d66b90ecf885fcbcd
2020-01-22 13:41:34 -08:00
Saurabh Singh
17ad617625 purge: move extension to core
Reviewed By: quark-zju

Differential Revision: D19506964

fbshipit-source-id: 173918346e90fadbaa52155786aa30fbd4951c8c
2020-01-21 20:49:08 -08:00
Mark Thomas
4958c4e342 tests: update tests-fb-*.t to use new tinit features
Reviewed By: quark-zju

Differential Revision: D19457679

fbshipit-source-id: d1010f0d2eee69ecdee5c3feba772bd3684d4cec
2020-01-20 02:45:17 -08:00
Mark Thomas
d2730c3ba0 tests: update tests-[r-x]*.t to use new tinit features
Reviewed By: quark-zju

Differential Revision: D19457676

fbshipit-source-id: 5bbab22ff0d98b725b63b906864037fae5fa5171
2020-01-20 02:45:16 -08:00
Mark Thomas
633382de11 tests: update tests-[i-p]*.t to use new tinit features
Reviewed By: quark-zju

Differential Revision: D19457680

fbshipit-source-id: 2be941f22525ed2d9f5a1aa3c92af38fb612eb46
2020-01-20 02:45:16 -08:00
Mark Thomas
b361a8d1bd tests: update tests-[a-h]*.t to use new tinit features
Reviewed By: quark-zju

Differential Revision: D19457677

fbshipit-source-id: 9f121837dfc6bf98ff4525c6535496b292409844
2020-01-20 02:45:15 -08:00
Mark Thomas
b654a9aae5 tests: use disable treemanifest in place of setconfig
Summary: Use `disable treemanifest` in place of `setconfig extensions.treemanifest=!`

Reviewed By: quark-zju

Differential Revision: D19457678

fbshipit-source-id: 47c8b3c4f4ed5cfc97275ca67afab4a86ffe7f0d
2020-01-20 02:45:15 -08:00
Mark Thomas
212cec117b tinit.sh: add configure for setting up standard configurations
Summary:
Add a new `tinit.sh` function: `configure`, which takes over from the
feature-enabling aspect of `enable`.

This provides a few features that are configurable:

  * `dummyssh` sets `ui.ssh` to `dummyssh`.
  * `mutation` and `mutation-norecord` enable mutation and visibility tracking
  * `evolution` enables evolution and disables mutation and visibility.
  * `noevolution` disables evolution, as well as mutation and visibility.

Since `enable` now only refers to extensions, it is joined by a corresponding `disable` to
disable an extension.

Some tests are updated to take advantage of these new functions.

Reviewed By: quark-zju

Differential Revision: D19427595

fbshipit-source-id: 03cc639918b4e667927330d3f3abf16121ebf161
2020-01-20 02:45:14 -08:00
Jun Wu
a78597c92d gitlookup: use nodemap index to speed up lookups
Summary:
Scanning through the plain git mapfile is slow. Use the nodemap to speed it up.
To avoid unnecessary risks, this only replace the "lookup" feature of the mapfile,
other features used by the hggit extension or wire-protocols are unaffected.

Reviewed By: singhsrb

Differential Revision: D19458406

fbshipit-source-id: 665184637d3e62590cc5d12ea3aa2563af4351d1
2020-01-17 19:21:40 -08:00
Jun Wu
8f694e04a1 pull: update remote/master unconditionally
Summary:
This is inteneded to solve multiple problems:

- Mitigate issues where our CI system does not enable remotenames in some
  random code paths, which leads to missing or stale `remote/master`.
  This further mitigates bad cases with narrow-heads' phase calculation
  where a stale `remote/master` can cause many commits to become draft
  incorrectly.
- Mitigate issues in `remotenames` where race condition can happen for
  pushrebase (remotenames does a "listnames" after the push operation).
  See D18601035 for a hacky workaround.

Reviewed By: DurhamG

Differential Revision: D19380940

fbshipit-source-id: 4481ff114d35be37c331c72ac561c2a0894206cb
2020-01-17 10:13:40 -08:00
Jun Wu
4a98b00205 changelog: still migrate non-public commits to zstore
Summary:
This makes it safer to do revlog-fallback -> server-fallback switch in the
future, because the server might not know all the draft commits.

Reviewed By: DurhamG

Differential Revision: D19416287

fbshipit-source-id: 8d69c1c5465b50710110370d84d5fb7c8ba6a6c4
2020-01-17 04:01:05 -08:00
Thomas Orozco
341e695ac5 hggit: don't crash in updatemeta if a commit does not have extras at all
Summary:
Right now, we check if extras contain `convert_revision` (and tolerate it not
being there), but if we don't have extras at all, we crash. Let's instead treat
"no extras" and "convert_revision not in extras" as the same thing.

Reviewed By: DurhamG, farnz

Differential Revision: D19428698

fbshipit-source-id: 74268dd3bde0f9cdb1b8164d2c2d322837803eaa
2020-01-16 10:13:12 -08:00
Mark Thomas
2815d67f41 mutation: update amend tests to use mutation and visibility
Summary:
Update all amend tests to use mutation and visibility.  For these tests, `mutation.record`
is disabled so that hashes do not change.

Most tests pass as-is.  A few tests have changes which are the results of slight behavioural
changes or bug-fixes compared with obsmarkers.

Reviewed By: quark-zju

Differential Revision: D19413580

fbshipit-source-id: 18696a08db69130b08f829366659783df4c9bcc1
2020-01-16 01:03:23 -08:00
Mark Thomas
05f1ef73b2 obsolete: add option for disabling evolution
Summary:
Allow disabling of evolution and obsolescence markers by setting
`experiemental.evolution=obsolete`.

Reviewed By: quark-zju

Differential Revision: D19411232

fbshipit-source-id: 89601a93cff1f87d04b7230fcb6c1e91cf074e92
2020-01-16 01:03:23 -08:00
Mark Thomas
eef0c650e7 mutation: make the mutationstore the source of truth for mutation entries
Summary:
Previously the mutation commit extras were the source of truth for mutation
information, and the mutation store served as a kind of cache.  This turned out
to be less useful than expected, as oftentimes commits are missing, and the
store is better indexed, so in practice using the store as the source of truth
is better.

This change makes the mutationstore the (sole) source of truth for mutation
data.  The extras are kept, but they are now only useful as human-readable
debug information, and to ensure the commit hash is unique.

Collecting the mutation information during commit creation is now done through
a new `mutinfo` object.  This is a dict with the same keys as the mutation
extras, for simplicity, but it is now passed through the `committablectx` and
used to generate the mutation store entry directly.

The `mutation.enabled` config option is now used to control all aspects of
enabling mutation.

The `mutation.record` config option is now only used to indicate whether the
mutation extras should also added to the commit.  Generally this should be set
to `true`, however the option is retained so that mutation extras can be
stripped by running `hg amend --config mutation.record=false`, which no longer
has the side-effect of not recording mutation information to the store.

The "remote commit" mutation record origin is now obsolete, and won't be
generated anymore.

Pushrebase now relies on the obsmarker information coming back from the server
in order to correctly generate mutation information.  We will need to change
this so that the server returns mutation records before we can fully deprecate
obsmarkers.

Reviewed By: DurhamG

Differential Revision: D19410650

fbshipit-source-id: 8d7094e4bfd8d8e97916898d899a8debd339485f
2020-01-16 01:03:22 -08:00
Xavier Deguillard
d784f6890c test-ssh.t: make it less flaky
Summary: This eliminates the broken pipes that have been more prevalent recently.

Reviewed By: DurhamG

Differential Revision: D19412153

fbshipit-source-id: 0062eb57ec07dfcbfee3ed9b77cf82cdcda09fb3
2020-01-15 14:05:06 -08:00
Joseph Friesen
1b504b8c93 add TCP support to fsmonitor
Summary:
This is part of proof-of-concept to test Watchman over TCP, a means
to accelerate hg workflows for the ASIC teams within Facebook.

For more context, refer to master task T55191832

Reviewed By: xavierd

Differential Revision: D18482107

fbshipit-source-id: 08ba3641854d81fe2a1cd8739bb4e9abcbc700ed
2020-01-15 13:43:36 -08:00
Jun Wu
dd1b9cc98d pull: use transaction
Summary:
Without this change, the next diff will fail tests with metalog programming
errors (write outside transaction).

Some test changes are caused by the being deprecated `rollback` command.

Reviewed By: DurhamG

Differential Revision: D19380939

fbshipit-source-id: 7c893d3025bb697102835670b8a38f8fb9a624c8
2020-01-14 21:02:27 -08:00
Jun Wu
ba2d83b3f8 pull: remove "new changesets" message
Summary:
Reverts https://www.mercurial-scm.org/repo/hg/rev/eb586ed5d8ce.

The colon syntax (x:y) is deprecated and is unsupported by segmented changelog.

Reviewed By: DurhamG

Differential Revision: D19394101

fbshipit-source-id: 8c66756f1035ab7660180716a2afa052879f384e
2020-01-14 21:02:27 -08:00
Durham Goode
d663a9dbdf fsmonitor: move warnings into filesystem layer
Summary:
Now that the post dirstate handlers are largely unused, let's move the
fsmonitor state warning into the fsmonitor filesystem. This also allows us to
remove the temporary _newid variable that was used to allow post-transaction
detection of if the transaction happened.

Reviewed By: quark-zju

Differential Revision: D18259479

fbshipit-source-id: da88638d34a80480bbeba8b1531d523785d72c30
2020-01-14 17:49:02 -08:00
Durham Goode
bca361cd3c dirstate: remove most of post dirstate handlers
Summary:
Previously the localrepo object contained a list of handlers to invoke
after status finished executing. This was used for 1) updating the fsmonitor
state with the new clock, ignore hash, and list of notable files, and 2)
updating the list of ignored files in treestate.

As part of moving all fsmonitor subtlities behind the filesystem abstraction,
this diff moves the fsmonitorstate file updating to be in the filesystem layer.
This also moves it inside the same transaction as the lookup file cleanup, which
removes the need for the hacky self._newid logic to detect if the dirstate was
changed by an external process.

(self._newid was previously added so that our second dirstate transaction, which
updates the fsmonitorstate, could determine if the dirstate had either been
changed by this process earlier in the lookup cleanup transaction, or if it had
been changed by an external process).

Reviewed By: quark-zju

Differential Revision: D18076655

fbshipit-source-id: c5175f61432f8e121b6baacd9587fcd288f67098
2020-01-14 17:49:02 -08:00
Durham Goode
af3292ea85 filesystem: refactor lookup marking to be more extensible
Summary:
A future diff is going to move the fsmonitor post-status fixups into
the same transaction as the lookup-marking logic. To prepare for this, let's
refactor the lookup marking logic to separate out the transaciton management
from the actual marking logic.

Reviewed By: quark-zju

Differential Revision: D18076656

fbshipit-source-id: 7711d5b086be7baaff0d9736cf51c6b0a46f237e
2020-01-14 17:49:01 -08:00
Durham Goode
a064e12d93 dirstate: move lookup resolution into the filesystem
Summary:
In an earlier diff we moved the lookup-state resolution from the repo
object to the dirstate object. Now that a filesystem layer exists, let's move
lookup resolution into the filesystem layer so that filesystem.pendingchanges
can now return perfect information.

Reviewed By: quark-zju

Differential Revision: D17749373

fbshipit-source-id: d03177e5e5374bd38c6c9adaa0fe8959052de19e
2020-01-14 17:49:01 -08:00