Commit Graph

73 Commits

Author SHA1 Message Date
Simon Farnsworth
deacaed311 Don't delete bookmarks in drawdag if there are none
Summary: In Mononoke tests, we have failures because `hg book -fd` aborts if it's not given any bookmark names. Fix up this function to not run `hg book -fd` if there are no bookmarks

Reviewed By: quark-zju

Differential Revision: D19251930

fbshipit-source-id: 2f1696d9207ad64a94c28941e72806d9b0e686fe
2019-12-30 15:41:14 -08:00
Jun Wu
c214a2de9e test-profile: fix the test
Summary: Use `debugpython` to replave `python`

Reviewed By: akushner

Differential Revision: D19221125

fbshipit-source-id: 68f5d83f9abe38174492fdaaf7496875696c4302
2019-12-23 16:37:10 -08:00
Jun Wu
3170aa7cbc test-parse-index2: remove the test
Summary:
The test is broken by D19190496 because the test uses some weird test cases
about legacy Pythons.

The "parseindex2" test is revlog-related. The revlog is kind of stable, tested
indirectly in countless tests, and is also going away. We don't run the code
on legacy versions of Pythons.The "parseindex2" test does not provide much
value. Therefore just remove it.

Reviewed By: akushner

Differential Revision: D19221126

fbshipit-source-id: 5b904d97caa47f92098435ee85c1bb8b725c9f84
2019-12-23 16:37:10 -08:00
Jun Wu
4dd04bf02f hgpython: replace hgpython interpreter with native Rust implementation
Summary:
The hgpython interpreter was used to run Python scripts in tests that might
rely on Mercurial modules.

The previous hgpython implementation is Python PAR based, which does not have
access to native Rust modules like bindings. Change it to use the native
"hg debugpython" implementation that is more compatible.

Reviewed By: markbt

Differential Revision: D19190496

fbshipit-source-id: 9791dbf9ba0ed92de702291faa9145f01b05ec40
2019-12-22 11:27:27 -08:00
Jun Wu
0c41aa6235 extensions: change error message to look non-fatal
Summary:
The current error message looks like fatal while it is not. Make it clear that
extension failures are not fatal.

Reviewed By: markbt

Differential Revision: D19166545

fbshipit-source-id: 7ce0231c90b0c5f50add15a12cb69b60b76dfcb1
2019-12-22 11:27:26 -08:00
Jun Wu
e5de1683e4 gitnode: try using commit extra first
Summary:
There are 3 extensions that can provide the `{gitnode}` template: "gitrevset",
"fbscmquery", "hggit". The last can read from commit extras. Fix the first two
to also read commit extras. At some point we need to unify the implementations.

Reviewed By: farnz

Differential Revision: D19198979

fbshipit-source-id: 24a0df0df4ceb7a9af9236a7f70babfd54e9802b
2019-12-20 16:14:25 -08:00
Jun Wu
2038472340 test-fb-hgext-sshaskpass: require linux to run
Summary:
The test is flaky in recent OSX builds.

The test is about a chg feature. Right now we only use chg on Linux. So limit
the test to Linux only.

Reviewed By: singhsrb

Differential Revision: D19191582

fbshipit-source-id: ce506f3f50c4368253caea0d73a647539c649735
2019-12-20 16:14:24 -08:00
Jun Wu
df5dce4138 test-convert-hg-source: require execbit to fix it on Windows
Summary:
After D19043330, the test is failing on Windows (no execbit).

When converting a repo, we almost always want to preserve the execbit. So let's
just skip the test if execbit is not available.

Reviewed By: singhsrb

Differential Revision: D19191556

fbshipit-source-id: 8e65d0b4b03833216ac8f28e2ae25f87de72304f
2019-12-20 16:14:23 -08:00
Durham Goode
b4f44d39a5 convert: delete support for gnuarchs, darcs, and bzr
Summary:
We don't support any of these VCS's, and we're not running any of the
tests. The code is just bit rotting. Let's delete them.

Reviewed By: quark-zju

Differential Revision: D19043710

fbshipit-source-id: 6e0d625c755cbc875755dc09b394bc730186db1d
2019-12-20 16:14:22 -08:00
Durham Goode
ff41e331e0 convert: remove tags from convert
Summary:
A future diff will remove the tags feature. Convert uses tags heavily
and it breaks a number of tests, so let's remove tags from the convert extension
before we remove tags entirely.

Reviewed By: quark-zju

Differential Revision: D19043330

fbshipit-source-id: 628d27fea1601931da45d1280eff981c5d12f93c
2019-12-20 16:14:19 -08:00
Durham Goode
218c83d574 tags: remove tip tag
Summary:
In a future diff we'll be removing tags. The most prevalent tag is
'tip', which shows up in a ton of test output. Let's drop that tag first, so we
can safely update the tests before we drop tags entirely.

Reviewed By: xavierd

Differential Revision: D18995058

fbshipit-source-id: 8c63710cd4ed567ea24e32724b8660f9006a61f1
2019-12-20 16:14:19 -08:00
Durham Goode
e1c73204f6 drawdag: use bookmarks instead of tags
Summary:
A future diff will remove tags entirely, so let's move drawdag to be
bookmark based.

Reviewed By: quark-zju

Differential Revision: D18995059

fbshipit-source-id: 70ef67259b37ef9821009d0145aa1e03c09b1309
2019-12-20 16:14:18 -08:00
Jun Wu
780faa2c10 tests: replace print in debugshell with ui.write
Summary:
Similar to D18926784.

Mercurial makes sure content written by `ui.write` is flushed, while there is
no such guarantee for `print`. When running using chg, it's more likely that
`print` content gets disappeared. Therefore let's use `ui.write` instead.

Reviewed By: ikostia

Differential Revision: D18926983

fbshipit-source-id: 960c189cc48bc3c89bb4f7993d2033dd45c52a67
2019-12-13 10:30:39 -08:00
Mateusz Kwapich
7e0e170db9 rename fbconduit extension to fbscmquery
Summary:
This is mostly result of:
```
  find . -type f -exec sed -i "s/fbconduit/fbscmquery/g" {} \;

```
`fbconduit` extension doesn't use conduit anymore so the name is just misleading.

Reviewed By: ikostia

Differential Revision: D18748843

fbshipit-source-id: 0d59e61ba7a96d86d9d1333d81255108cc3141bc
2019-12-13 03:23:25 -08:00
Xavier Deguillard
828f5b487d tests-flagprocessor.t: fix it
Summary: This looks like a fallout of D18666054

Reviewed By: quark-zju

Differential Revision: D18992910

fbshipit-source-id: c2392553a0489097f82b4073bbbca37b43f53bba
2019-12-12 20:36:43 -08:00
Xavier Deguillard
e7a3859828 convert: disable "getting files" progress bar
Summary:
This is showing in profile for about 10% of the time, let's just disable it as
getting files should be fairly quick.

Reviewed By: quark-zju

Differential Revision: D17841315

fbshipit-source-id: 08a61e19351fb5217431a3ca8993b8074f6d6c74
2019-12-12 14:15:05 -08:00
Xavier Deguillard
81365e9e9f localrepo: use repo.commitpending in repo.commitnotransaction
Summary:
There is no need to duplicate the code.

The test change are due to commitpending being called 3 times, vs 1 before. The
total amount of times {fileslog,manifestlog}.commitpending is called is unchanged.

Reviewed By: quark-zju

Differential Revision: D17841316

fbshipit-source-id: be33a126f913af8824a6d5ade17351707d39ed2f
2019-12-12 14:15:05 -08:00
Jun Wu
cf8efdb0d2 ui: use smarttraceback
Summary: The smart traceback is generally more useful.

Reviewed By: markbt

Differential Revision: D18666054

fbshipit-source-id: a96bb3e2919ed6692c4a7b965ad74cd2c8a66241
2019-12-12 13:47:49 -08:00
Xavier Deguillard
f0bf034842 test-check-code: use glob for st_*time error
Summary: This keep failing due to single line changes. Let's make it more robust.

Reviewed By: kulshrax

Differential Revision: D18963816

fbshipit-source-id: c56748560b619c4c682e8cc9e5710c607aa363fb
2019-12-12 11:41:22 -08:00
Xavier Deguillard
291db4b116 tests: fix test-fb-hgext-treemanifest.t
Summary: This looks like an omission from D18912817

Reviewed By: mitrandir77, ikostia

Differential Revision: D18935510

fbshipit-source-id: f72d95155c54d7eb36ff7c868f5e6b0ff6d6e39c
2019-12-11 10:20:59 -08:00
Mark Thomas
23fe5a7780 reset: add visibility tracking support
Summary:
The `reset` extension does its own obsmarker creation, rather than going
through `scmutil.cleanupnodes`.  This means it doesn't support new-style
visibility tracking.

Fix this by making it use `scmutil.cleanupnodes`.  This isn't completely
straightforward:

* The revset it uses to work out what to prune might accidentally include
  public commits (e.g. when you reset to a different public branch).  Make sure
  these are filtered.
* The tests originally had strip and obsmarker based tests.  The strip tests,
  when converted to obsmarkers and using `scmutil.cleanupnodes` stop working
  because they strip and revive the same commit over and over, which is an edge
  case that obsmarkers can't handle well.  Fix this by restoring the strip tests
  as strip tests.  A separate test handles the new-style visibility.
* Reset's behaviour is still a bit wonky.  If an ancestor of the source commit
  has other (non-bookmarked) descendants, then reset will try to prune those
  commits.  New-style visibility will ignore this, and this is tested in the
  new test.

Reviewed By: farnz

Differential Revision: D18912817

fbshipit-source-id: cc115333407cf67d339c24fcd0807ddedce2660d
2019-12-11 03:49:38 -08:00
Jun Wu
27a1ffa9d1 tests: fix test-doctor.t on Windows
Summary:
On Windows the error message is different. In this test we only need to verify
a command fails. Therefore remove the output and only keep the exit code.

Reviewed By: xavierd

Differential Revision: D18915580

fbshipit-source-id: bd1031170335918d507e6225b02541ec52bc62fa
2019-12-10 14:45:43 -08:00
Xavier Deguillard
d21a108280 tests: fix test-atomictempfile.py
Summary:
os.stat uses float values, use util.stat instead.

(Note: this ignores all push blocking failures!)

Reviewed By: singhsrb

Differential Revision: D18913982

fbshipit-source-id: 2df5ad0efbba3b18ef90669b4d1910ab39730e18
2019-12-10 11:57:12 -08:00
Jun Wu
2781801365 doctor: attempt to fix mutationstore, metalog and allheads
Summary:
Since we got `repair` APIs in the Python land, use them to attempt to repair
things.

This would hopefully be able to fix some user-reported issues, usually
caused by hard reboots.

Reviewed By: xavierd

Differential Revision: D18737907

fbshipit-source-id: ef3deccbf4a1c959cff7e3eb78771acd9ae9bd01
2019-12-09 20:02:09 -08:00
Jun Wu
a3129104fe tests: fix buck run :run_tests
Summary:
`buck run :run_tests -- ...` was added to be a buck version of `run-tests.py`.
However it does not work because the watchman path provided was invalided.

Reviewed By: xavierd

Differential Revision: D18892361

fbshipit-source-id: 8745a33e0d19b14f042ef1cd255d10c5737dffb1
2019-12-09 15:26:30 -08:00
Jun Wu
75a8173a10 tests: enable chg for 572 tests
Summary:
Add `#chg-compatible` to 572 tests that seem to pass with chg enabled.
This should make them run faster.

Reviewed By: xavierd

Differential Revision: D18870507

fbshipit-source-id: fe895e733efffc9286cd3d17c7a156c803124395
2019-12-09 15:26:29 -08:00
Jun Wu
84a4da85ca metalog: implement bi-directional migration
Summary:
Previously, it's fine to migrate up to metalog, and fine to migrate down once
since we double write data. However, re-enabling metalog can be problematic
since there is no code path to do "migrate up" again.

This diff fixes the issue by tracking what files (or "keys") are using metalog
as the source of truth in metalog. So we can accurately figure out whether to
migrate svfs files to metalog on demand.

Reviewed By: xavierd

Differential Revision: D18864424

fbshipit-source-id: e61e1790c231f9c88de869f413f27bb954a29920
2019-12-09 14:18:18 -08:00
Jun Wu
083bf3f1c3 run-tests: support '#chg-compatible' header
Summary:
Detect `#chg-compatible` in test header and force enable chg. This would allow
us to mark tests as chg-compatible to get some speed ups.

Reviewed By: xavierd

Differential Revision: D18870508

fbshipit-source-id: 923d6cb10b0c621d9995809b60ae535126f6f2a5
2019-12-09 13:20:25 -08:00
Jun Wu
fb13bc5ecf run-tests: make --chg work again
Summary:
The chg logic is inlined in the "hg" binary so the old logic running "chg" as
an external binary needs to be changed.

The version check part can be annoying - it requires more frequent `make local`
to run the tests while `make local` is actually not necessary. So let's just
skip the version check if running in tests.

Reviewed By: ahornby

Differential Revision: D18870510

fbshipit-source-id: 2343549c4080a0425098698b5423c6cfc1f60c77
2019-12-09 13:20:24 -08:00
Xavier Deguillard
82082bfaf8 policy: simplify it
Summary:
We only support the "C" policy, therefore let's inline it and simplify the code
significantly.

Reviewed By: quark-zju

Differential Revision: D18819680

fbshipit-source-id: 0bc0a12b85ddc42af007d3a20c0f4e8497bedb21
2019-12-09 13:13:27 -08:00
Xavier Deguillard
24d99a9178 util: remove os.stat_float_times(False)
Summary:
This is not available on Python3, instead stat.ST_MTIME and friends should be
used to get an integer time. This is achieved by wrapping the output of the
stat function and overriding the st_[acm]time properties.

Reviewed By: quark-zju

Differential Revision: D18819679

fbshipit-source-id: 2911f3d47506456e927872d57f69253d903618e2
2019-12-09 13:13:26 -08:00
Jun Wu
91884d1fab tests: mark tests as skipped on MySQL error
Summary:
Recently many tests become unreliable due to MySQL errors like:

  OperationalError: 2055: Lost connection to MySQL server at '<host:port>', system error: 32 Broken pipe

That makes the testing infra think our tests are broken and cause:

  # Test Failure Bot
  Test is now disabled because it has been consistently broken

Avoid that by detecting MySQL errors and mark tests as skipped.

Reviewed By: simpkins

Differential Revision: D18668303

fbshipit-source-id: 02cb09f31c712fed41903f1e8c4ad45a1d277c30
2019-12-06 21:01:44 -08:00
Jun Wu
35f85f7864 morecolors: remove extension
Summary:
It was used to highlight "more interesting" (aka. extension) code. Nowadays the
non-extension part of code is also interesting. Therefore drop the extension.

Reviewed By: simpkins

Differential Revision: D18666053

fbshipit-source-id: 027190f742015bdb9e7dba109e7a28987af3cf68
2019-12-06 21:01:44 -08:00
Stefan Filip
713dea745c tests: add test-rustmanifest-t
Summary:
This is a test that aims to validate that commit manifest match between the C++
and Rust implementations.

Reviewed By: quark-zju

Differential Revision: D18521823

fbshipit-source-id: 678b82239e9be7ad078f1e04a6467e87adaac966
2019-12-06 13:36:42 -08:00
Jun Wu
3f9123d94f pushrebase: also update remote names
Summary:
For now pushrebase updates working parent, bookmarks. This diff makes it also
update remote bookmarks.

This resolves a race condtion in remotenames where the pulled remote bookmarks
have unknown nodes and cause update to silently fail.

Reviewed By: sfilipco

Differential Revision: D18601035

fbshipit-source-id: 6f2c318cbf6b29a6427eeac6d374c1fb13e6155c
2019-12-06 11:39:01 -08:00
Jun Wu
ae2be4c73f test-pushrebase-remotenames: modernize the test
Summary:
Enable visibility and mutation to get modern features. Remove legacy configs.
As we're here, add more `log -G` outputs to make the test easier to reason about.

Reviewed By: xavierd

Differential Revision: D18601036

fbshipit-source-id: f0d656c696708c045c63f5b8e59b9a40f2dbbf20
2019-12-06 11:39:01 -08:00
Stefan Filip
6624293ca3 grep: remove xargs fanout from grep command implementation
Summary:
Move it to configuration.
This gives better control over how grep is executed. Previously the assumption
was that xargs was present in PATH. This updates removes that assumption.

Reviewed By: quark-zju

Differential Revision: D18715471

fbshipit-source-id: 09c3098984588cd7478172db0bcfb8d5cb8243fd
2019-12-06 11:16:28 -08:00
Xavier Deguillard
2da84af21f pycompat: remove ispy3
Summary:
Somehow, pyre isn't able to inline the value of ispy3 and propagate it properly
and thus complains about lots of code paths. Let's inline it everywhere.

Reviewed By: ikostia

Differential Revision: D18816333

fbshipit-source-id: 80f81cb91bef4c6831952f9469401d87040335e2
2019-12-04 17:04:46 -08:00
Mateusz Kwapich
7a0665c9fc remove dead code from fbconduit hg extension
Summary:
Since it's not calling conduit anymore we can remove all conduit related
functions.

Reviewed By: quark-zju

Differential Revision: D18733121

fbshipit-source-id: 20a6022d9ac7ae6e9afea2791a8daac57cefb22c
2019-12-03 05:56:20 -08:00
Mateusz Kwapich
fa8571f49a migrate log_v2 to grpahql
Summary:
conduit is going away, phabricator team wants us to stop using
it in hg.

Reviewed By: quark-zju

Differential Revision: D18732257

fbshipit-source-id: c4faf83e36af80fc616e91adede141ba12de5446
2019-12-03 05:56:20 -08:00
Mateusz Kwapich
fd3b110471 migrate get_mirrored_rev to graphql
Summary: conduit is going away, phabricator team wants us to stop using it in hg

Reviewed By: quark-zju

Differential Revision: D18727399

fbshipit-source-id: c208f5fec5fefd83aa37629b56d2bbaa2532d30e
2019-12-03 05:56:20 -08:00
Stefan Filip
30045a27ba manifest: update python bindings to allow insertions before deletions
Summary:
The Mercurial code has the bad habbit of inserting files in what can
appear impossible locations. Sometimes files with directory names and
sometimes directories in file locations. This happens because the initial
code would do additions before deletions on Manifest implementations that
were rudimentary. As soon as we introduce validation various code paths
surface.

I tried to fix the codepaths that modify manifests but it's a losing game.
I fixed the issue that appeared in tests and a couple of issues people
reported but more situations crop up.

This is giving up on the python code.

Reviewed By: quark-zju

Differential Revision: D18737678

fbshipit-source-id: 0c97128ff67e5ba2334942b6afc404aa64a2e5f4
2019-12-02 15:53:41 -08:00
Jun Wu
94cbed7002 metalog: track bookmarks
Summary:
Since bookmarks are stored in svfs, track it in metalog for better transaction
support.

This affects some transaction / rollback behaviors. Since our plan is to remove
`hg rollback` eventually, the compatibility is intentionally broken.

Reviewed By: xavierd

Differential Revision: D18538147

fbshipit-source-id: 6070772a4bce88d3808547207f5df194696b1b52
2019-11-27 11:37:44 -08:00
Jun Wu
c0bc1fb8be bookmarks: move 'bookmarks' state to storevfs
Summary:
Similar to D17199834, by moving 'bookmarks' from localvfs and sharedvfs to
storevfs, we can make it part of metalog and get better transaction support.

Reviewed By: xavierd

Differential Revision: D18524104

fbshipit-source-id: ae148c1f02fc83b5c2d73102ecab39ff223ea5df
2019-11-27 11:37:43 -08:00
Jun Wu
864b42fc8a tests: do not operate on .hg/bookmarks directly
Summary:
I'm going to move `bookmarks` to "metalog". So operating on the `.hg/bookmarks`
file no longer works.

Reviewed By: xavierd

Differential Revision: D18524105

fbshipit-source-id: dc31b13e1acc171d2e8b32cdfea7028faf6dc4d3
2019-11-27 11:37:43 -08:00
Jun Wu
4fe519d97f repo: always share bookmarks
Summary:
Right now `bookmarks` is stored at both "local" vfs and the "shared" vfs.
In an upcoming change I'd like to move bookmarks to the "metalog" to get
better transaction. Therefore make it always shared.

The shared bookmark feature is turned on by default. Assuming nobody manually
turns it off, production hosts all have shared bookmark turned on.

Reviewed By: simpkins

Differential Revision: D18524103

fbshipit-source-id: 3160146f357dd01f2d78f5d2f4a14838f8f12a94
2019-11-27 11:37:42 -08:00
Jun Wu
9c8156804e metalog: raise ProgrammingError on misuse
Summary:
The only valid place that metalog can be changed is inside a transaction, since
it's transaction.{close,abort} that writes or discards metalog changes.

In other words, metalog should not be changed during A, B, or C:

  |<- A ->|<----------- repo lock --------->|
          |<- B ->|<- transaction ->|<- C ->|

Add detection for them.

Reviewed By: xavierd

Differential Revision: D18538143

fbshipit-source-id: 036286ed32a897fe3ce0a91c1e3c848cc6167b1d
2019-11-27 00:24:09 -08:00
Jun Wu
05b53a4d7b metalog: discard in-memory metalog at lock/transaction boundary
Summary:
Before this diff, metalog has a same lifetime as repo.svfs and never gets
reloaded or dropped. That is problematic in case external processes also
make changes, ex. running `hg amend` in `histedit exec`.

    pid 1> histedit action foo (a single transaction, metalog loaded here)
    pid 1> histedit action exec ... (a single transaction)
    pid 2> hg amend (changes metalog)
    pid 1> histedit action bar (cannot perform this action because metalog has
           conflicts!)

This is why test-mutation.t didn't work with metalog.

Fix it by discarding metalog state at transaction/lock boundary (enter/exit).

The next two diffs add checks so we wouldn't discard uncommitted data silently.

Reviewed By: xavierd

Differential Revision: D18519995

fbshipit-source-id: ceb030362d66ad4be142e81accb82a4afa67f305
2019-11-27 00:24:08 -08:00
Jun Wu
2e092eb740 infinitepush: protect writes with locks and transaction
Summary: This resolves ProgrammingErrors detected by a later change.

Reviewed By: xavierd

Differential Revision: D18538145

fbshipit-source-id: 650e956707af6024457cdc7dabf516d087ad03cd
2019-11-27 00:24:08 -08:00
Jun Wu
6ef1bca4c2 clone: protect writes with locks and transaction
Summary: This resolves a ProgrammingError added later.

Reviewed By: xavierd

Differential Revision: D18538146

fbshipit-source-id: fd659491e77e2b21f876f16a61860806acbc1480
2019-11-27 00:24:07 -08:00