Commit Graph

287 Commits

Author SHA1 Message Date
Durham Goode
984af7d7fe push: avoid vanilla push when pushing to svn/git
Summary:
pushrebase, infinitepush, remotenames, hgsubversion, and hggit wrap the
push command in very complicated ways. For instance, if hgsubversion push runs,
it will never call the original push command, and therefore if its wrapper gets
called first none of the other code gets executed. Unfortunately the opposite
can also be true, where the other extensions may make decisions that ultimately
prevent the hgsubversion code from running. I believe this is the cause of our
recent issue where someone pushed directly to hg from an svn backed repo.

The real fix is to clean up our mess of push commands, but for now we can
at least prevent remotenames from avoiding the hgsubversion push path entirely.

I believe this used to work more reliably before D14153207. In that diff it
changed the behavior from passing "None" as the destination (which is what was
passed in originally) to passing the actual url. The remotename code has some
logic that says "if the passed in destination is None, default, or default-push,
check if its svn/git and call orig". By passing in the actual url, this logic is
bypassed and we can head straight to the remotenames push code which may call
exchange.push and begin a vanilla push.

The easy fix is to just validate the passed in url directly if it exists and
call orig if its svn or git.

Reviewed By: quark-zju

Differential Revision: D15075782

fbshipit-source-id: 10c9c1c5669ff647a03987a2de5eaf1e3b474ce0
2019-04-25 22:06:16 -07:00
Xavier Deguillard
06151c9633 remotefilelog: properly drop packs before repacking
Summary:
After trying to enable `remotefilelog.fetchpacks` on windows, I realized that
the inline repack would always fail to remove the old pack files, leaving
temporary files around. The reason for this is that the packfiles are simply
not being garbage collected, even though `self.packs` is properly being
reinitialized. For some reason, that isn't enough to drop the refcount on the
old `self.packs` and therefore the packfiles aren't being released.

Instead of re-initializing `self.packs`, we can simply clear them, which will
release every one properly. In some cases though, it looks like one of the
packfile still isn't being released properly, I haven't figured out why, but at
least only one temporary file will be left around (until a repack 24h later
removes it).

In doing all of this, I had to duplicate some of the code in refresh to avoid
holding packfiles references in `oldpacks`.

Reviewed By: DurhamG

Differential Revision: D15076018

fbshipit-source-id: f05852c3dddc6a25e1eb13bfd633c1fcc9466bb1
2019-04-25 18:53:06 -07:00
Zeyi Fan
6aa90444ab fix used before assignment error
Summary:
I'm getting reports on Eden failed to import data from Mercurial. One of the error message I have seen is `local variable 'rcvd' referenced before assignment` (unfortunately we don't have the backtrace to locate the exact problem), and this is the only place in our codebase has a variable named `rcvd`.

The log contains this error: P62827869$210-217

So if there is any exception raised in `self._connect`, `rcvd` and `total` will not be initialized, and these variables are being used to log the error message in the `except` block:

diffusion/FBS/browse/master/fbcode/scm/hg/edenscm/hgext/remotefilelog/fileserverclient.py;18aa2052b752f1255dd53474d541c4a4177bfef5$732-737

Reviewed By: quark-zju

Differential Revision: D15069162

fbshipit-source-id: 16ec56820107fbbb24d426ce309b38a88d7eae5b
2019-04-25 10:25:44 -07:00
Markus Emrich
44ace3d00a Safer parsing of referenced tasknumber
Summary: A more robust parsing regex for task references. It avoids some additional false positives, yet should cover all valid cases.

Reviewed By: Daij-Djan

Differential Revision: D15053374

fbshipit-source-id: 85410b5181eb9921d513b3a61ef3a1591b54539b
2019-04-24 19:25:11 -07:00
Arun Kulshreshtha
f1c1cf95d6 edenapi: release GIL during data fetching
Summary: Release the GIL during data fetching to allow for progress bars to update properly. The data fetching code is pure Rust and does not interact with the Python interpreter at all, so releasing the GIL here is safe.

Differential Revision: D15051852

fbshipit-source-id: 144da953720951f9a30aadfc2b7fc8c8bc6b14aa
2019-04-24 13:33:58 -07:00
Xavier Deguillard
baacd19749 remotefilelog: enforce a limit on the packfiles size
Summary:
Once `remotefilelog.fetchpacks` is enabled, `hg gc` will no longer be able to
limit the size of the hgcache. This will be particularly challenging for
Sandcastle/Quicksand as they already see hgcache over 100GB.

The long-term plan is switching to IndexedLog based stores with a log rotate
functionality to control the cache size. In the meantime, we can implement
a basic logic to enforce the size of the hgcache that simply remove packfiles
once the cache is over the configured size.

One complication of this method is that several concurrent Mercurial processes
could be running and accessing the packfiles being removed. In this case, we
can split the packfiles in 2 categories: ones created a while back, and new
ones. Removing packfiles from the first case, lookups will simply raise a
KeyError and data will be re-fetched from Memcache/Mononoke, ie: failure is
acceptable. The second category belongs to ones that were just created by
downloading them from Memcache/Mononoke, and the code strongly assume that they
will stick around. A failure at this point will not be recovered.

One way of fixing this would be to handle these failures properly and simply
retry, the other is to not remove new packfiles. A time of 10 minutes was chosen
to categorize the packfiles.

Reviewed By: quark-zju

Differential Revision: D15014076

fbshipit-source-id: 014eea0251ea3a630aaaa75759cd492271a5c5cd
2019-04-23 13:00:24 -07:00
Mark Thomas
94257a258b blackbox: clean up blackbox logging and log more during rage
Summary:
Clean up some of the calls to `ui.log` and how they appear in blackbox logging.

* Make the names of the events consistently use `snake_case`.
* For watchman, only log once for each watchman command.  Include whether or not it failed.
* Unify `fsmonitor` logging under the `fsmonitor` event.
* Omit the second argument when it is empty - it is optional and does nothing when empty.
* Increase the number of blackbox lines included in rage to 100.

Reviewed By: quark-zju

Differential Revision: D14949868

fbshipit-source-id: a9aa8251e71ae7ca556c08116f8f7c61ff472218
2019-04-23 02:48:50 -07:00
Arun Kulshreshtha
a13df01b7a remotefilelog: fall back to SSH if HTTP pack fetching fails
Summary: Per the title, if we attempt to fetch file data and history over HTTP and the fetch fails, fall back to SSH rather than crashing.

Differential Revision: D15035947

fbshipit-source-id: 2d00a49a51a0c8809daf1d28a6e3ab7f571415b0
2019-04-22 23:41:44 -07:00
Arun Kulshreshtha
af1b898311 edenapi: add debug config option
Summary: Add a debug option for HTTP data fetching. The intended usage is for it to gate verbose debug messages; the option can be set by Chef for users in the hg_dev tier.

Differential Revision: D15040988

fbshipit-source-id: b7eaa3bab4200e083cffc5822fb9873611725e6b
2019-04-22 18:46:34 -07:00
Xavier Deguillard
10d64adb01 sampling: silence BaseException.message deprecation warning
Summary: Almost all tests are failing on Windows due to a warning about BaseException.message being deprecated. Replace it with str(e).

Reviewed By: kulshrax

Differential Revision: D15039020

fbshipit-source-id: d984af91ec447b2f721eab2e3c6d39a0b350fb57
2019-04-22 17:58:07 -07:00
Durham Goode
bf9fd13411 pushrebase: throw if prechangegroup fails
Summary:
The prechangegroup hook didn't have throw=True set, so if the hooks
failed we ignored it. This seems to have been the case for a long time, but we
only recently hit it.

Reviewed By: kulshrax

Differential Revision: D15038494

fbshipit-source-id: 4fa9ed4924c02732e3e4070e747a80fbe63564c9
2019-04-22 17:10:15 -07:00
Arun Kulshreshtha
6745729cbd edenapi: make file validation configurable
Summary: Add a new config option to toggle file validation.

Differential Revision: D15034687

fbshipit-source-id: 3783ea1dacad9d1e494a5de1388f703db0ed1129
2019-04-22 14:46:29 -07:00
Arun Kulshreshtha
e5bbec4a60 edenapi: use argument unpacking in client constructor
Summary: We have to pass a lot of config options across the FFI boundary; these are currently passed as arguments to the Eden API client constructor. Let's use argument unpacking to avoid repeating a bunch of argument names in the call to the constructor.

Differential Revision: D15034480

fbshipit-source-id: 74d0830c686c8863fcede6e57404aec3f0a58ea1
2019-04-22 14:46:28 -07:00
Xavier Deguillard
324186a60c remotefilelog: avoid double close of mutable packs
Summary:
When eden request a tree, it manually commit the pending mutable pack files. In
the unlikely case where the temporary files are removed from the disk, the
pack.close() operation will fail, since the pending packs aren't reset, the
next commit that happens while the repo object is closed will try again. This
time, it may try to close an already closed packfile, leading to P62634761.

Reviewed By: quark-zju

Differential Revision: D15015632

fbshipit-source-id: 016617334498c0161feed9dcec5ce24df931ad9c
2019-04-22 10:15:42 -07:00
Marla Azriel
9e6d77b35a commands: update help text for amend
Summary: Updated help text for hg amend and moved some options to verbose

Reviewed By: kulshrax

Differential Revision: D15004588

fbshipit-source-id: 4c9e0bffb522184ac8750ed8aa4eb5a53b309bd0
2019-04-19 11:16:56 -07:00
Stefan Filip
a802e610d1 revisionstore: rename Store to LocalStore
Summary:
I want to give Store a more specific name so that it doesn't get
confused with other Store abstractions that we will add in the
future.

Reviewed By: singhsrb

Differential Revision: D15007383

fbshipit-source-id: 499bcda4aecd5389e3bc1eba5206ba72a69c4c3d
2019-04-19 09:51:29 -07:00
Xavier Deguillard
ef4844624e remotefilelog: remove fetchwarning
Summary:
The warning isn't that useful, and can actually cause more harm than good, as running `hg prefetch -r .`
can download gigabytes of unnecessary data to the hgcache.

Reviewed By: quark-zju

Differential Revision: D14999458

fbshipit-source-id: b0ff2c2ad0e441622066fac10a5efafe8de588db
2019-04-18 14:09:09 -07:00
Jun Wu
ae6bf97297 remotenames: make push with tracking bookmark work with infinitepush
Summary:
The `if dest` test fails with infinitepush changing `dest` to non-None.
Fix it by also checking if `dest` matches `default-push` (or `default`).

Reported by: fryfrog

Reviewed By: markbt

Differential Revision: D14965995

fbshipit-source-id: 91e68368eda4457d06059387307a9572bc6d2906
2019-04-17 08:41:12 -07:00
Jun Wu
177b4ef156 fastlog: patch follow revset instead
Summary:
Change the fastlog approach to patch the "follow" revset function instead of
"getlogrevs". This makes it more general purposed so it can speed up commands
like `hg log -r 'reverse(follow("dir"))'`.

Note: This will regress `log dir` performance, which will be fixed in the next
diff.

Reviewed By: sfilipco

Differential Revision: D14764074

fbshipit-source-id: c2a4c8e91359d971e6ea668e5ff1f0ab6eb0534c
2019-04-16 22:19:19 -07:00
Stefan Filip
dd6dd0f998 types: remove deprecated Key.name() and Key.set_name()
Summary: Removing this function in favor of using Key.path

Reviewed By: quark-zju

Differential Revision: D14945331

fbshipit-source-id: 6b6bb70375629edf37b2b04a86545f18e15b33b4
2019-04-16 15:34:31 -07:00
Stefan Filip
9c04803a33 pyrevisionstore: use Key::new instead of Key::from_name_slice
Summary: migration

Differential Revision: D14945334

fbshipit-source-id: 1244f0d4fb6df59ebd3b72c55dbd1e1013531464
2019-04-16 15:34:31 -07:00
Saurabh Singh
8479d48934 infinitepush: fix the help text for scratch bookmark commands
Reviewed By: quark-zju

Differential Revision: D14955186

fbshipit-source-id: 1ea79762621f54adc3d8f282472fc21d596593ba
2019-04-16 13:47:36 -07:00
Xavier Deguillard
8e078ed66b memcache: add an option to use the indexedlog instead of packfile
Summary:
When the option is set, the gets will be stored in the indexed log instead of
in a packfile. With the Python code now able to read from it, this will allow
us to get more real world testing.

Reviewed By: quark-zju

Differential Revision: D14895509

fbshipit-source-id: d73d49a028f7af199b7a0873551d7b18b047e50c
2019-04-16 10:47:09 -07:00
Saurabh Singh
0b0f262d0f infinitepush: introduce server side command for moving a scratch bookmark
Reviewed By: markbt

Differential Revision: D14919847

fbshipit-source-id: 5ae1750e78b24ac6126b621ca34942d7fb46d4fe
2019-04-16 09:54:27 -07:00
Saurabh Singh
c6aab56946 infinitepush: introduce server side command for creating scratch bookmark
Reviewed By: markbt

Differential Revision: D14919850

fbshipit-source-id: 2eef682fa528b82d0b9bdac1bad66ec47d552d3c
2019-04-16 09:54:27 -07:00
Mateusz Kwapich
802213bcbb phabricator: query the draft changes too
Summary: The super-smartlog shows "local changes" even when you have some unattached draft changes associated with the diff. This diff changes that.

Reviewed By: quark-zju

Differential Revision: D14936057

fbshipit-source-id: 32204ef9c5fa862923a165624913ecb344ed4a73
2019-04-16 06:33:30 -07:00
Stanislau Hlebik
e1e5d4bb0d pushrebase use hookargs correctly if transaction was taken
Summary:
Context: for Mononoke sync job we are considering applying a few pushrebase
bundles under the same transaction to make sync job faster. More details -
https://fburl.com/y4we86hc

Doing two pushrebases under the same transaction seems to fail for  just one
reason - `hookargs` is None on the second bundle. The reason is this line -
https://fburl.com/y4we86hc, after gettransaction() is called
bundleoperation.hookargs is set to None, but transaction.hookargs is set to
current hookargs value.

In this diff pushrebase is changed to check both bundleoperation.hookargs and
transaction.hookargs

Reviewed By: quark-zju

Differential Revision: D14930970

fbshipit-source-id: e4a4dd1c85b1fdca2699dd431040d65f2642ec8a
2019-04-16 03:10:02 -07:00
Mark Thomas
f337e0d5e4 sampling: fail gracefully when ui.log arguments are not a valid format
Summary:
`ui.log` expects to be called with valid format arguments.  If the arguments
are not a valid format string, or the number of arguments doesn't match the
number of format placeholders, formatting will fail.

In this case, catch the exception and fail gracefully.  Don't even bother
formatting if there is exactly one argument.

The `blackbox` extension already does this, so extend to the `sampling`
extension.

Also fix the place where `perftrace` calls `ui.log` with a string that might
contain formatting placeholders.

Reviewed By: quark-zju

Differential Revision: D14938952

fbshipit-source-id: 1d9802308dba925109c018124d51273c348526b4
2019-04-16 01:21:55 -07:00
Xavier Deguillard
312286d5d0 remotefilelog: do not attempt repack on not existing directory
Summary:
Looking at the Hgerrors scuba table, I noticed that a lot of the sandcastle
machines had repack failures due to "No such file or directory". I'm suspecting
that's due to not having a local store to repack, and therefore listing of
files to repack would fail. Let's verify that the directory is present before
repacking to avoid this issue.

Reviewed By: quark-zju

Differential Revision: D14906503

fbshipit-source-id: 98fbe57310511df4fc9856bf71f836adefb3d855
2019-04-15 11:06:05 -07:00
Saurabh Singh
0f155ea3f7 infinitepush: move scratch bookmark matcher to common module
Summary:
This functionality is generic enough to be inside the common module so
that it can be shared easily. Upcoming commits will make use of this
functionality by importing from the common module.

Reviewed By: markbt

Differential Revision: D14919848

fbshipit-source-id: b3b7eef9eb0929334cba7ce869e7c9377c265da2
2019-04-15 09:29:31 -07:00
Saurabh Singh
839a5ffa93 infinitepush: move infinitepush server check to common module
Summary:
This functionality is generic enough to be inside the common module so
that it can be shared easily. Upcoming commits will make use of this
functionality by importing from the common module.

Reviewed By: markbt

Differential Revision: D14919849

fbshipit-source-id: 74c6ad5158bd196bb062e2ec7b04ca121b5d2c3a
2019-04-15 09:29:30 -07:00
Mark Thomas
f4245770a3 shelve: add shelvename template keyword
Summary:
Add `shelvename` template keyword, which expands to the name of the shelve for
commits that contain shelves.

Reviewed By: farnz

Differential Revision: D14932985

fbshipit-source-id: cddebd2dbc6454f7c61ed296f37822179da8a2de
2019-04-15 05:44:49 -07:00
Stefan Filip
7e2b3c256f types: rename Key::new to Key::from_name_slice
Summary:
We should update the builder for Key to take a repo path. We could build
the key directly using the default struct constructor but representing
the two constructors as functions is more clear.

Reviewed By: quark-zju

Differential Revision: D14877543

fbshipit-source-id: 328906521cdbad535e28df22fea82f21e8b5410a
2019-04-14 19:56:50 -07:00
Stefan Filip
78d11002eb types: remove Key::node()
Summary:
This function is difficult to justify in the context of the Rust borrow checker.
The primary concern for this pattern is preventing mutation when the object is
passed around.

We can always add the function back if it has to more than just return the
underlying value.

Reviewed By: quark-zju

Differential Revision: D14877545

fbshipit-source-id: acdd796e1bee5445c1bce5ce0ceb41a7334e4966
2019-04-14 19:56:47 -07:00
Stanislau Hlebik
8adfcdd88c hgsql: use fetchall method in committodb
Summary:
It makes this method 25-30% faster (shaves off 250-300 ms).

Also it counts number of fetched rows correctly - fetchall method was
overriden, but looks like __iter__ method wasn't

Reviewed By: ikostia

Differential Revision: D14915472

fbshipit-source-id: 313695c1a83d05dac2fc801792226b6b64539cb5
2019-04-13 03:20:27 -07:00
Arun Kulshreshtha
106c528c30 amend: remove dead code
Summary: This extension has been refactored many times, resulting in some code and config options that are (as far as I can tell) completely unused. Let's remove them.

Reviewed By: singhsrb

Differential Revision: D14920751

fbshipit-source-id: 8d716a1d6144ba51cdb2750f6cfc6d6262b3b8a3
2019-04-12 14:24:46 -07:00
Mark Thomas
9160d34e9e histedit: fix call to hex in loginfo
Reviewed By: mitrandir77

Differential Revision: D14911288

fbshipit-source-id: f0cfda26022da98c3722946511e52d889f965810
2019-04-12 01:57:56 -07:00
Xavier Deguillard
5ddf39f788 remotefilelog: add an indexedlog contentstore
Summary:
While the Rust code can read/write content out of an indexedlog, the Python
code cannot. For now, all the writes will be done in Rust, and the Python code
will only be able to read from it.

Reviewed By: quark-zju

Differential Revision: D14894330

fbshipit-source-id: 5c1698d31412bc93e93dabb93be106a2ef17d184
2019-04-11 12:07:58 -07:00
Xavier Deguillard
301c0f173a remotefilelog: only take repacklock once per repack
Summary:
While not a correctness issue, taking and releasing the repack lock multiple
times per repack makes `hg debugwaitonrepack` unreliable, which in turns makes
test flakey.

Reviewed By: quark-zju

Differential Revision: D14877896

fbshipit-source-id: 682b649f388d19fd51bcf8dd205ac96944039e86
2019-04-11 10:43:38 -07:00
Mark Thomas
fd1fc9e705 visibility: pullcreatemarkers should exclude hidden commits
Summary:
With explicit visibility tracking, some commits may be hidden but not obsolete.
Pullcreatemarkers should not include these hidden commits when it is considering
what to link to landed commits.

Differential Revision: D14891062

fbshipit-source-id: 542363c979aca85d6de2e2161c00d91f67f0add3
2019-04-11 07:49:21 -07:00
Mark Thomas
511b52863e visibility: support cloud sync
Summary:
Add support for explicit visibility tracking in commit cloud sync.

This means commit cloud reads the visibleheads and syncs these with the commit
cloud heads directly, removing the source of problems where obsmarkers disagree
on different hosts.

Commit cloud requires that the ordering of heads is maintained to get stable
ordering of new commits.  Update the visibleheads tracking to maintain
ordering, rather than using sets.

Finally, the calculation of the replacement node was slightly off.  This was
revealed in the new test case that is being added, so it is also fixed.

Differential Revision: D14876266

fbshipit-source-id: fe5b6bffd196d3bd74e7582e29484969495eac8e
2019-04-11 07:49:20 -07:00
Mark Thomas
a5207547aa mutation: add absorb support
Summary: The `absorb` command should also record mutation information when it modifies commits.

Reviewed By: DurhamG

Differential Revision: D14871232

fbshipit-source-id: 46bc95b7f5781f0b5f5e057a34c755fcfe653f7e
2019-04-11 02:45:16 -07:00
Mark Thomas
07f5225572 visibility: don't let hiddenoverride pin commits visible
Summary:
With explicit visibility tracking, the hiddenoverride feature of the amend
extension is no long necessary.  When upgrading to explicit visibility,
include the pinned visible commits, however after that point, hiddenoverride
should have no effect.

Users can permanently reveal obsoleted commits using `hg unhide`.

Reviewed By: DurhamG

Differential Revision: D14851269

fbshipit-source-id: b516fa97ed1545d39b51baaf9c574cb73a571645
2019-04-11 02:45:15 -07:00
Mark Thomas
fb42aba542 infinitepushbackup: exclude hidden commits from backup heads
Summary:
When run with `--hidden`, the calculation for `backupheads()` may include extra
commits (ones that are hidden but not obsolete).  This can cause some of the old
nodes to apper with "Not backed up" annotations.  They should be excluded, too.

Reviewed By: DurhamG

Differential Revision: D14851035

fbshipit-source-id: f176b50a7ac62dc493a5c4df1e0c72532c43b680
2019-04-11 02:45:15 -07:00
Mark Thomas
38930fd664 pullcreatemarkers: also create synthentic mutation entries and update visibility
Summary:
The pullcreatemarkers extension creates fake markers for landed commits by comparing
the differential revision of draft commits with those of landed commits.

In the future, mutation records will handle lands correctly, however until that stage,
replicate the pullcreatemarkers behaviour.

Reviewed By: DurhamG

Differential Revision: D14834746

fbshipit-source-id: e196ee28645270ccab1775ea896f0e453740c03e
2019-04-11 02:45:15 -07:00
Kostia Balytskyi
8e92391e67 mononoke: preserve more output from hg side in the sync job
Summary: This will help us debugging of what's going on on the server side.

Reviewed By: StanislavGlebik

Differential Revision: D14876167

fbshipit-source-id: 17aaa6dca9d5b5d7bbf69be46b58e454fe9f3fc3
2019-04-10 18:05:37 -07:00
Mark Thomas
87d3ef1330 mutation: record predecessors and operation in commit loginfo
Summary:
Record the commit predecessors and the mutation operation in the commit loginfo
so that it can be logged to telemetry.

Reviewed By: quark-zju

Differential Revision: D14798032

fbshipit-source-id: 9c4ac1a4df3c91087c776d1f8e5fca94713b0390
2019-04-10 15:16:17 -07:00
Xavier Deguillard
543c250138 pyrevisionstore: convert to rust 2018
Summary:
Most of the extern crate are now removed. The cpython one is kept around as it
heavily depends on internal macros that would need to be manually imported.

Reviewed By: quark-zju

Differential Revision: D14864995

fbshipit-source-id: 05405ac7310e4dca65daf230cc8f574da32ed4c9
2019-04-10 10:24:55 -07:00
Arun Kulshreshtha
de2605bf4d edenapi: make data and history batch sizes separately configurable
Summary: Make the batch size of data and history requests independently configurable, since data responses are typically much larger than history responses (since the former contains actual file data whereas the latter is only metadata).

Differential Revision: D14859686

fbshipit-source-id: c87c31f3e6611a55ae712e7f0ed9bb392d31a579
2019-04-09 17:00:01 -07:00
Arun Kulshreshtha
9fdd71e4df edenapi: use curl multi interface
Summary: Use the curl multi interface to fetch multiple batches of files or history entries concurrently.

Differential Revision: D14718547

fbshipit-source-id: c5a740c7e9106b719e825540f8182be31a72bae7
2019-04-09 14:59:44 -07:00