Commit Graph

577 Commits

Author SHA1 Message Date
Mark Thomas
6a6c0fea7a commitcloud: add automigrate to automatically connect to commitcloud
Summary:
Add automigrate to commitcloud, which will automatically connect the user's
repo to commit cloud on pull.

Reviewed By: mitrandir77

Differential Revision: D16666810

fbshipit-source-id: a1d0857164d2ce6bf1db5784360681f04d35ed90
2019-08-08 03:09:24 -07:00
Mark Thomas
2e3cda1ade commitcloud: cloud leave should always clear the workspace name
Summary:
Running `hg cloud leave` on a repo that was never connected should mark the
repo as explicitly disconnected so that automatic joining will not try to
connect the repo later on.

Reviewed By: quark-zju

Differential Revision: D16687470

fbshipit-source-id: 0552ffa42a1dac40874bba30eeb93509a2227aeb
2019-08-08 03:09:24 -07:00
Mark Thomas
0c6db94ffb commitcloud: simplify subscription manager
Summary:
The `SubscriptionManager` is never a long-lived object, and cannot be
constructed if the user is not connected to a workspace.  Simplify this to
function calls, which are safe to call at all times.

Reviewed By: quark-zju

Differential Revision: D16687467

fbshipit-source-id: c7f81290a3e8012f7b154af3398771ac9254387f
2019-08-08 03:09:24 -07:00
Mark Thomas
be096ab1c6 commitcloud: make cloud rejoin always join if possible
Summary:
`hg cloud rejoin` limits joining to when the user has an authentication token
and the workspace already exists.  If the user uses a different authentication
method, or if the workspace is brand new, the rejoin does nothing.

Change this to always attempting to join, and only printing a message if the
join failed because of an authentication error, prompting the user to authenticate.

Reviewed By: mitrandir77

Differential Revision: D16666365

fbshipit-source-id: 3ea4542125a1b5266711fab2c31d9455ab764cef
2019-08-08 03:09:23 -07:00
Arun Kulshreshtha
18d9581d7e treemanifest: add single-node lazy HTTP tree fetching
Summary:
When `treemanifest.usehttp` is enabled, make `remotetreestore` fetch tree nodes over HTTP rather than SSH.

Note that unlike the SSH prefetch operation, this downloads only a single tree node, which will change the I/O behavior of Mercurial to fetch manifest nodes on demand. In general, this will result in excessive round trips, but for certain commands (such as `hg cat`), this works reasonably well.

Future diffs will expand upon this functionality to make the HTTP behavior more performant. For now, this won't affect anyone unless they specifically enable the aforementioned config option.

Reviewed By: xavierd

Differential Revision: D16663197

fbshipit-source-id: 4117e057996ed30f0bfd186238264e31484c2620
2019-08-07 19:09:46 -07:00
Aleksei Kulikov
cf0570d74a snapshot: add a command to upload snapshot manifest to remote lfs
Summary:
Add the `debuguploadsnapshotmanifest oid` command.

It checks that the local lfs has `oid`, then uploads it and all the related blobs to remote lfs.

Differential Revision: D16667158

fbshipit-source-id: 2978a6c0e7c58c3710f8253cf7b9ab36b24886ce
2019-08-07 05:57:45 -07:00
Arun Kulshreshtha
7302c42b77 remotefilelog: start HTTP file fetching progress bars at 0
Summary:
Previously, we would use `None` as the start value for HTTP data fetching progress bars so that the bar would be rendered as a spinner until we received a response (which would contain a content size header, allowing us to set the progress bar total).

This would result in incorrect behavior if the server took a long time to return a response, because by default if no start value is provided the progress bar framework will display the number of seconds that have elapsed. Given that we've specified a byte count format function for the progress value, the progress bar would end up displaying the number of seconds elapsed as a byte count, which was very confusing.

Reviewed By: quark-zju

Differential Revision: D16663124

fbshipit-source-id: 0e224b3b670abc803356214cd12205a6f4259cd9
2019-08-06 17:14:58 -07:00
Stefan Filip
5bc614c767 bindings: add finalize implementation for tree manifests
Summary: Matching more of the existing API.

Reviewed By: quark-zju

Differential Revision: D16607233

fbshipit-source-id: 7a71f22089067ecfccbfcb2ad072fbf21e360439
2019-08-06 14:24:31 -07:00
Arun Kulshreshtha
8ba2df04d9 treemanifest: remove bulky HTTP prefetch
Summary:
The initial attempt at supporting tree fetching over HTTP involved reimplementing the existing Mercurial prefetch functionality (corresponding to the gettreepack wireproto command) in the API server. Unfortunately, while this worked from a functionality perspective, it was far too slow to be usable in practice.

Rather than maintaining this unused code path, let's remove it and repurpose the config flag for a more sensible version of HTTP tree fetching.

Reviewed By: farnz

Differential Revision: D16663198

fbshipit-source-id: a489d5ca177b788f93383b8a9f758316e889ca5b
2019-08-06 11:40:05 -07:00
Xavier Deguillard
9937459abe remotefilelog: remove old files in the hgcache that aren't packfiles
Summary:
The hgcache packs directory is being written to in several places, most of the
files being created there are temporary ones and renamed once ready to be
visible. In some cases, when hg crashes midway, or when the packfile is mmap'ed
on windows, temporary files are left around.

While we were trying to remove these files before, the solution taken involved
removing files we knew were safe to be removed. Unfortunately, that meant we
missed some of the temporary files. Let's instead switch to removing everything
but packfiles and the repacklock.

Reviewed By: kulshrax

Differential Revision: D16657105

fbshipit-source-id: f4dd45aa71c02acba52a745b9bec3019d20e03c4
2019-08-06 10:34:27 -07:00
Mark Thomas
bafa640cde unhide: improve performance of unhide revset
Summary:
Add `not public()` to the unhide revset to improve its performance.  We can't
unhide public commits anyway, as they can't be hidden.

Reviewed By: mitrandir77

Differential Revision: D16645983

fbshipit-source-id: f9f23e7e31050e652f1389489734416fe3278219
2019-08-06 09:52:02 -07:00
Aleksei Kulikov
cbf11e8ca8 snapshot: add command debugcreatesnapshotmanifest
Summary:
Add a self-descriptive command `debugcreatesnapshotmanifest`.
For now it supports only deleted and unknown files.

1) Uploads all the untracked files to the local lfs storage.
2) Creates a json-like snapshot with the following structure:
```
{
  "deleted": {
    "path/to/file": None, # this is done for consistency
    "path/to/another/file": None
  },
  "unknown": {
    "added": {
        "oid": "oid in local blobstore",
        "size": 42
    }
    "another/added": {
        "oid": "another oid in local blobstore",
        "size": 24
    }
  }
}
```
...and stores it in the local blobstore.

Reviewed By: markbt

Differential Revision: D16621864

fbshipit-source-id: 6c497d1bb756561b3c3368483b838a2307b0b5f9
2019-08-05 11:10:17 -07:00
Jorge Lopez Silva
a1fd50cc9b Upgrade smc/hg to cpython/python-sys 0.3
Summary: Bump cpython and python27-sys to 0.3.

Reviewed By: quark-zju

Differential Revision: D16634957

fbshipit-source-id: 9f6b45baf8098399109ad03bf440da42f4483fcb
2019-08-05 09:56:45 -07:00
Shu-Ting Tseng
bbc6d19715 use manifest lookup to speed up operations
Summary:
The original code path is extremely slow because it has to iterate all files in manifest.
The new path instead only has to lookup the entries in keptdirs and therefore is O(change).

Reviewed By: mitrandir77

Differential Revision: D16646075

fbshipit-source-id: cb2c152d236ffa6f01349c223c9470205c540379
2019-08-05 05:22:40 -07:00
Johan Schuijt-Li
77f0d3fd04 lfs: rewind fp on retries
Summary:
To avoid the scenario where we are incorrectly uploading the data that we're
supposed to upload, we need to reset the file pointer to read from the
beginning so that for each retry of uploading we get the correct data.

Previously before this patch, Mercurial would have nothing to upload on a retry
and the connection would 'hang' waiting for the data to be send to the server.

Reviewed By: krallin

Differential Revision: D16620072

fbshipit-source-id: 2238b99ff612e06dc0640717bc42fe345c35037d
2019-08-02 05:15:57 -07:00
Arun Kulshreshtha
0f9f07b6a1 remotefilelog: make HTTP retries configurable
Summary: Make the number of retries for HTTP operations configurable. Previously, they were hardcoded to 3, which may not be ideal in situations where the retries are caused by server side timeouts. (If a single timeout takes 30 seconds it would take 90 seconds to fall back to SSH.)

Reviewed By: quark-zju

Differential Revision: D16592862

fbshipit-source-id: a9ba5273a1271532ff9814bcc47cb32e60ee87b7
2019-08-01 12:54:35 -07:00
Stefan Filip
71bff70aea manifest: rename filesnotin argument from match to matcher
Summary:
Similar to diff, the `match` argument can't be easily expressed using CPython
crate bindings. This argument is not used a lot so we can rename it.

Reviewed By: quark-zju

Differential Revision: D16571840

fbshipit-source-id: 19c7dea82924b7ec4c0b66d1675b9ad4569f8b62
2019-08-01 10:35:53 -07:00
Mohammad Ayoub
c3bb7153e0 change cloud sl --version_number to --workspace-version
Summary: Change --version_number flag to --workspace-version

Reviewed By: quark-zju

Differential Revision: D16561670

fbshipit-source-id: 797a7b2fee2c3e260263ae3029d793452def3033
2019-08-01 02:18:05 -07:00
Stefan Filip
71ab0b4b3d manifest: rename match to matcher in diff argument list
Summary:
`match` is a keyword in Rust. This is causing troubles in adding Rust bindings
for functions that use that as a keyword argument. Renaming the argument to
something else seems to be the easiest path forward.

Reviewed By: quark-zju

Differential Revision: D16496134

fbshipit-source-id: c923f49577564527a99d43dda3d3d9da43122b3e
2019-07-31 10:06:48 -07:00
Stefan Filip
5d1f390ca0 manifest: remove the clean argument from diff
Summary:
The diff algorithm takes the `clean` flag. When `clean` is used all the files
that are not changed between the two manifests are returned. In short the set
of files is equal to |files(M1) U files(M2)|.

This functionality would have to be implemented in the Rust manifest. I don't
feel that a flag on the diff algorithm should be used in this case. First, I
don't like how it interacts with the core diff algorithm, it changes it to the
point where it feel like it should be a different function. Second is that this
behavior can be achieved by getting all the files in the manifest and removing
the items in the diff. Third is that this operation is done quite rarely, being
so expensive.

The downside is that the places where this flag is used get a bit more
expensive.

Reviewed By: quark-zju

Differential Revision: D16496136

fbshipit-source-id: 205dcc23517b896de5c14634683bcbd5f2aa6666
2019-07-31 10:06:47 -07:00
Shu-Ting Tseng
97f4a710b9 don't use revmap to look for ancester in hg svn info
Reviewed By: singhsrb

Differential Revision: D16561866

fbshipit-source-id: 156477a4ecc7bf205158c13e57960a0cf1dc368e
2019-07-31 09:16:23 -07:00
Shu-Ting Tseng
acec61a376 hg svn info should print globalrev
Summary:
This is used by Jellyfish and sent to Phabricator. In the future, we won't have svnrev
and therefore we should use globalrev instead.

More context: https://fb.workplace.com/groups/248282915800791/permalink/372855146676900/

Reviewed By: singhsrb

Differential Revision: D16561651

fbshipit-source-id: 284ad26b1bf77f222086bb7e2104b1c2dbf65449
2019-07-31 09:16:23 -07:00
Shu-Ting Tseng
01394c9202 hg debugcrdump should also use globalrev
Summary:
This command uses svnrev directly. However once we migrate to www-hg, this fields will
go and we can only use globalrev instead.

Let's add that and put it behind a config.

More context: https://fb.workplace.com/groups/248282915800791/permalink/372855146676900/

Differential Revision: D16560447

fbshipit-source-id: de3100ed1e6cc39eaaeff2fe11af04d2f1e2c41a
2019-07-31 09:16:23 -07:00
Mateusz Kwapich
6b7f8fe167 autoformat all of fbcode/scm with black
Summary: blackpylogo

Reviewed By: krallin

Differential Revision: D16543521

fbshipit-source-id: 75977d00329e1068a92a344c99e0ad0392601c54
2019-07-30 08:21:05 -07:00
Jun Wu
67cd8c9b81 demandimport: blacklist IPython dependencies
Summary: This makes IPython work without disabling demandimport.

Reviewed By: xavierd

Differential Revision: D16509106

fbshipit-source-id: d4443d8b58c90a0fd7a34c620756e88f4f788337
2019-07-29 13:45:44 -07:00
Saurabh Singh
459d04df3f hgsubversion: allow disabling the svnrev template keyword
Reviewed By: quark-zju

Differential Revision: D16546466

fbshipit-source-id: d3d3005b250856d2e93fbd52f178e9cd8bdf6ef2
2019-07-29 13:29:39 -07:00
Mohammad Ayoub
880e757390 add skip 1 day buttons to interactive history
Summary: Added shortcuts a, d that allow you to skip 1 day forward or back in the historical smartlogs interactive view

Reviewed By: mitrandir77

Differential Revision: D16438722

fbshipit-source-id: e61a126ed7390b5ee77ee71694d8b23f3351854a
2019-07-29 08:52:13 -07:00
Mohammad Ayoub
a9fdfb3049 quick fix to add limit to hg cloud sl --history command
Summary: The interactive view doesn't support the pager, so it is problematic for longer smartlogs. As a quick fix the interactive view only contains two weeks of commits. The full version is accessible through hg cloud sl --version_number

Reviewed By: mitrandir77

Differential Revision: D16496065

fbshipit-source-id: 7224258b426724872bf796af618ef70cbf4c9d0b
2019-07-29 07:28:21 -07:00
Xavier Deguillard
efad0cf903 cstore: remove py-cdatapack
Summary:
With fastdatapack gone, the cdatapack bindings are no longer necessary and can
be removed.

Reviewed By: singhsrb

Differential Revision: D16476584

fbshipit-source-id: 130a9c5aed4e4f005876c420961f09d398f6e6aa
2019-07-26 10:35:46 -07:00
Xavier Deguillard
f36d8a8fe1 remotefilelog: remove basepack
Summary: This is no longer used anywhere, we can remove it.

Reviewed By: singhsrb

Differential Revision: D16476582

fbshipit-source-id: fe6a8f33cbc3c37fb1d8fb33226352e41bcbaa2a
2019-07-26 10:35:46 -07:00
Xavier Deguillard
28d7ef620b remotefilelog: remove fastdatapack
Summary: This code isn't used anywhere, let's get rid of it.

Reviewed By: singhsrb

Differential Revision: D16476583

fbshipit-source-id: d42376dbb2cf631a170ade3e2764d1f70922d882
2019-07-26 10:35:45 -07:00
Xavier Deguillard
6cdcb360ed remotefilelog: remove mutablebasepack
Summary: This code is no longer used anywhere.

Reviewed By: singhsrb

Differential Revision: D16462343

fbshipit-source-id: 3e11994575a6de75562cb1ebd8839f7058abc075
2019-07-26 10:35:45 -07:00
Aleksei Kulikov
59bb951024 amend: make next prefer draft commits
Summary: Add an option `update.nextpreferdraft` that makes `hg next` prefer single draft child commits.

Reviewed By: markbt

Differential Revision: D16500162

fbshipit-source-id: 3a20bb487d35b7acf92792e9a7b7424c9b163b64
2019-07-26 10:00:07 -07:00
Shu-Ting Tseng
86bdaeb464 make pushes faster in our reverse sync case
Summary:
Our reverse sync job is too slow when pushing to svn. It seems like the slowness comes
keep doing push-pull-rebase which doesn't seem necessary in our case.

From my understanding, we need to do push-pull-rebase because we have multiple writers.
In our sync job, we only have one writer and therefore can we skip the pulls and rebases?

Reviewed By: DurhamG

Differential Revision: D16442559

fbshipit-source-id: 926d1c516e8e6d59298d310fc67927ace37f72c9
2019-07-26 07:21:37 -07:00
George-Catalin Tintareanu
f91262be22 Enum creator
Summary:
Util method to generate Enum, since some machines don't have the
python library installed.

Reviewed By: suitingtseng

Differential Revision: D16491020

fbshipit-source-id: e06470a609605c482f591418583b516918c49d93
2019-07-25 07:24:36 -07:00
Xavier Deguillard
9b21206b39 remotefilelog: remove python mutablehistorypack
Summary: There no users left, let's get rid of it.

Reviewed By: kulshrax

Differential Revision: D16423137

fbshipit-source-id: 6898e681f800ab677010d7b6cdd36d377e3ef644
2019-07-24 10:34:32 -07:00
Xavier Deguillard
10a59c9b75 remotefilelog: remove python mutablehistorypack from mutablestore
Summary: The Rust code is the default.

Reviewed By: kulshrax

Differential Revision: D16423134

fbshipit-source-id: 30baf041a5e7c786a28b31cfe5025e893b34594c
2019-07-24 10:34:32 -07:00
Xavier Deguillard
e86e388661 remotefilelog: remove python mutabledatapack code
Summary: Goodbye.

Reviewed By: kulshrax

Differential Revision: D16392290

fbshipit-source-id: 541b945e274f097b722b5e79ca03e104c4cfd6a0
2019-07-24 10:34:31 -07:00
Xavier Deguillard
bd88a79858 remotefilelog: remove python mutabledatapack reference from mutablestores
Summary:
The Rust code is now always taken, let's start removing all the references to
the python mutabledatapack code.

Reviewed By: kulshrax

Differential Revision: D16392287

fbshipit-source-id: dfccd4f4ec052a46975b6f9144106b51c3282988
2019-07-24 10:34:30 -07:00
Xavier Deguillard
334e0c0c2e remotefilelog: the rust mutable stores are the default
Summary: This is now enabled for the entire fleet, let's hardcode this in the code now.

Reviewed By: kulshrax

Differential Revision: D16392289

fbshipit-source-id: 462152ded12d00cf8218526d51a911d6fe5975ca
2019-07-24 10:34:30 -07:00
George-Catalin Tintareanu
15f36ceede hg client handler for blacklisted files
Summary: Checks if the retrieved content of a file is equal to a `magic string` representing a blacklisted file. If so, then the content is replaced by a readable text which suggests a `rebase` or `update` to a newer commit.

Reviewed By: ikostia

Differential Revision: D16260011

fbshipit-source-id: ac1d40132b9c947927271d8e6efda98b19dce984
2019-07-24 03:41:20 -07:00
Arun Kulshreshtha
a491bb06ea remotefilelog: only print debug messages during interactive usage
Summary: The debug messages from Eden API provide Source Control team members with useful diagnostic information about HTTP data fetching, but they have the potential to be spammy when written to log files. To prevent log spam, let's only print these messages during interactive usage.

Reviewed By: quark-zju

Differential Revision: D16445346

fbshipit-source-id: 001dc75e440eaf797f4f953648453086421f624e
2019-07-23 15:13:59 -07:00
Xavier Deguillard
7478874389 remotefilelog: remove maintenance repack memcache fetch
Summary:
When using fetchpacks, memcache will write to an indexedlog, which can't be
repacked. I'm also suspecting that there is a race between this repack, and
hg_memcache_client opening the newly created packfiles which can cause the
misses to not be sent to memcache.

Reviewed By: kulshrax

Differential Revision: D16432538

fbshipit-source-id: 62362682474883bcd58249791c02b9fed5cb8fea
2019-07-22 22:31:38 -07:00
Shu-Ting Tseng
5c49bedd8b add a trailing newline when committing to svn
Summary:
By adding a newline, we can ensure the meta message is always on its own line.

This is to address the comment in D16340374.

link to comment: https://our.intern.facebook.com/intern/diff/D16340374/?transaction_id=732272950561759&src_number=86745022

Reviewed By: quark-zju

Differential Revision: D16417344

fbshipit-source-id: caaae1748018bbe5ddbb587adacd45b8709da8cc
2019-07-22 14:06:12 -07:00
Stefan Filip
cb57f5d7ac bindings: add manifest python classes
Summary: Bindings so that the rust manifest code can be used in Python.

Reviewed By: quark-zju

Differential Revision: D16352532

fbshipit-source-id: 34d4522f5e084f531f31bcd21770950f15f2fe13
2019-07-22 13:03:00 -07:00
Stefan Filip
a1a75d5d73 tremanifest: rename tree holding variable to _tree
Summary: Minor rename

Reviewed By: quark-zju

Differential Revision: D16352529

fbshipit-source-id: 658f9843041d858e1471c07554b5715db011d17c
2019-07-22 13:02:58 -07:00
Jared Bosco
3c30d27350 copytrace: remove copytrace flag from mutating global options table
Summary:
Copytrace modified the global definitions table which was making it very difficult to keep track of side-effects as the code was executed, as well as making it harder to replace the fancyopts calls with native Rust.

Since the copytrace behavior can be achieved through a configuration, it now will no longer modify the global definitions table, and will display the correct flag for a user to use in order to get this same behavior.

Reviewed By: quark-zju

Differential Revision: D15902449

fbshipit-source-id: 1c254162d56823e65085b7047bb37513f187b487
2019-07-20 01:06:33 -07:00
Xavier Deguillard
8f47102275 fixcorrupt: fix debugfixcorrupt on treeonly repos
Summary:
Treeonly repos doesn't use revlogs, and thus debugfixcorrupt shouldn't try to
fix them.

Reviewed By: quark-zju

Differential Revision: D16373142

fbshipit-source-id: 6517b9516358223bfb6c646fd22aaa99c26b0372
2019-07-19 20:15:36 -07:00
Matt Glazar
9b88f1e59b Fix slow rebase for commits which move files
Summary:
When rebasing or showing a diff for a commit which moved files, remotefilectx.ancestors (called by _tracefile) calculates the linkrev for each ancestor. Sometimes [1], this is a disaster:

* remotefilectx._linkrev executes its slow path and scans the change log.
* For each entry in the change log, remotefilectx._linkrev downloads trees if needed.
* Hg downloads trees one-by-one (as of D15964145).

remotefilectx.ancestors is only calculating linkrevs so it can sort the ancestors topologically. _tracefile only needs the ancestors to be ordered topologically, not by linkrev. remotefilectx.ancestors's calls to remotefilectx._linkrev are redundant.

Optimize _tracefile's use of remotefilectx.ancestors: order remotefilectx objects topologically (breadth-first) without sorting by linkrev. Create a new function for this purpose (topological_ancestors) to avoid possibly breaking other callers of remotefilectx.ancestors. As a side effect, make this new function return remotefilectx objects lazily, similar to the filectx.ancestors function.

On my machine, with warm caches, this speeds up 'hg diff -c' and 'hg rebase' for a modestly-sized commit. 'hg diff -c' takes 0.64 seconds, down from 65.6 seconds.

[1] Hypothesis: After 'hg amend', 'hg bundle' packages linkrevs which refer to the pre-amend commit (which is not serialized into the bundle) rather than the post-amend commit. 'hg unbundle' thus creates linkrevs referring to a missing commit.

Reviewed By: DurhamG

Differential Revision: D16297426

fbshipit-source-id: 407597d5e36fc06b33719c28f5ea5052e01dc7a3
2019-07-19 12:35:22 -07:00
Aida Getoeva
3c81066860 commitcloud: fix sync when remotebooks sync disabled on one of the copies
Summary:
If one of the repo checkouts doesn't have remote bookmarks synchronization enabled, it must not affect the Cloud's remote bookmarks state.

I also changed `localserver` (is used for our tests) because Commit Cloud server deletes the "old" bookmark names from the db and inserts "new". However, the `localserver` just set the "new" books dictionary as a new state, which is not quite correct.

Reviewed By: simpkins

Differential Revision: D16338257

fbshipit-source-id: d77d9218b1c35ea1a097bbe7393d0910ce7b4d38
2019-07-19 10:04:25 -07:00