Commit Graph

880 Commits

Author SHA1 Message Date
Jun Wu
26e4090522 distutils_rust: retry mt.exe properly
Summary:
This is a revised version of D19887220.

D19887220 has 2 problems:
- It can silently ignore the mt.exe error after failures of all retries.
- There is another place that `mt.exe` runs that is not covered by retry.

This diff fixes them by wrapping the `set_long_paths_manifest` function
directly so it covers two `mt.exe` places, and makes sure all retry failure
is still a failure.

Reviewed By: sfilipco

Differential Revision: D19977802

fbshipit-source-id: 774d0c42b247a7e111841cd69f71760a5544d685
2020-02-19 13:22:39 -08:00
Adam Simpkins
6f824649ff use absolute includes to the third-party xdiff code
Summary:
Update includes to the third-party xdiff.h file to use absolute includes
from the repository root.  This allows many parts of our internal build
tooling to work better, including automatic dependency processing.

Reviewed By: xavierd

Differential Revision: D19958228

fbshipit-source-id: 341dd8c94f1138cf4a387b92e1817b2a286d6aa1
2020-02-19 13:05:06 -08:00
Adam Simpkins
5ffa268af2 use absolute includes for the native cext modules
Summary:
Update the C files under edenscm/mercurial/cext to use absolute includes from
the repository root.  Also update a few of the libraries in edenscm/mercurial
that the cext code depends on.

This makes these files easier to build with Buck in fbsource, and reduces the
number of places where we have to use deprecated Buck functionality to help
find these headers.  This also allows autodeps to work with the build targets
for these rules.

Reviewed By: xavierd

Differential Revision: D19958221

fbshipit-source-id: e6e471583a795ba5773bae5f16ed582c9c5fd57e
2020-02-19 13:05:06 -08:00
Adam Simpkins
ab8071fa35 stop including thirdparty/pyre2 in the fbcode build
Summary:
Remove `thirdparty/pyre2/__init__.py` from the `libhg` sources list.

We don't compile the `thirdparty/pyre2/_re2.cc` file in the fbcode build, so
importing the `__init__.py` module from this package just triggers an
ImportError when the code tries to use it.  The code then always falls back to
using the version of pyre2 included from the `fb-re2` wheel.

Dropping the `__init__.py` module from our library should simply trigger an
ImportError earlier when we can't even find this file, and the code will still
fall back to using `fb-re2`.

Including this `__init__.py` file just causes issues for type checking, since
it causes us to try and type check this file even though its dependencies are
not present.

Reviewed By: xavierd

Differential Revision: D19958224

fbshipit-source-id: 34ea8806b6ee9377f17a9318c64c91ec242225df
2020-02-19 13:05:06 -08:00
Adam Simpkins
d736cca388 fix type annotations in eden_dirstate_map.py
Summary:
Some of the methods in eden_dirstate_map.py had comments that were close to
type annotations that were added a couple years ago.  Update them to proper
type comments that can be recognized by Pyre and mypy.

Also remove the unused create_clone_of_internal_map() method.

Reviewed By: chadaustin, xavierd

Differential Revision: D19958225

fbshipit-source-id: b753c030acb15cf4f8d8c536614e657ee1bcba52
2020-02-19 13:05:05 -08:00
Adam Simpkins
a673c6bd4d update eden_dirstate_map to store dirstatetuple objects
Summary:
Update the `eden_dirstate_map` class to store `dirstatetuple` objects instead
of plain tuples in its `_map` member variable.  Without this the `filefoldmap`
code that is used on Windows fails, as it directly accesses `self._map` and
expects it to contain `dirstatetuple` objects.

Reviewed By: DurhamG, pkaush

Differential Revision: D19841881

fbshipit-source-id: ddb7523b598cfd8ec8719a8a74446cefcb411358
2020-02-19 13:05:05 -08:00
Lukas Piatkowski
c4f0887fc2 eden/scm: cover xdiff with autocargo
Summary: Generate the Cargo.toml files inside xdiff with autocargo. This will enable Mononoke to depend on this code easily without sacrificing anything on eden/scm side.

Reviewed By: aslpavel

Differential Revision: D19948741

fbshipit-source-id: 905ff3d64b90830e5f075e4c6ed2b3de959e3f00
2020-02-19 05:15:17 -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
Jun Wu
ad6eb1928b treemanifest: make prefetchdraftparents non-fatal
Summary:
Not being able to prefetch draft parent trees should not be considered as a
fatal error.

This code path is causing trouble with narrow-heads clone:

1. Streaming clone. The client gets a changelog.
2. The client runs "pull" to get new commits. The prefetchdraftparents code path runs.
3. The client has stale remote names, and public() is lagging. `prefetchdraftparents`
   will try to fetch trees at the old master, but the repo is not configured properly.

That causes a stacktrace like:

  $ /usr/bin/hg --config 'extensions.fsmonitor=!' clone --shallow -U --config 'ui.ssh=ssh -oControlMaster=no' --configfile /etc/mercurial/repo-specific/www.rc ssh://hg.fb.com/repo repo
  connected to hg.fb.com
  streaming all changes
  searching for changes
  adding commits
  adding manifests
  adding file changes
  added 1 commits with 0 changes to 0 files  # <<<< No traceback if this says "0 commit".
  Traceback (most recent call last):
    File "edenscm/hgext/remotenames.py", line 1464, in exclonecmd
      orig(ui, *args, **opts)
    File "edenscm/hgext/remotefilelog/__init__.py", line 433, in cloneshallow
      orig(ui, repo, *args, **opts)
    File "edenscm/mercurial/commands/__init__.py", line 1615, in clone
      shareopts=shareopts,
      # shareopts = {'mode': 'identity'}
    File "edenscm/mercurial/hg.py", line 741, in clone
      exchange.pull(local, srcpeer, revs, streamclonerequested=stream)
    File "edenscm/mercurial/util.py", line 621, in __exit__
      self.close()
    File "edenscm/mercurial/transaction.py", line 46, in _active
      return func(self, *args, **kwds)
    File "edenscm/mercurial/transaction.py", line 543, in close
      self._postclosecallback[cat](self)
      # cat = bin('6472616674706172656e74747265656665746368')
    File "edenscm/hgext/treemanifest/__init__.py", line 490, in _parenttreefetch
      self.prefetchtrees([c.manifestnode() for c in draftparents])
      # c = <changectx b5ad643b3009>
      # draftparents = [<changectx b5ad643b3009>]
    File "edenscm/hgext/treemanifest/__init__.py", line 522, in prefetchtrees
      self._prefetchtrees("", mfnodes, basemfnodes, [], depth)
      # basemfnodes = [bin('a25f17018d7cd07f1f6bc3076f95c5980ba087a9')]
      # mfnodes = [bin('ad717aac7700e783a1d84f3330d13a7731a4726a')]
    File "edenscm/hgext/treemanifest/__init__.py", line 529, in _prefetchtrees
      fallbackpath = getfallbackpath(self)
    File "edenscm/hgext/treemanifest/__init__.py", line 2173, in getfallbackpath
      if util.safehasattr(repo, "fallbackpath"):
    File "edenscm/mercurial/util.py", line 190, in safehasattr
      return getattr(thing, attr, _notset) is not _notset
      # attr = 'fallbackpath'
    File "edenscm/mercurial/util.py", line 904, in __get__
      result = self.func(obj)
    File "edenscm/hgext/remotefilelog/shallowrepo.py", line 42, in fallbackpath
      "no remotefilelog server " "configured - is your .hg/hgrc trusted?"
  Abort: no remotefilelog server configured - is your .hg/hgrc trusted?
  abort: no remotefilelog server configured - is your .hg/hgrc trusted?

Fix it by making prefetchdraftparents non-fatal. This would hopefully unblock
narrow-heads rollout.

Reviewed By: xavierd

Differential Revision: D19957251

fbshipit-source-id: e65bbe6bf422776effe49055f7332ec538177a41
2020-02-18 17:36:54 -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
Adam Simpkins
1a263466c6 remove the unused sparsematchfn dirstate parameter
Summary:
This parameter was originally removed in D12811551, but re-added in D12855935
due to the fact that at the time the `eden_dirstate.py` and `dirstate.py`
files were deployed in separate RPMs and could not be updated together
atomically.  We now deploy these files together, so we can drop this extra
unnecessary argument.

Reviewed By: chadaustin

Differential Revision: D19913057

fbshipit-source-id: 0f0b4fde4b3124a8fc5bb568551b4e67de14d410
2020-02-18 11:39:22 -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
99a829340b py3: move sampling to use mercurial.json
Summary:
We're seeing a user have issues because their username contains unicode
characters and sampling's use of json doesn't handle it well. I've not been able
to repro it unfortunately, but let's go ahead and switch sampling to use
mercurial.json.

Differential Revision: D19895419

fbshipit-source-id: a1f087d1e2c7568488c2b8d54f267bd5c8266202
2020-02-18 09:36:28 -08:00
Xavier Deguillard
d8064b5e2a types: add a Sha256 type
Summary: This will be used in the LFS store.

Reviewed By: DurhamG

Differential Revision: D19895803

fbshipit-source-id: 4cf447987c10fed0b5c98904f20c841428965d89
2020-02-18 08:32:33 -08:00
Xavier Deguillard
17cc9ab5ab revisionstore: add a wrapper around IndexedLog/RotateLog
Summary:
In some cases, higher level stores may want to store data in either a plain
IndexedLog, or in a RotateLog, for local and shared data. Due to slight
difference between the 2, they can't easily be adapted into a common trait.

Instead let's just wrap both into an enum and implement the main functions that
the higher level stores need.

The first use of this will be the LfsStore, future use will include the
IndexedLogDataStore and the IndexedLogHistoryStores.

Reviewed By: DurhamG

Differential Revision: D19859292

fbshipit-source-id: 920572e0cf5f69bda4901a727a6b0dc0f08fc8d0
2020-02-18 08:32:32 -08:00
Durham Goode
d15cb231fb py3: get fastannotate closer to passing
Summary: There's still some issues, but it's a lot closer.

Reviewed By: quark-zju

Differential Revision: D19802023

fbshipit-source-id: da539094cbc0ba3542e4b5fd3d49f5f80455ec23
2020-02-17 14:52:40 -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
cd8e154e36 py3: fix test-bookmarks.t
Reviewed By: quark-zju

Differential Revision: D19800698

fbshipit-source-id: a9267e3bafa6f8abb472c0002815fdd2bf2024ca
2020-02-17 14:52:39 -08:00
Durham Goode
779b0beb0b py3: fix test-fb-hgext-phabstatus.t
Reviewed By: quark-zju

Differential Revision: D19800700

fbshipit-source-id: b9b052b5ad1bfa1c714b880cf79c9a21cfebadc2
2020-02-17 14:52:39 -08:00
Durham Goode
6b84a5da81 py3: fix stablerev tests
Reviewed By: quark-zju

Differential Revision: D19800695

fbshipit-source-id: a08efe3c43b1fa01be15ec43a6e32f68dd8eec71
2020-02-17 14:52:38 -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
5827145ef2 py3: fix some infinitepush py3 issues
Reviewed By: quark-zju

Differential Revision: D19772618

fbshipit-source-id: c5e520a3cec6496e24cc5b3825ef7287ab82f304
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
a8b4789109 py3: fix misc encoding errors that showed up in tests
Summary:
These are a random batch of stack traces that show up in remotefilelog
tests.

Reviewed By: quark-zju

Differential Revision: D19772619

fbshipit-source-id: a8b9ce188cb7a5a2c9ccaeb62f6744f1c4083e38
2020-02-17 14:52:34 -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
150aa7be3d py3: fix bundle2 bookmark default values
Summary: They need to be bytes to match the nodes.

Reviewed By: xavierd

Differential Revision: D19746027

fbshipit-source-id: 41e9cc390f4aa97d8c8b378144e64100811665c2
2020-02-17 14:52:32 -08:00
Durham Goode
6d40f2c380 py3: fix occasional ssh hang
Summary:
sshpeer._calltwowaystream used iter(fp, ""), where "" was the sentinel
indicating the fp was empty. Since fp was an iterator of bytes, the sentinel was
never hit and this code kept sending 0\n to each other until the pipes filled
and it hung.

Reviewed By: xavierd

Differential Revision: D19746028

fbshipit-source-id: 0daada0ae2356b5c99cc2c39c121cd88af8f750a
2020-02-17 14:52:32 -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
67ade10253 py3: fix minor bookmark and sparse encoding issues
Reviewed By: quark-zju

Differential Revision: D19717254

fbshipit-source-id: 1ee7fab0bec1bb5b42c2707e7bc07aa8300f4be7
2020-02-17 14:52:31 -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
66fd50346c py3: add pycompat buffer alias
Summary: buffer in Python 2 became memoryview in Python 3.

Reviewed By: quark-zju

Differential Revision: D19717251

fbshipit-source-id: f678abfed7e2ec94053329b13015bff3c31eb319
2020-02-17 14:52:30 -08:00
Durham Goode
e4b5247311 py3: fix test-cat.t
Summary:
Fixes test-cat.t by changing some formatter encoding choices. The
formatter is bit awkward here.  hg cat needs to support outputting raw binary,
but also json and templated output.

For now I've set it up so json and templated output can't output non-utf8 data.

Reviewed By: quark-zju

Differential Revision: D19786542

fbshipit-source-id: 84060928103b396b23e3173b715aed996074fa3e
2020-02-17 14:52:30 -08:00