Commit Graph

28 Commits

Author SHA1 Message Date
Arun Kulshreshtha
3f8518bf9b treemanifest: allow BFS prefetch without HTTP
Summary: Previously, we would only allow BFS prefetching when HTTP was enabled (since prior to the `designatednodes` server capability, SSH had no way of supporting BFS). That has now changed, so we should allow BFS even if HTTP is disabled.

Reviewed By: quark-zju

Differential Revision: D21581215

fbshipit-source-id: b9d5945730e2c718681004f7d5e5f319449fcf6a
2020-05-14 21:11:43 -07:00
Mark Thomas
8788654efd i18n: use _x to signal untranslated strings
Summary:
The latest version of Black removes unneccessary parenthesis.  Mercurial's
test-check-code currently uses extra parentheses to signal untranslated strings, so
Black's reformatting breaks this test.

Capitulate to Black by adding a new `_x` translation marker that means "untranslated".

Reviewed By: quark-zju

Differential Revision: D21426335

fbshipit-source-id: a6c26d7c6365c49530a7dee3a5f9ed71ff166835
2020-05-07 09:07:49 -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
Xavier Deguillard
10e9a56434 treemanifest: do a repack instead of purging treemanifest
Summary:
Purging treemanifest packfiles always made little sense to me, as the reason we
have tons of them, is because we fetched tons of them. Remove all of them would
just lead to the same situation again. Let's just do a repack instead.

Reviewed By: markbt

Differential Revision: D21065723

fbshipit-source-id: a7cdee1de1d7897481f75c13d8aceeb8c1a68550
2020-04-16 13:06:50 -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
Jun Wu
ea0ffd3607 treemanifest: make post-pull prefetch non-fatal
Summary:
Similar to D19957251, failing to prefetch trees post-pull is not a fatal error.
This recently became an issue because with these conditions:

- We're migrating a repo from hg to Mononoke, and Mononoke has lagged
  bookmarks, esp. remote/master.
- We're still using Mercurial to serve infinitepush pulls (ex. scratch
  bookmarks). Mercurial will return bookmarks that are not synced to
  Mononoke yet.
- I made a recent change (D20531121) that moves selectivepull logic that
  changes `pull -r HASH` to `pull -r HASH -B master` to core. The CI
  tier didn't have selectivepull enabled that will pull bookmarks, but
  now they also pull bookmarks.
- The tree prefetch logic uses unpatched paths.default to fetch `master`,
   which can be an unknown commit for Mononoke.

Ideally, the final state is to rely on Mononoke for everything. There is
only `paths.default` which points to Mononoke. For now, as a temporary
fix let's just make post-pull tree prefetch non-fatal. Once this happens,
it will be logged to the cloud table with fatal=false.

Reviewed By: krallin

Differential Revision: D20873599

fbshipit-source-id: 291a2dc41c7c602f004ad8df71e19a48a98e9c5e
2020-04-06 14:04:51 -07:00
Xavier Deguillard
d404b0a228 revisionstore: revamp repack to ease file format migration
Summary:
One of the main drawback of the current version of repack is that it writes
back the data to a packfile, making it hard to change file format. Currently, 2
file format changes are ongoing: moving away from packfiles entirely, and
moving from having LFS pointers stored in the packfiles, to a separate storage.

While an ad-hoc solution could be designed for this purpose, repack can
fullfill this goal easily by simply writing to the ContentStore, the
configuration of the ContentStore will then decide where this data will
be written into.

The main drawback of this code is the unfortunate added duplication of code.
I'm sure there is a way to avoid it by having new traits, I decided against it
for now from a code readability point of view.

Reviewed By: DurhamG

Differential Revision: D20567118

fbshipit-source-id: d67282dae31db93739e50f8cc64f9ecce92d2d30
2020-03-26 19:02:48 -07:00
Arun Kulshreshtha
1e698d4aaf treemanifest: add ondemandfetch parameter to _gettrees
Summary: Based on comments on D20382825, we need to make sure that `_gettrees()` knows for sure whether on-demand tree fetching is in use in order to properly identify missing nodes in the response.

Reviewed By: quark-zju

Differential Revision: D20520439

fbshipit-source-id: ffa6d62dbe8b6f641b1dacebcb6f94ceae714c1b
2020-03-18 18:24:41 -07:00
Arun Kulshreshtha
5c023bb37d treemanifest: add BFS fetching over SSH
Summary:
This diff adds client-side support for the new `designatednodes` mode of the `gettreepack` wireproto command (implemented in D20307442), which allows fetching an exact set of specified tree nodes. This enables the performance benefits of BFS tree fetching over SSH (whereas this sort of fetching was previously only possible over HTTPS via EdenAPI).

To allow us to smoothly control the rollout of this feature, it is gated behind the `treemanifest.ondemandfetch` config option. In theory, this should not be needed since the client will check that the server supports `designatednodes` before attempting to do on-demand fetching, but if users report issues it's nice to have a killswitch.

Reviewed By: quark-zju

Differential Revision: D20382825

fbshipit-source-id: f9aef3fdae08ae84a9720deead3549fe2fba0b9b
2020-03-12 09:59:47 -07:00
Thomas Orozco
472362fd6c treemanifest: comma-terminate directories list in gettreepack
Summary:
We cannot differentiate an empty list from a list containing the empty path only. This fixes that.

See D20309700 earlier in this stack for the server-side bits.

Reviewed By: quark-zju

Differential Revision: D20309699

fbshipit-source-id: 02efc747c3c5e2774f949ba0a6370169b55f3cf3
2020-03-12 06:35:34 -07:00
Adam Simpkins
0bc787c4c0 remove the mercurial.policy module
Summary:
This module previously used to handle deciding how a particular module should
be imported if it had multiple versions (e.g., pure Python or native).
However, as of D18819680 it was changed to always import the native C version.

Lets go ahead and remove it entirely now.  Using `policy.importmod` simply
makes it harder for type checkers to figure out the actual module that will be
used.

The only functionality that `policy.importmod()` still provided was verifying
that the module contained a "version" field that looked like what was
expected.  In practice these version numbers are not bumped often, so this
doesn't really seem to provide much value in checking that we imported the
correct version that we expected to be shipped with this release.

Reviewed By: xavierd

Differential Revision: D19958227

fbshipit-source-id: 05f1d027d0a41cf99c4aa93cb84a51e830305077
2020-02-21 13:54:19 -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
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
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
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
Kostia Balytskyi
a3f1d6ae64 clienttelemetry: report multiple server_hostnames
Summary:
Right now, if the client establishes connection to more than one peer, the
last one to proces `clienttelemetry` wireproto command gets the honor to set
`server_realhostname`. This is not desirable. Specifically, when we have
`fallbackpath` set up for remotefilelog/treemanifest and the prefetch happens
after pulling a commit, we get the hostname of the fallbackpath server,
while losing the hostname of the original `getbundle` server.

Reviewed By: DurhamG

Differential Revision: D19837570

fbshipit-source-id: fdc41565a5dfe670df3caf3b034196c4b7bdf6d9
2020-02-13 00:48:25 -08:00
Adam Simpkins
bcad94171a py3: add pycompat.ABC
Summary:
Assigning to `__metaclass__` only works in Python 2.  In Python 3 this
attribute is ignored, and you instead need to specify `metaclass=` in your
class signature.

This adds a new `pycompat.ABC` base class to make it easier to define abstract
classes that are compatible with both Python 2 and 3.

Reviewed By: sfilipco

Differential Revision: D19672078

fbshipit-source-id: c56eb6c7266f962ef9c13c742e6ac0651b9c19c9
2020-01-31 17:05:54 -08:00
Jun Wu
e124dfebc6 pyre: add stub for "bindings"
Summary:
Add a partial stub so pyre stops complaining about "bindings" being unknown.

Pyre's "search_path" was adjusted to read the new "pystubs" directory.

Reviewed By: DurhamG

Differential Revision: D19669131

fbshipit-source-id: a592ed411d1689058405689eb657e543b7172774
2020-01-31 13:18:54 -08:00
Durham Goode
984192ebef py3: fix hg pull
Summary:
D19657765+D19656773 made bundle2 use the standard urllib which turns
bytes into strings. This messes up bundle2 caps encoding and decoding. Caps
encoding/decoding is a nested mess of strings and bytes, so let's make it all
strings until the last minute it goes over the wire.

Reviewed By: quark-zju

Differential Revision: D19665131

fbshipit-source-id: a2fd6e309ed6da2b927d2f4ead97825a16bfcaac
2020-01-31 10:56:31 -08:00
Xavier Deguillard
5ecc59749e treemanifest: hashing requires bytes
Summary: We need to encode the key to be able to hash it.

Reviewed By: genevievehelsel

Differential Revision: D19651373

fbshipit-source-id: 214a3d127eb71a1c9cbf4ed1fec4f5a58f7f5195
2020-01-30 16:29:17 -08:00
Durham Goode
c1672ad848 py3: fix treemanifest fetching
Summary:
bundle2 parameter values are bytes, so when we compare the treemanifest
category with the bundle2 part category we need to encode the bundle2 part one.

Also fix wirepack to read utf8 paths.

Reviewed By: xavierd

Differential Revision: D19650197

fbshipit-source-id: 67da3bd8244f7953ec608019844988b20ad1929f
2020-01-30 15:22:25 -08:00
Genevieve Helsel
247f686447 izip_longest to zip_longest
Summary:
izip_longest depreciated in python3 in favor of zip_longest, use zip_longest from future

source: https://python-future.org/compatible_idioms.html#itertools-filterfalse-zip-longest

Reviewed By: xavierd

Differential Revision: D19632101

fbshipit-source-id: 2eb3c125d2beaf66045dad304b900fe7928f2066
2020-01-30 08:50:41 -08:00
Mark Thomas
82715fd2ea py3: iter{keys,values,items} -> pycompat.iter{keys,values,items}
Reviewed By: quark-zju

Differential Revision: D19608323

fbshipit-source-id: dd186ef16d6422a56af41fcaa850d9838ae9a240
2020-01-28 16:27:28 -08:00
Genevieve Helsel
514f13056d bool/nonzero aliasing
Summary: most instances of this `__non_zero__` ->` __bool__` were already aliased upstream, just updates some cases in which it was not.

Reviewed By: lisroach, quark-zju, sfilipco

Differential Revision: D19591210

fbshipit-source-id: 624fcfbb35b463f2660a47ca50d28d3dcd9e2cb0
2020-01-28 10:37:53 -08:00
Stefan Filip
2dc14cf9a6 manifest: use Rust Tree Manifest by default
Summary:
The Rust Manifest is deployed practically everywhere.
Removing the C++ code from being compiled in Mercurial along with all of the cstore extension.

Reviewed By: quark-zju

Differential Revision: D19543248

fbshipit-source-id: d632e171175e6866563c1aa0808a099b67bd937d
2020-01-23 16:06:51 -08:00
Jia Chen
a731c7518d Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Differential Revision: D19143864

fbshipit-source-id: 0d2d4ed32423b740a67aae670b7f10691e4f4800
2019-12-20 16:14:21 -08:00
Xavier Deguillard
ff36d65b5d typing: enable pyre
Summary:
The Mercurial codebase contains over 500 errors, let's ignore them for now, we
can go back to them later to fix them.

Besides the manual change to .pyre_configuration.local, the changes were
generated with:
  pyre --output=json check | pyre-upgrade fixme

Reviewed By: singhsrb

Differential Revision: D18803908

fbshipit-source-id: 724db7bd864c0de47a97ef2092bdee9f2cda531f
2019-12-04 10:55:00 -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