Commit Graph

51 Commits

Author SHA1 Message Date
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
Jun Wu
1d4682dfa0 metalog: improve conflict handling
Summary:
The current `commit` code path errors out without telling much about what
conflicts are. Improve it by showing what are actually conflicting, and allows
users to replace the resolver function to do customized merges.

Reviewed By: xavierd

Differential Revision: D18519996

fbshipit-source-id: 78f42ada1df45659783ce1eba30a19f6fc6b3b62
2019-11-27 00:24:07 -08:00
Jun Wu
44e6e32d5a tests: remove tests that #require svn
Summary:
Those tests will crash `run-tests.py` because `svn` is unknown to `hghave`.

Alternatively we can revert `hghave` changes in D18088850. But it seems there
is little interest in converting svn repos using the convert extension.

Reviewed By: singhsrb

Differential Revision: D18713922

fbshipit-source-id: 1a70b3d5d0fe8d02cc0549eabeb609ab1d9c12e6
2019-11-27 00:24:07 -08:00
Jun Wu
d011a49d16 run-tests: protect a "print" with "iolock"
Summary:
I have been seeing the progress bars get messed up like:

  [                    ] 0 Passed. 0 Failed. 0 Skipped. 903 Remaining         0.3s
  [                    ] test-contrib-perf.t                                  0.3s
  [                    ] test-check-code.t                                    0.3s
  [                    ] test-check-config.t                                  0.3s
  [                    ] test-contrib-check-code.t                            0.3s
  [                    ] 2 Passed. 0 Failed. 0 Skipped. 902 Remaining         0.4s
  [                    ] test-contrib-perf.t                                  0.4s
  [                    ] test-check-code.t                                    0.4s
  [                    ] 3 Passed. 0 Failed. 0 Skipped. 900 Remaining         0.9s
  [                    ] test-contrib-perf.t                                  0.9s
  [->                  ] test-check-code.t                                    0.9s
  [                    ] 5 Passed. 0 Failed. 1 Skipped. 897 Remaining         2.4s
  [-->                 ] test-contrib-perf.t                                  2.4s
  [--------->          ] test-check-code.t                                    2.4s
  [----------------->  ] test-check-config.t                                  2.4s
  [----------------->  ] test-contrib-check-code.t                            2.4s
  [                    ] test-run-tests.t                                     2.4s
  [------>             ] test-checkoutidentifier-commitinfo.t                 2.4s
  [-------------->     ] test-commitcloud-checkoutlocations-update.t          2.4s
  [-------->           ] test-checkserverbookmark.t                           2.4s
  [--------------->    ] test-checkoutidentifier-dirstateinfo.t               2.4s
  [---------->         ] test-debugcheckcasecollisions-treemanifest.t         2.4s
  [                    ] test-fb-hgext-copytrace.t                            2.4s
  [                    ] test-copytrace-heuristics.t                          2.4s
  [---------------->   ] test-check-execute.t                                 2.4s
  [----------->        ] test-fb-hgext-grpcheck.t                             2.4s
  [---->               ] test-treestate-needcheck.t                           2.4s
  [------------->      ] test-check-help.t                                    2.4s

I tracked it down to `hghave` crash with unknown svn-related features. The fix is
to protect the write with iolock. With thi spatch the progress bar now looks like:

  skipped: unknown feature: svn
  skipped: unknown feature: svn-bindings
  skipped: unknown feature: svn
  skipped: unknown feature: svn-bindings
  skipped: unknown feature: svn
  skipped: unknown feature: svn-bindings

  [                    ] 7 Passed. 0 Failed. 1 Skipped. 895 Remaining         2.9s
  [--->                ] test-contrib-perf.t                                  2.9s
  [--------->          ] test-check-code.t                                    2.9s
  [----------------->  ] test-check-config.t                                  2.9s
  [->                  ] test-run-tests.t                                     2.9s
  [------>             ] test-checkoutidentifier-commitinfo.t                 2.9s
  [----------------->  ] test-commitcloud-checkoutlocations-update.t          2.9s
  [-------->           ] test-checkserverbookmark.t                           2.9s
  [---------------->   ] test-checkoutidentifier-dirstateinfo.t               2.9s
  [---------->         ] test-debugcheckcasecollisions-treemanifest.t         2.9s
  [                    ] test-fb-hgext-copytrace.t                            2.9s
  [                    ] test-copytrace-heuristics.t                          2.9s
  [------------->      ] test-fb-hgext-grpcheck.t                             2.9s
  [----->              ] test-treestate-needcheck.t                           2.9s
  [----------------->  ] test-check-help.t                                    2.9s
  [----------->        ] test-commitcloud-smartlog.t                          2.9s
  [----------->        ] test-lfs-checksum.t                                  2.8s
  [-------->           ] test-progressfile.t                                  2.8s
  [-->                 ] test-dirstate-race.t                                 2.4s
  [->                  ] test-fb-hgext-copytrace-amend.t                      2.2s
  [                    ] test-help.t                                          1.9s

Reviewed By: singhsrb

Differential Revision: D18713921

fbshipit-source-id: 2897b2dda56a02842d8d88f31972156cf8f615ad
2019-11-27 00:24:06 -08:00
Jun Wu
ab6e41e651 continue: show a hint about how to resolve conflicted files
Summary:
"outstanding merge conflicts" is not a helpful message to inexperienced users.
Print out commands to get more context.

Reviewed By: simpkins

Differential Revision: D18535010

fbshipit-source-id: 035ec9f3d79bf04a997ee907469f2e3d749a1d0e
2019-11-22 21:22:45 -08:00
Johan Schuijt-Li
1b7dd50dbf hg: don't create tempfiles longer than allowed on filesystem
Summary:
[svcscm@hg022.prn2 /data/scm/www]$ hg log -r master
    transaction abort!
    rollback completed
    abort: File name too long: '/data/scm/www-merge-generaldelta/.hg/store/data/flib/intern/____generated____/_graph_q_l_meerkat_step/flib/intern/entschema/generated/entity/bizapps/dcp__insight/application__config/_ent_d_c_p_insights_application_config_action.php/._g_q_l_g___intern_____set_permission_manager_domain_dcp_insights_application_config_data_____ent_d_c_p_insights_application_config_action____gen_perform_graph_q_l_set_permission_manager_domain_dcp_insights_application_config_mutation_coercer.php.i-U0sMqX~'

On hg022.prn2 www currently failes under certain circumstances because filenames longer than
255 characters are currently created. I traced this back to mktempcopy and made sure that
we truncate filenames when they are created too long.

Reviewed By: quark-zju

Differential Revision: D18639433

fbshipit-source-id: 20e4b086ca5c775b6054b642ecedfb05efd00fb9
2019-11-21 10:41:02 -08:00
Jun Wu
6b6b6cf36d blackbox: add Event::Tags and its index
Summary:
Add Event::Tags so we can tag commands with one or more names.
Add index for the tags so we can search them more efficiently.

As we're here, update hgcommands to read EDENSCM_BLACKBOX_TAGS and write
Event::Tags automatically just after Event::Start.

Differential Revision: D18610733

fbshipit-source-id: c69b6e3d34b317e92a1c4d76f29e832b6b01c4fa
2019-11-21 08:36:10 -08:00
Jun Wu
6b8acfe260 hgsql: add rate limiting for read commands
Summary:
Similar to D2756217. But skip sync directly if the repo has been synced
recently.

This will help reducing CPU load on the DB tier.

Reviewed By: ikostia

Differential Revision: D18621013

fbshipit-source-id: 83370669ea61eb693d06495aaa13664648b97aca
2019-11-21 07:45:31 -08:00
Jun Wu
2918ef4850 test-hggit-clone: update the test
Summary:
The test needs to be updated since we now print commit hashes instead of
revision numbers in `phase` output.

Reviewed By: akushner

Differential Revision: D18596300

fbshipit-source-id: b42bb6ed68dfc33977f0c9df5018a5bf365c2909
2019-11-19 12:05:05 -08:00
Jun Wu
0bab8ac4b2 tests: revive silenttestrunner.py
Summary: D18541783 accidentally removed it. Revive the file to unbreak tests.

Reviewed By: singhsrb

Differential Revision: D18587477

fbshipit-source-id: 7a7a0cf8a53e5e1fc1856aab18a3da02e53e019a
2019-11-18 20:34:04 -08:00
Jun Wu
1f5ccb5939 test-hggit-bookmark-workflow: update the test
Summary: D18544475 changed `phase` output. Update this test.

Reviewed By: singhsrb

Differential Revision: D18587462

fbshipit-source-id: 82b5a75a006c792f259af9ca038c24a032069f55
2019-11-18 20:34:04 -08:00
Jun Wu
48722a4f20 test-contrib: remove the test
Summary: The test was about `simplemerge`, which was removed. Therefore, remove the test.

Reviewed By: singhsrb

Differential Revision: D18587461

fbshipit-source-id: daf12f0c38ec08a0f73d834b8f32dc1a65620a8f
2019-11-18 20:34:04 -08:00
Xavier Deguillard
81aabc01e7 phase: print node, not revision number
Summary: Revision numbers are going away, let's print the node instead.

Reviewed By: quark-zju

Differential Revision: D18544475

fbshipit-source-id: df9ab928a3f7dbbcd95352eebcea46f563eec4f3
2019-11-18 13:23:00 -08:00
Jun Wu
13a6237c1d run-tests: silent some errors from run-tests itself
Summary:
I have seen errors like:

  Traceback (most recent call last):
    File "/usr/lib64/python2.7/threading.py", line 812, in __bootstrap_inner
      self.run()
    File "/usr/lib64/python2.7/threading.py", line 765, in run
      self.__target(*self.__args, **self.__kwargs)
    File "./run-tests.py", line 2636, in job
      del runningtests[test.name]
    File "/usr/lib64/python2.7/collections.py", line 68, in __delitem__
      dict_delitem(self, key)
  KeyError: 'test-empty-t.py'

It's not fatal and is caused by race condition. So let's just ignore it.

Reviewed By: ikostia

Differential Revision: D18538388

fbshipit-source-id: 85e38578bea4c9b27439e6f10abb7619a8bb9238
2019-11-18 11:42:09 -08:00
Jun Wu
b4f7ff744e run-tests: dott Python tests do not have reference outputs
Summary:
Before this patch, if `test-foo-t.py.out` exists, the output of `test-foo-t.py`
will be diffed against it, something like:

  % ./run-tests.py test-empty-t.py
  --- test-empty-t.py.out
  +++ test-empty-t.py.err
  @@ -1,4 +1,4 @@
   Traceback (most recent call last):
     File "tests/test-empty-t.py", line 77, in <module>
  -    raise RuntimeError('a')
  -RuntimeError: a
  +    raise RuntimeError('ab')
  +RuntimeError: ab

However, the dott Python tests are not using "reference output" at all. If they
output something, it's mostly likely some crash or back traces that we want to
see the full content of it.

This patch makes it so. The new output looks like:

  % ./run-tests.py test-empty-t.py
  Traceback (most recent call last):
    File "tests/test-empty-t.py", line 77, in <module>
      raise RuntimeError('ab')
  RuntimeError: ab

  ERROR: test-empty-t.py output changed

As we're here, also improve the detection of dott Python test so they don't
have to have the `-t.py` suffix in file name.

Reviewed By: ikostia

Differential Revision: D18534830

fbshipit-source-id: 826328be5de5841081e8f093b07295bc2fadc6b1
2019-11-18 11:42:08 -08:00
Jun Wu
e5d47a8bde codemod: remove unneeded files
Summary:
Remove files that are ancient, not used, or not referred.
The file list was initially generated via a Ruby script:

  (Dir['{contrib,tests}/**']-Dir['tests/test-*']).select{|name| `rg #{File.basename(name).split('.')[0]}`.empty?}

Plus some manual selection.

Some notes about deleted files:
- Revset benchmarks: Benchmarks on the Rust side is a cleaner choice.
- editmerge and hg-new-workdir: Newer versions live in fb/.

Reviewed By: xavierd

Differential Revision: D18541783

fbshipit-source-id: f08933d5c1a9c46d25322adbc2cc1e8a1b505d70
2019-11-15 17:08:40 -08:00
Stefan Filip
e07097e3bc tests: set flatcompat=False for test-fb-hgext-treemanifest-pushrebase.t
Summary: Title

Reviewed By: quark-zju

Differential Revision: D18463485

fbshipit-source-id: 6356d87743764e85f46e91e6bffe35db7ebdf10b
2019-11-15 10:47:50 -08:00
Michael Devine
8c7131b74f Optimize memory usage of rev-list parser
Summary: The existing logic for parsing rev-list data relies very heavily on split, which creates many intermediate strings that take up a lot of memory. This commit updates the logic to use indices into the original output to extract individual strings. It also includes a new unit test for the list parsing. Big thanks to Tom Hebb for identifying the excessive memory usage.

Reviewed By: tchebb

Differential Revision: D18513949

fbshipit-source-id: c3b4e420ae2635904b42b84f2973e83c81c21dd7
2019-11-15 10:38:48 -08:00
Xavier Deguillard
75d4a47eb1 histgrep: replace rev number with node in default output
Summary:
Revision numbers are deprecated, let's only show the short hash of the commit
instead.

Reviewed By: quark-zju

Differential Revision: D18519655

fbshipit-source-id: df277cc7e99ad747899d1fae2d92cd88eebea0f1
2019-11-15 09:48:10 -08:00
Xavier Deguillard
d7de06ddfd cmdutil: use ctx.node() instead of ctx.rev() in finddate
Summary:
The finddate function is used when using `hg update --date`, and since it
returned a revision number, the user would see the revision number deprecation
warning. Using nodes solves this.

Reviewed By: quark-zju

Differential Revision: D18486760

fbshipit-source-id: e1a51f624d8e7133fbf334f9b8b4b4c3d5aff2a0
2019-11-14 15:30:47 -08:00
Jun Wu
055cf342d9 pathmatcher: hint globset to use prefix strategy instead of regexp strategy
Summary:
`globset` supports multiple matching strategies, including literal prefix
(backed by AhoCorasick), or regexp, etc.

In theory patterns like `foo/**` (where `*` cannot match `/`) can use `foo`
prefix strategy. However, the implementation detail of `globset` wouldn't
accept it as a prefix. But `foo/*` (where `*` can match `/`) can be treated as
a prefix. Transform the former pattern to the latter to hint `globset` to use
the optimal strategies.

Reviewed By: sfilipco

Differential Revision: D18500298

fbshipit-source-id: 39e604d6157a919b75c392488b6d42375e518c16
2019-11-14 14:27:39 -08:00
Jun Wu
63c1b3001d treematcher: implement proper error handling
Summary:
simpkins encountered a case where the treematcher does not work with many
patterns.  It turns out `globset` has a hard-coded regex size limit (10MB).

Implement proper error handling so we can detect such issues and fallback to
slower paths.

Reviewed By: sfilipco

Differential Revision: D18500299

fbshipit-source-id: 0122ba9b0246c1536b2069a40e13261ee47f8bba
2019-11-14 11:43:18 -08:00
Adam Simpkins
46890ae1ec Merge fb-mercurial sources into the eden repository
Summary:
Merge the fb-mercurial code into the Eden repository, under the
`eden/scm` subdirectory.

Reviewed By: quark-zju

Differential Revision: D18445774

fbshipit-source-id: fc3307f9937e0c7e1c8f7d03c5102c4fe5dedb10
2019-11-13 20:20:32 -08:00