Commit Graph

266 Commits

Author SHA1 Message Date
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
Aida Getoeva
0af9f95998 add backup command
Summary:
The command is supposed to check if the given commits are backed up and if not to back them up.

This is needed for `jf submit` to make sure that all the commits submitted are backed up by hg.

Reviewed By: markbt

Differential Revision: D14685222

fbshipit-source-id: 224a438ec1c5c17af6988c511be4af4a3a988a79
2019-04-09 12:14:08 -07:00
Aida Getoeva
6f4459dd42 don't skip metadata while creating data wirepacks
Summary:
Currently we skip metadata when constructing data wirepacks.
We need copy metadata in the data packflies, because the client expects the base text to contain copy metadata since the delta base on the server also contains copy metadata.

It is also needed for future file nodes validation.

Differential Revision: D14851678

fbshipit-source-id: 1a3f79dc2565cdb864bee2400d331ae3a7c3751b
2019-04-09 10:37:01 -07:00
Mateusz Kwapich
d5bae8360a phrevset: avoid crashing on null graphql reply
Summary:
The Dxxxx revset does two things in parallel:
 * walks the changelog in the search of commit associated with Dxxx.
 * makes graphql query to resolve Dxxxx to the hash associated with the last
   submitted version.

This behaviour is clowny and confusing and should be changed long-term. This is
just a short term fix to prevent it from crashing in cases there's no local
commit associated with Dxxx (or it's very old) and the graphql query comes back
with empty result (because there are no versions for the diff).

Reviewed By: markbt

Differential Revision: D14851313

fbshipit-source-id: 14f7531aa4691007266291a38a016242de563de4
2019-04-09 07:53:43 -07:00
Mateusz Kwapich
12ad4df265 phabricator: fix the getrevisioninfo for Diffs in reserved state
Summary:
Diffs in reserved state have latest_active_diff=null (but it's present). That's why our current logic failed for it.

=== Query

{P62246960}

=== Query Parameters

```
{
  "params": [
    {
      "numbers": 14814207
    }
  ]
}
```

=== Response

```
lang=json
{
  "data": {
    "query": [
      {
        "results": {
          "nodes": [
            {
              "number": 14814207,
              "diff_status_name": "Reserved",
              "latest_active_diff": null,
              "created_time": 1554501017,
              "updated_time": 1554501017,
              "is_landing": false,
              "differential_diffs": {
                "count": 0
              }
            }
          ]
        }
      }
    ]
  }
}
```

=== Run in GraphiQL

[[https://www.intern.facebook.com/intern/graphiql/intern/?query_paste_id=62246962 | Intern]]

Reviewed By: katherinez

Differential Revision: D14836776

fbshipit-source-id: 213afac5d51bf100973753ef8078ab0dcd18d52f
2019-04-08 13:32:17 -07:00
Mark Thomas
15242183ef treemanifest: consider all parents of outgoing nodes for tree comparison
Summary:
When determining the contexts to compare trees against, consider all parents
of the missing nodes that aren't themselves missing.

In the case of:
```
  C
 / \
D   B
    |
    A
```
Where A and D are common and B and C are missing, the parents of the roots
are only A, which means D's tree will not be compared against and all of its
trees will be included.

Reviewed By: StanislavGlebik

Differential Revision: D14798681

fbshipit-source-id: c80add907338a3011daf54a2304ea19415b7f9fb
2019-04-08 03:32:00 -07:00
Mark Thomas
6dc8896bd1 infinitepush: fix debugbundle for mutation parts
Summary:
The debugbundle implementation for mutation parts was not updated with
the recent changes made to mutation entries.  Update it.

Reviewed By: quark-zju

Differential Revision: D14798682

fbshipit-source-id: eb1defa33e8a0eed807360af2c130a225af15030
2019-04-08 02:54:39 -07:00
Arun Kulshreshtha
6705e2d120 bindings: allow choice between edenapi backends
Summary: Allow users to configure which HTTP client backend to use for the Eden API via the `edenapi.backend` config option. Valid options are `curl` and `hyper`, with `curl` being the default.

Reviewed By: quark-zju

Differential Revision: D14657871

fbshipit-source-id: 7a9972d2380fbbd5ed62d1accae764dc03ca4c29
2019-04-05 17:34:14 -07:00
Xavier Deguillard
99edfae94a remotefilelog: reduce packfile iteration cost
Summary:
In most cases, we won't have more packfiles than what is held in the LRU cache,
and therefore, building a set is unecessary. Testing for the length is a O(1)
operation and is therefore a quick test to verify if more packs needs to be
iterated on.

Reviewed By: quark-zju

Differential Revision: D14802940

fbshipit-source-id: 8b39befb27368d474ab71f3eeac2340d8183e70e
2019-04-05 15:50:06 -07:00
Xavier Deguillard
dbb35a26fa remotefilelog: Don't iterate on packs after a null refresh
Summary:
When many packfiles are present, and searching for missing data, we will
iterate on the packs twice. We can avoid the second iteration by testing if new
packfiles were detected.

Reviewed By: quark-zju

Differential Revision: D14802942

fbshipit-source-id: 624d9a86e65395af3141ea10d42bcfb8ee18db83
2019-04-05 15:50:05 -07:00
Xavier Deguillard
f8299c5d7c remotefilelog: cache pack path
Summary:
Building a set is a O(n) operation, and in the cases where refresh is called
often, it starts showing up in profiles. Instead of rebuilding it everytime, we
can simply update it when adding/removing packs.

Reviewed By: quark-zju

Differential Revision: D14802945

fbshipit-source-id: f8967d09d2d7d0cc0d7400b047a587d536315002
2019-04-05 15:50:05 -07:00
Xavier Deguillard
6e6a7e3e8b remotefilelog: cache remotefilelog.descendantrevfastpath
Summary:
The repo.ui.configbool was showing in profiles when running `hg log -p`. Since
its value won't change for the duration of the operation, let's cache it.

Reviewed By: quark-zju

Differential Revision: D14802941

fbshipit-source-id: c1a2a764cb4d4a1c0d45d5118bb1e892c10798a6
2019-04-05 15:50:05 -07:00
Mark Thomas
9867fdb893 cmdutil: add checkout identifier to commit loginfo
Summary:
Add the checkout identifier to the loginfo for commit contexts that take data
from the working copy.

Reviewed By: quark-zju

Differential Revision: D14751601

fbshipit-source-id: 6ddcbf17b970ee24237edf501ae3d7fc8d320193
2019-04-04 11:29:50 -07:00
Mark Thomas
528a5b064e util: extract makerandomidentifier from clienttelemetry
Summary: Extract the `makerandomidentifier` function from the `clienttelemetry` extension so that we can use it elsewhere.

Reviewed By: quark-zju

Differential Revision: D14725866

fbshipit-source-id: 0b3ed2e8c9698e892ad0f524f6dde7bf7337f85c
2019-04-04 11:29:49 -07:00
Xavier Deguillard
317bc11b4b remotefilelog: automatically repack when 100 packs are present
Summary:
One of the drawback of only using packfiles is the cost of the pathological
cases when one pack file is being downloaded per file. This can happen during a
`hg log -p`, or on Eden when running `cat` on lots of not materialized files.
In these cases, mercurial will become slower and slower as the command is
running.

This is due to mercurial having to search each individual packfile to find
whether some data exist locally, or it needs to be fetched from the network.
This search will iterate over each packfile linearly, and on a miss, a
directory scan will be performed to see if a new packfile is present.

Previous patches attempted to solve this by running a repack when the command
finishes, but in the case of `hg log -p`, or when Eden is requesting the
content of some file, the command could be running for a long time.

As a solution, let's repack while the command is running if we detect that too
many pack files are present.

Reviewed By: quark-zju

Differential Revision: D14740566

fbshipit-source-id: 95ba381bd99e5404e352f799e9053a6375abac0a
2019-04-04 10:39:55 -07:00
Zeyi Fan
9277617d1e fix double free in cdatapack
Summary:
Mercurial recently started to generate empty pack files (`0x01`). This will cause this check to fail:

diffusion/FBS/browse/master/fbcode/scm/hg/lib/cdatapack/cdatapack.c;2c4197d003ed906dd8eaf70fbb04aa53440ce681$314-319

This will subsequently result as a double-free error between these two:

**In `error_cleanup`**

diffusion/FBS/browse/master/fbcode/scm/hg/lib/cdatapack/cdatapack.c;2c4197d003ed906dd8eaf70fbb04aa53440ce681$387-389

**In `close_datapack`**

diffusion/FBS/browse/master/fbcode/scm/hg/lib/cdatapack/cdatapack.c;2c4197d003ed906dd8eaf70fbb04aa53440ce681$401

This diff will fix this bug.

Differential Revision: D14759374

fbshipit-source-id: 06f192513a935740c2142b5a2baac87a28903496
2019-04-03 21:13:13 -07:00
Katherine Zak
f88737dd96 migrate to use new names in scm/hg/edenscm
Summary:
The phabricator team is trying to eliminate `DifferentialRevision` in favor of `PhabricatorDiff`
See context here
https://our.intern.facebook.com/intern/wiki/Dev_Tools/Phabricator/GraphQLObjectRename/

I'm using aliases to reduce the number of changes needed (the object from the graphql query will have the same keys)

Reviewed By: quark-zju

Differential Revision: D14703867

fbshipit-source-id: 32204315dc154db7cbff68ee286579c0200f57b2
2019-04-02 23:34:04 -07:00
Xavier Deguillard
e2abd6aeca remotefilelog: more incremental repack for loosefile
Summary:
Loosefiles are quite slow to repack, and this is significantly affecting
laptops as the repack can potentially run for hours when a large amount of
loosefiles are present.

One of the reason for that is that an incremental repack really isn't
incremental for loosefiles as all of them are repacked at the same time.
Instead let's repack only one of the top-level directory at a time.

Reviewed By: quark-zju

Differential Revision: D14690348

fbshipit-source-id: ffba49840302ae0d99e32db410647e83e213fe64
2019-04-02 17:43:49 -07:00
Saurabh Singh
e79d8cb772 globalrevs: fail quickly for invalid searches during globalrev fast lookup
Summary:
Currently, if you lookup a globalrev which does not exist in the
repository, it leads to a linear scan of the entire changelog even while using
the globalrev based fast commit lookup. This commit speeds up the same by
relying on the indexing information.

Differential Revision: D14726937

fbshipit-source-id: 076ad8608aa656075dcb2c1287502ffe93bed851
2019-04-02 11:23:19 -07:00
Saurabh Singh
e855940cb8 globalrevs: refactor globalrevmap to include repo object as a class member
Summary:
This is just pending feedback from D14694620 which makes the class
interface more cleaner.

Reviewed By: quark-zju

Differential Revision: D14718748

fbshipit-source-id: 032fc25d7e5922aac5f4195eb007bd009822cb86
2019-04-02 08:33:09 -07:00
Harvey Hunt
024e39dbb5 hg: Fix sqlisreporeadonly sql connection
Summary:
When the sql_repo_lock.py hook is run, the sql connection won't have been
established yet. Let's open a connection and clean it up afterwards.

Reviewed By: quark-zju

Differential Revision: D14708851

fbshipit-source-id: f20b6dacdcb12cee839163325164d2e75816100c
2019-04-01 18:00:53 -07:00
Saurabh Singh
d7361b3c2b globalrevs: fix failure in globalrev lookup due to incorrect type
Summary:
The type for globalrev during lookup should be an integer instead of a
string after D14694623.

Reviewed By: quark-zju

Differential Revision: D14718749

fbshipit-source-id: eddc49ea0faa61df6ad435db2192fba4f61b0075
2019-04-01 17:42:02 -07:00