Commit Graph

73 Commits

Author SHA1 Message Date
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
Adam Simpkins
ab3a7cb21f Move fb-mercurial sources into an eden/scm subdirectory.
Summary:
In preparation for merging fb-mercurial sources to the Eden repository,
move everything from the top-level directory into an `eden/scm`
subdirectory.
2019-11-13 16:04:48 -08:00