Commit Graph

1816 Commits

Author SHA1 Message Date
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