Commit Graph

464 Commits

Author SHA1 Message Date
Jun Wu
90c062ca08 debugshell: accept file name
Summary:
This makes debugshell easier to use. Especially when the script wants to access
`__file__`.

Reviewed By: DurhamG

Differential Revision: D21169556

fbshipit-source-id: 88b3ebb1ca9a39fe26bc7cc5ea8e250c28fa0d6f
2020-04-27 10:58:56 -07:00
Saurabh Singh
79f5217ccc test-bisect-t: use debugshell instead of debugpython
Summary:
The python script run using `debugpython` within the test was importing
Mercurial internal modules which causes failures on some platforms like
Windows. Instead, lets use the `debugshell` command which already imports the
common objects like `repo` correctly.

Reviewed By: xavierd

Differential Revision: D21251818

fbshipit-source-id: db1b9e92df99b736a28bc9e89fb08ae77d6e82fc
2020-04-27 07:55:30 -07:00
Jun Wu
3de6513f0e revset: make autopull commit pull seletivepull bookmarks
Summary: This ensures lagged master issue does not happen by pulling a single commit.

Reviewed By: DurhamG

Differential Revision: D20845384

fbshipit-source-id: 3ba16c07fe264fe2b6aecd494bbb832af7b390a0
2020-04-24 11:16:23 -07:00
Jun Wu
3514ac0de8 remotenames: autopullprefix -> autopullpattern
Summary:
Patterns are more powerful than prefixes. Some full revset names are
obviously not valid remote name - for example, `remote/master :: .`.
They cannot be ruled out using prefixes but can using patterns.

As we're here, add some caching for the regex compiler.

Reviewed By: DurhamG

Differential Revision: D20831015

fbshipit-source-id: af8c4eed4a3153fd71480b8972c55feed4641392
2020-04-24 11:16:22 -07:00
Jun Wu
368d59e436 revset: attempt to pull the revset expression as a single name
Summary:
For names like `a-b-c`, it can be parsed in multiple ways:

- `"a-b-c"`
- `"a-b" - "c"`
- `"a" - "b-c"`

Mercurial uses `repo.lookup` in the parser to accept names like `"a-b-c"`.
Do it for the whole revset expression too.

But do not do it for every lookup (ex. testing `"a-b"` or `"b-c"` in the above
case), because that can be exceedingly expensive.

Reviewed By: DurhamG

Differential Revision: D20831014

fbshipit-source-id: f507e04ce24c953b096ccd836c356f50f11d2006
2020-04-24 11:16:22 -07:00
Jun Wu
e26f2eeacb tests: add a test about autopull on remote names with dashes
Summary:
Dashes are also revset operators. Add a test so we can verify if we can also
autopull those special names.

Reviewed By: DurhamG

Differential Revision: D20831016

fbshipit-source-id: 97e772053dae873ebaa529ac9eb84ea9d04f0f63
2020-04-24 11:16:22 -07:00
Jun Wu
a2d9f6604e infinitepush: disable old autopull if the new autopull is enabled
Summary:
Similar to the previous diff, let's use the new autopull logic, which
uses the tech-debt free repo.pull API.

In rare cases this can cause more pulls due to the path selection (ex. use
"infinitepush" for "remote/scratch/x" but "default" for "remote/stable/x").
With Mononoke serving repos, we might be able to remote the special paths,
and just use "default" for all cases.

If it goes well, we can then delete the old code.

Reviewed By: DurhamG

Differential Revision: D20804854

fbshipit-source-id: 75e68582a29b613c8626a119b85064e3c0ba9462
2020-04-24 11:16:21 -07:00
Jun Wu
d90be19909 remotenames: disable old autopull if the new autopull is enabled
Summary:
The new auto pull logic can replace the one in remotenames. It it goes well, we
can then remove the code in remotenames doing the auto pull.

Reviewed By: sfilipco

Differential Revision: D20804853

fbshipit-source-id: c87b6b382f4cce3b306648b305a7b6bbaec05df1
2020-04-24 11:16:21 -07:00
Jun Wu
614b349628 revset: implement auto pull for hoisted remote bookmarks
Summary:
Attempt to auto pull bookmark names without the `remote/` or `default/` prefix
if hoist is set. This would hopefully be enough to allow us to enable
selectivepull globally without breaking existing users.

Reviewed By: sfilipco

Differential Revision: D20804856

fbshipit-source-id: 72601ac5e3545523cbfd7087d1fc822ef33c2f2e
2020-04-24 11:16:21 -07:00
Jun Wu
880b33b0b7 revset: implement auto pull for commit hashes using repo.pull API
Summary: This might remove less clean logic in infinitepush.

Reviewed By: sfilipco

Differential Revision: D20804855

fbshipit-source-id: da5ed24dd912b5f86839e671a9d6b0e9356b7c86
2020-04-24 11:16:20 -07:00
Xavier Deguillard
413d2b3aba remotefilelog: enable uploading LFS blobs
Summary:
This adds the proper hooks in the right place to upload the LFS blobs and write
to the bundle as LFS pointers. That last part is a bit hacky as we're writing
the pointer manually, but until that code is fully Rust, I don't really see a
good way of doing it.

Reviewed By: DurhamG

Differential Revision: D20843139

fbshipit-source-id: f2ef7b045c6604398b89580b468c354d14de1660
2020-04-23 14:00:23 -07:00
Jun Wu
ae8046b036 tests: update test-hgsql-strip.t
Summary: Update the test to match the latest output.

Reviewed By: xavierd

Differential Revision: D21181146

fbshipit-source-id: 3b6190c9ae8e73309c0b7cb3c48d8a6646bc7fb4
2020-04-22 16:15:46 -07:00
Durham Goode
faced01356 tracing: add more trace values
Summary: This will help us debug slow commands

Reviewed By: xavierd

Differential Revision: D21075895

fbshipit-source-id: 3e7667bb0e4426d743841d8fda00fa4a315f0120
2020-04-22 15:35:17 -07:00
Jun Wu
b72002f91d tests: update tests with bookmarks behavior change
Summary:
Update tests. They are caused by the use of deprecated command "rollback".
Normally this kind of issues shouldn't happen.

Reviewed By: DurhamG

Differential Revision: D21164084

fbshipit-source-id: 7d847166f999e2bc472bb8276c1ebb66ad7c45c2
2020-04-21 14:31:46 -07:00
Adam Simpkins
5ed9871d31 don't print background repack messages to stdout
Summary:
D17677229 unintentionally changed the remotefilelog repack code to print
messages about the fact that it was doing a repack to stdout instead of
stderr.

This results in garbage messages showing up in the output of commands that are
intended for programmatic consumption, like `HGPLAIN=1 hg status -0mardu`

Reviewed By: DurhamG

Differential Revision: D21149364

fbshipit-source-id: 104d719af35835be098a375f9b9aebcd1f7a6eca
2020-04-21 14:15:54 -07:00
Durham Goode
3588633bb7 py3: revert mysql-connector-python upgrade and hgsql tests
Summary:
The tests are broken on non-fbcode builds because
mysql-connector-python is the old version. We're unable to upgrade
mysql-connector-python on centos 7/8 because yummy is broken. This blocks us
from getting a release.

Let's roll back the mysql-connector-python upgrade for now, until yummy is
fixed.

Reviewed By: singhsrb

Differential Revision: D21162119

fbshipit-source-id: 5d0b266d72274540eca5b9a76bf151a0fbbee059
2020-04-21 13:45:23 -07:00
Durham Goode
f764f12f72 tracing: fix function tracing
Summary:
The old pytracing logic walked the stack looking for the most recent
spanid. This was fragile and missed a bunch of spots because the function name
wasn't present in f_globals. Let's make this explicit by tracking the stack of
spanids for each python thread.

Reviewed By: quark-zju

Differential Revision: D21068332

fbshipit-source-id: 98759640fa1081bc5bc0805cc620e35a2de9dae3
2020-04-21 13:23:50 -07:00
Jun Wu
73c5cb89de bookmarks: reload changelog if unknown node is seen
Summary: This mitigates loading order issues demonstrated by the previous diff.

Reviewed By: DurhamG

Differential Revision: D21148446

fbshipit-source-id: 40e4861055822b4676f3ac38d0f004b365efe86d
2020-04-21 09:19:26 -07:00
Jun Wu
b4ff907c2a bookmarks: add tests showing loading ordering issue without metalog
Summary: Demonstrate that bookmark loading order can cause "unknown name" errors.

Reviewed By: DurhamG

Differential Revision: D21148445

fbshipit-source-id: d12417ad150904bda14df47cb6e9fe464f392588
2020-04-21 09:19:26 -07:00
Xavier Deguillard
af1ab52527 merge: add a "rg" merge action
Summary:
When a file goes from being a symlink to a regular file, a regular update
action ("g") is used, and the Python code implicitely remove the symlink before
writing to it. In the Rust code, we don't and as a consequence write through
the symlink, not the intended behavior.

An alternative way of fixing this would be to perform an lstat(2) before
writing to a file, but the cost of doing that will be fairly high for a very
unlikely situation especially since the manifest diff can give us exactly this
information.

This whole merge code feels extremely fragile, so I'm definitively not sure if
I got all the places that needs updating :(.

Reviewed By: DurhamG

Differential Revision: D21082733

fbshipit-source-id: 4f36a67363915c9b67d5a0b290a226075a9f1d31
2020-04-19 22:48:19 -07:00
Durham Goode
856262080e py3: enable a number of hgsql related tests
Summary:
Now that we've upgraded mysql-connector-python, we can enable these
tests.

Reviewed By: quark-zju

Differential Revision: D21009185

fbshipit-source-id: e9ae62cadcc8d0a291381ab2cfb5c7bc04606d9e
2020-04-16 12:24:41 -07:00
Jun Wu
f1c9a39922 doctor: check and hide less relevant branches
Summary:
Sometimes due to wrong configuration, branches that are not relevant to the
user become visible. Detect that and provide a way to hide them.

Reviewed By: xavierd

Differential Revision: D21055464

fbshipit-source-id: 19da498a137fdd08e363d6f689b6de31bc884dbd
2020-04-15 19:21:13 -07:00
Jun Wu
c0b5ad2294 doctor: fix too many remotenames
Summary:
Sometimes due to wrong configuration, cloud sync or legacy pull without
selectivepull will pollute the remote bookmark namespace with too many remote
bookmarks.  Detect that and provide a way to reset remotenames to selected
bookmarks.

Reviewed By: xavierd

Differential Revision: D21055466

fbshipit-source-id: f96c6ba79dd8646fa017947e48e80259ed77de67
2020-04-15 19:21:12 -07:00
Jun Wu
491279b140 doctor: fix incorrect visibility header
Summary:
This is rare. But if visibleheads has a broken header, attempt to fix instead
of skipping.

Reviewed By: xavierd

Differential Revision: D21055468

fbshipit-source-id: 8907c84b69eadb50afae1940862db01a926a38f5
2020-04-15 19:21:12 -07:00
Jun Wu
065ca1b066 doctor: add checks about lagged remote/master
Summary: Trigger a `hg pull` if the remote bookmark appears to be lagging.

Reviewed By: xavierd

Differential Revision: D21055465

fbshipit-source-id: e5ea33ca15f50b504368bec0f349a4abe895eee0
2020-04-15 19:21:12 -07:00
Jun Wu
7cf55dceda doctor: be less verbose
Summary: Remove "looks okay" messages. Only report issues and what changed.

Reviewed By: xavierd

Differential Revision: D21055467

fbshipit-source-id: ee7e732934b88bcdead8cb34ac4cd26b9c7aab42
2020-04-15 19:21:11 -07:00
Jun Wu
ebef9f0ab9 tests: remove test-check-config
Summary:
It was for preventing undocumented configs. Practically it does not achieve the
goal and we might prefer not documenting some of the advanced features to reduce
support burden of unusual configs. Therefore remove it.

We can revisit once we want to improve the documentation of the product.

Reviewed By: xavierd

Differential Revision: D21055469

fbshipit-source-id: 2c26791d2284071b1ac26d1190ec5c4876546f77
2020-04-15 19:21:11 -07:00
Jun Wu
2883e9e20d pushrebase: correctly detect the "rebased / obsolete" case
Summary:
`obsolete()` alone shouldn't prevent push. Check if a successor in the
destination branch instead.

Reviewed By: DurhamG

Differential Revision: D20911924

fbshipit-source-id: 0f983f3440a5bcff13e1a98b28aac2df80b419e0
2020-04-15 19:02:36 -07:00
Jun Wu
4ea261914c pager: replace fout and ferr of all ui objects
Summary:
The `ui` object is a bit messy - there are repo specific ui, and non-repo ui,
and ui can be copied around.

This diff changes `fout` and `ferr` to an indirect type that can be mutated
globally so the streampager can affect the `fout` and `ferr` of all related `ui`
objects instead of just one single `ui`.

Reviewed By: DurhamG

Differential Revision: D20903568

fbshipit-source-id: b2f139b91a39c20c22261e03ce50f3cc59074291
2020-04-15 18:23:12 -07:00
Durham Goode
6078dad33e py3: fix more hggit tests
Summary: These tests now pass with python 3.

Reviewed By: xavierd

Differential Revision: D21011004

fbshipit-source-id: 65ac8f864f6eaf24fa7d3c8b25a013b5e9f28ffe
2020-04-15 11:35:39 -07:00
Xavier Deguillard
643e69e045 remotefilelog: do not write delta in bundle2
Summary:
Computing delta force the client to have the previous version locally, which it
may not have, forcing a full fetch of the blob, to then compute a delta. Since
delta are a way to save on bandwidth usage, fetching a blob to compute it
negate its benefits.

Reviewed By: DurhamG

Differential Revision: D20999424

fbshipit-source-id: ae958bb71e6a16cfc77f9ccebd82eec00ffda0db
2020-04-15 10:26:39 -07:00
Durham Goode
bfe0c8d7ab configs: add dynamic config generator
Summary:
We want Mercurial to become more responsible for it's own
configuration, instead of relying on chef and other means. To do so, let's
introduce a new `hg debugdynamicconfig` that can generate dynamic configs for
a given repository based on various states, like what tier it's in or what shard
that machine is in.  By default it generates to '.hg/hgrc.dynamic' for the given
repository.

Currently it just sets the hostgroup config.

Future diffs will make Mercurial consume this config, and possibly have Mercurial
call this command asynchronously when it notices the file is out-of-date.

Reviewed By: quark-zju

Differential Revision: D20828132

fbshipit-source-id: 6f5bf749f5b04e0a5989d6dc19ee788c2e47f88f
2020-04-14 21:22:26 -07:00
Durham Goode
910ff8f180 py3: redisable failing py3 tests
Summary: These tests are breaking hgbuild.

Reviewed By: xavierd

Differential Revision: D21029157

fbshipit-source-id: cafcc74a646e18ec531a8f29dc791fa4837bb7eb
2020-04-14 15:49:55 -07:00
Jun Wu
4413d92cad pushrebase: add a test showing suboptimal abort
Reviewed By: simpkins

Differential Revision: D20911925

fbshipit-source-id: 81c7fe27b5cb85d6bdf5be385d3f1db84ed1b73b
2020-04-13 20:46:21 -07:00
Durham Goode
955013fdbc py3: fix test-bundle2-format.t
Summary: It now passes

Reviewed By: xavierd

Differential Revision: D20995130

fbshipit-source-id: c262cd8f3ef1c41cd52fd5ec5894be145059f045
2020-04-13 15:28:25 -07:00
Durham Goode
2f8cb4b6ec py3: fix test-bundle2-exchange.t
Summary: It now passes

Reviewed By: xavierd

Differential Revision: D20971712

fbshipit-source-id: d962c5f0171c056edfadb5cc795d1c8662456afa
2020-04-13 15:28:25 -07:00
Durham Goode
d9a508dfba py3: fix various wireprotocol related tests
Summary: They now pass

Reviewed By: xavierd

Differential Revision: D20970190

fbshipit-source-id: 8610e0877181c5e8b8842559f7a3e4a943c0c3fe
2020-04-13 15:28:24 -07:00
Xavier Deguillard
b6cb2f37f2 tests: fix test-parse-date.t in python3
Reviewed By: DurhamG

Differential Revision: D20972880

fbshipit-source-id: 6436fb9af8bb8adf48d6c23a0e8cc453d9336c47
2020-04-13 14:59:41 -07:00
Xavier Deguillard
e8c2e7a280 tests: fix test-perftweaks-remotenames.t in python3
Summary: Reading needs to be done via readutf8.

Reviewed By: DurhamG

Differential Revision: D20972835

fbshipit-source-id: 0705c04f1db8b20cc4679852d75ea1790a5cf5f9
2020-04-13 14:59:41 -07:00
Xavier Deguillard
6b85ee4edb remotenames: decode the content of selectivepullenabled
Summary: We're writing utf-8 data to it, decode it before returning it.

Reviewed By: DurhamG

Differential Revision: D20972741

fbshipit-source-id: fb23a6d1c3188e10598b839639cdd5e74322089a
2020-04-13 14:59:41 -07:00
Xavier Deguillard
d2c56495e4 metalog: fix for python3
Summary:
While keys are strings, values are bytes buffer and thus needs to be converted
sometimes.

Reviewed By: DurhamG

Differential Revision: D20974484

fbshipit-source-id: 13394f5dc43191e85e4b1d350cc4fbbd8489572a
2020-04-13 14:55:11 -07:00
Xavier Deguillard
8178dfd89b context: fix symlink validation
Summary:
Symlinks are pointers to path, that are required to be utf-8, thus we can
decode the data.

Reviewed By: DurhamG

Differential Revision: D20973701

fbshipit-source-id: 8399dfb3462fea907758a01ed2fcea508833fbaa
2020-04-13 14:55:11 -07:00
Xavier Deguillard
ffd876d967 tests: fix test-filelog.py for python3
Reviewed By: DurhamG

Differential Revision: D20973502

fbshipit-source-id: dc3201dcc25509d569442a240fa8361a819f1f5f
2020-04-13 14:55:11 -07:00
Xavier Deguillard
17855deb17 tests: fix test-extdiff.t for python3
Reviewed By: DurhamG

Differential Revision: D20973286

fbshipit-source-id: 3a2d3cfc61567934d53e58ce561c367746c02403
2020-04-13 14:55:10 -07:00
Xavier Deguillard
4d5515e6ef tests: fix test-revlog.t for python3
Reviewed By: DurhamG

Differential Revision: D20973212

fbshipit-source-id: 1535d50a0cb2a7350083600e4e6c6506e0749072
2020-04-13 14:55:10 -07:00
Xavier Deguillard
5f4d53cb54 tests: fix test-hggit-illegal-contents.t
Summary:
With the upgraded git, some error message aren't the same as before, update the
test to reflect that.

Reviewed By: quark-zju

Differential Revision: D20993735

fbshipit-source-id: d9b8bfc9c6d10f7c0898299659e4322589ea8077
2020-04-13 14:25:35 -07:00
Xavier Deguillard
cdb0fbdb71 convert: do not try to re-encode in python3
Summary: The encoding is utf-8 already.

Reviewed By: sfilipco

Differential Revision: D20966808

fbshipit-source-id: ade012588bf14df07772db0819be8670ecdb3b09
2020-04-13 08:53:51 -07:00
Xavier Deguillard
aa836d38ea tests: enable histedit for python3
Summary: These are now passing

Reviewed By: sfilipco

Differential Revision: D20966083

fbshipit-source-id: c9a34ee23a1552200756a4e1f75a29574c37960d
2020-04-13 08:53:51 -07:00
Xavier Deguillard
c256ee21ef treemanifest: fix flat manifest conversion
Summary: In Python3, str is not a byte string, but a unicode one. Use bytes instead.

Reviewed By: sfilipco

Differential Revision: D20965794

fbshipit-source-id: b04ff004aac87fd3afc8070fc8d1d849ad48d0d3
2020-04-13 08:53:51 -07:00
Xavier Deguillard
5aed0fe552 tests: fix test-important-remote-names-t.py for python3
Reviewed By: sfilipco

Differential Revision: D20965390

fbshipit-source-id: 790a712c8cc44d6a634ca4bfa7c37f9034a3f571
2020-04-13 08:53:50 -07:00