Commit Graph

2092 Commits

Author SHA1 Message Date
Jun Wu
bb7914ab50 remotenames: skip pull for modern clone paths
Summary:
The remotenames has logic to work with legacy clones to write the remotenames
state. However, modern clone paths take care of remotenames directly so there
is no need to do an extra pull by remotenames.

Reviewed By: DurhamG

Differential Revision: D29428883

fbshipit-source-id: a73c0ee716b09f4e34d6fa30997f961284678d13
2021-06-28 12:25:17 -07:00
Jun Wu
4c51695bf3 clone: reload config after writing hgrc
Summary:
This makes it pick up some `%include` configs and can avoid some surprises.

Also remove the manual `paths.default` setconfig. That seems to cause
`destrepo.edenapi` being `None` and break lazy changelog clone paths.

Reviewed By: DurhamG

Differential Revision: D29428882

fbshipit-source-id: bafeb195a560e35be17355b793613b60d97fbecf
2021-06-28 12:25:17 -07:00
Jun Wu
e454f71fa9 localrepo: write .hg/reponame on repo creation
Summary: Make dynamicconfig pick up the repo name because hgrc gets written.

Reviewed By: DurhamG

Differential Revision: D29428878

fbshipit-source-id: fbf578cd7c770a4541fff3b85ff40c40cd5a6cc5
2021-06-28 12:25:17 -07:00
Jun Wu
a26181e39e dirsync: skip metaedit commits
Summary: This avoids issues in assertions used by metadataonlyctx.

Reviewed By: DurhamG

Differential Revision: D29430672

fbshipit-source-id: 4de305d62f65a9d6c4fb2e3f375ef20d9d94d41c
2021-06-28 11:21:05 -07:00
Jun Wu
d249a22fe7 helptext: update streampager related doc
Summary:
We do not respect `$PAGER`, and the default is the internal streampager.
Also document streampager config options.

Reviewed By: markbt

Differential Revision: D29412598

fbshipit-source-id: 706f09f8805e9067b46eec7d83c6742b61084b09
2021-06-28 07:43:20 -07:00
Jun Wu
219bbde735 pager: add a way to not separate stderr in a separate pane
Summary:
See also D29400532 (909411bb1c). It turns out that it might be more desirable to just mix
stdout and stderr streams in streampager. For example, having them mixed then
the graph log output can show what network fetches or calculations are done
before outputting the graph lines. This is also more consistent with the
vanilla terminal (no pager) behavior.

Reviewed By: markbt

Differential Revision: D29412531

fbshipit-source-id: c07f68b12498a7cee6152bbecbb58d5a7e64097a
2021-06-28 07:43:20 -07:00
Jan Mazur
76179e66aa remove ssh-related debugnetwork functionality
Summary: No longer used: https://fburl.com/scuba/ssh_prod_logs/n6hn2cg3

Reviewed By: DurhamG

Differential Revision: D29100680

fbshipit-source-id: 6ee154d9348cd5201780aba723ea1793a5132aee
2021-06-28 06:00:55 -07:00
Andrey Chursin
26759fa8aa pull: fallback to slow path on root conflict
Reviewed By: quark-zju

Differential Revision: D29399075

fbshipit-source-id: b623f46beba5254b08d14a25187eee300454a1ff
2021-06-25 18:51:00 -07:00
Jun Wu
c00bc1ac2e grep: prevent external grep command writing stdout directly
Summary:
The external grep command (originally from fb-hgext's tweaks of grep command)
was run without redirecting its stdout. That could be problematic for
streampager, because writing directly to stdout will mess up with streampager
interface.

For example, the following command will show "nothing", while it should print
something:

  fbcode/antlir/fbpkg/build % lhg grep -l scuba --config pager.pager=internal:streampager --config grep.usebiggrep=False --config pager.interface=full

Fix it by using a PIPE and forward the external command's output to streampager
buffer properly.

Reviewed By: andll

Differential Revision: D29408821

fbshipit-source-id: 4b2a0a6bbd64aa00d09f921d830b173cc56ae630
2021-06-25 18:18:37 -07:00
Arun Kulshreshtha
ef79c2d811 localrepo: disable EdenAPI for non-Mononoke repos
Summary: Previously, hg would always try to fetch data via EdenAPI, even when doing so wouldn't make sense (for example, a local test repo). The only time it makes sense to try to use EdenAPI at all is when the repo in question is supported by Mononoke. As a quick heuristic, let's disable EdenAPI if `paths.default` is not set to a `mononoke://` URL.

Differential Revision: D29372739

fbshipit-source-id: b3601e529ed44c355cb192aedf4332317f4e3132
2021-06-25 15:33:00 -07:00
Arun Kulshreshtha
60139f5316 localrepo: add option to explicitly enable or disable EdenAPI globally
Summary: Add an option to allow manually forcing EdenAPI to be enabled or disabled. This is useful in a variety of cases, such as bypassing the normal EdenAPI activation logic in tests, or to forcibly disable EdenAPI in cases where it isn't working correctly.

Differential Revision: D29377923

fbshipit-source-id: f408efe2a46ef3f1bd2914669310c3445c7d4121
2021-06-25 15:33:00 -07:00
Jun Wu
909411bb1c hint: write to stdout in streampager
Summary:
Users get used to hints at the end of the output, not in a separate panel in
streampager. Make it so.

Reviewed By: andll

Differential Revision: D29400532

fbshipit-source-id: 41dc5d20f44a315bc0235ca3cb7857ae8955d3ad
2021-06-25 15:18:56 -07:00
Jun Wu
410769c529 mutation: make calculate_obsolete return non-lazy set
Summary:
More straightforward way of D29404055 (e6ea02372c). Return the non-lazy set directly from
Rust. This avoids some overheads.

Note: ignoring whitespace will make reviewing easier.

Reviewed By: andll

Differential Revision: D29404901

fbshipit-source-id: 02e4766256863fe3fe258bcb318473355cd1efe4
2021-06-25 14:55:52 -07:00
Jun Wu
0a8dd803f8 commitcloud: avoid inefficient remote commit hash lookups
Summary:
Running `hasnode` in a loop is inefficient with lazy changelog.
Update it so it does batch filtering and does not ask remote service.

With the change, BackupState.heads will only contain locally known heads.
So the extra filtering is removed.

Reviewed By: andll

Differential Revision: D29404056

fbshipit-source-id: 327bd4c292ad75fd14a47587482440b6ece1d2d5
2021-06-25 14:35:13 -07:00
Jun Wu
e6ea02372c mutation: make obsolete() non-lazy
Summary:
Previously, the obsolete() set (from repo.dageval) is a "meta" (lazy) set that
might trigger frequent remote lookups. Calculate the obsolete() set into a
static set form so it does not trigger remote lookups.

This avoids expensive remote lookups in:

  File "/data/users/quark/fbsource/fbcode/een/scm/edenscm/hgext/smartlog.py", line 432, in <lambda>
    hidenodes = repo.dageval(lambda: obsnodes - heads(obsnodes) - roots(obsnodes))d

This issue was found out by setting env vars:

  EDENSCM_LOG=dag::protocol=debug

to find the commit hashes, and:

  EDENSCM_DISABLE_REMOTE_RESOLVE=a8209cbe13bcdc42d4999ffaa15dc9881660d5d,76d91d23d583f92b6c909b6747db1b75229d5be5

to find the traceback.

Reviewed By: andll

Differential Revision: D29404055

fbshipit-source-id: cc8bdd5347b38c1681565455874ed22f1a87321e
2021-06-25 14:35:13 -07:00
Xavier Deguillard
fcd22a03f6 telemetry: significantly reduce the precision of logged times
Summary:
We don't need the full precision of execution time in the telemetry, thus
reduce the precision before logging it.

Reviewed By: kulshrax

Differential Revision: D29384354

fbshipit-source-id: cab02ab4db6b260525e56e0395ca1071fdb4b442
2021-06-25 14:31:17 -07:00
Andrey Chursin
9712359884 pull: use fast path pull for master
Summary:
Use segmented changelog fast path during master branch pull
This change is gated by a config

Reviewed By: quark-zju

Differential Revision: D29347804

fbshipit-source-id: f0cc7633e67fb04266ce15506375873d58ea77fc
2021-06-24 20:36:13 -07:00
Jun Wu
cf020c59e7 pyerror: expose NeedSlowPathError
Summary:
Make it possible for Python to detect the error and fallback to slow path
accordingly.

Reviewed By: andll

Differential Revision: D29369067

fbshipit-source-id: 1de6162532b145469c09070bdf843ec96d38e431
2021-06-24 17:54:46 -07:00
Jun Wu
03003242b0 debuginternals: new command to list or export internal states
Summary:
Sometimes we need repo internal states for deeper investigation. Right now
the process is quite adhoc - telling people to figure out where the "backing"
repo is, excluding unwanted files like 00changelog.d, etc. Let's just make
it easier so we have a dedicated command to tar up selected internal states.

Reviewed By: andll

Differential Revision: D29242716

fbshipit-source-id: 85604d0df5b3a12f1aed29e4f31fcd5c166f9066
2021-06-24 12:31:47 -07:00
Meyer Jacobs
640767d414 scmstore: track contentstore fallbacks
Summary:
Introduce basic contentstore fallback tracking to help monitor the scmstore shim rollout.

This will be expanded to a general fetch metrics system for scmstore in a future change.

Reviewed By: kulshrax

Differential Revision: D29305839

fbshipit-source-id: c6cc3ea15a3bb7b90f4ec298febc911ec4e2af91
2021-06-23 15:26:26 -07:00
Pyre Bot Jr
ca842ced69 suppress errors in fbcode/eden - batch 1
Differential Revision: D29301094

fbshipit-source-id: 2b0c3dc44295341efb68ae15403cd2df4e837db7
2021-06-22 13:31:57 -07:00
Andrey Chursin
70857500c7 sparse: fix size calculation on the file outside of sparse profile
Summary:
When user runs hg diff between revision and working copy, and if the diff contains file that is not present in working copy because of it's sparse profile, then hg diff fails

Failure happens because hg diff tries to compare file sizes and calculating file size on workingfilectx fails, because file does not exists.

This diff overwrites size function for workingfilectx in the sparse extension to protect against that, similarly how it is already done for data function

Differential Revision: D29279691

fbshipit-source-id: 55d7843d23370c31693a32a0e1df8b882db0d89d
2021-06-22 11:22:30 -07:00
Stanislau Hlebik
790986d561 setdiscovery: fix failing pulls
Summary:
Looks like D29145340 (d0e16f1a25) introduced regression - "hg pull" fails with
"TypeError: Population must be a sequence or set.  For dicts, use list(d).", stack trace - P424458181.

This diff fixing it by converted a dag.nameset to a list first

Reviewed By: mzr

Differential Revision: D29258771

fbshipit-source-id: 9ffcc756f9931d6d24b69dadf1cd2d08faccb443
2021-06-21 03:58:28 -07:00
Meyer Jacobs
18f2bb2b69 scmstore: introduce scmstore.enableshim config
Summary: Introduce a new config option, `scmstore.enableshim`, which replaces instances of contentstore in Python with scmstore objects instead. Currently, this config is not safe to enable. Addition fixes are incoming.

Reviewed By: DurhamG

Differential Revision: D29213190

fbshipit-source-id: 7fd4db77d55cd25cc08c40bee28798d6a6d2555c
2021-06-18 17:39:53 -07:00
Meyer Jacobs
5b1a16077f scmstore: actually fix undesired file logging
Summary: My previous fix was actually incorrect, we now log actual remote requests, but join that with the logs from the contentstore fallback.

Reviewed By: DurhamG

Differential Revision: D29206878

fbshipit-source-id: d22e58792bf380c274e8086ce08aebe20dd9b848
2021-06-18 17:39:52 -07:00
Jun Wu
4567de2ca6 helptext: remove reference of color.pagermode
Summary:
Follow up of D29172395 (6ed616db0c). Fixes `test-check-help.t`:

    --- test-check-help.t
    +++ test-check-help.t.err
    @@ -34,3 +34,6 @@
     to print errors.
       $ grep -v subversion $TESTTMP/topics > $TESTTMP/topics_filtered
       $ cat $TESTTMP/topics_filtered | xargs -n1 -P $NPROC hg --cwd / help >/dev/null
    +  abort: help section not found: config.color.pagermode
    +  xargs: hg: exited with status 255; aborting
    +  [124]

Reviewed By: DurhamG

Differential Revision: D29216316

fbshipit-source-id: 0df4e06b4f40de4bd2baaf47ad343f0b476ae405
2021-06-17 16:45:21 -07:00
Jun Wu
02a0d053e0 clone: add a way to stage rollout lazy-changelog for fbclone
Summary: Check the dest repo config to enable lazy-changelog.

Reviewed By: DurhamG

Differential Revision: D29123244

fbshipit-source-id: 5bae797fb43e94856296e62bbf6a17d1257b5f6e
2021-06-17 11:29:53 -07:00
Jun Wu
6ed616db0c pager: update helptext
Summary: Update helptext about streampager.

Reviewed By: DurhamG

Differential Revision: D29172395

fbshipit-source-id: 0aa0bd9c58f5bab3fa3d06495caf9cb3404f5a08
2021-06-17 09:33:40 -07:00
Jun Wu
2007761538 pager: make "internal:streampager" the default
Summary: It was rolled out weeks ago and there seem to be no complaints so far.

Reviewed By: DurhamG

Differential Revision: D29172396

fbshipit-source-id: 4f3310597ef1bb1abd92ee7207700a3d0039c598
2021-06-17 09:33:40 -07:00
Liubov Dmitrieva
98f863b323 use commitknown api for checking existing commits
Summary:
use `commitknown` edenapi api for checking the existing commits

it uses the same `lookup_commits` under the hood but a bit shorter to use

we won't need the tokens for existing changesets, so can use a simpler api

also, make `lookupfilenodes` function a bit shorter

Reviewed By: markbt

Differential Revision: D29134677

fbshipit-source-id: 257624d64480102c34761560b2bd768049cbfa83
2021-06-17 08:22:33 -07:00
Mark Juggurnauth-Thomas
759d6fc5b7 commitcloud: remove syncing of obsmarkers
Summary: Obsolescence markers have been deprecated in favour of mutation and visibility for some time.  Remove syncing of obsmarkers via the commit cloud service.

Reviewed By: liubov-dmitrieva

Differential Revision: D29159443

fbshipit-source-id: 33e1d526a9df5c02059931c880529d695036c616
2021-06-17 06:09:02 -07:00
Jun Wu
d0e16f1a25 setdiscovery: use native set types
Summary: Avoid converting to Python `set` for better performance.

Reviewed By: andll

Differential Revision: D29145340

fbshipit-source-id: 9c560f14404ac764184736bd09f5ea99f83cb7d5
2021-06-16 09:10:27 -07:00
Jun Wu
8afaafc486 changelog: remove code dealing with cl.userust() is False
Summary:
`cl.userust()` is always True after D29020191 (3765f8bd76) so `cl.userust() is False` code
is now dead.

Reviewed By: andll

Differential Revision: D29142464

fbshipit-source-id: f9a7e5c56641218758f12bad3de43d1cd1a71716
2021-06-16 09:10:27 -07:00
Thomas Orozco
28e474eb82 hg: set ignoreautobackup on hg cloud backup
Summary:
If this opens a transaction and fails, then we start a never-ending cycle of
starting hg cloud backup and failing.

This command normally doesn't open transactions but it might via other
extensions, here is one example: P423007962.

This ends up killing people's machines:

https://fb.workplace.com/groups/scm/permalink/3957513017631622/

This fixes that by not kicking off background backups in this case.

Reviewed By: liubov-dmitrieva

Differential Revision: D29136077

fbshipit-source-id: 1c4e6de6147571dd6d728f761324506b1804f303
2021-06-15 12:54:40 -07:00
Liubov Dmitrieva
99a2b85f1a upload file content
Summary:
implement uploading file content via Eden API

* in this diff I aim to upload file content for the given set of filenodes
* also, the code would check with Mononoke using the lookup request what is already there and skip those
* also, this diff introduces calculation of blake2 hash (called ContentId) for file contents (we would probably need to store/cache those and the mapping from hg filenode id to the canonical Mononoke content_id)
* for every uploaded content EdenApi returns a token that we would also need to store later

Reviewed By: markbt

Differential Revision: D29063229

fbshipit-source-id: 739a44bc3ff904cb04a39514ba5efd01c80ba6d0
2021-06-15 08:09:00 -07:00
Jun Wu
880b5c3cd8 mutation: avoid expensive server lookups for lazy changelog
Summary:
Similar to D29111710. Let's avoid asking servers for unknown nodes.

In theory this might affect correctness. Practically, this should only affect "landed as" markers,
because all drafts should be non-lazy. If the "landed as" correctness is an issue, we can fix
forward "landed as" later (ex. by writing down the public commit hash explicitly in
debugmarklanded).

Reviewed By: andll

Differential Revision: D29114049

fbshipit-source-id: db8dc34244feb66919cdff9433b6f18967c9ea9b
2021-06-14 16:00:58 -07:00
Jun Wu
f555f9c55d pydag: add a way to test commit existence without asking remote server
Summary: This will be used by upcoming changes.

Reviewed By: andll

Differential Revision: D29114048

fbshipit-source-id: ce963a42ebc5722ca9c61ab0a4e7a7377bbf7abb
2021-06-14 16:00:58 -07:00
Durham Goode
7a10894540 py3: fix crecord for non-utf8 files
Summary:
The crecord width calculation used a function that requires a string,
so we tried to force the rows from bytes to columns, which crashed if the row
wasn't utf8. Let's just use the error="replace" utf8 error handler since we
don't care if the row computation is slightly off.

Reviewed By: quark-zju

Differential Revision: D29043385

fbshipit-source-id: a00d867bca9c62007ae4f68b6198d159deeb6016
2021-06-11 11:33:15 -07:00
Jun Wu
8cc60851cb clindex: remove the extension
Summary:
It is only useful for Python revlog-based changelog, which was removed by the
previous diff.

Reviewed By: DurhamG

Differential Revision: D29020190

fbshipit-source-id: 3332f1532a510dc72f21d68801e093b5eba10145
2021-06-10 20:28:27 -07:00
Meyer Jacobs
8f9bcf232a scmstore: basic scmstore & sha256-based status
Summary:
Modify the status command to prefer comparing content sha256 when comparing files over comparing content directly, using cached aux data when possible and writing newly computed hashes to cache.

A new config option, `scmstore.status`, gates this new behavior.

When `scmstore.status` is enabled, the `status` output should be more accurate, not assuming files with non-matching `HgId`s in an arbitrary pair of revisions are different. As written, this will cause fetching of data that wouldn't otherwise be fetched, but remote fetching of aux data is planned.

This change also doesn't introduce batch fetching, this is planned.

Reviewed By: DurhamG

Differential Revision: D28826219

fbshipit-source-id: dcd253f169723983738148559d61ba655dd453a4
2021-06-10 18:24:59 -07:00
Jun Wu
fa7466cf90 doctor: work with non-revlog changelog
Summary:
Make `doctor` aware of non-revlog changelog and do not hide commits
incorrectly.

Reviewed By: DurhamG

Differential Revision: D29020189

fbshipit-source-id: af7fab75a877997e3f11dd21e506c965da078f83
2021-06-10 14:44:27 -07:00
Jun Wu
3765f8bd76 changelog: remove Python revlog-based changelog
Summary: For all clients and tests we're using revlog changelog based on Rust.

Reviewed By: DurhamG

Differential Revision: D29020191

fbshipit-source-id: 44ab603ea07b8891831692285e94ea0e4df849f5
2021-06-10 14:44:27 -07:00
Jun Wu
e4c9a1ae17 verify: make verify a no-op
Summary:
Verify is tightly coupled with revlog details, and assumes a non-lazy repo.
Revlog is going away and our repo is lazy typically, so let's just make verify
a no-op.

Reviewed By: DurhamG

Differential Revision: D28974546

fbshipit-source-id: 487dc65ceb9a1e445b58d03a53353a8382aefc08
2021-06-10 14:44:27 -07:00
Jun Wu
b2d5645a09 changelog: remove inline to non-inline changelog migration
Summary:
Practically, our client-side revlog changelogs should be non-inline now for a
long time. There is no need to keep the migration logic.

The revlog is being deprecated too so its implementation details (inline) is
going to be irreverent. The related test is then removed.

Reviewed By: DurhamG

Differential Revision: D28974551

fbshipit-source-id: ea456c46dac11d6a8b225c269b49598ab34c2548
2021-06-10 13:56:59 -07:00
Jun Wu
827bea0b58 linkrevcache: remove the extension
Summary: It was only useful server-side and will be incompatible with upcoming changes.

Reviewed By: DurhamG

Differential Revision: D28974549

fbshipit-source-id: 70a715ce170baa78adb8b1fcf7d29e3d1479c05e
2021-06-10 13:56:59 -07:00
Jun Wu
1f045a5683 debugchangelog: fix help text
Summary: Revise the help text so it matches the latest implementation.

Reviewed By: DurhamG

Differential Revision: D28971683

fbshipit-source-id: 3f8fb7ccc42a71fdb65b87e2b99d06fb347983f3
2021-06-10 12:32:26 -07:00
Andrey Chursin
ae4ef064e6 debughiddencommit: add --no-ignored-files option
Summary: This option allows to exclude ignored files, this way if user specifices wildcard patterns in --include, they will still not include ignored files

Reviewed By: mrkmndz

Differential Revision: D29007062

fbshipit-source-id: a8458811b4c16e11a91abdc31967b53c3cdf2ed7
2021-06-10 11:11:24 -07:00
Mark Juggurnauth-Thomas
98ada843e3 rage: include Windows disk usage information
Summary:
`df` doesn't exist on Windows, so this part of `rage` isn't populated.

The closest equivalent on Windows is `wmic LogicalDisk`.  Use this to query the
free space and size of the disks.

Reviewed By: quark-zju

Differential Revision: D28997337

fbshipit-source-id: 08b3b74d70928f2e9801061f049359a58108f4bf
2021-06-10 02:44:14 -07:00
CodemodService Bot
8cddb36cf2 Daily arc lint --take BLACK
Reviewed By: zertosh

Differential Revision: D28957848

fbshipit-source-id: 80ce3c197a09bc924a8920aedb7c7fb093760dd3
2021-06-08 03:55:06 -07:00
Durham Goode
40f304d428 run-tests: more Python 3 fixes
Summary:
More things needing fixing to be python 3 compatible. Caught when
trying to remove the Python 2 build.

Reviewed By: quark-zju

Differential Revision: D28880028

fbshipit-source-id: d162c78237f330f1f931c3581b25ead24e3ea375
2021-06-07 16:46:18 -07:00
Durham Goode
8a679138dd windows: fix local clones
Summary:
The combination of metalog and the new clone pattern of first creating
the repo causes local copy clones to fail on Windows because the initial metalog
files are held open and the copy can't overwrite them.

Let's drop the destrepo before we do the local copy.

Reviewed By: quark-zju

Differential Revision: D28880029

fbshipit-source-id: 2a4ef52675eebf16afa528e645acd927a6110cb4
2021-06-07 16:46:18 -07:00
Jan Mazur
3054c4eb63 send additional data identifying client
Summary: This will be used for rate limiting decisions. Also, could be logged to scuba tables to get more info about clients.

Reviewed By: quark-zju

Differential Revision: D28750197

fbshipit-source-id: 83f54e38f998c9dd824ef2d3834c777a44d0ffed
2021-06-07 06:38:37 -07:00
Liubov Dmitrieva
7fc42817cb edenapi: create a call to the lookup API for different types
Summary:
create end to end intergation for the lookup API on the client

Start prototyping of `hg cloud upload` command.

Currently, it just performs lookup for existing heads.

This way we can end to end test the new APIs.

Reviewed By: markbt

Differential Revision: D28848205

fbshipit-source-id: 730c1ed4a21c1559d5d9b54d533b0cf551c41b9c
2021-06-04 10:11:25 -07:00
Eric Chen (swe)
0ba2c44d90 uncopy: new command to mark files as not copied
Summary: create `uncopy` command to unmark files that were copied using `copy`.

Reviewed By: quark-zju

Differential Revision: D28821574

fbshipit-source-id: c1c15f6fb2837cec529860aba70b516ddd794f10
2021-06-03 13:54:48 -07:00
Durham Goode
8da8be4fde py3: fix shell aliases on Windows
Summary: Windows has an issue where subprocess don't inherit stdout/stderr correctly. util.system() has a workaround for this, so let's use that instead of subprocess when executing shell aliases.  This fixes 'hg pull --rebase' which is a shell alias.

Reviewed By: kulshrax

Differential Revision: D28815381

fbshipit-source-id: 7521c17166a2b2c0e4ee872dacfd09d2d97e00ce
2021-06-01 21:00:31 -07:00
Jun Wu
b488208048 changelog2: support migrating from revlog to lazy backend directly
Summary:
Previously it requires migrating to doublewrite first. There is no reason why
the doublewrite migration cannot be done automatically. So let's do it.

Reviewed By: DurhamG

Differential Revision: D28757734

fbshipit-source-id: ba2533b5506309610b87865a838d7efe22bccfac
2021-05-27 17:35:19 -07:00
Jun Wu
7617f2ef23 rm: do not list clean files with -A
Summary:
`rm -A` means removing files that are "deleted" (`rm`-ed but not `hg rm`-ed).
It does not need to list clean files. Listing clean files can be very slow
in a large repo.

Avoid listing clean files so `rm -A` can be faster.

This has a side effect that we no longer maintain the exit value (0: repo
becomes empty, 1: repo is not empty) like before. But I guess nobody really
cares the 1 exit value (and it does not really make sense in the `rm -A`
case).

Reviewed By: DurhamG

Differential Revision: D28622558

fbshipit-source-id: 2087d6508932905564a8307e9438895538ecede9
2021-05-27 11:28:51 -07:00
Jun Wu
38db21c8d8 changelog2: migrating to lazy makes changelog lazy
Summary:
Previously, migrating to lazy means repo requirement changes. This diff uses
the new API to actually make the changelog lazy.

Reviewed By: DurhamG

Differential Revision: D28700896

fbshipit-source-id: 82cfd70645230cd67223195e25ef07ae5abe7df6
2021-05-26 19:18:57 -07:00
Jun Wu
1721f5f866 debugrebuildchangelog: support rebuild with lazy segmented changelog
Summary:
Switch debugrebuildchangelog from using revlog stream clone to lazy segment clone.
This removes the revlog techdebt and can be used as a way to repair
repos with broken segmented changelog. As we migrate off double-write backend we
can no longer migrate down to revlog then migrate up, and a full reclone can be
slow. So a partial reclone command that just recreates the segmented changelog
seems useful.

This command is one of the two commands that handle emergency situations
when segmented changelog related logic goes wrong. The other command
is the emergency clone mode, added by D27897892 (d1413bbbad), which assumes everything
related to segmented changelog is broken on Mononoke side and we still
need to commit and push. This command relies on segmented changelog
related features, such as hash<->location lookup, and clone on Mononoke
to work properly and the server having a compatible IdMap. So it might
not be able to address all issues if Mononoke goes wrong.

Reviewed By: DurhamG

Differential Revision: D28430885

fbshipit-source-id: 17357a33f6fda4a67d46e2c7e7be6653b530f499
2021-05-26 19:00:01 -07:00
Johan Schuijt-Li
151b533a6f mononokepeer: log extra timings
Summary: Sometimes things take longer, make sure we are able to distinguish whether that's due to networking, tls handshake, http parsing, or Mononoke wireproto handling.

Reviewed By: markbt

Differential Revision: D28705508

fbshipit-source-id: 1bafda7fc447f2e429690f47fe7ab81cec511494
2021-05-26 06:47:46 -07:00
Jun Wu
c72cd2333f metalog: remove conditional metalog logic
Summary:
Now metalog can no longer be `None`. Let's just remove logic handling its
`None` case.

This changes the commitcloud-sync-race test because the metalog itself has
internal locking and changes are atomic.

Reviewed By: DurhamG

Differential Revision: D28595292

fbshipit-source-id: bd9851f5f3bb25f28f15d673f608af2863953c46
2021-05-25 19:43:45 -07:00
Jun Wu
1f8d8cfbf0 store: always enable store and fncache
Summary:
fncache and store have been default on for years. Enable them unconditionally.
This also makes sure that metalog is always available.

Practically, the only place that does not use fncache is hgsql server repos and
they are irrelevant now.

Reviewed By: DurhamG

Differential Revision: D28595289

fbshipit-source-id: 32b9906c179518acdb17a206b54f98a3dc994921
2021-05-25 19:43:45 -07:00
Jun Wu
2aa432e134 clone: add a config to clone with lazy changelog
Summary: This will be used by fbclone to ship lazy commit hash backend.

Reviewed By: DurhamG

Differential Revision: D28554445

fbshipit-source-id: a263ae7683124b3b86f4025b02c7de20dcb9813e
2021-05-24 14:51:58 -07:00
Jun Wu
5edc1f6433 metalog: expose compact as debugcompactmetalog command
Summary: This makes it possible to use non-debugshell to compact the metalog.

Reviewed By: DurhamG

Differential Revision: D28550902

fbshipit-source-id: 789830ba35243d248397e6a52ee343584c1e01a9
2021-05-24 11:44:55 -07:00
Jun Wu
bd1fb8e337 zipimport: workaroud pyc invalidation due to timezone settings
Summary:
The zipimport logic requires the pyc mtime to match its source. However, the
Windows system time zone can invalidate it and cause slow startups.

Workaround it by making the zipimport mtime function return a fallback value so
the mtime check is then bypassed.

    # zipimport.py, _unmarshal_code
    source_mtime, source_size = \
        _get_mtime_and_size_of_source(self, fullpath)

    if source_mtime:  # if source_mtime is false, then the check is bypassed.
        # We don't use _bootstrap_external._validate_timestamp_pyc
        # to allow for a more lenient timestamp check.
        if (not _eq_mtime(_unpack_uint32(data[8:12]), source_mtime) or
                _unpack_uint32(data[12:16]) != source_size):
            _bootstrap._verbose_message(
                f'bytecode is stale for {fullname!r}')
            return None

Change my Windows time zone from GMT-7 to GMT-4. Set PYTHONVERBOSE and
PYTHONDEBUG to 1. Ran `hg init -h` and check its stderr. It prints:

  # bytecode is stale for 'edenscm.traceimport'

and alike before this change, and no longer after replacing the `__init__.py`
in the zip with the new version.

Reviewed By: DurhamG

Differential Revision: D28622287

fbshipit-source-id: bb3e8e378ea168e4f83f4b6aa9713103b2c90ef8
2021-05-24 09:36:37 -07:00
Johan Schuijt-Li
112008bf7a mononokepeer: fix error message
Summary:
Would previously fail with:
  AttributeError: 'timeout' object has no attribute 'message'

Reviewed By: mzr

Differential Revision: D28636534

fbshipit-source-id: 44df954b659cfbfbe0b468798e7eb5142478be67
2021-05-24 05:34:10 -07:00
Liubov Dmitrieva
9f3609ec51 implement omision of old public bookmarks
Summary:
don't apply an old public bookmark if the commit is older than max_sync_age

there is a complicated logic because we need to make sure if we later run it with different commitcloud.max_sync_age value or hg cloud sync --full the bookmarks will be appear back.

So, the changes required in both:

* checkomission
* _mergebookmarks

but both cases covered in the tests

also, if you run with max_sync_age=1000 and later max_sync_age=0, the bookmarks will not disappear, which is expected.

Reviewed By: markbt

Differential Revision: D28572875

fbshipit-source-id: 317e897a2b81c3371dbea7eb39b8925570c1d40a
2021-05-21 06:31:04 -07:00
Liubov Dmitrieva
6a4814e664 reduce output of omitted bookmarks
Summary:
this output is not noisy for big workspaces

if a head is omitted, don't warn about the bookmark because it is expected

Reviewed By: markbt

Differential Revision: D28568919

fbshipit-source-id: eb19e1d155f65de411c1dd41a8be6d83ca71c264
2021-05-21 06:31:04 -07:00
Liubov Dmitrieva
bf0dab696c reduce output for listing omitted heads and bookmarks
Summary:
The output is a bit too noisy for large workspaces.

We could skip older commits, we know the list coming ordered from commit cloud service.

All hashes are anyway available via `hg cloud sl`.

Also I fixed several look-ups in the list. Omittedheads are heavily used to check if something is present there.

Reviewed By: markbt

Differential Revision: D28568421

fbshipit-source-id: bcf62522798fed92df7ca546c73aa14da95f1567
2021-05-21 06:31:04 -07:00
Carolyn Busch
4e03bd4021 pull: use bookmark http api
Summary: Add config pull.httpbookmarks to use the edenapi http protocol to fetch bookmarks in the central local repo pull method. This impacts the pull command, as well as other commands that pull bookmarks.

Reviewed By: quark-zju

Differential Revision: D27479112

fbshipit-source-id: 2b9821f458ec0af2579143fb2c2ed7d3ff41878a
2021-05-20 17:28:51 -07:00
Johan Schuijt-Li
daf7eb2138 add decompression support for mononoke
Summary:
Support decompression for mononoke connections. When we request it, Mononoke
can support compression our stream, saving bandwith on low throughput
connections.

Reviewed By: StanislavGlebik

Differential Revision: D28535058

fbshipit-source-id: 7594f72978093a474efd168bb87b41c415310d6c
2021-05-20 10:22:56 -07:00
Jun Wu
6ce450753a commitcloud: add FakeCtx.mutable
Summary: It can be used by `cloud ssl` template after D28000088 (b506eeea0c).

Reviewed By: liubov-dmitrieva

Differential Revision: D28561180

fbshipit-source-id: fb4bf3de85f7c320c13a2a53c6a103e85ebb5425
2021-05-20 09:44:41 -07:00
Jun Wu
7001f0de8a debugchangelog: add ways to skip migrating from specified format
Summary:
This allows us to do staged rollout where some users are using "lazy" backend
and they won't be migrating down to "doublewrite" backend.

Reviewed By: liubov-dmitrieva

Differential Revision: D28554381

fbshipit-source-id: ebe2e25c96fd3b086a451c3909643d19c64a186c
2021-05-20 09:42:12 -07:00
Jun Wu
5f9559ad99 debugchangelog: migrate from lazy to lazy is not an error
Summary: Migrating from the lazy backend to lazy backend should be a no-op.

Reviewed By: liubov-dmitrieva

Differential Revision: D28554382

fbshipit-source-id: 71c06584f6f7a89096ce4a94843c88cbea542475
2021-05-20 09:42:12 -07:00
Liubov Dmitrieva
12c4a1bbb1 add a config option to show all bookmarks in output of hg cloud sl
Summary:
add a config option to show all bookmarks in output of `hg cloud sl`

by default local bookmarks pointing to public commits are not returned unless it's a public root of some draft stack

Reviewed By: markbt

Differential Revision: D28537657

fbshipit-source-id: 0287c18b1b6c79b271f8a67f604024086a37ffcf
2021-05-19 10:01:19 -07:00
Liubov Dmitrieva
9f9bcd2c70 check commit cloud workspace for removing irelevant branches
Summary: If you have checked out a shared workspace or other user workspace, this part of hg doctor could hide incorrectly, so, should be skipped.

Reviewed By: markbt

Differential Revision: D28505928

fbshipit-source-id: 65e1b3978a916fad2a33bb4f81ff1b75cd657567
2021-05-19 07:03:21 -07:00
Carolyn Busch
411ed7adf5 infinitepush: use bookmark http api
Summary: Fetch bookmarks via the http edenapi protocol in the bookmark command with the --list-remote option when all bookmark patterns are full bookmark names (not prefixes).

Reviewed By: kulshrax

Differential Revision: D27331526

fbshipit-source-id: 4f4eda255c551c9b55c6966569755f493335b458
2021-05-18 11:10:33 -07:00
Mark Juggurnauth-Thomas
5dafb7333f commitcloud: support --workspace-version in hg cloud sl --history
Summary:
The --workspace-version option is currently ignored by interactive history.
Allow it to be used to specify the initial version.  This makes jumping back to
a much older version easier.

Reviewed By: liubov-dmitrieva

Differential Revision: D28478194

fbshipit-source-id: f4f121d919e89c298677256f227f2e96d63ef644
2021-05-18 09:16:15 -07:00
Liubov Dmitrieva
add020c9f3 increase commit cloud history limit for 12 weeks by default
Summary: increase commit cloud history limit for 12 weeks by default

Reviewed By: markbt

Differential Revision: D28476878

fbshipit-source-id: d66d2bd672232932b698fece143eeac82d426886
2021-05-18 02:11:53 -07:00
Liubov Dmitrieva
4fb70336da add an option to show remote bookmarks in commit cloud smartlogs
Summary: if this option is enabled, the server will be asked to add them

Reviewed By: markbt

Differential Revision: D28412810

fbshipit-source-id: d1531ecf97615cdb5e32d72c8c31598e6a406956
2021-05-17 08:39:31 -07:00
Durham Goode
d88b999faf Allow conflict editor prompts during arc pull
Summary:
Mercurial has gotten stricter about respecting interactive vs
non-interactive commands lately, and now is failing to automatically open the
editor for conflicts during arc pull. Let's force Mercurial to treat the
invocation as an interactive one.

Reviewed By: skotchvail

Differential Revision: D28358999

fbshipit-source-id: 551713a78abfe170f04e8e55318af6e157bae7da
2021-05-13 09:40:57 -07:00
Andrey Chursin
b7ec4892d9 commitcloud: fix doctest
Summary: D28351849 (2c3edb0989) broke doctest, this diff attempts to fix it

Reviewed By: quark-zju

Differential Revision: D28392077

fbshipit-source-id: 7f1f7261d8996b2c808399954fc895eccc2c1c06
2021-05-12 18:21:10 -07:00
Ron Mordechai
77b7617d4b Add myparenttags
Summary: I use tags extensively and I love them to be supported as well.

Reviewed By: asm89

Differential Revision: D28348565

fbshipit-source-id: 7d94d048b734c91e7d74a1c3efeefc87943066ad
2021-05-12 08:20:53 -07:00
Liubov Dmitrieva
297ab79a2a split full sync into 3 passes
Summary:
split full sync into 3 steps

Commit cloud by default pulls only 30 days of commits.

Users often see some of their commits are missing in their smartlog.

I discovered that most of the users know the '--full' option (`hg cloud sync --full`) but not the 'max_sync_age' config option.

So, they try --full option but it could fail due to very very old commits we haven't migrated to Mononoke.

Users often don't really need those commits but it's not nice that the whole sync run failed.

We know that at least latest 2 years of commits are present in Mononoke.

So if we split a bit how we sync with --full option works, it would at least result in partially successfully sync for the latest 2/3 years of commits.

Reviewed By: mitrandir77

Differential Revision: D28352355

fbshipit-source-id: b5bacd7d5256191528613e3c0bcbb21b0104ac3c
2021-05-11 14:00:16 -07:00
Liubov Dmitrieva
2c3edb0989 deprecate 4 commits at a time limitation for unhydrated pulls
Summary:
deprecate 4 commits at a time limitation for unhydrated pulls

This could speedify cloud join commands significantly (by many X times) and hg cloud sync --full command.

Reviewed By: farnz

Differential Revision: D28351849

fbshipit-source-id: f9f3d7a5c07d61cb51a5bb6284afaad963662c94
2021-05-11 12:40:39 -07:00
CodemodService Bot
0462f803c0 Daily arc lint --take BLACK
Reviewed By: zertosh

Differential Revision: D28282435

fbshipit-source-id: 26037c582a35a958702b5d9f5c371e19664ba3c6
2021-05-07 05:16:05 -07:00
Marc Fisher
9bdd73be2c Add stables template keyword to hg.
Summary:
Adding support for the stables template keyword in stablerev extension.

This keyword calls out to a script specified in the config stablerev.stables_cmd to get a list of stable aliases for a given revision.

Reviewed By: quark-zju

Differential Revision: D28204529

fbshipit-source-id: 3c5b21846ce6f686afddd00d3326a54b85be87dd
2021-05-06 23:52:32 -07:00
Thomas Orozco
ea8332c47d mononokepeer: increment mononoke_read_bytes on read()
Summary:
We were only incrementing this on `readline`, which resulted in very low
numbers. While in there, I also removed `self._totalbytes` as that was unused.

Reviewed By: johansglock

Differential Revision: D28260141

fbshipit-source-id: 6d9008f9342adaf75eecc8ed8c872f64212cd1f7
2021-05-06 13:41:52 -07:00
Jun Wu
f36574ef0f test-eager-exchange: test treemanifest reading
Summary:
Add a subtree to exercise treemanifest logic. Blobs in EagerRepo are verified
so we need to disable flatcompat.

Reviewed By: DurhamG

Differential Revision: D28006550

fbshipit-source-id: ac7157a9c01ed99f703601613fb3cf06add69003
2021-05-06 12:13:17 -07:00
Jun Wu
b6d24fc969 eagerepo: support "test:name" repo URLs
Summary: This makes it easier to use it in tests.

Reviewed By: DurhamG

Differential Revision: D28006549

fbshipit-source-id: 90e29b220453a3d7a260d0a62d697d64363d9a6c
2021-05-06 12:13:17 -07:00
Jun Wu
d9b901b22c extensions: always enable remotefilelog
Summary:
This makes it easier to get rid of revlog stores.

`debugindexdot` is no longer supported since it reads revlogs.
Two tests use flat manifest bundles. They are no longer supported
due to remotefilelog today has some assumptions that treemanifest
extension is also being used.

Reviewed By: DurhamG

Differential Revision: D27971126

fbshipit-source-id: fdb992a8d72bbcf562b5cb95b3f29051dd1c9464
2021-05-06 12:13:17 -07:00
Jun Wu
6763719506 eagerpeer: add clone support
Summary:
Add clone endpoint so we can clone from an eager test repo.

Note: the master group is empty and "cloneata" does not quite work yet due to
EagerRepo not writing to the master group. It will be fixed later.

Reviewed By: DurhamG

Differential Revision: D27971121

fbshipit-source-id: 0cc35136c6987673c2c4fbbd892c344c3586fcb7
2021-05-06 12:13:17 -07:00
Johan Schuijt-Li
e57f819b6e rage/debug output for schemes
Summary:
Add debug output to rage to make sure we have the relevant information in case
we need to debug issues with schemes.

Reviewed By: quark-zju

Differential Revision: D28222910

fbshipit-source-id: 9499c736d61b2c0e4568e05a3afc0ae9730acedf
2021-05-06 04:39:19 -07:00
Johan Schuijt-Li
c120560edf integrate hgext schemes into fb mercurial
Reviewed By: liubov-dmitrieva

Differential Revision: D28185505

fbshipit-source-id: 1eed74bf492c5f22abb7d616b9492eb2a549aead
2021-05-06 04:39:19 -07:00
Johan Schuijt-Li
395d04cecc import schemes hgext
Summary:
Import from upstream:
https://www.mercurial-scm.org/repo/hg/file/tip/hgext/schemes.py

at revision 47060:fde5bb5d1acf

Reviewed By: mitrandir77

Differential Revision: D28185506

fbshipit-source-id: 651398fb76adf0e05fcd22afd8f39e8f941919d5
2021-05-06 04:39:19 -07:00
Jun Wu
2cf4957de0 runtests: expand $TESTTMP in hgrc
Summary:
This makes it easier to use `--keep` to investigate tests by using
`--configfile`.

Reviewed By: kulshrax

Differential Revision: D27971122

fbshipit-source-id: 8adcbeab825155858499c24ca74c2979049adeda
2021-05-05 17:53:39 -07:00
Jun Wu
f347dc94f9 remotefilelog: do not use f strings
Summary: The syntax is not supported by Python 2.

Reviewed By: DurhamG

Differential Revision: D28233280

fbshipit-source-id: 9f882827b1357cb339e60180acadb38842c3cf8d
2021-05-05 13:30:11 -07:00
Jun Wu
2e07267f2d remotefilelog: do not use **kwargs,
Summary: The syntax is not supported by Python 2.

Reviewed By: DurhamG

Differential Revision: D28232995

fbshipit-source-id: 62058751b4f00b78a2bd56908100a7bb7a3adfde
2021-05-05 13:22:30 -07:00
Jun Wu
60e240b17e eagerepo: fix Windows compatibility
Summary: Windows path like `eagerepo:///C:\foo\bar` needs special handling.

Reviewed By: kulshrax

Differential Revision: D27971119

fbshipit-source-id: 9d4b87782eca2734b708565f0ee22a7495253cff
2021-05-05 12:01:50 -07:00
Genevieve Helsel
100fccc193 retire hg gc
Summary: `hg gc` does not do anything anymore, so in order to reduce confusion, let's just print a message that says it is no longer supported and provide a manual remediation.

Reviewed By: xavierd

Differential Revision: D28164614

fbshipit-source-id: 7ed2392cdb0091cd604a15b4c2382632706981f2
2021-05-05 11:48:58 -07:00
Jun Wu
c793852fba treemanifest: do not bundle trees present on server
Summary:
This avoids issues where the tree is stored without p1, p2. It is similar to
what we do for public commits (in createtreepackpart):

  if sendtrees == shallowbundle.AllTrees or ctx.phase() != phases.public:
      ...

Note: the trees API actually provides p1, p2, but p1, p2 are dropped when
writing to the current data store implementation.

Reviewed By: liubov-dmitrieva

Differential Revision: D28200388

fbshipit-source-id: e1fe93d8ae8576e691077d6db432d55f7b9d498d
2021-05-05 09:48:29 -07:00
Jun Wu
e687a92d10 pyedenapi: rename trees to storetrees
Summary:
The `trees` API is coupled with a store. We're going to add another API that is
not coupled with a store so let's rename `trees` to `storetrees`.

Reviewed By: liubov-dmitrieva

Differential Revision: D28200389

fbshipit-source-id: 826116f0b461873b2f5df07e7fd35e6d1018f929
2021-05-05 09:48:29 -07:00
Liubov Dmitrieva
b506eeea0c do not perform syncing for public commits
Summary: we display incorrectly 'local changes' for public commits

Reviewed By: DurhamG

Differential Revision: D28000088

fbshipit-source-id: 81bb8926dd7e96bf283eabe2b0aca84a9155fea3
2021-05-05 02:48:19 -07:00
Liubov Dmitrieva
f74c212472 remove dead code
Summary: the option has been deprecated and is not used anywhere

Reviewed By: krallin

Differential Revision: D28191314

fbshipit-source-id: f5f092b93a9644c8249628520d8d707b60854aac
2021-05-05 02:45:45 -07:00
Durham Goode
27d58bbd42 configs: delete applydynamicconfig
Summary: This is no longer used.

Reviewed By: quark-zju

Differential Revision: D26676518

fbshipit-source-id: 1cc9c32e2a95d6db78160f33ab5423338ea82e04
2021-05-04 22:18:55 -07:00
John Reese
9fd86a4fae apply upgraded black 21.4b2 formatting to fbsource
Summary:
This applies the formatting changes from black v21.4b2 to all covered
projects in fbsource. Most changes are to single line docstrings, as black
will now remove leading and trailing whitespace to match PEP8. Any other
formatting changes are likely due to files that landed without formatting,
or files that previously triggered errors in black.

Any changes to code should be AST identical. Any test failures are likely
due to bad tests, or testing against the output of pyfmt.

Reviewed By: thatch

Differential Revision: D28204910

fbshipit-source-id: 804725bcd14f763e90c5ddff1d0418117c15809a
2021-05-04 22:16:51 -07:00
Jun Wu
fa7ba86bad exchange: skip pull phase if narrow-heads is on
Summary: We skip it in other places but missed this one. Skip it too.

Reviewed By: kulshrax

Differential Revision: D27957853

fbshipit-source-id: 429d25e8b692218c9bae6c10ad76d08495a4bc66
2021-05-04 18:28:45 -07:00
Jun Wu
ae81c8fd34 edenapi: force use edenapi if ui.ssh is false
Summary: If ui.ssh is "false", then ssh cannot be used at all. Force using edenapi.

Reviewed By: kulshrax

Differential Revision: D27957312

fbshipit-source-id: 9860344779e6a6bab557d3f953ee38e40fadb78b
2021-05-04 18:28:45 -07:00
Jun Wu
66c0778db7 treemanifest: enable useruststore by default
Summary: It has been enabled for a long time in our production config.

Reviewed By: kulshrax

Differential Revision: D27953636

fbshipit-source-id: 428f6e8a3e7eae6d44c61970624a75d7d1ab3e36
2021-05-04 18:28:45 -07:00
Jun Wu
37404e7f64 treemanifest: enable ondemandfetch by default
Summary: It has been enabled for a long time in our production config.

Reviewed By: kulshrax

Differential Revision: D27953635

fbshipit-source-id: a351342fbc8cffccd16967bd0e7032ac3e4f35cf
2021-05-04 17:00:56 -07:00
Jun Wu
49e8c82d07 exchange: pull from EagerRepo without getbundle
Summary:
Add "getbundle" alternative "commitgraph" for pulling from a EagerRepo.
This avoids tech-debt like bundle2 or linkrev. It depends on a lazy
(text) changelog backend.

Reviewed By: kulshrax

Differential Revision: D27951620

fbshipit-source-id: f21119d37da6505e68c6c5f3b33b9bd1f65e4d9a
2021-05-04 17:00:56 -07:00
Jun Wu
199fba304a changelog2: allow migrating to lazy backend from an empty repo
Summary: It's okay to migrate to any backend if the repo is empty.

Reviewed By: kulshrax

Differential Revision: D27951626

fbshipit-source-id: 27c00c853bf73fa3c696d74f3c05eb620f35db0e
2021-05-04 17:00:56 -07:00
Jun Wu
494309f22a exchange: push to EagerRepo without unbundle
Summary:
Add "unbundle" alternative "addblobs" for pushing to a EagerRepo.
This avoids tech-debt like bundle2 and linkrev.

Reviewed By: kulshrax

Differential Revision: D27951628

fbshipit-source-id: 3315e0653ee12928993e4e9325fbe8e2c369307b
2021-05-04 17:00:56 -07:00
Jun Wu
abe4222df9 eagerepo: move url handling to Rust
Summary: So that we don't duplicate the URL handling in Python.

Reviewed By: andll

Differential Revision: D28006552

fbshipit-source-id: 2efda622fe86787373fa4ec5978537588defec28
2021-05-04 17:00:55 -07:00
Jun Wu
917e8f3e67 eagerpeer: add a new peer type backed by EagerRepo
Summary:
`peer` is the interface in hg to support push/pull. Implement it for EagerRepo.
Note: `getbundle` and `unbundle` are not implemented yet. Push / Pull are not
working yet. They will be made work later.

Reviewed By: kulshrax

Differential Revision: D27951621

fbshipit-source-id: 71f9c26713a532a0712460fa2aa34125b2b67e35
2021-05-04 17:00:55 -07:00
Pyre Bot Jr
99f17e57ed suppress errors in fbcode/eden - batch 1
Differential Revision: D28190108

fbshipit-source-id: 6d67de1cb21f6ec4400adae2f42811f1f3e5d155
2021-05-04 15:25:14 -07:00
Jun Wu
4c5d7c2123 ui: normalize foo://path to foo:path when finding name for url
Summary: This will affect upcoming changes.

Reviewed By: kulshrax

Differential Revision: D27951629

fbshipit-source-id: e1b24c187424962eb1f0e6c81370eca264eaa20a
2021-05-03 13:21:08 -07:00
Jun Wu
f31f5ebcd5 commands: update help text of log
Summary: It has been wrong since 2014 (tweakdefault).

Reviewed By: kulshrax

Differential Revision: D28122703

fbshipit-source-id: c83ddbac2c6162e36672649c60c2e7916dc7cbd2
2021-04-30 15:13:21 -07:00
Andrey Chursin
dd5909abe8 checkout: read native checkout concurrency from config
Summary:
This diff makes concurrency of native checkout to be configurable
This config can be used to reduce concurrency on platforms that are known to cause issues with watchman due to too many checkout operations

Reviewed By: quark-zju

Differential Revision: D28074993

fbshipit-source-id: 0a09fcf3ae48d08cead36da56c06b546aecd16b4
2021-04-30 13:04:57 -07:00
Jun Wu
d3de89f62c changelog: do not consider integers revs for shortest
Summary:
After D27144492 (48cd15ab14) we disabled revision number resolution. There is no need to
consider it when calculating shortest prefix.

Reviewed By: DurhamG

Differential Revision: D28072997

fbshipit-source-id: 832017c7b626265eb8cd2dd78946a03c4e7228f6
2021-04-29 13:39:31 -07:00
Jun Wu
9bf34fe364 remotenames: pass list to pushop.remote.known
Summary:
The "known" API is expected to accept a list with ordering guarantees.
Avoid passing `set` to it. This also stabilizes debug outputs in (upcoming)
tests.

Update `setdiscovery` to pass a list with stable order too.

Reviewed By: kulshrax

Differential Revision: D27951627

fbshipit-source-id: a2718e4380f80584fc8afc35d14e524ab428f9bd
2021-04-28 12:28:28 -07:00
Andrey Chursin
11eb0eb74e debugdryup: handle sparse profiles
Summary: This makes use of plan calculation logic in merge.py

Reviewed By: quark-zju

Differential Revision: D28045174

fbshipit-source-id: f2bfd1104ba2d010c2b911aa6c643b057e4cb91d
2021-04-28 12:26:08 -07:00
Andrey Chursin
9e05b5f6f2 checkout: factor out plan calculation in merge.py
Summary: This factors out native checkout plan calculation (including handling sparse profiles) into separate fn

Reviewed By: quark-zju

Differential Revision: D28045175

fbshipit-source-id: cd034b2c335496e5e2c6994795dd5c40d3388238
2021-04-28 12:26:08 -07:00
Johan Schuijt-Li
c66bd43f3f allow auth_proxy settings to come from local
Summary: Ensure these settings are available in mononokepeer.

Reviewed By: mitrandir77

Differential Revision: D28061520

fbshipit-source-id: 68cbe9f427d4a1528a4c9968b3f1f9dcd2541004
2021-04-28 12:12:47 -07:00
Andrey Chursin
9c0304b1e1 checkout: introduce debugdryup command
Summary:
This command executes native checkout dry run code for updating between specificed revisions
Command tests network and storage perf, without actually affecting working copy

Examples of usages:
1) User reports that when updating between revisions multiple times, they see unexpected fetches, even though they expected that all data should already be in cache. Running this command shows that update between those revs fetches more data then a cache size, so repating fetches are not a surprise

2) People working on storage/network layer optimizations can utilize this command to test performance without messing with their working copy

This command understands nativecheckout.usescmstore config, same way it is used in actual native checkout

Differential Revision: D28040641

fbshipit-source-id: e5454f3110ade11f3227d6adc804a22176f530b9
2021-04-28 02:14:44 -07:00
Andrey Chursin
735da3f688 util: introduce util.formattime
Summary: This fn can be use to format time using human readable units.

Differential Revision: D28042138

fbshipit-source-id: 8b1eb6fa892754ee1008b529477fd555bd41c692
2021-04-28 02:14:44 -07:00
Andrey Chursin
3d01cbc5d9 checkout: use native checkout on dirty copy
Summary: For now this does not work with --clean flag(fallback to regular checkout in that case)

Reviewed By: quark-zju

Differential Revision: D27953967

fbshipit-source-id: 71c097cf1e395ff2cba2f4ee528145d3b2c83c23
2021-04-27 13:33:25 -07:00
Andrey Chursin
3a0ed3f7ab checkout: separate native checkout code in merge.py into separate function
Reviewed By: quark-zju

Differential Revision: D27953968

fbshipit-source-id: 0bc80f0851d02795a02cc24344d878e4d4a6400c
2021-04-27 13:33:25 -07:00
Jun Wu
ad6b424474 config: enable selectivepull by default
Summary:
It turns out during the initial clone, we're not using selectivepull for some
tiers that do not have the non-repo selectivepull config.

We've been using selectivepull for devservers and corp (and it's effective
during clone) for a long time. Let's just enable it by default so even if
dynamicconfig does not set it properly, we can still use selectivepull clone
to avoid pulling 10k+ remote bookmarks (which triggers auto bookmark cleanups
as logged in hgfeatures).

There are too many incompatible tests so I'm not migrating them for now.

Reviewed By: DurhamG

Differential Revision: D28006488

fbshipit-source-id: f0dc000156abde530fd8881bd26b4642a36167be
2021-04-27 10:10:07 -07:00
CodemodService Bot
da5ae9e8f4 Daily arc lint --take BLACK
Reviewed By: zertosh

Differential Revision: D28024201

fbshipit-source-id: 8b9d7978c82f8a6c39eb7d9875ab86d0d9404793
2021-04-27 03:58:23 -07:00
Jun Wu
f09500ec1f scmutil: handle int in revrange correctly
Summary:
It's rare (only seem to be used by chistedit) but if revrange got an int, the
expected behavior is to treat it as a revision number.

Reviewed By: kulshrax

Differential Revision: D27983989

fbshipit-source-id: f9f8d9cb39af4ec1de7ed8ca69f7f1879b4a4614
2021-04-26 17:42:43 -07:00
Durham Goode
a77f847eab clone: add UX to hint for users to use 'hg checkout --continue'
Summary:
Adds a message for users to use 'hg checkout --continue' if there's a
.hg/updatestate file (indicating an aborted checkout) and if they're on the null
rev (indicating they likely just cloned).

Also adds support for 'hg checkout --continue' to work with non-merge commits.
Note, it really only currently works when checking out from null, since
otherwise there will be a lot of modified files in the way. Once native checkout
is more mature, we can teach it to ignore modified files that match the desired
checkout destination.

Reviewed By: quark-zju

Differential Revision: D26967976

fbshipit-source-id: 7397c5fe82027e22bf1b4db0f14bb180239fae25
2021-04-26 16:49:53 -07:00
Durham Goode
02d29166bb checkout: move VFS to live on CheckoutPlan
Summary:
Every function on CheckoutPlan required the VFS already, and the
CheckoutProgress is storing the VFS and living on the CheckoutPlan, so it makes
sense to just store the VFS on the CheckoutPlan.

Reviewed By: andll

Differential Revision: D27825088

fbshipit-source-id: 3d063fdfd1a50983b60d00a3992a893e71732f94
2021-04-26 16:49:53 -07:00
Durham Goode
0d4ac034ed checkout: move CheckoutProgress onto CheckoutPlan
Summary:
Now that CheckoutPlan can look for untracked files, it breaks the
ability to continue a checkout since those untracked files are considered dirty.
In a later diff we'll use the CheckoutProgress to inspect the dirty files and
determine which are actually dirty and which can be overwritten. To do so
though, we need access to the CheckoutProgress earlier. So let's just store it
on the CheckoutPlan.

This is a little awkward because we're passing the root VFS to the constructor
so CheckoutProgress can be instantiated, but then also passing it to every
CheckoutPlan function as well. We should probably just store the vfs on the
CheckoutPlan. If others agree, I can make a diff to do that.

Reviewed By: andll

Differential Revision: D27804720

fbshipit-source-id: e819c27fa8580c82a8cf8f0baf22ac1ea707ee54
2021-04-26 16:49:53 -07:00
Durham Goode
d7e46dd195 py3: fix Windows interactive subprocess launching
Summary:
Python on Windows has a couple bugs around passing stdin/out/err to
subprocesses. In Python 2 we patched our Python to fix one of the bugs. With
Python 3 we're using the vanilla Python distribution, so we'd rather not patch
it.

Instead, let's fix it by passing stdin/out/err explicitly.

See D15764537 (b8c747b6d5) for the details of the bug.

Reviewed By: kulshrax

Differential Revision: D28010523

fbshipit-source-id: d88f789a8100b04da996271de7dfe566c0f715df
2021-04-26 16:33:25 -07:00
Durham Goode
ce9d5a2f0f py3: fix conflict resolution case handling
Summary: In python 3 these strings are already unicode, so let's just .upper() them. Otherwise it crashes with 'no decode() on str'. This only impacts eden checkouts, since non-eden uses treestate which doesn't use this codepath.

Reviewed By: quark-zju

Differential Revision: D27978369

fbshipit-source-id: a298c1b455fdb8aa09db0ac667bd97b8e419bbe8
2021-04-23 18:04:11 -07:00
Durham Goode
423e5ee12d commitcloud: don't crash pull if there are no commitcloud certs
Summary:
During pull, commitcloud may try to auto join a cloud workspace. If
there are no certs, the join will fail and will cause the overall pull to exit
non-zero. Let's just print a warning instead and allow the pull to succeed.

Reviewed By: sfilipco

Differential Revision: D27928397

fbshipit-source-id: 432ee589438bb5af9f47f7aaa735bbbb5a17ad6b
2021-04-23 17:01:21 -07:00
Andrey Chursin
e81ae0f900 vfs: add VFS::case_sensitive
Summary: This diff adds flag to VFS to detect whether FS is case sensitive. The logic in this code losely follows similar logic in Python

Reviewed By: quark-zju

Differential Revision: D27926952

fbshipit-source-id: 36fdf4187ae513b25346f704050c64f9a1a4ec74
2021-04-22 15:56:49 -07:00
Andrey Chursin
b2db768f21 rebase: try resolving conflicts with 3-way text merge during native rebase
Summary:
This handles large chunk of cases where tree merge returns conflict, but the conflict can be trivialy resolved by textual merge.
No markers are left in file, if merge yields conflicts we simple abort to on-disk merge, same as with existing code

Reviewed By: quark-zju

Differential Revision: D27752771

fbshipit-source-id: ff8d4bbc88b48812150327cae6e31991a30236c9
2021-04-22 10:18:24 -07:00
Andrey Chursin
320119ac2f rebase: bypass merge.py for in-memory rebase
Summary:
This diff modifies rebase flow(based on config) and attempts to create commit wihthout using merge.py:update

This currently passes some test cases, but not all.
This implementaiton currently does not attempt to resolve conflicts and fallbacks to on-disk merge if they are encountered.
This fails some test cases, because they expect some trivial conflicts to be resolved by in-memory merge.

There are also certain rebase flags that currently are not handled

Reviewed By: DurhamG

Differential Revision: D27639394

fbshipit-source-id: d8f71e955930e3a8a64d7d95a0cf184d9b4ccadc
2021-04-22 10:18:24 -07:00
Liubov Dmitrieva
e5b00fae7a disable phases exchange if narrow heads is enabled
Summary:
phases calculation could be expensive on the server and it should be a perf win to disable it if not needed

It shouldn't be needed if narrow heads are enabled

Reviewed By: quark-zju

Differential Revision: D27908691

fbshipit-source-id: 7000fb23f9332d58c2c488ffbef14d73af4ac532
2021-04-22 05:26:10 -07:00
Jun Wu
d1413bbbad clone: add an emergency clone mode
Summary:
In case the Mononoke server cannot provide the commit graph, and we need to
checkout and push changes. Let's add an emergency mode where the commit graph
only contains a single commit: master.

This can be used using `--config unsafe.emergency-clone=1`:

  ~/hg % lhg clone --shallow -U mononoke://mononoke.internal.tfbnw.net/fbsource ~/tmp/c1 --config unsafe.emergency-clone=1 --configfile /data/users/quark/.eden-backing-repos/fbs-lazy/.hg/hgrc.dynamic
  connected to <remote host> session yyvXqQlHnMYQMEfw
  warning: cloning as emergency commit+push use-case only! accessing older commits is broken!
  resolving master
  connected to <remote host> session ODc4PPiJ21L6r4Sn
  added master: 248bd246f4467a2d4d0cacc09c5e55131ada9919
  warning: this repo was cloned for emergency commit+push use-case only! accessing older commits is broken!

Smartlog:

  ~/hg % cd ~/tmp/c1
  ~/tmp/c1 % lhg sl
  warning: this repo was cloned for emergency commit+push use-case only! accessing older commits is broken!
  o  248bd246f  25 seconds ago  remote/master

Pull:

  ~/tmp/c1 % lhg pull
  warning: this repo was cloned for emergency commit+push use-case only! accessing older commits is broken!
  pulling from ssh://hg.vip.facebook.com//data/scm/fbsource?stage1_read
  connected to twshared1103.03.prn6.facebook.com session L4sDKzLm093aLUbo
  searching for changes
  adding commits
  adding manifests
  adding file changes
  added 8 commits with 0 changes to 0 files

Checkout:

  ~/tmp/c1 % lhg sparse include .gitignore
  warning: this repo was cloned for emergency commit+push use-case only! accessing older commits is broken!
  ~/tmp/c1 % lhg up master
  warning: this repo was cloned for emergency commit+push use-case only! accessing older commits is broken!
  19 files updated, 0 files merged, 0 files removed, 0 files unresolved

Commit:

  ~/tmp/c1 % vim .gitignore
  ~/tmp/c1 % lhg c -m gitignorewarning: this repo was cloned for emergency commit+push use-case only! accessing older commits is broken!

Smartlog:

  ~/tmp/c1 % lhg sl
  warning: this repo was cloned for emergency commit+push use-case only! accessing older commits is broken!
    @  cc43f0e5b (Backup pending)  4 seconds ago  quark
  ╭─╯  gitignore
  │
  o  10ef2879e  5 minutes ago  remote/master
  │
  ~

Reviewed By: andll

Differential Revision: D27897892

fbshipit-source-id: f1770482455968dac217c9c6ee34ec0a20e5f432
2021-04-21 19:30:15 -07:00
Jun Wu
2d06b826c1 clone: log reasons we use legacy clone code path
Summary:
I found that there are still lots of (automation) users use the legacy clone
code path but it's unclear why (not having selectivepull?). Let's log the
reasons why the legacy path is used.

Reviewed By: sfilipco

Differential Revision: D27913616

fbshipit-source-id: b83f15e42a4afa94164b68bc9a91b4f0c022260c
2021-04-21 19:30:15 -07:00
Jun Wu
0973a82e2f config: drop experimental.new-clone-path
Summary: The config is True everywhere for a long time.

Reviewed By: sfilipco

Differential Revision: D27913615

fbshipit-source-id: f2af34323c38f11db6bf3137652adea0bf38e858
2021-04-21 19:30:15 -07:00
Jun Wu
185a057eb0 remotefilelog: move edenapi to localrepo
Summary:
Non-remotefilelog logic might want to use edenapi too. So let's move it to
core.

It might make sense to make the `None` case an explicit error saying
`edenapi.url` is not set. For now I just keep it for compatibility.

The edenapi module is added so one can construct the edenapi client
without using a repo.

Reviewed By: kulshrax

Differential Revision: D27897889

fbshipit-source-id: 2a1fdf4c68464873f294ac1423d2348c1e526d5f
2021-04-21 19:30:15 -07:00
Jun Wu
cbd6366e9a clienttelemetry: move correlator to ui
Summary:
Expose the correlator to core. This also reduces the lifetime of correlator
from global (process lifetime) to ui (dispatch.request/command), which
makes more sense and is more compatible with a multi-command per
process world (not using it by default yet).

This is needed to move edenapi to core.

Reviewed By: kulshrax

Differential Revision: D27897891

fbshipit-source-id: 7bd7e422c15e09a82e726436f92d4315ae876d94
2021-04-21 19:30:15 -07:00
Jun Wu
dcb7775096 changelog: remove Python zstore support
Summary:
The zstore for commit messages are now handled by Rust entirely. There is no
need to keep the Python zstore around, except for migration and doctor
use-cases.

Reviewed By: andll

Differential Revision: D27897893

fbshipit-source-id: 21b10596af28c45425f6f102fd13f0421d1e8373
2021-04-21 19:30:15 -07:00
Jun Wu
86f08f9ab8 clone: rename shallowclone to revlogclone
Summary:
The `shallowclone` method uses (legacy) revlog. We'll add more APIs that clone
in different ways but all of them use "shallow" (or remotefilelog).  Name it to
clarify.

Reviewed By: andll

Differential Revision: D27897890

fbshipit-source-id: 2397a9621d3b207c394c995dff54deda4016e6fa
2021-04-21 18:40:03 -07:00
Jun Wu
fe816910b1 changelog: optionally record tracebacks of rev and node
Summary:
This will be used to figure out suboptimal fetches.

For example, `EDENSCM_LOG=edenscm::mercurial=trace lhg log archival.py`:

  Callsites for node:
   118 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4214 > streams:28 > util:4985 > smartset:101,1059 > dagop:131,150,160 > context:809 > util:984 > remotefilectx:471,471,288,98
   113 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4214 > streams:28 > util:4985 > smartset:102,1059 > localrepo:1189 > context:405
   4 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4234 > cmdutil:1923 > extensions:569 > smartlog:82 > cmdutil:2252 > templatefilters:422 > util:1078 > templater:414,1034,362,479,1506,1506,1507 > templatefilters:405 > templater:463,362,479 > templatekw:860 > context:590,226 > localrepo:96 > scmutil:1207 > localrepo:1061 > phases:347,332,212 > localrepo:2805
   1 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4183 > cmdutil:2969 > localrepo:1257 > revset:1271,363,106,2824 > fastlog:224 > revset:1254,1254 > context:982 > remotefilectx:471,471,288,173
   1 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4234 > cmdutil:1923 > extensions:569 > smartlog:82 > cmdutil:2252 > templatefilters:422 > util:1078 > templater:414,1034,362,479,1506,1506,1507 > templatefilters:405 > templater:463,362,479 > templatekw:860 > context:590,226 > localrepo:96 > scmutil:1207 > localrepo:1061 > phases:346,332,212 > localrepo:2805

  Callsites for rev:
   118 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4214 > streams:28 > util:4985 > smartset:101,1059 > dagop:131,150,160 > context:809 > util:984 > remotefilectx:100
   113 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4214 > streams:28 > util:4985 > smartset:1061 > context:92,205
   113 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4217 > context:92,205
   113 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4234 > cmdutil:1923 > extensions:569 > smartlog:82 > cmdutil:2252 > templatefilters:422 > util:1078 > templater:414,1034,362,479,1506,1506,1507 > templatefilters:405 > templater:463,362,479 > templatekw:860 > context:92,590,226
   113 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4234 > cmdutil:1923 > extensions:569 > smartlog:82 > cmdutil:2252 > templatefilters:422 > util:1078 > templater:463,362,367,395,426,927,1506,1507,1506,1507,1506,1507 > templatekw:872 > scmutil:518 > context:92,205
   113 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4234 > cmdutil:1924 > context:92,205
   113 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4236 > cmdutil:1898 > context:92,205
   2 blackbox:184 > context:257 > util:984 > context:1632 > dirstate:393 > localrepo:1177
   2 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4234 > cmdutil:1923 > extensions:569 > smartlog:82 > cmdutil:2252 > templatefilters:422 > util:1078 > templater:414,1034,362,479,1506,1506,1507 > templatefilters:405 > templater:463,362,479 > templatekw:860 > context:590,226 > localrepo:96 > scmutil:1207 > localrepo:1061 > phases:346,332,212 > localrepo:2738,2778,2789,2804 > dirstate:393 > localrepo:1177
   2 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4234 > cmdutil:1923 > extensions:569 > smartlog:82 > cmdutil:2252 > templatefilters:422 > util:1078 > templater:414,1034,362,479,1506,1506,1507 > templatefilters:405 > templater:463,362,479 > templatekw:860 > context:590,226 > localrepo:96 > scmutil:1207 > localrepo:1061 > phases:347,332,212 > localrepo:2738,2778,2789,2804 > dirstate:393 > localrepo:1177
   2 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4234 > cmdutil:1923 > extensions:569 > smartlog:82 > cmdutil:2252 > templatefilters:422 > util:1078 > templater:414,1034,362,479,1506,1506,1507 > templatefilters:405 > templater:463,362,479 > templatekw:860 > context:590,226 > localrepo:96 > scmutil:1207 > localrepo:1061 > phases:347,332,212 > localrepo:2746,2778,2789,2804 > dirstate:393 > localrepo:1177
   1 blackbox:184 > context:257 > util:984 > context:414,1635 > dirstate:397 > localrepo:1177
   1 blackbox:184 > context:257 > util:984 > context:417,1635 > dirstate:397 > localrepo:1177
   1 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4183 > cmdutil:2791,2960 > context:1624 > dirstate:372 > eden_dirstate_map:125,111 > localrepo:1189 > context:417 > dirstate:397 > localrepo:1177
   1 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4183 > cmdutil:2957 > sparse:463 > cmdutil:2899 > dirstate:397 > localrepo:1177
   1 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4183 > cmdutil:2957 > sparse:463 > cmdutil:2902 > localrepo:1257 > revset:194,106,223,106,2203,362,106,2824 > localrepo:1189 > context:417 > dirstate:397 > localrepo:1177
   1 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4183 > cmdutil:2957 > sparse:463 > cmdutil:2902 > localrepo:1257 > revset:194,106,223,106,2203,362,106,2824 > scmutil:518 > context:92,205
   1 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4183 > cmdutil:2969 > localrepo:1257 > revset:1271,363,106,2824 > fastlog:182 > context:92,205
   1 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4183 > cmdutil:2969 > localrepo:1257 > revset:1271,363,106,2824 > fastlog:182 > localrepo:1189 > context:417 > dirstate:397 > localrepo:1177
   1 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4183 > cmdutil:2969 > localrepo:1257 > revset:1271,363,106,2824 > fastlog:224 > revset:1232 > localrepo:1189 > context:417 > dirstate:397 > localrepo:1177
   1 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4183 > cmdutil:2969 > localrepo:1257 > revset:1271,363,106,2824 > fastlog:224 > revset:1254,1254 > context:982 > remotefilectx:170 > context:809 > util:984 > remotefilectx:93 > context:92,205
   1 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4183 > cmdutil:2969 > localrepo:1257 > revset:1271,363,106,2824 > fastlog:224 > revset:1254,1254 > context:982 > remotefilectx:175
   1 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4234 > cmdutil:1923 > extensions:569 > smartlog:82 > cmdutil:2252 > templatefilters:422 > util:1078 > templater:1162,1176,362,367,918,1506,1507,1506,1507,1506,1507 > revset:2730,2778,2738 > localrepo:1189,1199 > context:417 > dirstate:397 > localrepo:1177
   1 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4234 > cmdutil:1923 > extensions:569 > smartlog:82 > cmdutil:2252 > templatefilters:422 > util:1078 > templater:1162,1176,362,367,918,1506,1507,1506,1507,1506,1507 > revset:2761,2738 > revsetlang:513,576 > parser:39,90 > revsetlang:99,99 > localrepo:1189,1199 > context:417 > dirstate:397 > localrepo:1177
   1 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4234 > cmdutil:1923 > extensions:569 > smartlog:82 > cmdutil:2252 > templatefilters:422 > util:1078 > templater:1165,1176,362,367,918,1506,1507,1506,1507,1506,1507 > revset:194,106,2824 > localrepo:1189 > context:417 > dirstate:397 > localrepo:1177
   1 remotenames:629 > tweakdefaults:648 > remotefilelog:890 > commands:4234 > cmdutil:1923 > extensions:569 > smartlog:82 > cmdutil:2252 > templatefilters:422 > util:1078 > templater:1165,1176,362,367,918,1506,1507,1506,1507,1506,1507 > revset:194,106,2824 > scmutil:518 > context:92,205

Reviewed By: andll

Differential Revision: D27867671

fbshipit-source-id: d85c41c7335850eb6114413c63187e673a13c214
2021-04-21 09:41:31 -07:00
Jun Wu
9cd55d6a53 util: add recordcallsites
Summary: Added an API to record Python tracebacks to figure out 1-by-1 fetches.

Reviewed By: andll

Differential Revision: D27867670

fbshipit-source-id: d6941dd385db6eb2f810d97815056b660b970032
2021-04-21 09:41:31 -07:00
Jun Wu
3ded4caf6a util: add shorttraceback
Summary:
`shorttraceback` returns a shorter version of the "traceback". It will be used
to figure out (frequent) callsite that triggers suboptimal 1-by-1 fetches.

Reviewed By: andll

Differential Revision: D27867673

fbshipit-source-id: 8f1f823007c2c94e1f62e72d816f03cbb4c8bc59
2021-04-21 09:41:31 -07:00
Jun Wu
a98340bd8d util: move frame extraction to a function
Summary: Split `smarttraceback` so the frame extraction logic can be reused.

Reviewed By: andll

Differential Revision: D27867669

fbshipit-source-id: 0e198f5400df5c1841926f9fac30f70ae74e8108
2021-04-21 09:25:49 -07:00
Jun Wu
abe821055e tracing: add isenabled
Summary: Expose Rust APIs to test if a callsite is enabled or not.

Reviewed By: andll

Differential Revision: D27867674

fbshipit-source-id: 0734b5ad6a65040f41a6f8b1bfc1e9a9109b9a8d
2021-04-21 09:25:49 -07:00
Liubov Dmitrieva
0ca356f0de Fix for reading infinitepush.wantsunhydratedcommits and lfs.wantslfspointers config options in client telemetry
Summary:
hg.py has a hard coded list of what configs it will copy from the source repo to the remote repo object (hg.py remoteui())
we use one of lfs and one of infinitepush option in edenscm/hgext/clienttelemetry.py where the remote repo object is used

Reviewed By: ahornby

Differential Revision: D27906275

fbshipit-source-id: d551934437126fdd0b920354bf4c51a6e09bafb2
2021-04-21 04:20:13 -07:00
Jun Wu
c903e63463 hgsql: revs('%s', rev) -> revs('%d', rev)
Summary: `%s` with a rev number is not accepted in the current codebase. Use `%d` instead.

Reviewed By: ikostia

Differential Revision: D27874102

fbshipit-source-id: b83c40b7182da8639e82bea7bd00a036be4120c4
2021-04-20 08:51:29 -07:00
Jun Wu
d37f462b17 remotefilelog: revs('%s', rev) -> revs('%d', rev)
Summary: `%s` with a rev number is not accepted in the current codebase. Use `%d` instead.

Reviewed By: ikostia

Differential Revision: D27873899

fbshipit-source-id: b34eb0b80f0789c9e06af366bfdaa884c5c69357
2021-04-20 08:51:29 -07:00
Jun Wu
6eb9c2b59e drop: reduce rev number usage
Summary: `%s` with `revid` is not accepted in the current codebase.

Reviewed By: ikostia

Differential Revision: D27873898

fbshipit-source-id: e3790855892d3b07e1e5ea6bd92a14738bf6c100
2021-04-20 08:51:29 -07:00
Jun Wu
e006af173d debugresetheads: remove local bookmarks too
Summary:
`debugresetheads` is expected to remove all non-essential heads. That
includes bookmarks.

Reviewed By: kulshrax

Differential Revision: D27861548

fbshipit-source-id: 045976a5a9e27e7eee7ee48448c44552da439983
2021-04-19 15:19:41 -07:00
Arun Kulshreshtha
628a5ecef6 httpconnection: use Rust auth matching
Summary: Replace Python `readauthforuri` with Rust equivalent.

Reviewed By: DurhamG

Differential Revision: D27838072

fbshipit-source-id: 4366bb55964a0082e56f07bcb2ea3241b67841dd
2021-04-19 14:02:54 -07:00
Jun Wu
4bfdbb3f95 repo: do not inherit createemode from svfs to other vfses
Summary:
The svfs might have a different permission setup (ex. g+s, on ext4) that cannot
be applied to other vfs (ex. on edenfs). Do not inherit it. Instead, calculate
proper mode from the vfs root (ex. `.hg`).

Practically, the `createemode` is `None` in most of our repos. However,
`debugsegmentclone` might create svfs with `g+s` mode due to indexedlog's
`mkdir -p` recursively chmods created parents.

The original logic was added in 6590bef21 (FBS), 80e51429cb9a (HG) in 2008 with
little review comments: https://www.mercurial-scm.org/pipermail/mercurial-devel/2008-July/007269.html

Reviewed By: DurhamG

Differential Revision: D27860581

fbshipit-source-id: 43f93080621aaef168d2cecae46fd6dfb879fa1c
2021-04-19 13:55:46 -07:00
Skotch Vail
a3a02abd7a debug for merge picker
Summary:
I am debugging why some people get vim to pop up during a merge conflict and some do not.

also fixes a few lint issues

Reviewed By: DurhamG

Differential Revision: D27684419

fbshipit-source-id: f636d71c18353a3816d1e442c05790cf4fd7b90b
2021-04-19 12:22:27 -07:00
Andrey Chursin
360a6b5a0e checkout: check unkwnown file content in native checkout
Summary:
This replicates behaviour of Python code - if unknown file content matches content of the file to be check out, do not abort checkout

This is useful for resuming interrupted checkouts / clones

Reviewed By: DurhamG

Differential Revision: D27799147

fbshipit-source-id: 7d2582583525da18fba08dfcd8bced2b619304de
2021-04-15 20:08:17 -07:00
Andrey Chursin
261e309caf checkout: handle --clean in native checkout
Summary: Currently native checkout aborts on unknown files even with --clean flag. It should not abort with --clean

Reviewed By: DurhamG

Differential Revision: D27779554

fbshipit-source-id: 2badc84c10eab28d2b1fc8840142ef883ac48c26
2021-04-15 09:26:12 -07:00
Johan Schuijt-Li
deb1059f81 mononokepeer: support connecting over unix socket proxy
Reviewed By: markbt

Differential Revision: D27647191

fbshipit-source-id: c3b50529cd5ef421e84dc34b45550742f8cd19c6
2021-04-15 05:18:34 -07:00
Jan Mazur
de0cd376bf get --insecure flag from options
Summary:
Before:
```
➜  scm hg --insecure pull --config paths.default='mononoke://localhost:20667/fbsource' --insecure
pulling from mononoke://localhost:20667/fbsource
trying different paths
trying path infinitepush mononoke://mononoke.internal.tfbnw.net/fbsource
connected to twshared7229.27.lla2.facebook.com session XlIEDC1TJoVscAfF
searching for changes
adding commits
adding manifests
adding file changes
added 45 commits with 0 changes to 0 files
(running background incremental repack)
➜  scm hg --insecure pull --config paths.default='mononoke://devvm2552.lla0.facebook.com:20667/fbsource' --insecure
pulling from mononoke://devvm2552.lla0.facebook.com:20667/fbsource
connected to devvm2552.lla0.facebook.com session 14iIYK6mFs9KmUM3
no changes found
adding commits
devel-warn: applied empty changegroup at: /opt/fb/mercurial/edenscm/mercurial/bundle2.py:522 (_processchangegroup)
adding manifests
adding file changes
added 0 commits with 0 changes to 0 files
(running background incremental repack)
➜  scm hg pull --config paths.default='mononoke://devvm2552.lla0.facebook.com:20667/fbsource'                 pulling from mononoke://devvm2552.lla0.facebook.com:20667/fbsource
connected to devvm2552.lla0.facebook.com session kyOtOxOMm2iEAgqw
searching for changes
adding commits
adding manifests
adding file changes
added 1 commits with 0 changes to 0 files
(running background incremental repack)
```

Something from this stack D27243638 (3295f0f1fe) might have broken --insecure flag
when pulling. I believe this is the fix.

Reviewed By: johansglock

Differential Revision: D27765417

fbshipit-source-id: 7c7f47643e73b568985e74794ee028b40499674d
2021-04-15 00:32:17 -07:00
Andrey Chursin
9d644ac97e checkout: integrate with rust progress bar
Summary: This will show proper checkout progress when using native checkout

Reviewed By: quark-zju

Differential Revision: D27775423

fbshipit-source-id: 79f2afa02bd1fab7d5f747da1c714d4d1126ce7c
2021-04-14 19:43:26 -07:00
Mark Juggurnauth-Thomas
f897ce4fce cmdutil: indicate that hg update needs a destination
Summary:
If a operation can't proceed because we are in an interrupted update state,
indicate in the hint that `hg update` needs a destination.

Reviewed By: sfilipco

Differential Revision: D27764182

fbshipit-source-id: f0734a4929e34833c4bf84e148db04d57b779246
2021-04-14 09:19:10 -07:00
Meyer Jacobs
fb44958218 scmstore: improve debugscmstore command to support fetching arbitrary files / trees
Summary:
Extend debugscmstore command to fetch arbitrary files / trees by key.

Replace debugpyscmstore with a python fallback for debugscmstore (allowing you to test with the store as it is constructed for Python, with legacy fallback).

Refactor some functionality so it is shared between the rust and python versions of debugscmstore.

Currently the output is pretty ugly. It uses the `{:#?}` format for everything. In the next change, I propose modifying the `Debug` implementation for `minibytes::Bytes` to use ascii-escaped bytestrings rather than the default slice formatter to make things much nicer.

This new `debugscmstore` functionality should be useful in integration tests for testing scmstore under different repo configurations, and for test harnesses and performance testing (fetch a specific set of things easily, simulate delays in the key stream by delaying the input pipe, etc).

Reviewed By: andll

Differential Revision: D27351321

fbshipit-source-id: 8650480e3f5b045b279472643570309c48d7fe6b
2021-04-13 22:13:03 -07:00
Durham Goode
d678e3ac7c py3: fix tweakdefaults on Windows again
Summary: The previous change here wasn't sufficient. We need to wrap the handle fd in a Handle now as well.

Reviewed By: quark-zju, sfilipco

Differential Revision: D27753458

fbshipit-source-id: bd8ebbdcdc9acb411362795263b1419360f15e1a
2021-04-13 21:17:35 -07:00
Jun Wu
6491adfbfc setdiscovery: use filternodes for faster "hasnode" tests
Summary:
The filternodes is an API that can batch hasnode checks. It is more efficient
if the commit hashes are lazy.

Reviewed By: sfilipco

Differential Revision: D27636338

fbshipit-source-id: 4eb2dcd20b939faa38611b82e32ed97cf0c8f175
2021-04-13 17:12:47 -07:00
Jun Wu
53d84ff13f commitcloud: use filternodes for faster "hasnode" tests
Summary:
The filternodes is an API that can batch hasnode checks. It is more efficient
if the commit hashes are lazy.

Reviewed By: sfilipco

Differential Revision: D27636341

fbshipit-source-id: 69cd708a46c719624d654c53de3d92968392d572
2021-04-13 17:12:47 -07:00
Jun Wu
a585f6c1cc localrepo: persist IdMap fetched from remote
Summary:
If a vertex was resolved via remote protocol, respect it and
avoid requesting the same thing twice.

Reviewed By: sfilipco

Differential Revision: D27636340

fbshipit-source-id: 43cf86010745a85cf622c67be4261ea47a33c802
2021-04-13 17:12:47 -07:00
Jun Wu
1e5b98ad1a changelog: add filternodes API
Summary:
Many places use the `[n for n in nodes if hasnode(n)]` pattern, which
can be slow with a lazy graph due to N+1 problem. Add an API so the
Python world can use a more efficient way for the same query.

Reviewed By: sfilipco

Differential Revision: D27636339

fbshipit-source-id: 99ccb85b2266aed22f1cf87a5e2528106edb3783
2021-04-13 17:12:47 -07:00
Jun Wu
48e732f58d changelog: avoid testing nodemap.__contains__ in a loop
Summary:
That could cause a slow loop testing node.__contains__ remotely.

This changes the behavior subtly - nodes added via addgroup will change `tip`
position regardless of whether the nodes exist. This might be more desirable,
since add or addgroup explicitly adding nodes should probably update the
tip position.

Offending test `test-globalrevs-requires.t` was removed since we have
forked the server-side codebase and do not need to maintain hg server
features here.

Reviewed By: sfilipco

Differential Revision: D27630090

fbshipit-source-id: cf7ecc44bf08ed756f0f1aece6655bf674171249
2021-04-13 17:12:47 -07:00
Jun Wu
72507580de smartset: use nameset instead of idset for spans
Summary:
The idset is not fully backed by Rust and do not batch resolve vertexes.
The nameset is backed by Rust NameSet and has proper batch prefetching.
Use nameset if possible but fallback to idset if the backend is not in
Rust (rare, only used by hgsql repos now).

Reviewed By: sfilipco

Differential Revision: D27630092

fbshipit-source-id: cf847dd1a78bd5273a8928ecb6616fe11f2c7026
2021-04-13 16:56:17 -07:00
Jun Wu
735a8a92ad pydag: add an API to test if the dag has lazy vertexes
Summary:
This will be useful to avoid suboptimal code paths that is very slow
with lazy vertexes.

Reviewed By: sfilipco

Differential Revision: D27630089

fbshipit-source-id: 35ee4ba79b551453de78fd22aecccf10bc43b08b
2021-04-13 16:40:07 -07:00
Jun Wu
691317fd17 changelog2: add "lazy" backend
Summary: Similar to "lazytext" but IdMap is also lazy.

Reviewed By: sfilipco

Differential Revision: D27547579

fbshipit-source-id: 70452f1a8e7f00d6a216a2aaec2d55442130d3ce
2021-04-13 16:37:45 -07:00
Jun Wu
e365eec476 revset: do not autopull x or y for revset limit(a, x, y)
Summary:
In revset limit(a, x, y), both x and y are numbers, not commit identities.
The issue is that the revset AST uses different ways to represent functions
with one argument or multiple arguments. For example:

  (func (symbol parents) (symbol master))
  (func (symbol limit)   (list (x) (symbol 1) (symbol 2)))

Fix it by special handling the `list` AST.

Reviewed By: DurhamG

Differential Revision: D27632395

fbshipit-source-id: 081506bdd4b10e197a2685f4ab4d6448fbd79957
2021-04-13 14:34:41 -07:00
Jun Wu
88df00bd2f util: do not redirect stdout
Summary:
out could be stdout but not a tty. In that case, do not redirect stdout to
pipes.  This might solve some arc pull issues.

Write `a.py`:

  util.system('ls -l /proc/self/fd/1')
  util.system('ls -l /proc/self/fd/1', out=ui.fout)
  ui.system('ls -l /proc/self/fd/1')

Before:

  hg dbsh a.py > /tmp/b; cat /tmp/b
  l-wx------ 1 quark users 64 Apr 13 11:44 /proc/self/fd/1 -> /tmp/b
  l-wx------ 1 quark users 64 Apr 13 11:44 /proc/self/fd/1 -> pipe:[2144298266]
  l-wx------ 1 quark users 64 Apr 13 11:44 /proc/self/fd/1 -> /tmp/b

  CHGDISABLE=1 hg dbsh a.py > /tmp/b; cat /tmp/b
  l-wx------ 1 quark users 64 Apr 13 11:47 /proc/self/fd/1 -> /tmp/b
  l-wx------ 1 quark users 64 Apr 13 11:47 /proc/self/fd/1 -> pipe:[2144352743]
  l-wx------ 1 quark users 64 Apr 13 11:47 /proc/self/fd/1 -> pipe:[2144352745]

After:

  lhg dbsh a.py > /tmp/b; cat /tmp/b
  l-wx------ 1 quark users 64 Apr 13 11:45 /proc/self/fd/1 -> /tmp/b
  l-wx------ 1 quark users 64 Apr 13 11:45 /proc/self/fd/1 -> /tmp/b
  l-wx------ 1 quark users 64 Apr 13 11:45 /proc/self/fd/1 -> /tmp/b

  CHGDISABLE=0 lhg dbsh a.py > /tmp/b; cat /tmp/b
  l-wx------ 1 quark users 64 Apr 13 11:55 /proc/self/fd/1 -> /tmp/b
  l-wx------ 1 quark users 64 Apr 13 11:55 /proc/self/fd/1 -> /tmp/b
  l-wx------ 1 quark users 64 Apr 13 11:55 /proc/self/fd/1 -> /tmp/b

Reviewed By: skotchvail

Differential Revision: D27744057

fbshipit-source-id: 62cab690a5cf32b2b3c68c776c627476b0f975d8
2021-04-13 13:43:39 -07:00
Jun Wu
7341c4af7e commandserver: clear progress explicitly before os._exit
Summary:
`os._exit` bypasses all clean-up logic, including `IO::drop` in `hgmain` which
cleans up the progress bars. So let's explicitly clean up the progress bars
before `os._exit`.

Reviewed By: kulshrax

Differential Revision: D27744944

fbshipit-source-id: 5cd50b283728fd4e3b559142f7f61fc6672492e9
2021-04-13 12:35:13 -07:00
Andrey Chursin
f2d873d77c checkout: check unknown files during native checkout
Summary: This is needed to prevent situation when we try writing into file that is untracked by hg

Reviewed By: DurhamG

Differential Revision: D27667152

fbshipit-source-id: 31bb9e30bd6b58e80ba96d280ff6ca1842c8caf6
2021-04-13 11:47:54 -07:00
Mark Juggurnauth-Thomas
876f812e4b commitcloud: do not send backup bookmarks part
Summary:
The backupbookmarks part was used for infinitepush backup bookmarks, which were
deprecated.  Now stop sending the part entirely unless
`commitcloud.pushbackupbookmarks` is set.

Reviewed By: StanislavGlebik

Differential Revision: D27710099

fbshipit-source-id: 1eb404f106f5a8d9df6d73e11f60f89c1fa10400
2021-04-13 03:07:50 -07:00
Andrey Chursin
80adbe385c rename ephemeralcommit->hiddencommit
Summary: This name is more reasonable, since this commit is not actually ephemeral

Reviewed By: quark-zju

Differential Revision: D27722921

fbshipit-source-id: e2c0243d41a73341f9d0afdc79696ea37b34b8c7
2021-04-12 20:13:11 -07:00
Jun Wu
2480bfcef5 discovery: remove unused discovery logic
Summary:
We have `experimental.findcommonheadsnew` set to True in all tests, and
Rust commit backends force the `findcommonheadsnew` paths, which is
pretty much everywhere except hgsql repos. Remove `_findcommonheadsold`.

The fast discovery is also unnecessary. Remove them too.

Reviewed By: DurhamG

Differential Revision: D27630496

fbshipit-source-id: ab1948f03a8c84e75e3b5c9ff4769e17533447d2
2021-04-12 17:11:37 -07:00
Andrey Chursin
aa86902059 checkout: use scmstore in merge.py during checkout
Summary: This diff uses filescmstore for native checkout when nativecheckout.usescmstore config is set

Reviewed By: DurhamG

Differential Revision: D27658844

fbshipit-source-id: ec3442d677ccb25e8b08cc194e4c8c18c0e01fa1
2021-04-12 14:45:11 -07:00
Arun Kulshreshtha
11697cde4c remotefilelog: cache edenapistore
Summary: Make this method match the behavior of `remotefileslog.memcachestore` and cache the `edenapistore` instead of constructing a new one each time. Right now this doesn't matter too much because we currently only call this once when setting up the Rust `revisionstore`, but it would be good to avoid creating multiple instances if we do start using this elsewhere.

Reviewed By: DurhamG

Differential Revision: D27684210

fbshipit-source-id: 7987f603c79758902b4740dd8b46d26a25baec93
2021-04-12 12:17:12 -07:00
Arun Kulshreshtha
fdfc52775d remotefilelog: disable memcache when cachekey is empty
Summary:
This diff causes memcache to be disabled when `remotefilelog.cachekey` is set to the empty string, thereby allowing memcache to be disabled on the command line with `--config remotefilelog.cachekey=''`. This is useful when testing data-layer changes.

Previously, the only way to do this was to add `%unset cachekey` to the `remotefilelog` section of your `hgrc`, which was a bit tedious compared to just using a `--config` flag.

Reviewed By: DurhamG

Differential Revision: D27683782

fbshipit-source-id: 3e0434e98a32db916a07935e8b26f70317f50286
2021-04-12 12:17:12 -07:00
Stefan Filip
b48f998a61 mononokepeer: update handling of pipe read errors
Summary: The error is not going to have a message in many cases leading to crashes.

Reviewed By: quark-zju

Differential Revision: D27637119

fbshipit-source-id: 135b133371916dddf0c47a84f00957a8b8fdfe92
2021-04-12 11:07:55 -07:00
Stefan Filip
fd4e0754c4 remotefilectx: fix fctx usage
Summary:
fctx is not guaranteed to have the _path and _filenode attributes. Those are
specific to implementations, e.g. `absentfilectx` does not have them.
`basefilectx` instead defines the `path()` and `filenode()` for general fctx
use.

Reviewed By: quark-zju

Differential Revision: D27667176

fbshipit-source-id: 1d7889d264b597665ef05f84a752323f078cb455
2021-04-09 10:53:33 -07:00
Mark Juggurnauth-Thomas
d560d298e9 commitcloud: nodeinfo["remote_bookmarks"] might be None
Summary:
Defend against the possibility of `nodeinfo["remote_bookmarks"]` being `None`
by treating it the same as an empty list.

Reviewed By: quark-zju

Differential Revision: D27658994

fbshipit-source-id: 06c31bdba2cc6cbd82f5bd718befd6be9bb233f2
2021-04-08 16:31:04 -07:00
Durham Goode
22a8ddad44 py3: fix tweakdefaults Windows CreatePipe usage
Summary: This API has moved in Python 3. This is only used for util.popen4 calls, which aren't super frequent, so it escaped notice until now.

Reviewed By: sfilipco

Differential Revision: D27603246

fbshipit-source-id: 9ee6af4f66380480fe6c1c736287231464d0b21e
2021-04-07 22:07:28 -07:00
Andrey Chursin
d0cf303e2a checkout: Use native rebase in merge.py
Summary:
Usage is hidden under config experimental.nativerebase
When config is set, we attempt to execute native rebase, and check if it has conflicts
If there are no conflicts, we convert native rebase result into Python actions
In case of conflicts, we currently just fallback to python merge

Reviewed By: DurhamG

Differential Revision: D27482909

fbshipit-source-id: 5705d372095f64ce0c6ee93c783e1c8dccf8b11a
2021-04-07 19:07:31 -07:00
Andrey Chursin
fcfe9a451e checkout: basic rebase model
Summary:
This diff contains proposal for basic rebase model for new checkout.

This diff introduces two types of file changes - basic no conflict Actions(that will replace CheckoutPlan actions) and ConflictAction for actions that contain conflicts

No conflict actions are produced when comparing two manifests
Conflict actions can be produced when rebasing manifests.

Eventually we will adjust checkout code to take either list of Actions or Conflict actions and perform corresponding operations on the file.

Rebase::rebase is used to generate list of conflict actions when rebasing.
Currently `Rebase::rebase` produces list of actions on top of 'base' commit.

Before doing actual checkout we will need to take into account what current commit is and adjust this list of actions accordingly (however, this adjustment will be trivial, it won't produce more conflicts)
After getting adjusted list of actions, checkout code can roll it out to fs and call merge drivers if needed.

In the future, if we will want to allow check in conflicts, we will need to adjust `Rebase::resolve_conflict` to take `ConflictAction` as input, instead of an Action.

Reviewed By: DurhamG

Differential Revision: D27028001

fbshipit-source-id: b02b7ad8030fcf146b53639d69e66fdc8f38a62d
2021-04-07 19:07:31 -07:00
Jun Wu
51821b16b2 smartset: disable nameset.{fastasc,fastdesc} if it has prefetch fields set
Summary:
The nameset._set.iter() used by nameset.{fastdesc,fastdesc} do not know how to
prefetch. Just make them return `None` in this case. This addresses issues
where `log` can trigger one-by-one fetching.

  hg log -r "limit(all(), 100000, 100000) & date('2021-04-01')"

The stack is a bit deep, it is:

  # cmdutil.getlogrevs
  if not revs:
      ...

  # smartset.filteredset.__nonzero__
  fast = None
  candidates = [self.fastasc, self.fastdesc]
  ...
  if fast is not None:
      it = fast()

Basically filteredset calls into its _subset (nameset)'s fast{asc,desc},
which does not do prefetch properly and that cause filteredset.__nonzero__
to be slow.

Reviewed By: sfilipco

Differential Revision: D27634020

fbshipit-source-id: c3a44a1eb81c32f4dccb319ce42a15c56121c2ec
2021-04-07 17:51:50 -07:00
Liubov Dmitrieva
e11142d243 introduce a way of requesting unhydrated commits
Summary: introduce a way of requesting unhydrated commits using client telemetry

Reviewed By: StanislavGlebik

Differential Revision: D27591868

fbshipit-source-id: 7616f9d3b222c2c7f43c2ba930086eb0ec9e15bc
2021-04-07 03:02:32 -07:00
Andrey Chursin
916fe41416 debugephemeralcommit: include extra files
Summary:
This adds command line argument `-I` that supplies \0-separated list of files to add to commit.
Added files can be ignored/untracked.

No limit on total size for now, still waiting to hear from mononoke team on max files size

Reviewed By: quark-zju

Differential Revision: D27547822

fbshipit-source-id: 8bb755db5dd6e557e2752381dbeb5f1035073725
2021-04-06 14:58:12 -07:00
Andrey Chursin
e0e3ab79c0 matcher: add option to allow generating nevermatching when there is no patterns
Summary: This will be used in ephemeral commit, since by default it does not need to include untracked files

Reviewed By: quark-zju

Differential Revision: D27580975

fbshipit-source-id: 16c4faa92e9afe472ff1677e5b92507bebaee247
2021-04-06 14:58:12 -07:00
Mark Juggurnauth-Thomas
f44d2ddaa5 commitcloud: interactive history default limit should be two weeks
Summary: The default limit for commit cloud interactive history should be two weeks, not two days.

Reviewed By: farnz

Differential Revision: D27589697

fbshipit-source-id: 4314621fa7f06dac9243eb9b826acc1c7b0c0b10
2021-04-06 09:07:06 -07:00
Jun Wu
2118b02db2 reset: avoid using %s for rev number
Summary:
This crashes with `ui.ignorerevnum=1`.

Rev number should use `%d`. Or use node and `%n`. `%s` is not the right way.

Reviewed By: kulshrax

Differential Revision: D27527470

fbshipit-source-id: 115385d8bb8dd006fcbf62dee1099b8f9d5262c7
2021-04-05 16:22:05 -07:00
Durham Goode
6d9f0b1f06 clone: make resumable checkout optional
Summary:
Since we're rolling out native checkout and resumable checkout around
the same time, let's make resumable checkout optional so we can turn it off it
causes issues, without turning off native checkout.

Reviewed By: quark-zju

Differential Revision: D27481986

fbshipit-source-id: a0a3e68567ca2a468e852dce95c03c4b606aaf22
2021-04-05 15:35:08 -07:00