Commit Graph

321 Commits

Author SHA1 Message Date
Johan Schuijt-Li
fe14359a3b logginghelper: log normalized repo name
Summary:
Filter query strings from logging helper to avoid polluting logging tables with
parameters.

Reviewed By: StanislavGlebik

Differential Revision: D14298421

fbshipit-source-id: fe5d405570ce6f0e16d574b9970b2d526ec8b5c9
2019-03-04 00:05:00 -08:00
Xavier Deguillard
7e6fe67687 remotefilelog: give memcache the right cache directory for packsfile
Summary:
When using memcache in its packfile mode, the key no longer contains the name
of the repo, and therefore, memcache will store the downloaded packfiles under
/var/cache/hgcache instead of /var/cache/hgcache/fbsource/packs.

Reviewed By: quark-zju

Differential Revision: D14217056

fbshipit-source-id: f78ce1021985dbb71a1db21d8821e8b8fcda8179
2019-03-01 11:15:25 -08:00
Mark Thomas
87da4d2043 infinitepushbackup: always check remote when checking remote backups
Summary:
Currently when checking if a commit is backed up on the server, we assume that
if the local backup state says it is not backed up then the server can't have
it.  However, it's possible for the local repo to have received the commit
from elsewhere even if the backup state says it is not backed up, when in fact
it is.  Make the --remote flag always check with the server, even if the local
state says the commit is not backed up.

Reviewed By: ikostia

Differential Revision: D14279495

fbshipit-source-id: cbd8253c6bfd0ee4cc3f573fabe5b632af7ad569
2019-03-01 10:04:18 -08:00
Arun Kulshreshtha
6c5123d822 remotefilelog: add newlines to docstring
Summary: Apparently we need to add newlines between config items in the docstring to ensure that it gets formatted correctly in the help output. A similar change was made upstream: https://www.mercurial-scm.org/repo/hg/rev/040447dc3c62

Reviewed By: quark-zju, singhsrb

Differential Revision: D14267738

fbshipit-source-id: c61f67f2c119fd9d71326eb42c2a4aa2106573da
2019-02-28 19:47:05 -08:00
Arun Kulshreshtha
b855ea2fbc fileserverclient: add ability to request packs over http
Summary: Allow file data/history packs to be fetched via HTTP when the Eden API is enabled.

Reviewed By: quark-zju

Differential Revision: D14257368

fbshipit-source-id: 8b6823a57a6fdef546a596df20387b3fc1ccdd4a
2019-02-28 17:10:47 -08:00
Arun Kulshreshtha
5f578e136c remotefilelog: add debuggethistory command
Summary: This diff adds a new `hg debuggethistory` command that takes filenode/path pairs from stdin, fetches the history of the files from the API server, and writes the results to a historypack in the hg cache.

Reviewed By: quark-zju

Differential Revision: D14248082

fbshipit-source-id: 8014a758abd3a578ea213d8d3177812629b2fd51
2019-02-28 15:42:17 -08:00
Arun Kulshreshtha
55171a856b remotefilelog: attach edenapi client to repo object
Summary: The Eden API client in Mercurial should be a singleton. This diff assigns the client to `repo.edenapi` so that it is accessible throughout the code.

Reviewed By: quark-zju

Differential Revision: D14233314

fbshipit-source-id: 8e0ed22c32611e8f6e7d4461c3e31870d47a0e95
2019-02-28 15:42:17 -08:00
Arun Kulshreshtha
0fc20f828d remotefilelog: add --long option to debughistorypack
Summary: Add a `--long` option, similar to the one avaiable on `hg debugdatapack`, which prints full node hashes.

Differential Revision: D14256168

fbshipit-source-id: 342932aa4dd96197daf6bbba7b5bc8623ebbf9bd
2019-02-28 12:52:57 -08:00
Liubov Dmitrieva
51cd05bf46 commitcloud remove excessive details on tls error
Summary: just provide the important information

Reviewed By: quark-zju

Differential Revision: D14230573

fbshipit-source-id: 945bb0be48ed38ba4511d0cef605ef0b7baa2b5d
2019-02-27 20:56:30 -08:00
Adam Simpkins
b360d9ee62 make debugedenimporthelper require an --out-fd argument
Summary:
When using the `debugedenimporthelper` subcommand that is part of `hg` itself
it is much more important to make sure that we don't try to use `stdout` as
the import communication mechanism.

The old `hg_import_helper.py` script more carefully set up its own `UI` object
to try and avoid ever printing any messages to `stdout`.  However it isn't
easily possible to do this as part of the normal `hg` program.  Therefore
abort the command if `hg debugedenimporthelper` is ever run without an
`--out-fd` argument.

This also helps avoid potentially confusing users by printing binary data to
stdout if they invoke accidentally `hg debugedenimporthelper` interactively in
a terminal.

Reviewed By: chadaustin

Differential Revision: D14222372

fbshipit-source-id: 7e0829dff41b2bca28c7f4539b90c6c354f8c79f
2019-02-27 13:44:29 -08:00
Adam Simpkins
a6832788b5 allow hg debugedenimporthelper to use the normal repo object
Summary:
This starts to fix some of the `hg debugedenimporthelper` behavior and make it
work more like most other hg subcommands with respect to how it finds the hg
repository.

Previously the code was copied into hg largely as-is from an external script
that took the repository path as a separate argument.  This resulted in
confusing behavior as it completely ignored the normal repository object
opened by `hg`.

This makes `debugedenimporthelper` honor the normal hg repo object if the
extra repository path argument is not specified.

Reviewed By: chadaustin

Differential Revision: D14222323

fbshipit-source-id: 57048178b588dd1dd7150184665d6c13427d6b56
2019-02-27 13:44:29 -08:00
Xavier Deguillard
b6d63aaabd remotefilelog: ignore OSError when cleaning temporary files
Summary:
When the pack directory is missing, os.listdir will throw an OSError. Instead
of failing repack, let's just ignore the error.

Reviewed By: singhsrb

Differential Revision: D14234830

fbshipit-source-id: 14e683b7d850ab316d9821031e91a19e5f2f4c1e
2019-02-27 11:35:56 -08:00
Xavier Deguillard
176e57b6d0 remotefilelog: do not error when the repack lock is already held
Summary:
Instead of falling back to python, we should just skip the current repack. The
python code already does this, but the rust one will report the error to the
user (and scuba).

Reviewed By: singhsrb

Differential Revision: D14234831

fbshipit-source-id: d285499ae85205d6ccee3c22eb50352d77673488
2019-02-27 11:35:56 -08:00
Durham Goode
1c4bc4c533 treemanifest: don't crash when pushing empty commits
Summary:
When pushing an empty commit, the server receives a pack part with no
data, which ends up not producing any pack files. Some newly added logic tries
to access the pack paths, which then crash.

Let's fix it so we get None for the paths in this situation, and update the only
consumers of those paths to handle the None case.

Reviewed By: quark-zju

Differential Revision: D14237452

fbshipit-source-id: 418bd30179fdb76b9de3bc2c2509079502edfef8
2019-02-27 09:53:16 -08:00
Mark Thomas
2603eab68c flake8: fix lints for unused imports and variables
Summary:
Fix lint errors involving unused imports and variables.  In some cases we are
relying on the side effect of importing, so tag these with the appropriate
noqa flag.

Reviewed By: ikostia

Differential Revision: D14241398

fbshipit-source-id: b639af47c563f914a54188af48f1f9100442d08f
2019-02-27 06:26:06 -08:00
Jun Wu
6a639c1153 sshaskpass: workaround sys.executable
Summary:
The Rust entry point has an incorrect `sys.executable`. Workaround it with a
hard-coded `python2` for now.

Differential Revision: D14236437

fbshipit-source-id: 97d99d59365c2d5c70bfdeebc66b51f870073ded
2019-02-26 18:19:43 -08:00
Saurabh Singh
f93cde953d hgsql: execute memcommit with the hgsql lock
Summary:
We need to ensure that memcommit is executed with the hgsql lock if
the `hgsql` extension is enabled.

Reviewed By: DurhamG

Differential Revision: D14177416

fbshipit-source-id: dcabf08003b618579461c608f924fe7f5b796c37
2019-02-26 13:16:35 -08:00
Saurabh Singh
ac86455d22 memcommit: print JSON output for easy consumption by clients
Summary:
The `memcommit` command output will be processed by the calling
process and therefore, let's just output JSON for easy consumption.

Reviewed By: quark-zju

Differential Revision: D14177417

fbshipit-source-id: 541cf73fa2bef20512164b43f1c4224415fba596
2019-02-26 13:16:35 -08:00
Saurabh Singh
5b52bc60d9 memcommit: introduce command to allow making commits without working copy
Summary:
This commit introduces the `memcommit` command to allow creation of
commits without a working copy.

Reviewed By: quark-zju

Differential Revision: D14177415

fbshipit-source-id: 518d29e2fe8fcc7e74d10ec22ebfcd22e136da06
2019-02-26 13:16:35 -08:00
Saurabh Singh
4f208ae0cf stackpush: create pushrequest from memcommit parameters
Summary:
We will be relying on `pushrequest` to create commits to the
repository without a working copy using the `memcommit` command that will be
introduced in D14177415. Therefore, lets introduce a class method for creating
a pushrequest based on memcommit parameters.

Reviewed By: quark-zju

Differential Revision: D14177413

fbshipit-source-id: fe326e1e2908724b81a95fbf13a05163fb435ada
2019-02-26 11:18:25 -08:00
Saurabh Singh
a92aa38702 stackpush: move calculating file conditions to a separate method
Summary:
Calculating the file conditions will be a common operation for any
class method which creates the pushrequest object as in D14177413. Therefore,
it makes sense to segregate this functionality.

Reviewed By: quark-zju

Differential Revision: D14177414

fbshipit-source-id: d57919098f372a9cbed13f59e3d3c4e3cc7a0b55
2019-02-26 11:18:25 -08:00
Saurabh Singh
885d694fe4 stackpush: make specifying the commit date function optional
Summary:
This is certainly not required while creating new commits using
stackpush. Therefore, let's change the code to make this optional. See
D14177415 for an example of when specifying the date is not required.

Reviewed By: quark-zju

Differential Revision: D14177422

fbshipit-source-id: 6a8c5bcf8a01d79c46bc4fe1b4cca8ec16f7f0c2
2019-02-26 11:18:25 -08:00
Adam Simpkins
06e4448f19 only print backup status message when backing up
Summary:
Change the message about limiting the number of backup heads to only print
when actually performing a backup.  Previously it was printed by anything that
used the `notbackedup()` revset predicate, which could cause it to be printed
in `hg log` commands in the middle of normal log template output.

e.g.:

  $ hg log -r. --graph -T'{node} {sl_backup}\n'
  @  backing up only recent 50 heads
  |  ffc89f60162956497cd9e8e33798dd1d63ddd1da
  ~

This diff also changes the behavior to print the message to stderr rather than
stdout (using `ui.warn()` instead of `ui.status()`).

Reviewed By: quark-zju

Differential Revision: D14212701

fbshipit-source-id: ef3636850d8149cb0c1931b84b9a5b45e60f89c7
2019-02-25 20:40:28 -08:00
Saurabh Singh
72d929c351 memcommit: introduce extension and debug command for serializing commit
Summary:
This commit introduces the `memcommit` extension along with the
`debugmemcommit` command. The `debugmemcommit` serializes a commit in a format
that is consumable by the command for creating commit i.e `memcommit`
introduced in D14177415. The `debugmemcommit` is mainly for testing purposes.

Reviewed By: quark-zju

Differential Revision: D14177419

fbshipit-source-id: 3a05a210986402f661d7d08902f28fd53f4bdb2d
2019-02-25 18:55:20 -08:00
Jun Wu
304e5c383b push: remove newbranch option
Summary:
`push --new-branch` is very rarely used and it does not make much sense with
checkheads removed (D14179861). Remove it everywhere.

There is still [one user](https://fburl.com/t5hmcxrp) of the
`push --new-branch` flag. Do not remove it just yet.

Reviewed By: singhsrb

Differential Revision: D14212180

fbshipit-source-id: 18f80576ab6464fc36b047a8a35b339231ee9d8e
2019-02-25 17:51:10 -08:00
Stanislau Hlebik
dee75aa345 pushrebase: support deletion of a bookmark in sendunbundlereplay
Summary:
Previously one couldn't use `sendunbundlereplay` to replay a bundle that just
deletes a bookmark i.e. sends only pushkey part. The problem was in that
`bundleoperation.gettransaction` method wasn't called and so a few hook
arguments weren't set.

In order to fix it this diff just calls this method before calling pushkey. The
solution is not clean, but I don't see much better alternatives.

Another smaller change that this diff is doing is changing sendunbundlereplay
command to require `--deleted` flag. This is just for convenience.

Reviewed By: quark-zju

Differential Revision: D14185380

fbshipit-source-id: f511dc0b9906520b7877501b37639d89ada6fc45
2019-02-25 13:08:00 -08:00
Stanislau Hlebik
086e927aab sendunbundle: better process errors
Summary:
We didn't process parts like `error:abort` and so we might have easily missed
an error. This diff fixes it.

Reviewed By: quark-zju

Differential Revision: D14185378

fbshipit-source-id: e68e365fd939a4bd6a0c2835a513ebc94530aa87
2019-02-25 13:08:00 -08:00
Jun Wu
da0b66a8ec copytrace: fix an issue where undesirable entries are reported
Summary:
This solves an issue vipannalla saw that the heuristics logic behaves incorrectly
when running `hg up -C c4a88583; hg graft 23001ead`. The file `great_persons_on_ex_civilization-inl.h`
would be marked as "unresolved" and removed from the working copy potentially
due to other mergedriver actions, while it should be merged cleanly and do not
appear in mergestate at all.

After debugging, the file was only renamed on one side, and not changed on the
other side. In the heuristics code path, the file was reported as copied and
confused the callsite.

Reviewed By: singhsrb

Differential Revision: D14195031

fbshipit-source-id: 0602fd56b75219f851c0175debfe72c4d49d652d
2019-02-25 12:43:20 -08:00
Jun Wu
97755349f5 hgsubversion: fix or silent tests with latest branchmap change
Summary:
This is probably not the proper fix but we're getting rid of svn too.

Remove tests coupled with named branches. Modified some critical tests (ex.
"push") so they can still pass.

Reviewed By: DurhamG

Differential Revision: D14210968

fbshipit-source-id: 62e02179b0e4745db8f90f718613afad42d7376a
2019-02-25 11:23:56 -08:00
Xavier Deguillard
12eedc5745 rage: add ssh config
Summary:
In some cases, a user has a badly configured ssh config which leads to
unexpected errors when running hg pull. Collecting the ssh config should help
us catch what is wrong.

Reviewed By: sfilipco

Differential Revision: D14189702

fbshipit-source-id: 73fff933987bcc95f23795c5cb6beee54ae2f141
2019-02-25 10:22:28 -08:00
Saurabh Singh
f7c02136cd memcommit: introduce the data model
Summary:
We are working on a `memcommit` extension to provide a command for
making commits without a working copy. This is required for implementing the
ScmWrite Commit API i.e. https://fb.quip.com/u5WJAx6i59Kl. The plan is that
ScmWrite service will use this command to create the commits in the repository.

This commit just introduces the data model for the memcommit.

Reviewed By: DurhamG

Differential Revision: D14177420

fbshipit-source-id: 5c5e63bfecedd71a56d9e0b27e308e1803a4dafe
2019-02-25 10:10:03 -08:00
Liubov Dmitrieva
f30445fbce pushbackup: increase waiting time
Summary: I think when we moved to process commits stack by stack we didn't change the timeout.

Differential Revision: D14188545

fbshipit-source-id: a01432e6aef29f7e603742f854c323996856fdda
2019-02-25 04:21:44 -08:00
Mark Thomas
9a19e06fee strip: move extension to core and rename to debugstrip
Summary:
Move the strip extension to core.  Rename the command to `hg debugstrip` as it
is not intended for use by users.  Users should use `hg hide` instead.

Reviewed By: quark-zju

Differential Revision: D14185822

fbshipit-source-id: ef096488cb94b72a7bb79f5bf153c064e0555b34
2019-02-25 03:55:08 -08:00
Mark Thomas
cb47493670 commitcloud: accept cloud bookmarks for hidden commits
Summary:
When receiving cloud bookmarks, if they point to a hidden/obsolete commit,
don't omit them.  The bookmark will make the commit visible again.

Reviewed By: quark-zju

Differential Revision: D14183009

fbshipit-source-id: ddcb8cce6aaa1eefae93490f76c3dffeaffda21c
2019-02-25 02:34:50 -08:00
Jun Wu
bfaf19a6a8 fetch: remove the extension
Summary:
`fetch` is a deprecated extension. It uses non-trivial branch-related logic.
Drop it to unblock further branch related cleanups.

Differential Revision: D14180593

fbshipit-source-id: 8288a7f0ac1ba72cf476cb78f109c71aa11c92c0
2019-02-22 21:02:42 -08:00
Jun Wu
56338d7005 branchmap: drop revbranchcache and other unused logic
Summary:
They're no longer used. Drop them. The `branchcache` is still somehow used,
although it's basically equvilent to `{"default": heads}`.

We can probably clean it up further after detached from subversion.

Reviewed By: singhsrb

Differential Revision: D14180592

fbshipit-source-id: 45230d486f203bf3f55e89ce9eb89e6855e14e54
2019-02-22 21:02:41 -08:00
Jun Wu
b8eecfa308 streamclone: drop branchmap code
Summary: It's a no-op already. Drop it.

Reviewed By: singhsrb

Differential Revision: D14180595

fbshipit-source-id: 9f904b818bcf56b9d12405ca9894baa9c786801b
2019-02-22 21:02:41 -08:00
Jun Wu
e188aff028 revset: make "branch(x)" equvilant to "all()"
Summary:
All commits belong to `default` branch. Therefore `branch(x)` can be seen as
just `all()`, assuming `x` is a valid name.

This removes the only user of `repo.revbranchcache`.

In a later step, branch related features will be moved to an extension so the
code becomes separate and features are optional.

Reviewed By: sfilipco

Differential Revision: D14180594

fbshipit-source-id: 9dc52743f1b69a1838114c8c0de5fc69383dc41e
2019-02-22 21:02:41 -08:00
Jun Wu
66f2e5f45e branch: disable branchcache and drop all branches other than "default"
Summary:
This hardcodes several perftweaks configs that have been enabled for major FB
repos for months:

  [perftweaks]
  disablebranchcache = True
  disablebranchcache2 = True
  disableresolvingbranches = True
  disableupdatebranchcacheoncommit = True

Practically, this means the branchmap is now just `{'default': heads}`. (i.e.
there are no named branches other than `default`), and branchcache is removed
(i.e. `.hg/cache` does not exist without clindex or in-repo tags).

This diff only makes easy-to-verify logic changes by assuming the configs and
removing dead code. Things can be further cleaned up. They will be done by
upcoming changes.

Most test changes are due to the fact that `.hg/cache` is no longer created.

Reviewed By: singhsrb

Differential Revision: D14179858

fbshipit-source-id: 479f7427168eb1d9614a973e273a229e50f5620a
2019-02-22 21:02:41 -08:00
Jun Wu
850022dd70 convert: drop cvs support
Summary:
The CVS branch support will break with the upcoming branchcache removal.
CVS repos are rare. Let's just remove the code.

Differential Revision: D14179863

fbshipit-source-id: 890ce34958d2efe4f2ef02b1d72cf92f6269378c
2019-02-22 21:02:41 -08:00
Jun Wu
047b1a05f4 exchange: kill checkheads
Summary:
We had `ui.checkheads=false` set for a long time. Let's remove the feature
entirely and update the tests.

This is necessary before killing the branch cache, as some tests still use
different branches and there would be suddently more "heads" that cause
test issues.

Reviewed By: sfilipco

Differential Revision: D14179861

fbshipit-source-id: 0de76566799a9560b45e823cc5f49cfda9e3dd30
2019-02-22 21:02:41 -08:00
Liubov Dmitrieva
6ee9cf11e5 infinitepush + commitcloud: strip the marker to get build the
Summary: Mononoke uses the markers but we shouldn't look at them for Commit Cloud.

Differential Revision: D14188356

fbshipit-source-id: e5dee581728a9bc83d2f7a17575b3ae6b3183d39
2019-02-22 13:16:24 -08:00
Liubov Dmitrieva
65b628a472 commit cloud: check that the secondary path is not the same as the first.
Summary:
add this check to avoid overhead

we don't need to backup to the secondary place if it is the same as the first.

Reviewed By: singhsrb

Differential Revision: D14187754

fbshipit-source-id: 6ee59ae2f0846716ca99253958af7088d0538df9
2019-02-22 12:55:14 -08:00
Liubov Dmitrieva
ac751a0ac1 fix format for broken check-code test
Summary: Just renaming, and another variable as well to look similar

Reviewed By: DurhamG, quark-zju

Differential Revision: D14185033

fbshipit-source-id: e34de690274afd2f2c6e51db21c7b158f6c3452a
2019-02-22 11:44:51 -08:00
Johan Schuijt-Li
877d1315da treemanifest/remotenames: use write path for reads after push
Summary:
Treemanifest uses it's own fallbackpath for reads in all cases, but
particularly in the case of remotenames it should stay on the path that is
actively being used by the push. It is possible to have remotenames which are
mirrored and selected by query strings in the repo path. In this case it is
possible that the mirror is still out of date when reading back data from our
push. Ensure that when doing a push the remote server this is considered
'sticky' so that we read back from the remote we pushed to, rather then
determening the path ourselves.

To disable, please use:
  treemanifest.stickypushpath=False

Reviewed By: DurhamG, markbt, quark-zju

Differential Revision: D14165444

fbshipit-source-id: 75a53ffab895d87a4c52814f7887145c134868b5
2019-02-22 06:03:18 -08:00
Stanislau Hlebik
9aaad3788f pushrebase: limit pushrebase error message
Summary: We'll start recording hook output, which can be rather long. Let's limit that.

Reviewed By: quark-zju

Differential Revision: D14164228

fbshipit-source-id: efb50d89c2c78e717c4eb340f53fe049fe69f932
2019-02-22 05:10:46 -08:00
Stanislau Hlebik
8922f8a4b1 hook: make it possible to record stderr of failed python hooks
Summary:
Context: in pushrebase replay job we run on Mononoke we also want to test our
hooks i.e. replay pushrebase requests that were denied on mercurial because of
a hook failure. The problem is that at the moment the only error message we have
is `prepushrebase.driver hook failed` (see xdb table `xdb.mononoke_production`,
query `select * from pushrebaserecording where pushrebase_errmsg like '%hook%'
limit 10;`). This error message tells us nothing, not even what hook failed.

To change it I suggest to make it possible for python hooks to raise HookAbort
and provide more information in the `hook_failure_reason` field.

Reviewed By: quark-zju

Differential Revision: D14131359

fbshipit-source-id: 69a2b51b30c78efadf3ba0d3332f46a777022568
2019-02-22 05:10:46 -08:00
Liubov Dmitrieva
db6d74a622 pushbackup - add a message when we truncate heads that needs to be backed
Summary: In chef there is currently an override to 50, so if someone got more due to some reason, it is nice to add a message.

Reviewed By: quark-zju

Differential Revision: D14170749

fbshipit-source-id: 3f3c79e4e6103523c14c8d9c1600f104e3d5d3d8
2019-02-21 20:27:32 -08:00
Arun Kulshreshtha
fd1ccf44e3 rage: use pastry instead of arc paste
Summary: `pastry` is the modern replacement for `arc paste`. Let's use it in `hg rage` instead of `arc paste`.

Reviewed By: singhsrb

Differential Revision: D14172108

fbshipit-source-id: 6586b9a8d8b90bac55d91baed852edbc7c1d9db9
2019-02-21 14:00:58 -08:00
Saurabh Singh
1c782a4f47 stackpush: make specifying the original node optional
Summary:
Currently, stackpush requires specifying the original node for each
new node to be created. This inhibits the creation of new commits which are not
replacing any commit via stackpush. This commit changes the behaviour such that
specifying the original node is optional.

Reviewed By: quark-zju

Differential Revision: D14153674

fbshipit-source-id: b3d150a8a8044ac1740937f2dc058ce542ee13e4
2019-02-21 10:01:19 -08:00
Stanislau Hlebik
ddd0f0ed99 mononoke: mononoke -> hg sync job
Summary:
First stab at a job that will keep hg in sync with Mononoke when Mononoke
becomes a source of truth.

Reviewed By: ikostia

Differential Revision: D14018269

fbshipit-source-id: f88c5eba8bf5482f2f162b7807ca8e41a3b4291d
2019-02-21 05:46:40 -08:00
Stanislau Hlebik
e36da58ac9 pushrebase: fix choosing commit timezone
Summary: There was a typo, the timezone is `[1]` and not at `[0]`

Reviewed By: ikostia

Differential Revision: D14147329

fbshipit-source-id: 8ad4bff810ed949a9f8e86d03ef62bc63aaf11bd
2019-02-21 00:59:13 -08:00
Mark Thomas
7755c9df12 help: use only first line of alias doc strings in command list help
Summary:
Alias documentation can now include multiple lines, however for the output
of `hg help commands`, only the first line should be used.

Reviewed By: quark-zju

Differential Revision: D14149607

fbshipit-source-id: 84992078c9bc4659532350b47694c562f4dc1983
2019-02-20 22:39:13 -08:00
Jun Wu
f6c3848463 commands: remove more branch related CLI flags
Summary:
Remove:
- log --only-branch
- pull --branch
- push --branch
- record --close-branch
- incoming --branch
- outgoing --branch

Currently, `log --branch` is kept since some arcanist code still uses it.
We can probably remove it after the next arcanist release.

Differential Revision: D14116320

fbshipit-source-id: 50960ae8700200b322f615c4defd9c05353c2435
2019-02-20 20:05:29 -08:00
Jun Wu
2dc2a3d2a2 dispatch: do not show help on CommandError
Summary:
CommandError happens if there is an unknown command flag, or a required
argument is missing. The old behavior is to print an error message to
stderr, then start the pager with the command help printed to stdout.

There are 2 problems with that approach:
1. When using mosh, a long help text might flush the actual error to out of the
   screen. The error message will be missed.
2. When captured in shell scripts, the help text printed to stdout would be
   captured, which is almost always undesirable.

The actual motivation of this change is for 2. Zsh themes like bullet-train [1]
uses `hg id -b 2>/dev/null` and we'd like to remove `id -b` support. After that,
the command should not polluate stdout with help text.

[1]: bd88ade263/bullet-train.zsh-theme (L102)

Differential Revision: D14151200

fbshipit-source-id: edd38e91115f96929438379aa2e40edfba560b41
2019-02-20 18:44:35 -08:00
Jun Wu
fba42ecd00 mergedriver: handle queueremove correctly
Summary:
It's possible that the non-mergedriver code path decides to create ("get") a
file, because it only exists in one side of the merge parents, while
mergedriver decides to remove that file. That makes the file exist in both
"g" (get, aka. create) and "r" (remove) lists and result in incorrect
dirstate state.

Fix it by detecting the case and remove the conflicted files from the "g" list.

Reviewed By: DurhamG

Differential Revision: D14145990

fbshipit-source-id: f4e5d9787dca5cda6cae270f8a84296ecddf553c
2019-02-20 18:11:33 -08:00
Liubov Dmitrieva
bf0fec10f0 infinitepush: priority for scratch pushes should start with infinitepush path
Summary: the push-path will be used for Mononoke write path roll out.

Reviewed By: markbt

Differential Revision: D14153207

fbshipit-source-id: 158e6e08dfa017c98e668fdfc37138dd7b7d76c7
2019-02-20 15:36:29 -08:00
Liubov Dmitrieva
ac401b9d9f commitcloud: trigger a backup to a secondary storage after cloud sync in the background
Summary:
We can't run in parallel at the moment as the log file and the lock file are
shared.

Every path maintains independent backup state (the previous diff).

The secondary backup state doesn't affect smartlog (only the main one)

The issue with this approach is that we maintain backup lock a bit longer.

Unfortunately, the progress in smartlog doesn't show anything about the second backup.

I added 'finished', it makes it easier to compare in the logs.

Reviewed By: markbt

Differential Revision: D14149399

fbshipit-source-id: f90e8aac6cb8dee53d5c7468bd6adba067e13362
2019-02-20 15:36:29 -08:00
Liubov Dmitrieva
ae7b506f80 infinitepush backup: separate depends on the remote infinitepush path
Summary:
We are going to support 2 different backends of Commit Cloud: Mercurial and
Mononoke.

Each of them should maintain local backup state separately.

Output of some tests have been slightly changes, this is because a separate backup
state, the same error appears earlier when we are trying the backup stacks.

The idea is to have separate backup states for different remote paths, but
there will be only one cloud sync state for the current source of
truth. We could include there the remote path and then validate that cloud sync
state is correct if the remote path has been changed.

However, for backup states it is much easier to have them separately (and we
will backup in 2 places)

Reviewed By: markbt

Differential Revision: D14138496

fbshipit-source-id: 0a7a763a395be5456cbd724bff7ebc069f03fb0e
2019-02-20 15:36:29 -08:00
Arun Kulshreshtha
a15b016f89 movement: add short flags for --clean and --merge
Summary: The `hg update` command has short flags for `--merge` and `--clean`, namely `-m` and `-C`. Let's add the short versions to `hg next` and `hg prev` as well.

Reviewed By: quark-zju

Differential Revision: D14155218

fbshipit-source-id: d51f5f658b525809e4c512ffa300dea4b4cabcdf
2019-02-20 14:49:53 -08:00
Durham Goode
8d31ac8424 simplecache: add checksum to simplecache values
Summary:
We're encountering an issue that I think is caused by invalid data
coming back from memcache, possibly due to our recently introduced connection
reusing. Let's add some checksums to verify that the data we put in is identical
to the data we get out for a given key.

Reviewed By: kulshrax

Differential Revision: D14141683

fbshipit-source-id: 206b51b862db7d54def02f5310b90f473d5a0d03
2019-02-20 13:56:33 -08:00
Arun Kulshreshtha
aaf26c23ca movement: pass --merge flag to update from prev/next
Summary: We weren't passing the `--merge` flag from `hg prev` and `hg next` to the underlying invocation of `hg update`. This diff fixes the problem so that `--merge` now works as expected.

Reviewed By: DurhamG

Differential Revision: D14154244

fbshipit-source-id: 4a2412cca714ec8f269eb5f2989e39821642fbb3
2019-02-20 13:49:08 -08:00
Durham Goode
1935d046b8 pushrebase: backout change to preload the manifest
Summary:
Backs out D13944829 that add preloading the manifest to pushrebase. In
a situation where you receive tree commits, but the repo is hybrid, this causes
it to try to lookup the bundled tree manifests in the flat manifest revlog.

Let's just back this out for now until we can come up with an appropriate fix,
or move all our repos to treeonly.

Reviewed By: quark-zju

Differential Revision: D14151876

fbshipit-source-id: 0f7419d5b9bcd9d7ce363f4349e9e2e4a86cf713
2019-02-20 13:44:51 -08:00
Mark Thomas
6ee252bb95 debugstatus: print the clock value stored in treestate
Summary: Add the current clock value to the output of `hg debugstatus`

Reviewed By: quark-zju

Differential Revision: D14150641

fbshipit-source-id: 917ac3095bc933c042c0f057d0dbda38ef710844
2019-02-20 11:01:52 -08:00
Mark Thomas
23aa7bda11 rage: read fsmonitor state from treestate
Summary:
If treestate is in use, fsmonitor state is stored in the treestate, rather than
in a separate fsmonitor.state file.  Update rage to understand this.

Reviewed By: quark-zju

Differential Revision: D14131131

fbshipit-source-id: d80d766625d7915b6a76f66f33e763eed23677e9
2019-02-20 11:01:52 -08:00
Kostia Balytskyi
33a83f729b replay: only expect timestamp and not timezone
Reviewed By: StanislavGlebik

Differential Revision: D14149972

fbshipit-source-id: 3cab55c9247fa06e3a01a5d4dda507d47a6ebf5e
2019-02-20 08:47:25 -08:00
Kostia Balytskyi
4a3a890f0d unbundlereplay: do not produce changegroup response part
Summary:
This is a perf optimization. `unbundlereplay.respondlightly` instructs the
server to not produce the pushback parts regardless of what `replycaps` part
of the incoming bundle says. This is important, since the mononoke-hg sync will
send all the bundles in a searialized way, so we want to optimize time where
possible.

Reviewed By: StanislavGlebik

Differential Revision: D14131575

fbshipit-source-id: afec15347d43fa52b1ec64b4ac8ece5b227ccf7d
2019-02-20 08:47:25 -08:00
Mark Thomas
590fbf957b pager: add config option to disable paging of stderr
Summary:
Add a `pager.stderr` config option that when set to false, disables the
redirection of stderr to the pager.

This means progress bars will be rendered, and other information will appear
synchronously, rather than buffered by the pager, but also that Mercurial will
start outputting stderr over the top of any output that the pager produces,
potentially corrupting the pager display.

Reviewed By: simpkins

Differential Revision: D14130965

fbshipit-source-id: eba8e31fdad05c935eae13e1900c5f7e5af7ecbc
2019-02-20 07:33:00 -08:00
Xavier Deguillard
126de4655e revisionstore: add a Store trait
Summary:
A lot of code is duplicated between data stores, and history stores, and one
reason for it is the absence of common trait between these 2. By adding a new
Store trait it will make it easier to write generic code that works accross
data and history store.

Reviewed By: quark-zju

Differential Revision: D14091899

fbshipit-source-id: deef1d43a7d300cb3607c67554ad54f20c870e23
2019-02-19 12:18:27 -08:00
Liubov Dmitrieva
6f13efb795 infinitepush - prepare the code to use 'known' wireprotocol request for
Summary:
Prepare the code to use 'known' wireprotocol command to check what is backed up
on the server instead of slower 'lookup'. We don't need to reestablish ssh
connection, and we can test all the nodes in one go.

Also test the 'known' request with Mononoke is working (all commands have been
tested with isbackedupnodes => isbackedupnodes2)

Reviewed By: markbt

Differential Revision: D14131383

fbshipit-source-id: 5a150b64d0e84a02357c2367879b2da8493d9167
2019-02-19 08:48:07 -08:00
Kostia Balytskyi
db51ee5121 bundle2: fix misleading function name
Summary: `reply` vs `replay`.

Reviewed By: StanislavGlebik

Differential Revision: D14131576

fbshipit-source-id: 2507968047ec8ff9ae14b961f2c90eb3d19f7f2a
2019-02-19 08:22:24 -08:00
Liubov Dmitrieva
5e7afa31ff commit cloud / pushbackup - use the same way to check what is backedup with Mononoke and Mercurial
Summary:
Use the same way to check if the commits have been backed up in Mononoke and Mercurial.

The only common way to check is 'lookup' command because Mercurial doesn't support discovery for commit cloud commits, the command 'known' is also not supported.

Also we have to go one by one because lookup doesn't got any better API.
It is still much faster than backup commits that are already there.

Introduce such check for pushbackup as well.

Remove hacky way to check it from cloud sync.

For commit cloud in Mononoke we will have backfill, so the server side check  will be heavily used when you go to Mononoke at the first time.

Unfortunately connection pool module in mercurial is not good enough in detecting closed connections and can easily return a broken connection on the next call.

Reviewed By: markbt

Differential Revision: D14085849

fbshipit-source-id: d76d9a71f9efdbdfec4de3198cd428b6b693418d
2019-02-19 05:49:07 -08:00
Kostia Balytskyi
da3e429150 wireproto: add unbundlereplay command
Summary:
This is to be used from Mononoke->hg sync.
Currently expects only `pushrebase` bundles, e.g. one head and one book to
move.

Reviewed By: StanislavGlebik

Differential Revision: D14116130

fbshipit-source-id: 959a6e51f51e21da5592c84188e294a33057ffaa
2019-02-19 01:57:39 -08:00
Mateusz Kwapich
4db0750027 fsmonitor: use correct length for number of files changed
Summary: When comparing the number of files changed, fsmonitor was incorrectly using the length of the result dict (always 4), rather than the number of files watchman returned.  Use the right list of files instead.

Reviewed By: markbt

Differential Revision: D14123604

fbshipit-source-id: 94684f1f189d045b2f6a880180b15e52ba9bba8c
2019-02-18 10:03:12 -08:00
Liubov Dmitrieva
1c47c775c0 inifinitepush: add new capability
Summary:
this will be used to understand if server supports 'listkeyspatterns'

(Mononoke doesn't support this)

Reviewed By: DurhamG

Differential Revision: D14107742

fbshipit-source-id: c9a42e8516eb5660ab2f498996b211db7086bcb1
2019-02-18 04:30:32 -08:00
Arun Kulshreshtha
9c6b914a22 types: move Key and NodeInfo out of revisionstore
Summary:
In order to move the types in `edenapi-types` (containing types shared between Mercurial and Mononoke) to the `types` crate, we need to move a few types from the  `revisionstore` crate into this crate first, because `revisionstore` depends on `types`, which would create a circular dependency since `edenapi-types` uses types from `revisionstore`.

In particular, this diff moves the `Key` and `NodeInfo` types into their own modules in the `types` crate.

Reviewed By: quark-zju

Differential Revision: D14114166

fbshipit-source-id: 8f9e78d610425faec9dc89ecc9e450651d24177a
2019-02-15 22:51:04 -08:00
Liubov Dmitrieva
4454d6eeb5 pushbackup: fix early exit logic
Summary:
the early exit logic was incorrect, basically if there is at least 1 bookmark
in the repo and the backup state was not empty, it didn't catch that nothing has been changed.

bookmarks are dicts, so it is fine to compare them

if any bookmarks in the repo, everytime `hg pushbackup` established a connection to mercurial

Reviewed By: quark-zju

Differential Revision: D14103938

fbshipit-source-id: 0edc4d9e186199670765fd2362236330e831c7d9
2019-02-15 10:04:00 -08:00
Jun Wu
f752c4dd75 commands: deprecate "hg id -b"
Summary:
There are still users of "hg id -b", namely shell prompt scripts.
However, it seems fine to remove "branch" from the formatted (JSON or other
formats) output.

Reviewed By: ikostia

Differential Revision: D14076296

fbshipit-source-id: a77f4b9e73161d322da3f1bdec993082ac463939
2019-02-14 17:44:40 -08:00
Jun Wu
dc38aa9d7a commands: remove "clone --branch" flag
Differential Revision: D14076299

fbshipit-source-id: dafbb7866e12e551b162a20ee048264866b67c96
2019-02-14 17:44:40 -08:00
Jun Wu
e257757924 commands: remove "bundle --branch" flag
Summary: Named branches are going away.

Differential Revision: D14076297

fbshipit-source-id: b68356f7075a6a8787cf0d2aa972bb27e1ef9bb1
2019-02-14 17:44:40 -08:00
Jun Wu
37af1cfda3 commands: remove "commit --close-branch" flag
Summary: Without named branch, it is not meaningful to close a branch.

Differential Revision: D14076295

fbshipit-source-id: 527ae457cb14f9415fa7269b7dc123252e7d6867
2019-02-14 17:44:40 -08:00
Jun Wu
35a58e8c24 commands: replace "branch" command with deprecation warnings
Summary:
Unfortunately, there are still users of the "hg branch" command so we cannot
remove it right now. But I'm updating internal tools to not call it.

Reviewed By: ikostia

Differential Revision: D14076300

fbshipit-source-id: a5322d9c9ce8148c6ad0800653bd829736556386
2019-02-14 17:44:40 -08:00
Jun Wu
82b4be9a7f config: hard-code ui.allowbranches=False
Summary: Since it's always False, remove the config option.

Reviewed By: ikostia

Differential Revision: D14076304

fbshipit-source-id: 2cc6409355a0c4514a62bc764e1deec0af1bd3a1
2019-02-14 17:44:40 -08:00
Jun Wu
9a87d9567c commands: remove "branches" command
Summary:
It seems nobody uses it from dev_commands logging. Search for "allowbranches"
in all internal repos suggests nobody turned it on. The tests were also
migrated to not use the command so let's just remove it.

Reviewed By: ikostia

Differential Revision: D14076298

fbshipit-source-id: a1cb03b2da289c01b15f0580ffe77531941be213
2019-02-14 17:44:40 -08:00
Jun Wu
4801f88fad config: set ui.allowbranches to False by default
Summary: This would make the test runner run tests with named branch disabled.

Reviewed By: phillco

Differential Revision: D14059835

fbshipit-source-id: 9fbad5688bd8c69d32016b2ec1f931102638da68
2019-02-14 17:44:40 -08:00
Jun Wu
702ed9a453 test-revset: do not use "hg branch" directly
Summary:
Migrate away from using the "hg branch" command to "hg commit --extra branch="
instead. In the future the branch namespace would be removed, so we create
local tags instead.

`test-revset2` was split from `test-revset` and has the same header. Do the
same change to it. Besides, de-duplicate tests about the `tag()` revset.

Reviewed By: ikostia

Differential Revision: D14058435

fbshipit-source-id: b59fadc43939d85d14bbf9f81227c523b65557a0
2019-02-14 17:44:39 -08:00
Jun Wu
338fe1197f dirstate: add more logging to debug T39234759
Summary:
"st_size" returned by watchman is sometimes 0. We suspect it's incorrect.
It could be the file on disk is actually empty, or the kernel made it
look empty to watchman in the past, or there is something wrong with
serialization, etc. Let's first add a real os.stat to test if the file
is really empty.

Reviewed By: phillco

Differential Revision: D14090851

fbshipit-source-id: bd75cf86bfd117285658ad0dd7fb28d0e8b5585c
2019-02-14 16:29:46 -08:00
Phil Cohen
50ebbbbb86 hook: print exception message on load failure
Summary: Otherwise mergedrivers become impossible to debug if they don't import correctly.

Reviewed By: ikostia

Differential Revision: D14071200

fbshipit-source-id: 3e677089e6b008d892158290c392e1f9d68a67ae
2019-02-14 16:22:22 -08:00
Xavier Deguillard
76316fbf9d revisionstore: verify repacked keys before deleting pack files
Summary:
During repack, the repacked files are deleted without any verification. Since
Adam saw some data loss, it's possible that somehow repack didn't fully repack
a packfile but it was deleted. Let's verify that the entire packfile was
repacked before deleting it.

Since repack is mostly a background operation, we don't have a way to notify
the user, but we can log the error to a scuba table to analyse further.

Reviewed By: DurhamG

Differential Revision: D14069766

fbshipit-source-id: 4358a87deeb9732eec1afdfb742e8d81db41cd87
2019-02-14 13:03:09 -08:00
Michael Liu
8747ff025f Apply modernize-use-override
Summary:
Use C++11’s override and remove virtual where applicable.
Change are automatically generated.

Reviewed By: Orvid

Differential Revision: D14052667

fbshipit-source-id: 119e237155a5318e08e31065c8f87e6b7f3f7c52
2019-02-14 11:57:55 -08:00
Xavier Deguillard
e5a7da32da revisionstore: rename the packfile before removal on windows
Summary:
Removing files on Windows is hard. It can fail for many reasons, many of which
involves another process having the file opened in some way. One way to solve
this problem is that renaming the file isn't as restrictive as removing it.

Since hg repack will attempt removing any temporary files it will also try to
remove the packfiles that we failed to remove earlier.

Reviewed By: DurhamG

Differential Revision: D14030445

fbshipit-source-id: 1f3799e021c2e0451943a1d5bd4cd25ed608ffb6
2019-02-14 10:34:52 -08:00
Xavier Deguillard
dc6cbcdfe6 remotefilelog: do not preload packs
Summary:
Preloading all the pack files on initialization ties the lifetime of the
packfiles to the repo. For normal operations, this is fine, as packfiles are
mostly read. During a repack however, we need to be able to remove them, and
while having an open file handle allows deletion on unix OSes, it prevents it
on Windows.

The Rust repack now succeeds on Windows.

Reviewed By: DurhamG

Differential Revision: D14013786

fbshipit-source-id: 99279d4af67a0dfe8679159e9409186f56a09296
2019-02-14 10:34:52 -08:00
Mateusz Kwapich
4f58ae8678 config: stop lying about the config locations
Summary:
Since september (D9840431) rcutil.rccomponents is no longer source of truth
about which config files we load. In fact we use it only in the
`hg config --debug`. This leads to situations where the debug command mentions
loading a specific config file and then ignores it completely which is very
confusing.

Let's remove it.

Reviewed By: suitingtseng

Differential Revision: D14083220

fbshipit-source-id: 362fd9bf574e24639f99a1203206184da42d1e24
2019-02-14 09:31:58 -08:00
Johan Schuijt-Li
09d54f3cf4 remotenames: treat query strings and fragments as parameters
Summary:
When using query strings or fragments in an URL we should treat repository paths
as the same repo. This allows servers to use query strings for metadata, without
treating the urls as different servers. By introducing normalization in our grouping,
we will consider the normalized result to be the qualifier for what is the same repo,
rather then the full absolute path - which includes query strings and fragments.

Reviewed By: DurhamG

Differential Revision: D14051479

fbshipit-source-id: c82fe041467f6bd6af210688c0be873e2da93781
2019-02-14 03:21:53 -08:00
Arun Kulshreshtha
a4a155c025 edenapi: add configitem call for edenapi.url
Summary: We were reading the  `edenapi.url` config item without explicitly setting it up with the `configitem()` function. Not sure what negative impact this would have, but it's probably a good idea to have the explicit call in place.

Reviewed By: quark-zju

Differential Revision: D14075080

fbshipit-source-id: bb4e25de273341768f850f1d5aab6ac21e7f2fc5
2019-02-13 17:41:54 -08:00
Arun Kulshreshtha
c68b388bed edenapi: remove try around import
Summary: Now that the `edenapi` module in bindings is always available for all platforms, we no longer need a try block around the import.

Reviewed By: quark-zju

Differential Revision: D14075082

fbshipit-source-id: e3f45e67ef4572e58f85875af12390ea5d697d43
2019-02-13 17:41:54 -08:00
Arun Kulshreshtha
575e570a28 bindings: move pyedenapi into bindings crate
Summary: Move the edenapi Python bindings into the common `bindings` crate.

Reviewed By: quark-zju

Differential Revision: D13963179

fbshipit-source-id: 76dead82af992615a9e452ee6fbb9f66639c822c
2019-02-13 16:07:00 -08:00
Arun Kulshreshtha
127ca1a990 edenapi: use rustls instead of openssl
Summary:
Switch from using OpenSSL (via `native-tls`) to [Rustls](https://github.com/ctz/rustls), a pure-Rust TLS implementation based on the `ring` crypto crate.

Unlike `native-tls`, Rustls supports ALPN, which means it can be used along with Hyper to perform HTTP/2 requests over TLS. (OpenSSL also supports ALPN, but older versions of Windows' `schannel` library do not, and as such `native-tls` doesn't support ALPN either regardless of platform.)

Rustls also builds on Windows without any special configuration, sidestepping the issues we've been having with OpenSSL in the Windows build.

Reviewed By: quark-zju

Differential Revision: D14070084

fbshipit-source-id: 25268c58a88177f4708370696d326b4c0bdc89a0
2019-02-13 16:07:00 -08:00
Arun Kulshreshtha
1d00a343e4 bindings: add init module
Summary:
Add a new `init` module to the `bindings` crate. This is intended as a place to put global Rust initialization code for Mercurial's Rust extensions. Ordinarily, such code would go at the start of `main()`, but since `hg` doesn't have a Rust main, putting initialization here at least guarantees that it will happen before any of the Rust extension code runs.

Right now, the only thing initialized in the new module is `env_logger`.

Reviewed By: quark-zju

Differential Revision: D14072560

fbshipit-source-id: 0f2770d0a3a6e9c6b7fe68eb62007cc091adad59
2019-02-13 16:07:00 -08:00
Liubov Dmitrieva
380f425385 infinitepush: fix issue with discovery
Summary:
if server already have everything, the function should return True

otherwise we treat it as fail to backup in pushbackupbundlestacks function

failed to push stack bundle rooted at ...

Reviewed By: quark-zju

Differential Revision: D14048141

fbshipit-source-id: 288291db2f31b0d284c97fecbd61049a58c045de
2019-02-13 08:20:17 -08:00
Jun Wu
9d21b98c57 convert: drop monotone support
Summary:
Monotone repos are rare these days. Drop support for it.
This also solves an issue that test-convert-mtn.t uses named branches.

Differential Revision: D14059836

fbshipit-source-id: 1e9d4fe6fdc295393ff67c5e068b230b9ed0c0af
2019-02-12 21:45:13 -08:00
Jun Wu
4cd0b5c098 transplant: remove the extension
Summary:
The (disabled by default) `transplant` command is similar to `graft` or
`rebase`. It makes sense to removeit.

This diff removes the extension.

Reviewed By: singhsrb

Differential Revision: D14000099

fbshipit-source-id: a03e4925cefa4236bd9d62cfe9d33d140707bd7c
2019-02-12 21:45:11 -08:00
Jun Wu
8fd207a853 revset: stop supporting origin() and destination()
Summary: They will be replaced by successors and predecessors.

Reviewed By: singhsrb

Differential Revision: D14000097

fbshipit-source-id: 07f0c97edd7eb16ad665c00886c00212d516ae72
2019-02-12 21:45:11 -08:00
Jun Wu
87b87d5490 rebase: remove --keepbranches flag
Summary: Branches are going away. Remove related features.

Differential Revision: D13993824

fbshipit-source-id: 8afb01912df016bda08be5bc22ac52be7f5168eb
2019-02-12 21:45:10 -08:00
Jun Wu
fbccd19ed7 patchbomb: remove the extension
Summary:
`test-patchbomb.t` uses named branches and does not look simple to fix.
We don't use email patches internally, and it's not hard to write scripts
around `hg export`. Therefore drop the extension and its tests.

Reviewed By: singhsrb

Differential Revision: D13978577

fbshipit-source-id: 19867ae68c19c996bfce064eb2234705939db9ea
2019-02-12 21:45:10 -08:00
Jun Wu
64c43d2eab import: remove the --import-branch flag
Summary: Branches are going away.

Reviewed By: singhsrb

Differential Revision: D13978568

fbshipit-source-id: b9b4f3d2755757c0d3780bbb10c4579bf8d15fef
2019-02-12 19:54:31 -08:00
Jun Wu
04f6795519 remotenames: remove logic about named branches
Summary: Named branches are going away. Remove the logic around it.

Reviewed By: phillco

Differential Revision: D13978575

fbshipit-source-id: d6e28d7cadffa612f74a2afc12800829d6113dfa
2019-02-12 19:54:30 -08:00
Xavier Deguillard
e241404290 remotefilelog: always refresh before runonpacks
Summary:
The refresh function is intended to load on-disk packfiles that aren't yet
present in the cache, but it had several issues that resulted in unexpected
behavior. Mainly, the new files would be added in the wrong order in the cache,
and runonpacks would not update the last used packs.

Differential Revision: D14013785

fbshipit-source-id: da4151b859441f0ba51863f3907852922c255f82
2019-02-12 11:21:34 -08:00
Xavier Deguillard
f5d7209d39 remotefilelog: move rustrepack
Summary:
Previously, the logic for chosing between the rust repack, and the python one
was deeply integrated with the python repack. This resulted in work being
performed unnecessarily.

The drawbacks of this method is that in the case of fallback to Python, the
repacklock will be dropped and re-obtained, as well as the prerepack hook will
be ran twice. Since the python code will soon be entirely replaced this is
probably not important.

Differential Revision: D14013790

fbshipit-source-id: 7c754db3fb984cc9e6b7df1a4e32b72fa4a1531b
2019-02-12 11:21:34 -08:00
Xavier Deguillard
f134a4fe92 remotefilelog: refactor incremental/full repack
Summary: Most of the code is identical between these 2 functions, so let's merge them.

Differential Revision: D14013787

fbshipit-source-id: f0469e05fcf723db02d9f4c28097e61f958284a5
2019-02-12 11:21:34 -08:00
Jun Wu
946fa43efd fsmonitor: update watchman clock if too many files are returned
Summary:
This should auto recover from a state where watchman returns too many files,
which makes "hg status" slow.

The default config value 200 is not chosen very scientifically, but it should
cover the 6s status case where there are 90k changed files reported.

Differential Revision: D14036494

fbshipit-source-id: 368f53e99e2e54343a6ac9145cbb86e4ac65e4ac
2019-02-12 11:16:12 -08:00
Jun Wu
98bb16cace hgsql: fix hggit sync
Summary: Teach mysql connector to deal with bytearray.

Reviewed By: DurhamG, StanislavGlebik

Differential Revision: D14025816

fbshipit-source-id: 738d9ef37b985afad5fe62815be134a4a5913b9a
2019-02-11 13:47:12 -08:00
Aida Getoeva
3aee83d26a prefetch: replaced store path with the cache path
Summary:
To connect to the memcache client it used a path from a loose files data store (`remotefilelogcontentstore._path`), which is a path to the hg cache, but pack files store doesn't have the same field.
I replaced the path with cache path from shallowutil.

Reviewed By: singhsrb, liubov-dmitrieva

Differential Revision: D14020122

fbshipit-source-id: 29bc8a01fc42d43eddc6ae67cf4e41fc552e117c
2019-02-11 09:38:43 -08:00
Jun Wu
f656af6866 encoding: alias cp65001 to utf-8 on Windows
Summary:
This back ports Yuya's patch from upstream:

  changeset:   443029011990c75c533ec0454fd0f5c1060d4690
  branch:      stable
  user:        Yuya Nishihara <yuya@tcha.org>
  date:        Sun, 01 Jul 2018 06:36:53 -0800

      encoding: alias cp65001 to utf-8 on Windows

      As far as I can tell, cp65001 is the Windows name for UTF-8. I don't know
      how different it is from the UTF-8, but Python 3 appears to have introduced
      new codec for cp65001, so the alias is enabled only for Python 2.

      https://bugs.python.org/issue13216

      This patch is untested, but hopefully fixes the following issue.

      https://bitbucket.org/tortoisehg/thg/issues/5127/

More context:
Windows 10 Build 17035 (November 2017) introduced a
"Use Unicode UTF-8 for worldwide language support" checkbox, which makes the
"A" flavored APIs use UTF-8 instead of some non-UTF-8 local encoding. With
that checkbox ticked, hg would crash in cmd.exe complaining
"LookupError: unknown encoding: cp65001"

{F150484107}

Reviewed By: phillco

Differential Revision: D14017361

fbshipit-source-id: a648b2a9bc341d796532c6fd2730c083402b3736
2019-02-11 09:16:02 -08:00
Xavier Deguillard
0ce06567ab remotefilelog: properly declare CacheConnectionError
Summary:
The super python builtin expects a type as an argument, while a string was
passed, this was causing trouble for some users.

Reviewed By: DurhamG

Differential Revision: D14012716

fbshipit-source-id: 6714eb20745428818721ec3df85588a7b4c7ebb7
2019-02-08 17:16:00 -08:00
Jun Wu
b74ee0564d chg: make it incompatible with upstream chg server
Summary:
It would be massy if there are 2 chg servers running: one for fb hg, one for
upstream hg, and they share a same socket path.

Change socket path and the commandserver name so fb-hg chg can only talk to
fb-hg chg servers.

Reviewed By: markbt

Differential Revision: D13869319

fbshipit-source-id: f9d42af9bdfc542207f23c536b478fd5ef8d02a0
2019-02-08 16:12:53 -08:00
Liubov Dmitrieva
ca7f631006 lazy connection open for memcache has an issue with SIGPIPE
Summary: My earlier diff broke master, this is the fix.

Reviewed By: markbt

Differential Revision: D14005894

fbshipit-source-id: 6ce43913fb501791592512f2f12cd67ef27f0457
2019-02-08 09:44:06 -08:00
Liubov Dmitrieva
261da2a786 fix remotenames for infinitepush
Summary:
Currently if default path and infinitepush both point to the remote path
from the repo, the activepath function returns 'infinitepush' rather than
'default' because of the logic I have fixed.

It makes your smartlog looks like.

```
o  037dddb5  62 minutes ago  infinitepush/fbobjc/stable remote/fbobjc/stable
.
o  66e0e00c  Today at 05:58  infinitepush/fbandroid/stable
remote/fbandroid/stable
.
@  28c3b5b0  Today at 05:40  mlesyk  D14003881  T27597699
.  [fbar][prod_role] fix region detection part
.
o  407504d6  Today at 04:58  infinitepush/fbsource/stable
remote/fbsource/stable
```

When you pull it updates infinitepush/master, etc instead of remote/master,
etc.

This only happens if they both point to the same url.

This is not desirable for infinitepush.

I also introduced infinitepush-other that we will use for the secondary commit cloud backend.

It would have the same issue if it matches the url of the default path.

Reviewed By: markbt

Differential Revision: D14005639

fbshipit-source-id: f3ea8098e1c418e2efd43b5430bb4252f6ad6b2c
2019-02-08 09:24:20 -08:00
Wez Furlong
35e2b7c6ff hg: fix lfs and journal extension postshare wrapping
Summary:
this fixes `hg-new-workdir` by matching the function signature
and propagating the arguments.

Reviewed By: singhsrb

Differential Revision: D13992348

fbshipit-source-id: 582025affe2e0511f239e82bc880b2fecea84ac7
2019-02-07 18:58:40 -08:00
Jun Wu
c2ef481658 logexchange: delete the experimental component
Summary:
logexchange was a subset of remotenames, added by:

  changeset:   5a62910948d2d4bac5defe305d0ddb22f0fda549  D1547
  user:        Pulkit Goyal <7895pulkit@gmail.com>
  date:        Wed, 04 Oct 2017 10:32:02 -0800
  summary:     remotenames: move function to pull remotenames from the remoterepo to core

Since we use the full remotenames instead, remove logexchange and its test,
which depends on named branch.

Differential Revision: D13954458

fbshipit-source-id: d565c131100ef90f3cf69e9051643ac8e5846f0d
2019-02-07 18:17:18 -08:00
Durham Goode
20f9ac38f6 remotefilelog: handle corrupt loose files more gracefully
Summary:
If the history portion of a loose file was corrupt, users would often
get errors like "ValueError: substring not found" when trying to split on the
null separators. Let's catch that and handle it where appropriate. For cache
stores, we move it out of the way and return a KeyError, so the union store will
move on to try to fetch it from the server again. For local stores, we return a
ValueError and surface it to the user since their local data may be corrupt.

Reviewed By: quark-zju

Differential Revision: D13976499

fbshipit-source-id: 39e63f19fc752ca0179fbc5b0908a28d46de3a3a
2019-02-07 13:40:42 -08:00
Durham Goode
2def6874f5 remotefilelog: default file blobs to version 1
Summary:
We're seeing cache corruption issues due to mixing and matching loose
file versions. Let's just default to 1.

Reviewed By: quark-zju

Differential Revision: D13980892

fbshipit-source-id: 1e8cc9a53b8b92e05dc08b202505bb8f453a3074
2019-02-07 11:08:01 -08:00
Liubov Dmitrieva
da5a666d2f use simplecache store on the server side to store remotefilelog cache
Summary:
simplecache can be configured with memcache backend

this will potentially save us a lot of disk space and allow us to have a shared cache between hg hosts.

getting rid of the caches on disks will save 966GB of disk space per machine.
P60876105

Reviewed By: quark-zju

Differential Revision: D13950137

fbshipit-source-id: 015e971f1bfed334edb4fe2381c2c6336b84b161
2019-02-07 05:15:11 -08:00
Liubov Dmitrieva
638959056d simplecache - reuse the connection to memcache
Summary:
reuse the connection for other requests
I made it global

Reviewed By: quark-zju

Differential Revision: D13964705

fbshipit-source-id: ed759e36f15b91a838dc2c20b58384ae54ad5d48
2019-02-07 04:59:48 -08:00
Liubov Dmitrieva
13abfafb8d treemanifest: use simplecache as a cache store
Summary:
simplecache extension support both memcache and local disk as a cache store.

we are going to use memcache on hg servers

getting rid of the caches on disks will save 966GB of disk space per machine.

P60876105

this will also allow hg machines to share the same cached data

Reviewed By: DurhamG

Differential Revision: D13927163

fbshipit-source-id: 3155c61da4a82dd7a790a8ccf8dbc701fe3957e1
2019-02-07 04:59:48 -08:00
Aida Getoeva
baa9bab088 set ui.slash=True if HGPLAIN=1
Summary:
`hg status` should show slashes in filepaths standard for the diff format. Now it shows windows' backslash.

More details:
https://fb.workplace.com/groups/scm/permalink/1933867456662865/

Reviewed By: quark-zju

Differential Revision: D13944478

fbshipit-source-id: d34d2c6bc0b9966e1806e36668c21e8abfc83a02
2019-02-07 04:32:27 -08:00
Adam Simpkins
8d35b90969 fix a crash in remotefilelog prefetch
Summary:
It looks like D13924759 accidentally replace `prog.value` with `prog` in one
location, which is causing crashes of the form:

  TypeError: unsupported operand type(s) for +=: 'nullbar' and 'int'

Reviewed By: quark-zju

Differential Revision: D13984835

fbshipit-source-id: cbf1a52d8048b623beac6048224767f0abb7f5c0
2019-02-06 22:03:19 -08:00
Jun Wu
dbc9a9f3e6 fscap: mark "fuse.ntfs" (ntfs-3g) as not supporting symlinks
Summary: See D13964546 for context.

Reviewed By: DurhamG, ikostia

Differential Revision: D13982878

fbshipit-source-id: abce6f3c005b916cfb2e7a34276b99f9fcaa44b5
2019-02-06 18:34:30 -08:00
Jun Wu
89882201b0 posix: detect fuse.ntfs on Linux
Summary:
On linux, ask /proc/self/mountinfo for the block device information, and then
ask udev for the filesystem type. It works for block devices, and is what
util-linux tools like findmnt, lsblk do.

This detects ntfs-3g mounts of block devices as `fuse.ntfs`.

Reviewed By: DurhamG

Differential Revision: D13982877

fbshipit-source-id: eacea6a949b54d9a6483f2c55c437718eb89c243
2019-02-06 18:34:30 -08:00
Jun Wu
efba35645a osutil: detect fuse on Linux
Summary:
The constant is not exposed in linux/magic.h, perhaps because fuse is an
optional feature. It's unlikely to be changed. Define it so fuse fstype
can be detected.

Reviewed By: DurhamG

Differential Revision: D13969640

fbshipit-source-id: 5084bdacf193261a187a74546a82995f2dd2d7c6
2019-02-06 18:34:30 -08:00
Durham Goode
af61927d32 remotefilelog: add documentation for remotefilelog.getfilesstep
Summary:
This is breaking the tests. It has existed for years, so not sure why
the recent reformatting broke it now.

Reviewed By: quark-zju

Differential Revision: D13976462

fbshipit-source-id: 08f3a9f08ec54449b4554017ea9806f3ee51afcb
2019-02-06 13:02:59 -08:00
Aida Getoeva
562b9d1884 prefetch: remove check misses after fetching from server
Summary: We don't really need to check misses here as neither of request fucnctions return misses after fetching from the server. They raise exception if there are any misses.

Differential Revision: D13908252

fbshipit-source-id: 80b6e4fb79b419b5e6d3b343b3bd46d3f8dc7d3c
2019-02-06 10:43:15 -08:00
Aida Getoeva
996ac6da37 prefetch: add requestpacks
Summary: Implemented logic for fetching data from the scmmemcache and the server in pack files format. By default `prefetch` will still use loose files, unless the `remotefilelog.fetchpacks` config flag will be set to true.

Differential Revision: D13905733

fbshipit-source-id: cc559f5bc600067199a91efe6cf44b1bde6bf69b
2019-02-06 10:43:15 -08:00
Aida Getoeva
d853db727d prefetch: add get/set for pack files and remove hitcount
Summary: New get/set protocols for pack files. Also removed hitcount from `receive` method, because it is not used.

Differential Revision: D13924759

fbshipit-source-id: 1382b6f2bc865a19125f3ccd17a779cd16f08b50
2019-02-06 10:43:15 -08:00
Aida Getoeva
2b23a376f6 prefetch: get packs' paths after fetching from server
Summary: To add the data fetched from the server to the scmmemcache, we need to know pasths to the packfiles created.

Differential Revision: D13905734

fbshipit-source-id: 7c470b560e32e63e7df4f960be92bc9b6da9de3d
2019-02-06 10:43:15 -08:00
Aida Getoeva
3ea6881ea7 prefetch: move "fetch from server" code to the requestloose
Summary: Moved fetching loose files from the server to the separate function

Reviewed By: DurhamG

Differential Revision: D13855807

fbshipit-source-id: 39821644abcdc7375ba1b9ef9519fd2083eb0a71
2019-02-06 10:43:15 -08:00
Aida Getoeva
e218de341c prefetch: add set and get request
Summary: Move scmmemcache set/get commands protocol to the cache wrapper to isolate it from the main logic

Reviewed By: DurhamG

Differential Revision: D13855809

fbshipit-source-id: 95b70f7f9d10d97beff107f9f6e5e4f5a8a307c1
2019-02-06 10:43:14 -08:00
Aida Getoeva
79a1bd7770 prefetch: return set of misses instead of list
Summary: List of missed files is converted to a set many times. So changing the type to a set.

Differential Revision: D13924760

fbshipit-source-id: 65fe52ff6113724d8f7f7a8d5b3c1501f245eedc
2019-02-06 10:43:14 -08:00
Aida Getoeva
494608cf81 prefetch: add receive
Summary: Move scmmemcache receive logic to the cache wrapper to isolate it from the main prefetch logic

Reviewed By: DurhamG

Differential Revision: D13855808

fbshipit-source-id: d0da84857797e3e155507fcf284b39a146677e54
2019-02-06 10:43:14 -08:00
Durham Goode
163704f80a disablesymlinks: add extension to disable symlinks
Summary:
In some cases we are mounting ntfs in a linux host using ntfs.3g and we
want to prevent it from writing symlinks that can't be read from Windows.

Some background, ntfs.3g supports symlinks, but it produces IntxLNK which cause
problems when mounted into a real Windows machine. We don't support symlinks on
Windows anyway, so we want to just disable this. Unfortunately it's difficult to
detect if we're on a ntfs.3g fuse mount, so instead we're just going to have the
machine set up the repo with this extension enabled.

Differential Revision: D13964546

fbshipit-source-id: 7545538e51be4c986a50161165d7cc2e64280555
2019-02-06 08:41:34 -08:00
Arun Kulshreshtha
8aaab173c0 bindings: convert to Rust 2018
Summary: Convert crate to Rust 2018.

Reviewed By: quark-zju

Differential Revision: D13963023

fbshipit-source-id: f81a1ecd505d3bdc70c41f5272f861fdd737a8fc
2019-02-05 21:22:48 -08:00
Arun Kulshreshtha
5f6998719e edenapi: add static builder() method to get a client Builder
Summary: In Rust it is typically more idiomatic to have a static method on a struct to produce a builder, since this means the builder doesn't need to be explicitly imported to construct a new instance of the struct.

Reviewed By: DurhamG

Differential Revision: D13925323

fbshipit-source-id: c06d5d42ba941dbbb2c619f9470e79fa23f35f68
2019-02-05 21:22:48 -08:00
Arun Kulshreshtha
70aff50986 edenapi: rename mononokeapi to edenapi
Summary: Rename Mononoke API to Eden API, per war room discussion.

Reviewed By: quark-zju

Differential Revision: D13908195

fbshipit-source-id: 94a2fe93f8a89d0c5e9b6a24939cc4760cfaade0
2019-02-05 21:22:48 -08:00
Arun Kulshreshtha
6eab7a5222 mononokeapi: use auth section for TLS configuration
Summary:
Use the hgrc auth section to configure HTTP data fetching. For example:

```
[mononoke-api]
enabled = true
url = https://mononoke-api.internal.tfbnw.net

[auth]
mononoke-api.prefix = mononoke-api.internal.tfbnw.net
mononoke-api.schemes = https
mononoke-api.key = /var/facebook/credentials/$USER/x509/$USER.pem
mononoke-api.cert = /var/facebook/credentials/$USER/x509/$USER.pem
```

Reviewed By: DurhamG

Differential Revision: D13907185

fbshipit-source-id: 3b607f25912a85438b56c4ea7ab9cfed91ab7e85
2019-02-05 21:22:48 -08:00
Jun Wu
eaebf8d02d commands: drop unnecessary "config(..., default=...)"
Summary:
The default value is specified in configitems.py. Remove the `default`
argument.

Reviewed By: phillco

Differential Revision: D13909730

fbshipit-source-id: ca45c63be7d48e04e71a6f5b3b682f625a3030f6
2019-02-05 20:36:03 -08:00
Jun Wu
50932456ad tests: drop experimental.single-head-per-branch feature
Summary:
This reverts the upstream changeset:

  changeset:   66ecde8a704d9fa92bd99720923524c4bd3f315b
  user:        Boris Feld <boris.feld@octobus.net>
  date:        Wed, 15 Nov 2017 18:52:42 -0800
  summary:     server: introduce a 'experimental.single-head-per-branch' option

Named branches are going to be removed. Remove experimental dependent feature.

Reviewed By: phillco

Differential Revision: D13909727

fbshipit-source-id: 3baf101e5a038b58bc01506826b631a2a58a7782
2019-02-05 20:36:03 -08:00
Jun Wu
eb0ce36ac2 util: make timer return constant on tests
Summary:
Lots of places use it to print some thing like "fetched x files in y seconds (1KB/s)".

In tests, these have to be manually replaced to "* (glob)" patterns.

This diff makes test output static without using globs. So `run-tests.py -i` would just fix things.

Reviewed By: phillco

Differential Revision: D13954456

fbshipit-source-id: d139c7c5e268d3bab562c266335d740986780924
2019-02-05 20:36:03 -08:00
Jun Wu
f8f8e3962a status: add a way to log more details about why hg thinks a file was modified
Summary:
We're seeing issues where a file show up as "M" while it isn't expected so. When
running "hg status" again, the file disappeared. Existing logs suggest that
watchman does not think anything has changed between the two "status" commands.
Therefore add more logs of the internals to try to get more insights.

Differential Revision: D13954209

fbshipit-source-id: 0b89a6da5e8702e707440ef2e1823eb4968c10be
2019-02-05 19:41:35 -08:00
Durham Goode
3309a8090a pushrebase: read the manifest before looping through files
Summary:
pushrebase has logic that loops through all the files and builds a list
of what has changed. Unfortunately, Mercurial has some optimizations where if
the manifest isn't loaded already, it tries to only load the manifest delta, and
checks if this might be a good idea by first checking if the file is in the
commit metadata file list. The commit metadata is a list, which makes it a O(n)
scan to check containment. Since we do this for every file, it becomes O(n^2).

To avoid this, let's just make sure the actual manifest is loaded.

Once every repo is a tree repo, we can get rid of the manifest delta
optimization and get rid of the need to prefetch here.

Reviewed By: singhsrb

Differential Revision: D13944829

fbshipit-source-id: c0f33ca650b7956a1f39e961c94678a6f7f380b6
2019-02-05 16:05:50 -08:00
Durham Goode
f3a5d55c2b changelog: cache commit files list
Summary:
During pushrebase there is code that says 'for each file, do some work
that involves listing the changed files'. Because we reparse the list each time,
this becomes n^2 behavior. Let's cache the list to avoid this.

Reviewed By: singhsrb

Differential Revision: D13944830

fbshipit-source-id: 4fd0dbf26b6cee9d0c01879cafb9837262f7afa0
2019-02-05 15:52:00 -08:00
Stanislau Hlebik
ff74d1cc82 remotefilelog: add an option to verify all the hashes
Reviewed By: DurhamG

Differential Revision: D13838772

fbshipit-source-id: e7220ba8a0e07f3003693199086e3a3512023857
2019-02-05 15:03:24 -08:00
Jun Wu
452e2bd5d6 commandserver: import mercurial.__version__ from the right place
Summary: It was moved to edenscm.

Reviewed By: singhsrb

Differential Revision: D13955193

fbshipit-source-id: 79ec1a314398813de4f686f104b17cda0f43a92d
2019-02-05 09:47:34 -08:00
Fatih Aydin
64bd91b7f4 commands: add option to disable the outgoing command
Summary: Extend the option to disable `incoming` to also disable `outgoing`.

Reviewed By: markbt

Differential Revision: D13877971

fbshipit-source-id: c4f994d536dda5db7c0e9f14656be48fc757c237
2019-02-04 14:25:27 -08:00
Mark Thomas
f402b4f525 lfs: include name of file being downloaded in progress bar
Summary:
When doing lfs prefetch, pass the filenames that correspond to each oid to lfs
so that it can include them in the progress bar.

Reviewed By: DurhamG

Differential Revision: D13716078

fbshipit-source-id: c91eca6b342996c0c3d1ee43f3b1e98db4ed64d4
2019-02-04 11:44:28 -08:00
Durham Goode
5eced4c533 watchman: canonicalize repo root before querying watchman
Summary:
If the repository was mounted into a different directory than the
source of truth, our watchman integration would not work. To fix this, Mercurial
now applies the same canonicalization logic to the path before passing it to
watchman. This logic is stolen verbatim from watchmans integration test path
utility.

This also requires updating our copy of pywatchman to match the upstream
pywatchman.

Reviewed By: quark-zju

Differential Revision: D13886207

fbshipit-source-id: ea72166edf2eb30f2bee992d9aa936e2e9729e63
2019-02-04 10:34:08 -08:00
Fatih Aydin
7e7faeea81 commands: add option to disable the incoming command
Summary: In repositories which change quickly, the incoming and outgoing commands aren't useful.  Add an option to disable these commands.

Reviewed By: markbt

Differential Revision: D13859604

fbshipit-source-id: c4784b7eafbe3c4a6cf03686f1431204089b0155
2019-02-04 07:09:37 -08:00
Mark Thomas
b44e2103d7 simplecache: don't use memcache in tests
Summary:
The simplecache test attempts to connect to a memcache instance on localhost.
This means the test fails if a memcache instance is not available.

Remove the use of memcache in the test.  We still test local files, and assume
that memcache itself works.

Also corrupt the correct key when testing corruption handling, and document the
config options.

Reviewed By: quark-zju

Differential Revision: D13818471

fbshipit-source-id: 6ca7f575aa813f95773144be5337796f029ffd90
2019-02-01 19:19:36 -08:00
Mark Thomas
ae0a81f2c2 rust: move bindings to a single python extension
Summary:
Move all Rust bindings to a single python extension, `bindings`.  This should
improve compilation time and make things simpler.

Reviewed By: quark-zju

Differential Revision: D13923866

fbshipit-source-id: 560592b5a6c0c4f1b836c755ef123666a1059164
2019-02-01 17:53:22 -08:00
Saurabh Singh
1752853929 commit: remove option to specify secret phase
Summary:
We will probably not be supporting secret phase in the future anyway
so lets get rid of it.

Reviewed By: quark-zju

Differential Revision: D13928907

fbshipit-source-id: 7edcd84d2ee3c37124dcf9d3ba92c0610d074157
2019-02-01 15:36:44 -08:00
Stanislau Hlebik
6adfda0e99 pushrebase: move selecting commit date in a separate file
Summary:
Add an option that let's us specify the date of each commit in a pushrebase.
It should be specified via a config option, which accepts a name of a file in
which json dictionary should be stored. Key of this dictionary is a commit hash, value
is a date.

Reviewed By: ikostia

Differential Revision: D13803174

fbshipit-source-id: 6271c18c61399b89c92dce7a4fe63c8fae8dae7c
2019-02-01 09:42:57 -08:00
Arun Kulshreshtha
78ba8186f3 remotefilelog: add debug command to fetch multiple files over HTTP
Summary: Previously, `hg debuggetfile` would allow fetching a single file from the API server. This diff updates the command to `hg debuggetfiles`, which accepts a list of filenode/path pairs on stdin, and fetches all the files concurrently, writing the contents to a single datapack.

Reviewed By: DurhamG

Differential Revision: D13893894

fbshipit-source-id: 36fc54f1870273ab4b447de5d615b3fb6aaa3378
2019-02-01 01:41:31 -08:00
Arun Kulshreshtha
50c293b94e pymononokeapi: add Python API for batch file downloads
Summary: Expose `MononokeClient`'s multi-get functionality through the Python bindings using a builder-style API.

Differential Revision: D13893748

fbshipit-source-id: 312e7449eb8300432b1f1de28e0c6fc3e47d1d53
2019-02-01 01:41:31 -08:00
Arun Kulshreshtha
f02ebcffb7 mononokeapi: support fetching multiple files concurrently
Summary: Give MononokeClient the ability to fetch multiple files concurrently. Right now this functionality is not exposed via the Python bindings, so as far as the Mercurial Python code is concerned, nothing has changed. The multi-get functionality will be used later in the stack.

Differential Revision: D13893575

fbshipit-source-id: c9e514fbeb41bbb37f52f6df3920eb01a66df293
2019-02-01 01:41:31 -08:00
Arun Kulshreshtha
1b74af2ace mononokeapi: add ability to fetch a file and write it to a datapack
Summary: Add a new `get_file()` method to `MononokeClient` that fetches Mercurial file content from the API server and writes it to a datapack in the cache. This functionality is exposed via the new `hg debuggetfile` debug command, which takes a filenode and file path and fetches the corresponding file.

Differential Revision: D13889829

fbshipit-source-id: 2b68bf114ee72d641de7a1043cca1975e34cf4e6
2019-02-01 01:41:31 -08:00
Arun Kulshreshtha
f19e1e6771 remotefilelog: rename debugmononokeapi to debughttphealthcheck
Summary: Rename this debug command to make it obvious what it does (i.e., perform a health check) and make it print more useful output (i.e., the name of the server for which it performs the health check).

Reviewed By: DurhamG

Differential Revision: D13890867

fbshipit-source-id: 8fc96bcc06d04611a308ecc0b870049936f1cb29
2019-01-30 18:30:49 -08:00
Jun Wu
b557ea167b doc: fix rst format
Summary: Fix ill-formatted content that breaks `make doc`.

Reviewed By: singhsrb

Differential Revision: D13885565

fbshipit-source-id: 1b4a771e535f76679d73d9081714ad4c36b1db8c
2019-01-30 14:57:42 -08:00
Jun Wu
9dc21f8d0b codemod: import from the edenscm package
Summary:
D13853115 adds `edenscm/` to `sys.path` and code still uses `import mercurial`.
That has nasty problems if both `import mercurial` and
`import edenscm.mercurial` are used, because Python would think `mercurial.foo`
and `edenscm.mercurial.foo` are different modules so code like
`try: ... except mercurial.error.Foo: ...`, or `isinstance(x, mercurial.foo.Bar)`
would fail to handle the `edenscm.mercurial` version. There are also some
module-level states (ex. `extensions._extensions`) that would cause trouble if
they have multiple versions in a single process.

Change imports to use the `edenscm` so ideally the `mercurial` is no longer
imported at all. Add checks in extensions.py to catch unexpected extensions
importing modules from the old (wrong) locations when running tests.

Reviewed By: phillco

Differential Revision: D13868981

fbshipit-source-id: f4e2513766957fd81d85407994f7521a08e4de48
2019-01-29 17:25:32 -08:00
Wez Furlong
83f00ab318 hg: restore spawning watchman on-demand
Summary:
A while back, as a startup optimization, we started to hard code
the path to the watchman socket in the mercurial config.  This meant
that we could avoid running a subprocess for every command.

Today, a chef configuration change was rolled out that caused watchman
to be stopped on all of the corpnet macs with the result being that
all mercurial commands are slow because it never uses and never restarts
watchman.

This diff adds some fallback logic to allow spawning the server in
the case that we have a connection error.

Reviewed By: DurhamG

Differential Revision: D13855696

fbshipit-source-id: 44c0ad36b6e80520912e42bcea9e04f4f165b588
2019-01-29 15:49:37 -08:00
Adam Simpkins
043e2016ac fix some additional edenscm name changes
Summary:
Follow up to D13853115 to fix test failures:
- Update an `__import__` statement in dispatch.py to use the new
  `edenscm.mercurial` package path.
- Make sure the `__version__.py` file is generated at the correct location by
  the buck build files.

Reviewed By: quark-zju

Differential Revision: D13858016

fbshipit-source-id: 54ac4a02274cf921397932e9625f422c5f427623
2019-01-29 12:26:10 -08:00
Kostia Balytskyi
401eff3cda bundle2: fix debugging output for input parts
Reviewed By: quark-zju

Differential Revision: D13819208

fbshipit-source-id: 373d9669395a08f46e5801f822486ba2f10fd36b
2019-01-28 21:47:17 -08:00
Jun Wu
c12e300bb8 codemod: move Python packages to edenscm
Summary:
Move top-level Python packages `mercurial`, `hgext` and `hgdemandimport` to
a new top-level package `edenscm`. This allows the Python packages provided by
the upstream Mercurial to be installed side-by-side.

To maintain compatibility, `edenscm/` gets added to `sys.path` in
`mercurial/__init__.py`.

Reviewed By: phillco, ikostia

Differential Revision: D13853115

fbshipit-source-id: b296b0673dc54c61ef6a591ebc687057ff53b22e
2019-01-28 18:35:41 -08:00