Commit Graph

3916 Commits

Author SHA1 Message Date
Alex Hornby
9fce86450a fix rust warnings
Summary: noticed these in passing while working on previous diff

Reviewed By: mitrandir77

Differential Revision: D27227682

fbshipit-source-id: e7858c81951b780722b0836ecf6ee72aeb1ffa09
2021-03-22 11:47:55 -07:00
Jun Wu
e7ffe860c3 test-convert-git: fix test with latest git
Summary:
The latest git prints extra hints:

       $ git init repo
    +  hint: Using 'master' as the name for the initial branch. This default branch name
    +  hint: is subject to change. To configure the initial branch name to use in all
    +  hint: of your new repositories, which will suppress this warning, call:
    +  hint:
    +  hint: 	git config --global init.defaultBranch <name>
    +  hint:
    +  hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
    +  hint: 'development'. The just-created branch can be renamed via this command:
    +  hint:
    +  hint: 	git branch -m <name>
       Initialized empty Git repository in $TESTTMP/repo/.git/

Silent it to make the test pass.

Reviewed By: akushner

Differential Revision: D27235547

fbshipit-source-id: 6f7c8da3ac1e01ee9f57730e1586fa2053f9ca98
2021-03-22 10:49:09 -07:00
Liubov Dmitrieva
77a1beb917 improve output of hg cloud status command for a renamed current workspace
Summary:
a workspace could be renamed from a different machine

educate users that they need to switch to a valid workspace

Reviewed By: markbt

Differential Revision: D27155544

fbshipit-source-id: eed066f2f3e6ebf99732499fdb355f8aebb4c1df
2021-03-22 07:03:17 -07:00
Liubov Dmitrieva
029a5b5d5a improve output of hg cloud list command for a renamed current workspace
Summary:
this could happen if it has been removed from a different machine

In this case, we should educate the users about the '--force' option

Reviewed By: markbt

Differential Revision: D27155423

fbshipit-source-id: 41cc3ac769dfd4145031fef687e8069d0ef8f4c9
2021-03-22 07:03:17 -07:00
Liubov Dmitrieva
072dcd06a2 provide better ux for switching workspace if the current workspace has been renamed
Summary:
provide better ux for switching workspace if the current has been renamed from another machine

sometimes users rename a workspace but it's unclear for them how to switch other machines to the new one

we should educate them about '--force' option

Reviewed By: markbt

Differential Revision: D27117194

fbshipit-source-id: faef1cf9ce64f054f715ef3683a133d3088ddc72
2021-03-22 07:03:16 -07:00
Alex Hornby
c4c0ec57ee getdepsbuild: update to python3
Summary:
We've been seeing flaky test output due to python2 and python3 stdout being different

Bring getdeps builds unambiguously onto python3.

Reviewed By: mitrandir77

Differential Revision: D27190200

fbshipit-source-id: e53327fc3293a0ccdf88d8a199b66eddb4b9b8e4
2021-03-22 05:26:47 -07:00
Alex Hornby
567ab8ccd3 setup3: remove its remaining python2 parts
Summary: There were a few remaining python2 parts to remove and the error case from hgcommand.run() had wrong encoding

Reviewed By: mitrandir77

Differential Revision: D27194046

fbshipit-source-id: 8c154204991e5a587f70ae4b18c73c4f005880ab
2021-03-22 05:26:47 -07:00
Xavier Deguillard
0fb5fa7846 thrift: remove getManifestEntry
Summary:
This is unused, and the Thrift file mentions that it should be fine to remove
in July 2020. It's now March 2021, time to kill it.

Reviewed By: chadaustin

Differential Revision: D26852134

fbshipit-source-id: 2872185edd834f889b78802210071d16b881e14c
2021-03-19 09:25:05 -07:00
Jun Wu
be1fa084a9 ui: disable Rust progress when starting external pager
Summary:
See the previous diff for context. Disable the Rust progress for external
pager.

Reviewed By: kulshrax

Differential Revision: D27149241

fbshipit-source-id: 4260a8be55bbfa648d8910f021195e9d11bdab73
2021-03-18 13:00:24 -07:00
Jun Wu
a2a588d53a hgcommands: avoid creating a new IO struct if possible
Summary:
When testing "disable_progress" with chg (next diff) I found it was not
effective because there are 2 separate IO structs. The one we disable
from Python is different from the one the Rust progress thread uses.

I traced it down here. Since the Python IOs are just wrappers of
Rust IOs in the chg use-case. There is no need to recreate an IO
struct.

The "creating IO" struct is still useful, for things like "-t.py" testing where
the output needs to be captured into different Python variables per different
commands.

Reviewed By: DurhamG

Differential Revision: D27149243

fbshipit-source-id: 6e27adcc9f48b21fc24fba120be8c4a8fef1f909
2021-03-18 13:00:23 -07:00
Jun Wu
5e412629ee io: provide a way to disable progress rendering
Summary:
In some cases (ex. using an external pager). The IO states are changed outside
the IO struct's control. Ideally we should implement the external pager logic
on IO too but for now let's just add an API so the Python external pager logic
can disable progress output after starting an external pager.

Reviewed By: kulshrax

Differential Revision: D27149242

fbshipit-source-id: ff51fc153d3cc211cfa8ef697923d36f7c0f0d9b
2021-03-18 13:00:23 -07:00
Durham Goode
560bb0bfbd dynamicconfigs: fix prod check for Windows
Summary:
Detecting prod on Windows wasn't working because we used a posix path.
Let's add the Windows equivalent.

Also moves us to use the new hostcaps crate.

Reviewed By: chadaustin

Differential Revision: D27126497

fbshipit-source-id: 4035012fb7701378fb6e2e902c0efcd54ef42ea9
2021-03-18 11:26:06 -07:00
Durham Goode
b8ca876ee0 configs: add --configfile's to new .hg/hgrc during clone
Summary:
We've been seeing issues where repositories end up with incorrect
dynamic configuration since there's a window of time after they're cloned where
they don't have %include /etc/mercurial/.../repo.rc and therefore generate an
incorrect dynamicconfig which gets used for 15 minutes until we regen the
dynamicconfig.

Let's change hg clone to write the %include as part of the initial hgrc, so we
remove that window of time and the repo will always be correctly configured.

Reviewed By: quark-zju

Differential Revision: D27093772

fbshipit-source-id: a9ca0ec54e06549546d532d1c49a80d49981decf
2021-03-18 10:23:07 -07:00
Thomas Orozco
21e170f6de thrift/rust: pass service_name and fn_name to call() on clients
Summary:
I'd like to add support for event handlers in the Rust ServiceRouter client (I
need this in order to inject CATs in calls made by the SMC client). To do so, I
need to be able to instantiate a `ContextStack`, and to do so, I need a static
c-string representing the service name & function name, which is what this diff
does.

Note that we actually do the same thing for Rust servers already.

#forcetdhashing

Reviewed By: farnz

Differential Revision: D27088187

fbshipit-source-id: be2ad541d5123b31f0dab73da16b35dbfd308d6f
2021-03-18 10:19:40 -07:00
Anna Kukliansky
885f172d83 dont define MIN if it is allready defined
Summary:
to overcome this error:
```
stderr: In file included from eden/scm/edenscm/mercurial/cext/osutil.c:44:
eden/scm/edenscm/mercurial/cext/util.h:39:9: error: 'MIN' macro redefined [-Werror,-Wmacro-redefined]
#define MIN(a, b) (((a) < (b)) ? (a) : (b))

buck-out/dev/cells/fbsource/gen/03598924/xplat/toolchains/minimal_xcode/MacOSX11.1.sdk__/MacOSX11.1.sdk/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include/sys/param.h:215:9: note: previous definition is here
#define MIN(a, b) (((a)<(b))?(a):(b))
```

Reviewed By: andrewjcg

Differential Revision: D27137302

fbshipit-source-id: c0ecdfe41e4f2215fb6b886a350d1e4e0224abd5
2021-03-18 04:09:20 -07:00
Anna Kukliansky
0f06f9a092 workaround const qualifier discard
Summary:
In regular xcode this was warning and being ignores. Not the working is handled as an error.
This diff is only a workaround so we wont get those errors .
```
eden/scm/edenscm/mercurial/cext/osutil.c:745:49: error: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  ret = _listdir_batch(path, pathlen, keepstat, skip, &fallback);
                                                ^~~~
eden/scm/edenscm/mercurial/cext/osutil.c:586:11: note: passing argument to parameter 'skip' here
    char* skip,
```

Reviewed By: mzlee

Differential Revision: D27136440

fbshipit-source-id: 00d61fd00e3ed8e23643ea69b5a82dbeb5e742ce
2021-03-18 02:38:56 -07:00
Jun Wu
9d71e83f99 smartlog: show obsoleted commit stack
Summary:
With `sl -r OBSOLETED` the intention is see the obsoleted stack instead of just
a single commit. So filter the "::heads" with "- public()", not "& draft()".

The goal is to deprecate `--hidden`. See the linked post for more context.

Reviewed By: DurhamG

Differential Revision: D27093425

fbshipit-source-id: 76e9650a809c1d94da2341e2aca31d349487610d
2021-03-17 23:23:07 -07:00
Arun Kulshreshtha
c51b647565 async-runtime: add spawn_blocking function
Summary: Add a simple wrapper around `tokio::runtime::Runtime:spawn_blocking`.

Reviewed By: quark-zju

Differential Revision: D27145094

fbshipit-source-id: 9575341dbfd90f169eba53f6c5ae2cc3e8b41c70
2021-03-17 19:23:00 -07:00
Durham Goode
4275cb5488 configs: stop creating .hg directories
Summary:
This creates .hg directories when there is no repository at all, which
breaks jf submit in git repos. D26801059 is the real fix, but it has some other
complications. Let's drop the creation here, since it really isn't necessary.

Reviewed By: quark-zju

Differential Revision: D27134087

fbshipit-source-id: d15048b2d1022d38393b62cc02ebf022e617ed4f
2021-03-17 13:14:32 -07:00
Jun Wu
17e9512f94 log: preserve prefetch information for log -r
Summary:
When using `log -r REVS` with filtering flags like `-u`, `-d`, preserve the
prefetch information by using the `revs(subset=subset)` API.

Reviewed By: sfilipco

Differential Revision: D27119174

fbshipit-source-id: 8483d7113cfc819c6053d1429221588c3a917c12
2021-03-17 11:02:16 -07:00
Jun Wu
b98bf3873f localrepo: add subset arguments to revs
Summary:
This allows specifying subsets. So we can rewrite:

  revs & repo.revs(expr)

to:

  repo.revs(expr, subset=revs)

The latter will apply prefetch tweaks on subset when evaluating the revset
expr, while the former will lose prefetch information.

There might be a way to make `revs & repo.revs(expr)` do the right thing
for pre-fetching, too. But that could be more complicated w.r.t `&` fast
paths, over fetching (?), etc. For now I just took the fix that looks more
obvious to me.

Reviewed By: sfilipco

Differential Revision: D27119175

fbshipit-source-id: 2629d21594cf97d7c0f63cf085a2c427d8782e58
2021-03-17 11:02:16 -07:00
Jun Wu
216363e15e smartset: show progress filtering commits
Summary:
The filteredset can often be expensive filtering commits like `hg log -u foo`,
`hg log -d '2010-1-1'`. Add a progress bar to show what's going on.

Reviewed By: sfilipco

Differential Revision: D27119176

fbshipit-source-id: 458fbf331978b26e78e6a85fb194ae8b12b949d6
2021-03-17 11:02:16 -07:00
Arun Kulshreshtha
4ced7f2e6d edenapi_types: implement ToJson for various commit requests
Summary:
`CommitHashToLocationRequestBatch` and `CommitRevlogDataRequest` implemented `FromJson` but not `ToJson`. The latter is required so that the EdenAPI client can log JSON representations of all request types.

In the process of adding tests for those two types, I discovered a bug in `CommitLocationToHashRequestBatch`'s `ToJson` implementation which prevented it from passing JSON roundtrip tests (which I added because this type didn't have test coverage here). The bug is now fixed and the roundtrip test passes.

Reviewed By: krallin

Differential Revision: D27105414

fbshipit-source-id: d2e23e21f996ac8062bca948ed9abe3779e4669d
2021-03-17 10:57:48 -07:00
Arun Kulshreshtha
8686c15a53 edenapi_types: implement quickcheck::Arbitrary for CommitRevlogDataRequest
Summary: Used in next diff.

Reviewed By: krallin

Differential Revision: D27105415

fbshipit-source-id: f93990bff2c8a8bcc1293ec7db4c87f34e3b8d2e
2021-03-17 10:57:48 -07:00
Arun Kulshreshtha
ad02212fce edenapi_types: use macro for JSON rountrip quickcheck tests
Summary: Use a macro to define quickcheck tests that perform roundtrip conversions for EdenAPI types that implement `ToJson` and `FromJson`. This makes it easier to add additional roundtrip tests for new types.

Reviewed By: krallin

Differential Revision: D27105416

fbshipit-source-id: c6059f9527d57b88cd6e3d1647fa89d8f826b1e3
2021-03-17 10:57:48 -07:00
Chad Austin
e05a6575b3 editmerge editor selection consistency
Summary:
editmerge did not follow the same editor fallback described in
https://www.mercurial-scm.org/wiki/HGEDITOR and `hg help
environment`. Make the fallback behavior (especially to `vi` if none
are set) consistent by defining HGEDITOR before invoking external
merge scripts.

Reviewed By: farnz

Differential Revision: D27104830

fbshipit-source-id: 0ca657578f010a682afb84649f2f18ff46046864
2021-03-17 10:48:36 -07:00
Jun Wu
667c6a1274 io: improve mixed stdout + stderr progress output behavior
Summary:
Rework the progress. Always move the cursor to the top-left corner of the
progress output. So the clear progress instruction is just to erase till
the end of the screen. There is no need to track the height of the progress.

Update flush logic so we only do flush when crossing the progress/non-progress
boundary: When we write progress (to stderr), flush stdout, write progress,
then flush stderr.

Also, disable progress unconditionally if the current output line is incomplete.

Reviewed By: sfilipco

Differential Revision: D27109228

fbshipit-source-id: 717345e9c7eaeebeb378ce090f7b2f60957fd150
2021-03-17 09:27:51 -07:00
Jun Wu
985939bc25 io: do not write to output for write_err
Summary: This makes write_err() consistent with error().write().

Reviewed By: sfilipco

Differential Revision: D27109227

fbshipit-source-id: 4e7ea1fe464c17548c34e5f9bf78085868a20256
2021-03-17 09:27:51 -07:00
Jun Wu
acbb9ee8d3 commandserver: remove a debug output
Summary:
See the previous diff. This avoids complex logic in the signal handler so we
don't need to think about whether the complex logic is reentrant or not.

Reviewed By: DurhamG

Differential Revision: D27111183

fbshipit-source-id: 110ef5699d5fcd007f8399e90443bb406e2b173c
2021-03-17 08:30:27 -07:00
Jun Wu
c0c4d0b22c tracing-runtime-callsite: fix a potential deadlock
Summary:
This can cause a deadlock if `func()` calls `create_callsite`.

Usually it's rare. But (Python) signal handler makes it realistic.

Example backtrace:

  Traceback (most recent call first):
    File "/opt/fb/mercurial/edenscm/tracing.py", line 337, in event
    File "/opt/fb/mercurial/edenscm/mercurial/ui.py", line 1275, in debug
      tracing.debug(msg.rstrip("\n"), depth=1)
    File "/opt/fb/mercurial/edenscm/mercurial/commandserver.py", line 608, in _reapworkers
      self.ui.debug("worker process exited (pid=%d)\n" % pid)
    File "/opt/fb/mercurial/edenscm/mercurial/commandserver.py", line 591, in _sigchldhandler
      self._reapworkers(os.WNOHANG)
    File "/opt/fb/mercurial/edenscm/tracing.py", line 337, in event
    File "/opt/fb/mercurial/edenscm/mercurial/ui.py", line 1275, in debug
      tracing.debug(msg.rstrip("\n"), depth=1)
    File "/opt/fb/mercurial/edenscm/mercurial/commandserver.py", line 608, in _reapworkers
      self.ui.debug("worker process exited (pid=%d)\n" % pid)
    File "/opt/fb/mercurial/edenscm/mercurial/commandserver.py", line 591, in _sigchldhandler
      self._reapworkers(os.WNOHANG)

  #0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
  #1  0x000055d0d65ba339 in <parking_lot::raw_rwlock::RawRwLock>::lock_upgradable_slow ()
  #2  0x000055d0d55b5814 in tracing_runtime_callsite::create_callsite::<tracing_runtime_callsite::callsite_info::EventKindType, pytracing::new_callsite<tracing_runtime_callsite::callsite_info::EventKindType>::{closure#2}> ()
  #3  0x000055d0d5584cb9 in <pytracing::EventCallsite>::__new__ ()
  #4  0x000055d0d55a3eaa in std::panicking::try::<*mut python3_sys::object::PyObject, cpython::function::handle_callback<<pytracing::EventCallsite>::create_instance::TYPE_OBJECT::wrap_newfunc::{closure#0}, pytracing::EventCallsite, cpython::function::PyObjectCallbackConverter>::{closure#0}> ()
  #5  0x000055d0d5589365 in cpython::function::handle_callback::<<pytracing::EventCallsite>::create_instance::TYPE_OBJECT::wrap_newfunc::{closure#0}, pytracing::EventCallsite, cpython::function::PyObjectCallbackConverter> ()
  #6  0x000055d0d55856e1 in <pytracing::EventCallsite>::create_instance::TYPE_OBJECT::wrap_newfunc ()
  #7  0x00007ff88d576230 in type_call (
      kwds={'obj': Frame 0x7ff87c1f8c40, for file /opt/fb/mercurial/edenscm/mercurial/commandserver.py, line 608, in _reapworkers (self=<unixforkingservice(ui=<ui(_buffers=[], _bufferstates=[], _bufferapplylabels=None, _outputui=None, callhooks=True, insecureconnections=False, _colormode=None, _styles={}, _terminaloutput=None, cmdname=None, _uiconfig=<uiconfig(quiet=False, verbose=False, debugflag=False, tracebackflag=False, logmeasuredtimes=False, _rcfg=<localrcfg(_rcfg=<bindings.configparser.config at remote 0x7ff87d7325d0>) at remote 0x7ff87eb73e80>, _unserializable={}, _pinnedconfigs=set(), _knownconfig={'alias': <itemregister(_generics={<configitem(section='alias', name='.*', default=None, alias=[], generic=True, priority=0, _re=<re.Pattern at remote 0x7ff87d69bed0>) at remote 0x7ff87d690a60>}) at remote 0x7ff87dbfde50>, 'annotate': <itemregister(_generics=set()) at remote 0x7ff87d6ad9f0>, 'auth': <itemregister(_generics=set()) at remote 0x7ff87dc037c0>, 'blackbox': <itemregister(_generics=set()) at remote 0x7ff87d...(truncated), args=(),
      type=0x55d0d8ea5b40 <_RNvNvMs1R_CsgCrAUYYhx1D_9pytracingNtB8_13EventCallsite15create_instance11TYPE_OBJECT.llvm.4665269759137401160>) at Objects/typeobject.c:974
  #8  _PyObject_MakeTpCall (callable=<type at remote 0x55d0d8ea5b40>, args=<optimized out>,
      nargs=<optimized out>, keywords=<optimized out>) at Objects/call.c:159
  #9  0x00007ff88d56dc81 in _PyObject_Vectorcall (
      kwnames=('obj', 'name', 'target', 'level', 'fieldnames'), nargsf=<optimized out>,
      args=<optimized out>, callable=<type at remote 0x55d0d8ea5b40>) at ./Include/cpython/abstract.h:125
  #10 _PyObject_Vectorcall (kwnames=('obj', 'name', 'target', 'level', 'fieldnames'),
      nargsf=<optimized out>, args=<optimized out>, callable=<type at remote 0x55d0d8ea5b40>)
      at ./Include/cpython/abstract.h:115
  #11 call_function (kwnames=('obj', 'name', 'target', 'level', 'fieldnames'), oparg=<optimized out>,
      pp_stack=<synthetic pointer>, tstate=<optimized out>) at Python/ceval.c:4963
  #12 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3515
  #13 0x00007ff88d566268 in PyEval_EvalFrameEx (throwflag=0,
      f=Frame 0x7ff87cced010, for file /opt/fb/mercurial/edenscm/tracing.py, line 337, in event (message='worker process exited (pid=3953080)', name=None, target=None, level=1, depth=1, meta={}, frame=Frame 0x7ff87c1f8c40, for file /opt/fb/mercurial/edenscm/mercurial/commandserver.py, line 608, in _reapworkers (self=<unixforkingservice(ui=<ui(_buffers=[], _bufferstates=[], _bufferapplylabels=None, _outputui=None, callhooks=True, insecureconnections=False, _colormode=None, _styles={}, _terminaloutput=None, cmdname=None, _uiconfig=<uiconfig(quiet=False, verbose=False, debugflag=False, tracebackflag=False, logmeasuredtimes=False, _rcfg=<localrcfg(_rcfg=<bindings.configparser.config at remote 0x7ff87d7325d0>) at remote 0x7ff87eb73e80>, _unserializable={}, _pinnedconfigs=set(), _knownconfig={'alias': <itemregister(_generics={<configitem(section='alias', name='.*', default=None, alias=[], generic=True, priority=0, _re=<re.Pattern at remote 0x7ff87d69bed0>) at remote 0x7ff87d690a60>}) at remote 0x7ff87dbfde50>, 'annotate': ...(truncated))
      at Python/ceval.c:741
  #14 _PyEval_EvalCodeWithName (_co=<optimized out>, globals=<optimized out>, locals=<optimized out>,
      args=<optimized out>, argcount=<optimized out>, kwnames=<optimized out>, kwargs=0x7ff87c0fdc78,
      kwcount=<optimized out>, kwstep=1, defs=0x7ff87d572558, defcount=4, kwdefs=0x0, closure=0x0,
      name='event', qualname='event') at Python/ceval.c:4298
  #15 0x00007ff88d57fdce in _PyFunction_Vectorcall (func=<optimized out>, stack=0x7ff87c0fdc70,
      nargsf=<optimized out>, kwnames=<optimized out>) at Objects/call.c:435
  #16 0x00007ff88d57574f in _PyObject_FastCallDict (callable=<function at remote 0x7ff87d5741f0>,
      args=0x7ff87eb63838, nargsf=<optimized out>, kwargs=<optimized out>) at Objects/call.c:104
  #17 0x00007ff88d66d1ab in partial_fastcall (kwargs={'level': 1, 'depth': 1}, nargs=<optimized out>,
      args=<optimized out>, pto=0x7ff87d572630) at ./Modules/_functoolsmodule.c:169
  #18 partial_call (pto=0x7ff87d572630, args=<optimized out>, kwargs=<optimized out>)
      at ./Modules/_functoolsmodule.c:224
  #19 0x00007ff88d576331 in _PyObject_MakeTpCall (callable=<functools.partial at remote 0x7ff87d572630>,
      args=<optimized out>, nargs=<optimized out>, keywords=<optimized out>) at Objects/object.c:2207
  #20 0x00007ff88d56dc81 in _PyObject_Vectorcall (kwnames=('depth',), nargsf=<optimized out>,
      args=<optimized out>, callable=<functools.partial at remote 0x7ff87d572630>)
      at ./Include/cpython/abstract.h:125
  #21 _PyObject_Vectorcall (kwnames=('depth',), nargsf=<optimized out>, args=<optimized out>,
      callable=<functools.partial at remote 0x7ff87d572630>) at ./Include/cpython/abstract.h:115
  #22 call_function (kwnames=('depth',), oparg=<optimized out>, pp_stack=<synthetic pointer>,
      tstate=<optimized out>) at Python/ceval.c:4963
  #23 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3515
  #24 0x00007ff88d566268 in PyEval_EvalFrameEx (throwflag=0,
      f=Frame 0x7ff87c0e43c0, for file /opt/fb/mercurial/edenscm/mercurial/ui.py, line 1275, in debug (self=<ui(_buffers=[], _bufferstates=[], _bufferapplylabels=None, _outputui=None, callhooks=True, insecureconnections=False, _colormode=None, _styles={}, _terminaloutput=None, cmdname=None, _uiconfig=<uiconfig(quiet=False, verbose=False, debugflag=False, tracebackflag=False, logmeasuredtimes=False, _rcfg=<localrcfg(_rcfg=<bindings.configparser.config at remote 0x7ff87d7325d0>) at remote 0x7ff87eb73e80>, _unserializable={}, _pinnedconfigs=set(), _knownconfig={'alias': <itemregister(_generics={<configitem(section='alias', name='.*', default=None, alias=[], generic=True, priority=0, _re=<re.Pattern at remote 0x7ff87d69bed0>) at remote 0x7ff87d690a60>}) at remote 0x7ff87dbfde50>, 'annotate': <itemregister(_generics=set()) at remote 0x7ff87d6ad9f0>, 'auth': <itemregister(_generics=set()) at remote 0x7ff87dc037c0>, 'blackbox': <itemregister(_generics=set()) at remote 0x7ff87dc039a0>, 'bookmarks': <itemregister(_generics=se...(truncated))
      at Python/ceval.c:741
  #25 _PyEval_EvalCodeWithName (_co=<optimized out>, globals=<optimized out>, locals=<optimized out>,
      args=<optimized out>, argcount=<optimized out>, kwnames=<optimized out>, kwargs=0x7ff87c1f8de8,
      kwcount=<optimized out>, kwstep=1, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name='debug',
      qualname='ui.debug') at Python/ceval.c:4298
  #26 0x00007ff88d57fdce in _PyFunction_Vectorcall (func=<optimized out>, stack=0x7ff87c1f8dd8,
      nargsf=<optimized out>, kwnames=<optimized out>) at Objects/call.c:435
  #27 0x00007ff88d56821a in _PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>,
      args=0x7ff87c1f8dd8, callable=<function at remote 0x7ff87d57e9d0>)
      at ./Include/cpython/abstract.h:127
  #28 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>,
      tstate=0x7ff88ca08780) at Python/ceval.c:4963
  #29 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3486
  #30 0x00007ff88d57fd38 in PyEval_EvalFrameEx (throwflag=0,
      f=Frame 0x7ff87c1f8c40, for file /opt/fb/mercurial/edenscm/mercurial/commandserver.py, line 608, in _reapworkers (self=<unixforkingservice(ui=<ui(_buffers=[], _bufferstates=[], _bufferapplylabels=None, _outputui=None, callhooks=True, insecureconnections=False, _colormode=None, _styles={}, _terminaloutput=None, cmdname=None, _uiconfig=<uiconfig(quiet=False, verbose=False, debugflag=False, tracebackflag=False, logmeasuredtimes=False, _rcfg=<localrcfg(_rcfg=<bindings.configparser.config at remote 0x7ff87d7325d0>) at remote 0x7ff87eb73e80>, _unserializable={}, _pinnedconfigs=set(), _knownconfig={'alias': <itemregister(_generics={<configitem(section='alias', name='.*', default=None, alias=[], generic=True, priority=0, _re=<re.Pattern at remote 0x7ff87d69bed0>) at remote 0x7ff87d690a60>}) at remote 0x7ff87dbfde50>, 'annotate': <itemregister(_generics=set()) at remote 0x7ff87d6ad9f0>, 'auth': <itemregister(_generics=set()) at remote 0x7ff87dc037c0>, 'blackbox': <itemregister(_generics=set()) at remote 0x7ff87dc039a0>,...(truncated))
      at Python/ceval.c:738
  #31 function_code_fastcall (globals=<optimized out>, nargs=2, args=<optimized out>, co=<optimized out>)
      at Objects/call.c:283
  #32 _PyFunction_Vectorcall (func=<optimized out>, stack=<optimized out>, nargsf=<optimized out>,
      kwnames=<optimized out>) at Objects/call.c:410
  #33 0x00007ff88d56821a in _PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>,
      args=0x7ff87c0f26d8, callable=<function at remote 0x7ff87d73b310>)
      at ./Include/cpython/abstract.h:127
  #34 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>,
      tstate=0x7ff88ca08780) at Python/ceval.c:4963
  #35 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3486
  #36 0x00007ff88d57fd38 in PyEval_EvalFrameEx (throwflag=0,
      f=Frame 0x7ff87c0f2550, for file /opt/fb/mercurial/edenscm/mercurial/commandserver.py, line 591, in _sigchldhandler (self=<unixforkingservice(ui=<ui(_buffers=[], _bufferstates=[], _bufferapplylabels=None, _outputui=None, callhooks=True, insecureconnections=False, _colormode=None, _styles={}, _terminaloutput=None, cmdname=None, _uiconfig=<uiconfig(quiet=False, verbose=False, debugflag=False, tracebackflag=False, logmeasuredtimes=False, _rcfg=<localrcfg(_rcfg=<bindings.configparser.config at remote 0x7ff87d7325d0>) at remote 0x7ff87eb73e80>, _unserializable={}, _pinnedconfigs=set(), _knownconfig={'alias': <itemregister(_generics={<configitem(section='alias', name='.*', default=None, alias=[], generic=True, priority=0, _re=<re.Pattern at remote 0x7ff87d69bed0>) at remote 0x7ff87d690a60>}) at remote 0x7ff87dbfde50>, 'annotate': <itemreg
  ister(_generics=set()) at remote 0x7ff87d6ad9f0>, 'auth': <itemregister(_generics=set()) at remote 0x7ff87dc037c0>, 'blackbox': <itemregister(_generics=set()) at remote 0x7ff87dc039a...(truncated))
      at Python/ceval.c:738
  #37 function_code_fastcall (globals=<optimized out>, nargs=3, args=<optimized out>, co=<optimized out>)
      at Objects/call.c:283
  #38 _PyFunction_Vectorcall (func=<optimized out>, stack=<optimized out>, nargsf=<optimized out>,
      kwnames=<optimized out>) at Objects/call.c:410
  #39 0x00007ff88d592153 in _PyObject_Vectorcall (kwnames=<optimized out>, nargsf=<optimized out>,
      args=<optimized out>, callable=<optimized out>) at ./Include/cpython/abstract.h:115
  #40 method_vectorcall (method=<optimized out>, args=<optimized out>, nargsf=<optimized out>,
      kwnames=<optimized out>) at Objects/classobject.c:67
  #41 0x00007ff88d5963fb in PyVectorcall_Call (kwargs=0x0, tuple=<optimized out>,
      callable=<method at remote 0x7ff87c70d5c0>) at Objects/dictobject.c:1802
  #42 PyObject_Call (callable=<method at remote 0x7ff87c70d5c0>, args=<optimized out>, kwargs=0x0)
      at Objects/call.c:227
  #43 0x00007ff88d6405ea in _PyErr_CheckSignals () at ./Modules/signalmodule.c:1689
  #44 0x00007ff88d5a41a1 in _PyErr_CheckSignals () at Objects/object.c:577
  #45 PyErr_CheckSignals () at ./Modules/signalmodule.c:1649
  #46 PyObject_Str (v='_reapworkers') at Objects/object.c:561
  #47 0x000055d0d557c821 in pytracing::tostr_opt ()
  #48 0x000055d0d55b5a7d in tracing_runtime_callsite::create_callsite::<tracing_runtime_callsite::callsite_info::EventKindType, pytracing::new_callsite<tracing_runtime_callsite::callsite_info::EventKindType>::{closure#2}> ()
  #49 0x000055d0d5584cb9 in <pytracing::EventCallsite>::__new__ ()
  #50 0x000055d0d55a3eaa in std::panicking::try::<*mut python3_sys::object::PyObject, cpython::function::handle_callback<<pytracing::EventCallsite>::create_instance::TYPE_OBJECT::wrap_newfunc::{closure#0}, pytracing::EventCallsite, cpython::function::PyObjectCallbackConverter>::{closure#0}> ()
  #51 0x000055d0d5589365 in cpython::function::handle_callback::<<pytracing::EventCallsite>::create_instance::TYPE_OBJECT::wrap_newfunc::{closure#0}, pytracing::EventCallsite, cpython::function::PyObjectCallbackConverter> ()
  #52 0x000055d0d55856e1 in <pytracing::EventCallsite>::create_instance::TYPE_OBJECT::wrap_newfunc ()
  #53 0x00007ff88d576230 in type_call (
      kwds={'obj': Frame 0x7ff87c1f8440, for file /opt/fb/mercurial/edenscm/mercurial/commandserver.py, line 608, in _reapworkers (self=<unixforkingservice(ui=<ui(_buffers=[], _bufferstates=[], _bufferapplylabels=None, _outputui=None, callhooks=True, insecureconnections=False, _colormode=None, _styles={}, _terminaloutput=None, cmdname=None, _uiconfig=<uiconfig(quiet=False, verbose=False, debugflag=False, tracebackflag=False, logmeasuredtimes=False, _rcfg=<localrcfg(_rcfg=<bindings.configparser.config at remote 0x7ff87d7325d0>) at remote 0x7ff87eb73e80>, _unserializable={}, _pinnedconfigs=set(), _knownconfig={'alias': <itemregister(_generics={<configitem(section='alias', name='.*', default=None, alias=[], generic=True, priority=0, _re=<re.Pattern at remote 0x7ff87d69bed0>) at remote 0x7ff87d690a60>}) at remote 0x7ff87dbfde50>, 'annotate': <itemregister(_generics=set()) at remote 0x7ff87d6ad9f0>, 'auth': <itemregister(_generics=set()) at remote 0x7ff87dc037c0>, 'blackbox': <itemregister(_generics=set()) at remote 0x7ff87d...(truncated), args=(),
      type=0x55d0d8ea5b40 <_RNvNvMs1R_CsgCrAUYYhx1D_9pytracingNtB8_13EventCallsite15create_instance11TYPE_OBJECT.llvm.4665269759137401160>) at Objects/typeobject.c:974
  #54 _PyObject_MakeTpCall (callable=<type at remote 0x55d0d8ea5b40>, args=<optimized out>,
      nargs=<optimized out>, keywords=<optimized out>) at Objects/call.c:159
  #55 0x00007ff88d56dc81 in _PyObject_Vectorcall (
      kwnames=('obj', 'name', 'target', 'level', 'fieldnames'), nargsf=<optimized out>,
      args=<optimized out>, callable=<type at remote 0x55d0d8ea5b40>) at ./Include/cpython/abstract.h:125
  #56 _PyObject_Vectorcall (kwnames=('obj', 'name', 'target', 'level', 'fieldnames'),
      nargsf=<optimized out>, args=<optimized out>, callable=<type at remote 0x55d0d8ea5b40>)
      at ./Include/cpython/abstract.h:115
  #57 call_function (kwnames=('obj', 'name', 'target', 'level', 'fieldnames'), oparg=<optimized out>,
      pp_stack=<synthetic pointer>, tstate=<optimized out>) at Python/ceval.c:4963
  #58 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3515
  #59 0x00007ff88d566268 in PyEval_EvalFrameEx (throwflag=0,
      f=Frame 0x7ff87ccec890, for file /opt/fb/mercurial/edenscm/tracing.py, line 337, in event (message='worker process exited (pid=3953122)', name=None, target=None, level=1, depth=1, meta={}, frame=Frame 0x7ff87c1f8440, for file /opt/fb/mercurial/edenscm/mercurial/commandserver.py, line 608, in _reapworkers (self=<unixforkingservice(ui=<ui(_buffers=[], _bufferstates=[], _bufferapplylabels=None, _outputui=None, callhooks=True, insecureconnections=False, _colormode=None, _styles={}, _terminaloutput=None, cmdname=None, _uiconfig=<uiconfig(quiet=False, verbose=False, debugflag=False, tracebackflag=False, logmeasuredtimes=False, _rcfg=<localrcfg(_rcfg=<bindings.configparser.config at remote 0x7ff87d7325d0>) at remote 0x7ff87eb73e80>, _u
  nserializable={}, _pinnedconfigs=set(), _knownconfig={'alias': <itemregister(_generics={<configitem(section='alias', name='.*', default=None, alias=[], generic=True, priority=0, _re=<re.Pattern at remote 0x7ff87d69bed0>) at remote 0x7ff87d690a60>}) at remote 0x7ff87dbfde50>, 'annotate': ...(truncated))
      at Python/ceval.c:741
  #60 _PyEval_EvalCodeWithName (_co=<optimized out>, globals=<optimized out>, locals=<optimized out>,
      args=<optimized out>, argcount=<optimized out>, kwnames=<optimized out>, kwargs=0x7ff87c0fdd78,
      kwcount=<optimized out>, kwstep=1, defs=0x7ff87d572558, defcount=4, kwdefs=0x0, closure=0x0,
      name='event', qualname='event') at Python/ceval.c:4298
  #61 0x00007ff88d57fdce in _PyFunction_Vectorcall (func=<optimized out>, stack=0x7ff87c0fdd70,
      nargsf=<optimized out>, kwnames=<optimized out>) at Objects/call.c:435
  #62 0x00007ff88d57574f in _PyObject_FastCallDict (callable=<function at remote 0x7ff87d5741f0>,
      args=0x7ff87eb59d18, nargsf=<optimized out>, kwargs=<optimized out>) at Objects/call.c:104
  #63 0x00007ff88d66d1ab in partial_fastcall (kwargs={'level': 1, 'depth': 1}, nargs=<optimized out>,
      args=<optimized out>, pto=0x7ff87d572630) at ./Modules/_functoolsmodule.c:169
  #64 partial_call (pto=0x7ff87d572630, args=<optimized out>, kwargs=<optimized out>)
      at ./Modules/_functoolsmodule.c:224
  #65 0x00007ff88d576331 in _PyObject_MakeTpCall (callable=<functools.partial at remote 0x7ff87d572630>,
      args=<optimized out>, nargs=<optimized out>, keywords=<optimized out>) at Objects/object.c:2207
  #66 0x00007ff88d56dc81 in _PyObject_Vectorcall (kwnames=('depth',), nargsf=<optimized out>,
      args=<optimized out>, callable=<functools.partial at remote 0x7ff87d572630>)
      at ./Include/cpython/abstract.h:125
  #67 _PyObject_Vectorcall (kwnames=('depth',), nargsf=<optimized out>, args=<optimized out>,
      callable=<functools.partial at remote 0x7ff87d572630>) at ./Include/cpython/abstract.h:115
  #68 call_function (kwnames=('depth',), oparg=<optimized out>, pp_stack=<synthetic pointer>,
      tstate=<optimized out>) at Python/ceval.c:4963
  #69 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3515
  #70 0x00007ff88d566268 in PyEval_EvalFrameEx (throwflag=0,
      f=Frame 0x7ff87c0e4200, for file /opt/fb/mercurial/edenscm/mercurial/ui.py, line 1275, in debug (self=<ui(_buffers=[], _bufferstates=[], _bufferapplylabels=None, _outputui=None, callhooks=True, insecureconnections=False, _colormode=None, _styles={}, _terminaloutput=None, cmdname=None, _uiconfig=<uiconfig(quiet=False, verbose=False, debugflag=False, tracebackflag=False, logmeasuredtimes=False, _rcfg=<localrcfg(_rcfg=<bindings.configparser.config at remote 0x7ff87d7325d0>) at remote 0x7ff87eb73e80>, _unserializable={}, _pinnedconfigs=set(), _knownconfig={'alias': <itemregister(_generics={<configitem(section='alias', name='.*', default=None, alias=[], generic=True, priority=0, _re=<re.Pattern at remote 0x7ff87d69bed0>) at remote 0x7ff87d690a60>}) at remote 0x7ff87dbfde50>, 'annotate': <itemregister(_generics=set()) at remote 0x7ff87d6ad9f0>, 'auth': <itemregister(_generics=set()) at remote 0x7ff87dc037c0>, 'blackbox': <itemregister(_generics=set()) at remote 0x7ff87dc039a0>, 'bookmarks': <itemregister(_generics=se...(truncated))
      at Python/ceval.c:741
  #71 _PyEval_EvalCodeWithName (_co=<optimized out>, globals=<optimized out>, locals=<optimized out>,
      args=<optimized out>, argcount=<optimized out>, kwnames=<optimized out>, kwargs=0x7ff87c1f85e8,
      kwcount=<optimized out>, kwstep=1, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name='debug',
      qualname='ui.debug') at Python/ceval.c:4298
  #72 0x00007ff88d57fdce in _PyFunction_Vectorcall (func=<optimized out>, stack=0x7ff87c1f85d8,
      nargsf=<optimized out>, kwnames=<optimized out>) at Objects/call.c:435
  #73 0x00007ff88d56821a in _PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>,
      args=0x7ff87c1f85d8, callable=<function at remote 0x7ff87d57e9d0>)
      at ./Include/cpython/abstract.h:127
  #74 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>,
      tstate=0x7ff88ca08780) at Python/ceval.c:4963
  #75 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3486
  #76 0x00007ff88d57fd38 in PyEval_EvalFrameEx (throwflag=0,
      f=Frame 0x7ff87c1f8440, for file /opt/fb/mercurial/edenscm/mercurial/commandserver.py, line 608, in _reapworkers (self=<unixforkingservice(ui=<ui(_buffers=[], _bufferstates=[], _bufferapplylabels=None, _outputui=None, callhooks=True, insecureconnections=False, _colormode=None, _styles={}, _terminaloutput=None, cmdname=None, _uiconfig=<uiconfig(quiet=False, verbose=False, debugflag=False, tracebackflag=False, logmeasuredtimes=False, _rcfg=<localrcfg(_rcfg=<bindings.configparser.config at remote 0x7ff87d7325d0>) at remote 0x7ff87eb73e80>, _unserializable={}, _pinnedconfigs=set(), _knownconfig={'alias': <itemregister(_generics={<configitem(section='alias', name='.*', default=None, alias=[], generic=True, priority=0, _re=<re.Pattern at remote 0x7ff87d69bed0>) at remote 0x7ff87d690a60>}) at remote 0x7ff87dbfde50>, 'annotate': <itemregister(_generics=set()) at remote 0x7ff87d6ad9f0>, 'auth': <itemregister(_generics=set()) at remote 0x7ff87dc037c0>, 'blackbox': <itemregister(_generics=set()) at remote 0x7ff87dc039a0>,...(truncated))
      at Python/ceval.c:738
  #77 function_code_fastcall (globals=<optimized out>, nargs=2, args=<optimized out>, co=<optimized out>)
  {<configitem(section='alias', name='.*', default=None, alias=[], generic=True, priority=0, _re=<re.Pattern at remote 0x7ff87d69bed0>) at remote 0x7ff87d690a60>}) at remote 0x7ff87dbfde50>, 'annotate': <itemregister(_generics=set()) at remote 0x7ff87d6ad9f0>, 'auth': <itemregister(_generics=set()) at remote 0x7ff87dc037c0>, 'blackbox': <itemregister(_generics=set()) at remote 0x7ff87dc039a0>,...(truncated))
      at Python/ceval.c:738
  #77 function_code_fastcall (globals=<optimized out>, nargs=2, args=<optimized out>, co=<optimized out>)
  --Type <RET> for more, q to quit, c to continue without paging--
      at Objects/call.c:283
  #78 _PyFunction_Vectorcall (func=<optimized out>, stack=<optimized out>, nargsf=<optimized out>,
      kwnames=<optimized out>) at Objects/call.c:410
  #79 0x00007ff88d56821a in _PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>,
      args=0x7ff87c0f2528, callable=<function at remote 0x7ff87d73b310>)
      at ./Include/cpython/abstract.h:127
  #80 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>,
      tstate=0x7ff88ca08780) at Python/ceval.c:4963
  #81 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3486
  #82 0x00007ff88d57fd38 in PyEval_EvalFrameEx (throwflag=0,
      f=Frame 0x7ff87c0f23a0, for file /opt/fb/mercurial/edenscm/mercurial/commandserver.py, line 591, in _sigchldhandler (self=<unixforkingservice(ui=<ui(_buffers=[], _bufferstates=[], _bufferapplylabels=None, _outputui=None, callhooks=True, insecureconnections=False, _colormode=None, _styles={}, _terminaloutput=None, cmdname=None, _uiconfig=<uiconfig(quiet=False, verbose=False, debugflag=False, tracebackflag=False, logmeasuredtimes=False, _rcfg=<localrcfg(_rcfg=<bindings.configparser.config at remote 0x7ff87d7325d0>) at remote 0x7ff87eb73e80>, _unserializable={}, _pinnedconfigs=set(), _knownconfig={'alias': <itemregister(_generics={<configitem(section='alias', name='.*', default=None, alias=[], generic=True, priority=0, _re=<re.Pattern at remote 0x7ff87d69bed0>) at remote 0x7ff87d690a60>}) at remote 0x7ff87dbfde50>, 'annotate': <itemregister(_generics=set()) at remote 0x7ff87d6ad9f0>, 'auth': <itemregister(_generics=set()) at remote 0x7ff87dc037c0>, 'blackbox': <itemregister(_generics=set()) at remote 0x7ff87dc039a...(truncated))
      at Python/ceval.c:738
  #83 function_code_fastcall (globals=<optimized out>, nargs=3, args=<optimized out>, co=<optimized out>)
      at Objects/call.c:283
  #84 _PyFunction_Vectorcall (func=<optimized out>, stack=<optimized out>, nargsf=<optimized out>,
      kwnames=<optimized out>) at Objects/call.c:410
  #85 0x00007ff88d592153 in _PyObject_Vectorcall (kwnames=<optimized out>, nargsf=<optimized out>,
      args=<optimized out>, callable=<optimized out>) at ./Include/cpython/abstract.h:115
  #86 method_vectorcall (method=<optimized out>, args=<optimized out>, nargsf=<optimized out>,
      kwnames=<optimized out>) at Objects/classobject.c:67
  #87 0x00007ff88d5963fb in PyVectorcall_Call (kwargs=0x0, tuple=<optimized out>,
      callable=<method at remote 0x7ff87c70d5c0>) at Objects/dictobject.c:1802
  #88 PyObject_Call (callable=<method at remote 0x7ff87c70d5c0>, args=<optimized out>, kwargs=0x0)
      at Objects/call.c:227
  #89 0x00007ff88d6405ea in _PyErr_CheckSignals () at ./Modules/signalmodule.c:1689
  #90 0x00007ff88d59b7fd in _PyErr_CheckSignals () at ./Modules/signalmodule.c:1660
  #91 PyErr_CheckSignals () at ./Modules/signalmodule.c:1649
  ....

Reviewed By: DurhamG

Differential Revision: D27111187

fbshipit-source-id: 1aa29ab24088b57b98de3741eb81c0a7be01237d
2021-03-17 08:30:27 -07:00
generatedunixname89002005287564
acee496fa8 Daily arc lint --take BLACK
Reviewed By: zertosh

Differential Revision: D27114089

fbshipit-source-id: 2bad79f50ca4389748f6bcbed57401af7cd9f555
2021-03-17 04:26:37 -07:00
Liubov Dmitrieva
d687360349 display remote bookmarks that are in smartlog
Summary: display remote bookmarks that belongs to existing nodes in commit cloud smartlog

Reviewed By: krallin

Differential Revision: D27048074

fbshipit-source-id: 85d2a5bbf2e0c50cc28ca3e29f6b98b1d848cda2
2021-03-17 03:36:15 -07:00
Durham Goode
7ba5270539 tests: make test-debugdynamicconfig.t more robust
Summary: The zz could match temporary file names on Windows. Let's add the _ to make it more unlikely to match temp files.

Reviewed By: quark-zju

Differential Revision: D27100451

fbshipit-source-id: 5646bb2ad1e52b1f49c29729d424111601468c69
2021-03-16 22:23:40 -07:00
Chad Austin
6defcfe9d6 shelve: remove buck warning from shelve and unshelve
Summary:
Now that EdenFS and Watchman are compatible with hg shelve and other
rapid commit changes, this warning is no longer necessary.

This backs out D25337932 (c1659751c9).

Reviewed By: quark-zju

Differential Revision: D27095024

fbshipit-source-id: 31af1d2dafaa0f340a4ace10a16f9357ed84dbf0
2021-03-16 20:33:19 -07:00
generatedunixname89002005307016
0d67ab076a suppress errors in fbcode/eden - batch 1
Differential Revision: D27082204

fbshipit-source-id: b1d1562878ff55cf464c336aec02f8501967c60e
2021-03-16 17:32:09 -07:00
Jun Wu
e5f2a6b8ce localrepo: flush changelog before remotenames
Summary:
Currently it has write order issues:

  > hg pull
  searching for changes
  adding commits
  adding manifests
  adding file changes
  added 76503 commits with 0 changes to 0 files
  memory allocation of 369697160 bytes failed

  > hg up master
  abort: unknown revision 'master'!

Fix it by writing changelog first.

Reviewed By: DurhamG

Differential Revision: D27066479

fbshipit-source-id: 496319db2ce512a448af8a4e97db75211e2e97a6
2021-03-16 16:34:40 -07:00
Arun Kulshreshtha
a7f610e683 edenapi: remove no-op collect
Summary: This line just collects a vector into a vector. Probably a remnant of a refactor. Delete it.

Reviewed By: quark-zju

Differential Revision: D27091643

fbshipit-source-id: fb611aabea375b8495476401b2d9cdf7ba12fde1
2021-03-16 15:45:49 -07:00
Andrew Gallagher
fdf9827efb Remove dead get_build_rule_output_path() calls
Summary:
These appear to have been made effectively dead by cleanup in D25313325 (23daa7f90f).

This is part of unblocking the hashed buck-out rollout effort
(https://fb.prod.workplace.com/groups/fbcode.fyi/permalink/3694589863910121/),
as `get_build_rule_output_path()` relies on hard-coded buck-out paths.

Reviewed By: mzlee

Differential Revision: D27072131

fbshipit-source-id: 4fccee06a73c4afbf89cb737b25e1713a1afc55a
2021-03-16 14:23:31 -07:00
Jun Wu
59b8287c85 indexedlog: be compatible with MultiLog changes written by older software
Summary: This makes the new software respects writes by older software.

Differential Revision: D27093942

fbshipit-source-id: 097b57c61b5ee1f0264babb88737306113fe356a
2021-03-16 13:59:21 -07:00
Andrey Chursin
a43d7c5029 checkout: log when native checkout is used to scuba
Reviewed By: DurhamG

Differential Revision: D27064447

fbshipit-source-id: aabb79657e6e48779126733d0ab2b326c91e807e
2021-03-15 21:58:48 -07:00
Jun Wu
f2ed2600d2 test-sparse-fetch: improve robustness
Summary:
`hg stauts` can be "indeterministic" because of the last second mtime fix
special rule (see pytreestate/src/lib.rs:invalidatemtime).
The test sometimes fails like:

  test-sparse-fetch-t.py:140: [] != ['x', 'x/x']

Update it to support both `[]` and `['x', 'x/x']` case.

Reviewed By: sfilipco

Differential Revision: D27071225

fbshipit-source-id: c413906897b408c1e85912852afed1717a87ffc9
2021-03-15 20:04:54 -07:00
Jun Wu
b8fa495ea8 indexedlog: make finalize_indexes report more detailed error
Summary:
The error was triggered but it's unclear what's wrong. Make the error
more detailed.

Reviewed By: xavierd

Differential Revision: D27058212

fbshipit-source-id: 3f6220e2d100d9118c05a8b4c75c5ba19c9181db
2021-03-15 18:49:16 -07:00
Jun Wu
e312b57623 doctor: repair segmented changelog
Summary: Add repair logic for segmented changelog.

Reviewed By: sfilipco

Differential Revision: D27057695

fbshipit-source-id: 2c1c367ce161e830219f449993fbf371f9330f16
2021-03-15 18:45:07 -07:00
Jun Wu
b573e1b866 pydag: add API to repair NameDag
Summary: This will be used by `doctor` command.

Reviewed By: sfilipco

Differential Revision: D27053349

fbshipit-source-id: bc33e25997f30107f919a090ff68693bfdd7199d
2021-03-15 18:45:07 -07:00
Jun Wu
a904d5606d dag: move MultiLog OpenOptions to a DefaultOpenOptions
Summary:
By implementing DefaultOpenOptions, indexedlog provides `repair()` for free.

Re-export the `Repair` trait so other crates can use `repair()` without
importing indexedlog.

Reviewed By: sfilipco

Differential Revision: D27053352

fbshipit-source-id: 8fa952f0e51e007b9d348bc12699ef1d65000c6b
2021-03-15 18:45:07 -07:00
Jun Wu
6e85ede2c1 indexedlog: implement repair for MultiLog
Summary:
With the new log for MultiMeta. It's now possible to repair a MultiLog by:
- Repair all Logs
- Scanning through the MultiMeta Log and find a valid MultiMeta.
- Set the current MultiMeta to the picked MultiMeta.

Reviewed By: sfilipco

Differential Revision: D27053346

fbshipit-source-id: d60596fb00323b3bcadd5ade2e34cad29a37d64a
2021-03-15 18:45:07 -07:00
Jun Wu
f2f7d49a0a indexedlog: make a few APIs crate visible
Summary: They will be used later.

Reviewed By: sfilipco

Differential Revision: D27053348

fbshipit-source-id: 85b534873a4470532cde1f2b201469a034f08d55
2021-03-15 18:45:07 -07:00
Jun Wu
568ad7a7cb indexedlog: track multilog meta in a separate log
Summary:
We recently saw a few reports about "multimeta" being 0-sized. MultiLog cannot
be repaired like other logs because the logs (ex. IdDag and IdMap) have to be
in sync. To implement Repair for MultiLog, let's track MultiMeta in a Log so
we can check its previous entries and fix the multimeta.

Reviewed By: sfilipco

Differential Revision: D27053347

fbshipit-source-id: af99b13d658ee62bfe63973ab9d37338d14a7d4a
2021-03-15 18:45:06 -07:00
Jun Wu
7eea44ce4e test-doctor: improve robustness
Summary:
The test failed sometimes on Linux:

    --- test-doctor.t
    +++ test-doctor.t.err
    @@ -204,11 +204,11 @@
       M A2
       A A0
         A
    -  A X
       R A
       R A1
       ? B
       ? C
    +  ? X
       ? Y
       ? Z

The treestate fix appears to rollback to even a previous version, which is also
a valid fix. Let's accept that state too.

Reviewed By: DurhamG

Differential Revision: D27064825

fbshipit-source-id: 6aab04e66ad14ad651f93805c9652c7423178665
2021-03-15 18:22:50 -07:00
Jun Wu
c554c56494 test-fb-hgext-fastlog: improve robustness
Summary:
The test failed sometimes on OSX:

    --- test-fb-hgext-fastlog.t
    +++ test-fb-hgext-fastlog.t.err
    @@ -34,6 +34,7 @@
       $ hg log dir -T '{desc}\n'
       b
       a
    +  Exception in thread Thread-3 (most likely raised during interpreter shutdown): (no-eol)
       $ hg log dir -T '{desc}\n' --all
       b
       a2

The threading usage in fastlog does seem kind of risky (especially with async
Rust involved). Race condition in Py_Finalize is not at all fun. Let's just
make the test more robust for now. In the future we probably want to avoid
threading in fastlog.

Reviewed By: DurhamG

Differential Revision: D27064618

fbshipit-source-id: a6c2ee5eda0fbd5120c8b5e5cfcc7af0f158f9b9
2021-03-15 18:22:50 -07:00
Jun Wu
a4912b15c7 tests: fix flakiness of test-fb-hgext-remotefilelog-repack-remove-old.t
Summary:
The test is failing:

    --- test-fb-hgext-remotefilelog-repack-remove-old.t
    +++ test-fb-hgext-remotefilelog-repack-remove-old.t.err
    @@ -63,7 +63,7 @@
       -r--r--r--      80 *.datapack (glob)
       -r--r--r--      80 *.datapack (glob)
       -r--r--r--      80 *.datapack (glob)
    -  -r--r--r--     144 *.datapack (glob)
    +  -r--r--r--      80 ef52660a201e447b43868610b08c72e22067b8b2.datapack

We are migrating away from repack so I just made the test pass without
investigating what's going on exactly.

Reviewed By: sfilipco

Differential Revision: D27064249

fbshipit-source-id: 6bcd583b6ecbe0b373d9fec2b23269b0da6a27f3
2021-03-15 16:00:20 -07:00
Jun Wu
ffb23d32a3 dag: make Debug<Segment>::fmt print invalid segments
Summary: This makes it easier to spot problematic segments.

Differential Revision: D27025039

fbshipit-source-id: 44ae9eaf03ca54751b64c0cf977b78737eaa58f0
2021-03-12 17:23:48 -08:00
Jun Wu
062c21d4d8 destutil: exclude null in histedit rev selection
Summary: The Rust commit graph does not hardcode nullid. This avoids crashes in some cases.

Differential Revision: D27022659

fbshipit-source-id: 0f61ffd9da89de7a477470384c6015d9edfaaaa0
2021-03-12 17:14:17 -08:00
Jun Wu
ea61594e04 dag: add some validations about segment parents
Summary:
We saw the `unwrap()` panic at `iddag.rs:453`:

  let (new_idx, low, high, parent_count, has_root) = candidate.unwrap();

Reading the code, it seems it can only happen if one of `parents` is `high` in a segment.
Parents in a segment should all be < low.  Add some validations for that.

Reviewed By: sfilipco

Differential Revision: D27021394

fbshipit-source-id: 2c51713dfb8f07f2921229d8866f7e8a0bd9490f
2021-03-12 13:02:50 -08:00
Jun Wu
3525a5b1e3 io: do not clear progress if stdout is redirected
Summary:
For example, `hg log > a.txt`, writing to `a.txt` does not need to clear the
progress bars.

Reviewed By: andll

Differential Revision: D26886281

fbshipit-source-id: 392c50e62a854e03ea0c400a1dac8bfb900815a2
2021-03-12 11:39:10 -08:00
Jun Wu
d76c91096a hgcommands: drop indicatif progress bar
Summary:
The Rust progress bars now integrates with hg-http and all requests get
progress bars for free. There is no need for a separate bar.

Reviewed By: andll

Differential Revision: D26970747

fbshipit-source-id: c5e59c745e75a93e5da0541baab21c3f23dc1322
2021-03-12 11:39:10 -08:00
Jun Wu
be8e45cdd1 hgcommands: support Rust progress
Summary:
Render the progress bars in a Rust thread.
Also make it compatible with traditional Python progress bars (not the most efficient way because the Python still have its own progress thread, but the code change is minimal).

Reviewed By: andll

Differential Revision: D26886282

fbshipit-source-id: ad1f862ced278cc1cb90c37f576eb05f52a50b13
2021-03-12 11:39:10 -08:00
Jun Wu
f561d3b862 streams: increase commit text batch size to 10k
Summary: 100 and 5k seems too small - requests are too frequent.

Reviewed By: andll

Differential Revision: D26886276

fbshipit-source-id: cb5cce1111120f8a437fbc8c60906940588f38bc
2021-03-12 11:39:09 -08:00
Jun Wu
a7c3458c82 clidispatch: split dispatch() method
Summary:
Split `dispatch()` into 2 parts: config parsing and command execution.
This allows callsite to do extra work based on the config before running the
command.

Reviewed By: andll

Differential Revision: D26853749

fbshipit-source-id: 459918b43341f7e14df6958056b6e07453bb691b
2021-03-12 11:39:09 -08:00
Andrew Gallagher
44feabdeaf Codemod away get_build_rule_output_path()
Summary:
This uses the codemod tool from D26980571 to port uses of deprecated
`get_build_rule_output_path()` (https://www.internalfb.com/intern/wiki/Buck-users/buildoutput-paths/)
to resources (https://fburl.com/python-resources).

This is part of unblocking the hashed buck-out rollout effort
(https://fb.prod.workplace.com/groups/fbcode.fyi/permalink/3694589863910121/),
as `get_build_rule_output_path()` relies on hard-coded buck-out paths.

Reviewed By: aniketmathur

Differential Revision: D26981028

fbshipit-source-id: d8cc70a2df3167d9e1961efa530ca639131f45fa
2021-03-12 09:09:02 -08:00
Andrey Chursin
e1ce22be1e async-runtime: introduce (try_)block_unless_interrupted
Summary: This method should be preferred to use from python binding. It is similar to block_on but allow to interrupt future on Ctrl+C

Reviewed By: quark-zju

Differential Revision: D26894586

fbshipit-source-id: 02d8fbb2f9c4d9e585f8fbee51bfc400c402d0d2
2021-03-12 09:04:04 -08:00
Andrey Chursin
6ed54d0317 checkout: switch to Bytes::to_vec since it is fixed now
Summary: See removed comment for detals

Reviewed By: quark-zju

Differential Revision: D26966487

fbshipit-source-id: 600c73fdec22180d7814608ecf1c3c9354fee5a1
2021-03-12 09:04:04 -08:00
Andrey Chursin
b67b2f21e1 checkout: handle sparse profile change file duplication
Summary:
During sparse profile change, there might be a case when file has changed between checkouts, and also is added due to sparse profile change

Currently this would lead to creating duplicated update action that would waste resources. This diff deduplicates such action

Reviewed By: quark-zju

Differential Revision: D26953657

fbshipit-source-id: ccd9084cc3984ac0692ee6178fce018a94cd56e7
2021-03-12 09:04:03 -08:00
Andrey Chursin
1e6ed3059c checkout: strip metadata from value returned by storage
Summary:
Current store implementation returns value that may contain matadata.
We need to strip it before writing out file to disk

This is not going to be a problem with new Eden API, but it is not erady yet and rolling it out may take time
So in order to start testing native checkout now, we are incorporating metadata removal in the checkout code

Reviewed By: quark-zju

Differential Revision: D26953658

fbshipit-source-id: 05d8be55bb96e7c3162594498ef0b9944b422c90
2021-03-12 09:04:03 -08:00
Rafael Catalão Lopes Perrella
f0f6d57e9b Fix package boundary violations
Reviewed By: yfeldblum

Differential Revision: D26944733

fbshipit-source-id: c67250ca846732cbcc456ae39a5cc58cd38498e6
2021-03-12 04:03:53 -08:00
Jun Wu
e9d5bed659 hg-http: add API to integrate with progress/model
Summary:
Add a way to register an IO time series showing total network I/O, and register
download progress bars for requests.

Reviewed By: andll

Differential Revision: D26853750

fbshipit-source-id: 42c4ab9724c60db9612a2bc419ca3bceaa667647
2021-03-11 17:19:14 -08:00
Jun Wu
2f032a420a http-client: add a callback for all requests
Summary:
It turns out there are multiple users sending requests bypassing the
HttpClient, like the LFS in revisionstore, or the segmented changelog
clone.

Requests bypassing HttpClient means HttpClient event callbacks do not
have a chance to insert progress and bandwidth monitoring. So let's
add another callback that can capture what HttpClient misses. This would allow
us to get proper progress bars of revisionstore LFS and segmented clone without
changing their code.

Reviewed By: andll

Differential Revision: D26970748

fbshipit-source-id: 5133bc6f9eeb14a6d2944d253bc66cefd49c83c5
2021-03-11 17:19:14 -08:00
Jun Wu
44df77ef6b pyprogress: expose Rust progress model and render
Summary: Expose Rust's progress model so Python can operate on them.

Reviewed By: andll

Differential Revision: D26886283

fbshipit-source-id: 843de4cd2d8d22aba014ee097b0fee2feeb6ee43
2021-03-11 17:19:14 -08:00
Jun Wu
a310122ce2 progress: add a sub-crate for rendering progress
Summary: Add a simple way to render progress into a multi-line string.

Reviewed By: andll

Differential Revision: D26853751

fbshipit-source-id: 4f1de55e7bb03f607d683eff16e035aa5d1476c1
2021-03-11 17:19:14 -08:00
Jun Wu
309bcb5424 progress: add a registry
Summary:
Add a struct to "register" progress data for Rust to render them.
Note: The "registry" only tracks the data. Rendering will be
implemented separately.

Reviewed By: andll

Differential Revision: D26615606

fbshipit-source-id: affa663660bd52a2583d40e3b28f0b65480851a3
2021-03-11 17:19:13 -08:00
Jun Wu
6ffd0573ac progress: add model about progress bar
Summary: Add an API to render the time series samples into ASCII graph.

Reviewed By: andll

Differential Revision: D26836633

fbshipit-source-id: 9c7a757e46c28c810fb3e0671a775fde16318f54
2021-03-11 17:19:13 -08:00
Jun Wu
916f4c558f progress: add model about cache hit statistics
Summary: This could be used for showing overall statistics

Reviewed By: andll

Differential Revision: D26886280

fbshipit-source-id: a52f057dbbebb441d0eee14860275f2690c7a3a3
2021-03-11 17:19:13 -08:00
Jun Wu
1af1506ba7 progress: render time series into scaled values
Summary: Add an API to render the time series samples into an array that can be further turned into an ASCII graph.

Reviewed By: andll

Differential Revision: D26615170

fbshipit-source-id: 4a2f178869c235e7dda3edef7930a6e04bc4bda3
2021-03-11 17:19:13 -08:00
Jun Wu
216bb6d1f2 progress: add a time series type for keeping samples
Summary: Continue with last change. Add a time series type that keeps samples.

Reviewed By: andll

Differential Revision: D26615171

fbshipit-source-id: 5dcc775820d782ac502d84b6af5e270f2a9072ee
2021-03-11 17:19:12 -08:00
Jun Wu
2b3d131b9e progress: add a "Sample" type for measuring IO
Summary:
Going to add some kind of "time series" graph based on periodical sampling.
Add the sample structure for IO with some simple math helpers.

Reviewed By: kulshrax

Differential Revision: D26615173

fbshipit-source-id: 4d610f435a3c7913e8bb31a8de0738ffb3de1468
2021-03-11 17:19:12 -08:00
Jun Wu
0066271bb5 progress: add a model sub-crate
Summary:
Going to add some kind of data model definitions for pure Rust logic.

Use a dedicated crate so progress model and rendering are separate. If the
rendering logic becomes bloated somehow, it won't affect the data models.
The idea is that only application-level logic like `hgcommands` care about
rendering. Other use-cases only care about pure progress states.

Reviewed By: andll

Differential Revision: D26836634

fbshipit-source-id: 5222d2f9fb4894bd246c62ad48e1c5fc982e2fa6
2021-03-11 17:19:12 -08:00
Durham Goode
541aa5daa8 tests: fix test-config.t on Windows
Summary: A recent diff modified this test and accidentally introduced a mismatch with Windows. Let's glob out the different path separators.

Reviewed By: quark-zju

Differential Revision: D26997063

fbshipit-source-id: 3cbe1f1fa748f8282fe16ee3d38f23519c87f6b9
2021-03-11 16:03:11 -08:00
Jun Wu
a9301bf00b util: handle isatty is missing on 'out'
Summary: With `ui.pushbuffer`, `out` can be `ui`, and it does not have `isatty()`.

Reviewed By: DurhamG

Differential Revision: D26992865

fbshipit-source-id: 1725291ba5ab3b7ccd8702fbb9df7213a05e3350
2021-03-11 14:28:27 -08:00
Stefan Filip
5a0206228f edenapi: add more context to errors
Summary: Makes debugging network issues easier to pinpoint.

Reviewed By: kulshrax

Differential Revision: D26967561

fbshipit-source-id: 41037bb120195cffe88f5c95ee9bde6de830f37c
2021-03-11 11:33:59 -08:00
Durham Goode
413086f4ff dynamicconfigs: rename config path location to config_dir
Summary:
Previously we referred to the config location as the repo_path or
repo_dir. In an upcoming diff we'll support NoRepo configuration, so let's
rename this to config dir and support using cache_dir as a config dir if there
is no repo. That code path isn't actually used in this diff though.

Reviewed By: kulshrax

Differential Revision: D26801061

fbshipit-source-id: 72cd672f65ca10821882ee9124fd4a293ead7257
2021-03-11 10:13:37 -08:00
Durham Goode
f86a7fcdd1 dynamicconfig: make NoRepo an explicit option
Summary:
Previously we assumed there was always a repository. In an upcoming
diff we'll support configuring Mercurial without any repository. To support that
let's add a representation of NoRepo to the dynamicconfig structure and update
all uses to use that.

Nothing will currently create a NoRepo, but that will come in a later diff.

Reviewed By: kulshrax

Differential Revision: D26801060

fbshipit-source-id: d8e9066c865921f45e068c799ac8acb8eec32acd
2021-03-11 10:13:37 -08:00
Durham Goode
addb3c4e81 dynamicconfig: move validation into pure Rust
Summary:
Pure Rust commands weren't loading dynamicconfigs correctly because the
validation was happening in Python. This diff moves it down into Rust so that
all config loading gets the same validation.

Also removes the hard coded list of files to validate. I'll add this to
configerator to make it easier for us to edit.

Also removes the configs.validatedynamicconfig option. Validation is on
everywhere and should just be on by default.

Reviewed By: kulshrax

Differential Revision: D26680075

fbshipit-source-id: f206198154801f655b4b277cdb22a728d0004b5f
2021-03-11 10:13:36 -08:00
Durham Goode
ed7b192f9a configs: pin --configfile configs
Summary:
Previously, only --config configs were pinned in the uiconfig. "pinned"
means that no matter what values were loaded underneath, those pinned values
would not be changed. This allows CLI specified configs to take precendence
regardless of what and when config files are loaded. --configfile configs were
not pinned in the same way, despite it seeming like they should be pinned. In
fact, during clone we "reload" the config, which causes the --configfile value
to be lost.

Let's make --configfile pin all of it's configs as well.

This has a bit of an unfortunate side effect. When we do clone via hg-clone we
pass --configfile /etc/mercurial/repo-specific/$REPO.rc so the clone has the
right configuration. This diff means that those values are now loaded in a
pinned state, so dynamicconfig cannot overwrite them and the values cannot be
deny-listed.

The longterm solution to this would be to stop using --configfile during clone,
and instead use --config remotefilelog.reponame=$REPO and allow dynamicconfig to
generate the rest. But for now it's probably fine to let them be pinned.

Reviewed By: quark-zju

Differential Revision: D26677599

fbshipit-source-id: 2837a5b5d14bb42b49eaf9d1d0019f2ea0620a9e
2021-03-11 10:13:36 -08:00
Durham Goode
36b6b30e0d clone: move dest repo creation earlier in clone
Summary:
We've had a few issues recently where clones failed because of
unexpected config load ordering. The main problem is that we can't load repo
configs until the repo is created and the .hg/hgrc created. This happened rather
late in the process, for instance it happened after the source connection was
created, so no repo-specific dynamicconfigs could affect the source connection.

This diff moves the destination repo creation earlier in the clone process,
which will load the appropriate dynamicconfigs before we connect to the clone
source. This removes the last usage of applydynamicconfig, which will be deleted
in the next diff.

Reviewed By: quark-zju

Differential Revision: D26676519

fbshipit-source-id: 9a0f0b2ac0d9f19b8bb6fbaf26b4a5e7fb803399
2021-03-11 10:13:36 -08:00
Durham Goode
0026cbfa23 clone: move repo creation earlier in the localrepo constructor
Summary:
We've had a few issues recently where clones failed because of
unexpected config load ordering. The main problem is that we can't load repo
configs until the repo is created and the .hg/hgrc created. This happened rather
late in the process, for instance it happened after the source connection was
created, so no repo-specific dynamicconfigs could affect the source connection.

This diff moves basic repo creation (the directory, the .hg, and the .hg/hgrc)
earlier in the repo creation process and loads dynamicconfigs before proceeding.
This eliminates the use of applydynamicconfig in the localrepo constructor.

The next diff moves repo creation earlier in the clone process to then benefit
from this, and removes the final use of applydynamicconfig, thus preventing
config load ordering issues.

Reviewed By: quark-zju

Differential Revision: D26676520

fbshipit-source-id: 8784f2483909a50e8be9eb1a7adf03e8807ef076
2021-03-11 10:13:36 -08:00
Durham Goode
b38cc98e54 vfs: add a few Debug derives
Summary: These were generally useful when debugging native checkout.

Reviewed By: quark-zju

Differential Revision: D26955400

fbshipit-source-id: 967a4fa2d831b8b060409a5f7be31a1416c1ba63
2021-03-11 10:07:04 -08:00
Mark Juggurnauth-Thomas
d03c68396f smartlog: add focused branch revset
Summary:
Add the `focusedbranch` revset.  This expands to the current draft branch, plus
any commits that are related to the branch via commit mutation and their
descendants.

This can be used as the revset for `hg smartlog` to give a more focused smartlog
that shows only the changesets relevant to the current stack.

Reviewed By: quark-zju

Differential Revision: D26852107

fbshipit-source-id: 9723935bf3bf900f8e109d4f507ae1db6627807e
2021-03-11 08:40:00 -08:00
Stanislau Hlebik
acf26beb79 mononoke: add an option to record committer fields in hg extras
Summary:
When generating hg changesets from git changesets we can run into a situation
where two git commits are almost completely identical with the exception of
committer field. Currently it results in us generating identical mercurial
changesets for different bonsai changesets, and this is something we do not
allow.

Let's do the same thing as hggit does i.e. record committer field in extras if
committer is different from author.

In case of ambiguities (i.e. committer extra is already set, or committer date is set but committer name is not) I opted for returning an error instead of trying to guess what the correct field should be.

Reviewed By: farnz

Differential Revision: D26867740

fbshipit-source-id: 6271e2f7ad421bec296c60ff211723c2162878c6
2021-03-10 23:41:28 -08:00
Jun Wu
f8e2d8fd84 io: provide a way to set progress without IO reference
Summary:
Similar to `output()`, and `error()`, provide a `progress()` to support setting
progress without needing `&IO`.

Reviewed By: andll

Differential Revision: D26886278

fbshipit-source-id: a54563a9cf1d9d1cdb9dabe945aeb5ed1d84e8fb
2021-03-10 19:37:00 -08:00
Jun Wu
123789ea85 io: move set_progress implementation to inner
Summary: The method will be reused.

Reviewed By: andll

Differential Revision: D26886279

fbshipit-source-id: 5e82c53bf37aedaab4d6b14ee68be3420c613063
2021-03-10 19:37:00 -08:00
Jun Wu
f629c0097d io: flush progress output
Summary: Make sure the progress is not hidden because of buffering.

Reviewed By: singhsrb

Differential Revision: D26886277

fbshipit-source-id: d44e48e67b4529a181dd36c30e92608654d8fea6
2021-03-10 19:36:59 -08:00
Jun Wu
2a4db136e5 mergetools: add new conflict marker format with diffs in
Summary:
Written by Martin von Zweigbergk at https://phab.mercurial-scm.org/D9551,
or https://www.mercurial-scm.org/repo/hg/rev/bdc2bf68f19e.
He suggested it and it's a useful feature. I did minor compatibility changes
(encoding, avoid rev numbers, foo_bar -> foobar).

Original commit message:

I use 3-way conflict markers. Often when I resolve them, I manually
compare one the base with one side and apply the differences to the
other side. That can be hard when the conflict marker is large. This
patch introduces a new type of conflict marker, which I'm hoping will
make it easier to resolve conflicts.

The new format uses `<<<<<<<` and `>>>>>>>` to open and close the
markers, just like our existing 2-way and 3-way conflict
markers. Instead of having 2 or 3 snapshots (left+right or
left+base+right), it has a sequence of diffs. A diff looks like this:

```
------- base
+++++++ left
 a
-b
+c
 d
```

A diff that adds one side ("diff from nothing") has a `=======` header
instead and does not have have `+` prefixed on its lines. A regular
3-way merge can be viewed as adding one side plus a diff between the
base and the other side. It thus has two ways of being represented,
depending on which side is being diffed:

```
<<<<<<<
======= left
contents
on
left
------- base
+++++++ right
 contents
 on
-left
+right
>>>>>>>
```
or
```
<<<<<<<
------- base
+++++++ left
 contents
 on
-right
+left
======= right
contents
on
right
>>>>>>>
```

I've made it so the new merge tool tries to pick a version that has
the most common lines (no difference in the example above).

I've called the new tool "mergediff" to stick to the convention of
starting with "merge" if the tool tries a regular 3-way merge.

The idea came from my pet VCS (placeholder name `jj`), which has
support for octopus merges and other ways of ending up with merges of
more than 3 versions. I wanted to be able to represent such conflicts
in the working copy and therefore thought of this format (although I
have not yet implemented it in my VCS). I then attended a meeting with
Larry McVoy, who said BitKeeper has an option (`bk smerge -g`) for
showing a similar format, which reminded me to actually attempt this
in Mercurial.

Reviewed By: DurhamG

Differential Revision: D26947920

fbshipit-source-id: 8b4446862897ff9a6dfdf5a2e35617d4db09e883
2021-03-10 17:29:18 -08:00
Jun Wu
16564f94c9 minibytes: into_vec cannot use fast path if the vec is sliced
Summary:
Add a check to ensure the `into_vec()` fast path do not take the full vec if
the `Bytes` is sliced.

Reviewed By: andll

Differential Revision: D26966453

fbshipit-source-id: 538dfb8ca2f01a46d1ede7b98b7f0a30fc7a786e
2021-03-10 17:16:53 -08:00
Durham Goode
9b3dacb521 fsmonitor: add fsmonitor.watchman-query-lock
Summary:
VS Code is seeing issues where they are accidentally triggering
multiple hg status calls, which trigger multiple expensive watchman queries.
While they're trying to track down why this is happening, they'd like a config
that would enable hg to only run one of their status calls at a time.

Reviewed By: quark-zju

Differential Revision: D26931193

fbshipit-source-id: 3b36ac06217bb506110b8d708d4a74378245d5bb
2021-03-10 17:07:08 -08:00
Jun Wu
cb39612472 visibility: extract pure deserialization to a function
Summary: Similar to D26924712 (1225d154d8). It'll be reused elsewhere.

Reviewed By: kulshrax

Differential Revision: D26935028

fbshipit-source-id: 26e1271a4fc61559a2f659d052a6adbf509eace3
2021-03-10 16:49:59 -08:00
Jun Wu
44a226e7e6 error: make BadResponseError also RepoError
Summary:
RepoError prints `!` at the end of `abort:`. This maintains the old behavior
and should fix test breakages like:

     $ hg clone 'ssh://fakehost|touch%20owned/path'
     destination directory: path
  -  abort: no suitable response from remote hg!
  +  abort: no suitable response from remote hg
     [255]

Reviewed By: DurhamG

Differential Revision: D26964146

fbshipit-source-id: 2e6d095b82ce1e2e23a353cf8f06ae844ee872d7
2021-03-10 16:01:52 -08:00
Jun Wu
33b28a117e smartlog: limit commits to show
Summary:
There are a report of slow smartlog that tries to show 8M nodes in `draft()`.
That is an issue after the automatic bookmark clean up, and the visible heads
incorrectly make large amount of commits draft.

Reviewed By: kulshrax

Differential Revision: D26934644

fbshipit-source-id: 0c0890f8eaf1422dab9c03159a419800ae7247ca
2021-03-10 15:24:39 -08:00
Jun Wu
a22c4883f3 context: make memctx.mirror copy mutinfo and loginfo
Summary: Those were previously ignored incorrectly.

Reviewed By: kulshrax

Differential Revision: D26957315

fbshipit-source-id: 5366460c1368ab9a83471d092bb860cc85fb64c3
2021-03-10 15:20:14 -08:00
Durham Goode
5276ded496 watchman: log when hg checkout triggers watchman recrawls
Summary:
We're seeing issues where watchman is frequently having to recrawl the
repository due to fsevents getting dropped. We believe this is caused by large
amounts of IO, but we're not sure from what process (buck? hg? arc? ide?). Let's
add some logging to Mercurial to estimate when a checkout triggers a recrawl.

Reviewed By: xavierd

Differential Revision: D26931996

fbshipit-source-id: 0026c792f0ec216cb3e98424da819c4c6e925072
2021-03-10 14:22:44 -08:00
Jun Wu
b1547cad1a bookmarks: clean up visibleheads if remotenames are removed
Summary:
Visible heads can overlap with scratch remote bookmarks, and in bad cases
(before D26792731 (7a759b6075)), overlap with public remotenames.

When we remove remotenames we need to remove referred nodes in visibleheads
too so we don't end up with massive draft commits.

Reviewed By: DurhamG

Differential Revision: D26954215

fbshipit-source-id: 91010e6608d0150ecf374ce31705e97712154b27
2021-03-10 11:55:53 -08:00
Jun Wu
3fdd766b65 bookmarks: clean up scratch remotenames
Summary:
Scratch remote bookmarks are considered draft() and were not cleaned up.
Practically there are users with 100+ scratch remote bookmarks. Let's
clean them up too.

Note the commit still remain visible, which will be fixed in upcoming
diffs.

Reviewed By: DurhamG

Differential Revision: D26954216

fbshipit-source-id: e84f99e4e914f0c5169583fc9f60084f23664e02
2021-03-10 11:55:53 -08:00
Andrey Chursin
a3b1e04c7e async_runtime: block_on_future to call block_on_exclusive
Summary:
Current `block_on_future` implementation is not safe, as it does not panic on nested calls. Nesting `block_on_future` calls causes starvation of tokio scheduler processes and eventually will lead to deadlock if nested too many times

This diff simply calls `block_on_exclusive` from `block_on_future`. When we see that this does not cause problems we can simply remove `block_on_future`

Reviewed By: sfilipco

Differential Revision: D26899522

fbshipit-source-id: 93794bf2c5908421691dfb094d1807266c9ecd8d
2021-03-10 11:20:45 -08:00
Jun Wu
ea9cac2520 fsync: add allheads and lfs to fsync list
Summary:
Johan Schuijt-Li found they are broken on some CI hosts.
(But other store paths seem okay, which might indicate the fsync list is effective)

Reviewed By: DurhamG

Differential Revision: D26950101

fbshipit-source-id: e3bcd3f77636325be9e9ce8dfded8b17ec68f436
2021-03-10 11:06:10 -08:00
Thomas Orozco
f5f78c4906 third-party/rust: update tokio & tokio-stream
Summary:
Pulling this for those 2 PRs:

- https://github.com/tokio-rs/tokio/pull/3547
- https://github.com/tokio-rs/tokio/pull/3576

Reviewed By: ahornby

Differential Revision: D26944216

fbshipit-source-id: ad67afa69cb291cfb1622cf4b2a10727a13d19cd
2021-03-10 11:01:28 -08:00
Jun Wu
cac01986ae debugreseteads: command to reset heads to a fresh state
Summary: This is intended to be used in Sandcastle / OnDemand use-cases to provide a cleaner state.

Reviewed By: DurhamG

Differential Revision: D26924711

fbshipit-source-id: a37d24a10c99d953e2af842f729ef634cbb2e2f9
2021-03-10 10:44:44 -08:00
Durham Goode
cf95f40455 py3: fix eol filemerge logic
Summary:
Some merge-tools, like kdiff3, are configured to fix end of line stuff.
This code breaks in Python 3.

Reviewed By: quark-zju

Differential Revision: D26932815

fbshipit-source-id: 7601d53616e50961b89bbc4b0340a9fb672293ef
2021-03-10 09:39:46 -08:00
Jun Wu
1225d154d8 visibility: extract pure serialization to a function
Summary: It'll be reused elsewhere.

Reviewed By: kulshrax

Differential Revision: D26924712

fbshipit-source-id: 0be666a1acd0bdfbc14bd39d4193a06a9929eed7
2021-03-09 18:52:24 -08:00
Jun Wu
3db2121dec async-runtime: add a way to spawn task using the runtime
Summary: This API will be used to spawn tasks in the runtime.

Reviewed By: andll

Differential Revision: D26615607

fbshipit-source-id: 6b9892fad755bbe8feb775e9dad457697b2ea1b7
2021-03-09 11:45:28 -08:00
Jun Wu
846050ea0f changelog: disable migrating backend for hgsql repos
Summary: hgsql can only use traditional revlog. Disable changelog migration for it.

Reviewed By: kulshrax

Differential Revision: D26891252

fbshipit-source-id: 36c5a448d4fcad15b3415e4534448a945f6d0b4b
2021-03-08 15:58:36 -08:00
Jun Wu
5b7b35d399 changelog: add missing changelog type logging
Summary: A few types weren't logged properly. Add them.

Reviewed By: kulshrax

Differential Revision: D26891253

fbshipit-source-id: 64f59c56663b4f395679307df4a75dcff1ff811f
2021-03-08 15:58:36 -08:00
Stefan Filip
95ab9679e2 error: fix constructor for NetworkError
Summary: hint is an expected valid keyword argument.

Reviewed By: quark-zju

Differential Revision: D26896943

fbshipit-source-id: 006413838fbfa63eccc24cbc98d0e713d5237a69
2021-03-08 14:56:26 -08:00
Arun Kulshreshtha
c94dfbcc38 clidispatch: pass repo path to config contructor in from_raw_path
Summary: We weren't passing a repo path when initially loading the repo's config in `clidispatch`. This meant that the resulting `ConfigSet` didn't contain values from the shared-repo `.hgrc.dynamic`. Evidently, some other code path in Python would eventually add these values, but this meant that pure-Rust commands could not see config values set via dynamicconfig. Passing the path fixes the problem.

Reviewed By: DurhamG

Differential Revision: D26508980

fbshipit-source-id: 65f187d18098a08c81325e78cb02a8ed854c739a
2021-03-08 13:31:10 -08:00
Jun Wu
02ff6e200c remotenames: clean up bookmarks that are ancestors of master
Summary:
See the previous diff for motivation. This removes bookmarks that are
ancestor of master, too. This is important in practice.

Reviewed By: DurhamG

Differential Revision: D26889412

fbshipit-source-id: 255722ed5b486e88ef56e7e378fae3f1113d5fbe
2021-03-08 11:28:40 -08:00
Jun Wu
2e353eb4ce tests: add a test showing release bookmarks aren't automatically cleaned up
Summary:
The auto cleanup was conservative. It keeps `::draft()`. But that means
ancestors of public commits are not cleaned up. Not all release branches
branch off the master branch.

Reviewed By: DurhamG

Differential Revision: D26889413

fbshipit-source-id: c6a8e3f32cf1f7d2ffe74b7ecd183f4e583949bb
2021-03-08 11:28:40 -08:00
Stefan Filip
f172c2f8ae mononokepeer: wrap read exceptions with NetworkError
Summary:
This allows for errors raised in these cases to be retried. Most notable is
the timeout error.

Reviewed By: johansglock

Differential Revision: D26855441

fbshipit-source-id: 6137ed1755072d43dbdd25fa092ddb21c8669aa3
2021-03-08 08:06:01 -08:00
Stefan Filip
573c25553a mononokepeer: add timeout to socket
Summary:
No timeout is set up by default so the process wait forever when reading bytes
in cases where the connection is lost somehow.

Reviewed By: johansglock

Differential Revision: D26855443

fbshipit-source-id: d741f73e7186fe862f3d78a806f3219c2cbe7e0a
2021-03-08 08:06:00 -08:00
Stefan Filip
882c8c70a7 mononokepeer: prefer NetworkError over Abort
Summary:
Abort one of the most general exceptions in Mercurial. In theory it should be
something that isn't handled. We can say at least that it shouldn't be retried.
For thing that may be transient it is better to use a different type of
exception. NetworkError is something is checked and retries in a few places so
that seems like a natural candidate.

Reviewed By: johansglock

Differential Revision: D26855444

fbshipit-source-id: f15c723293a416b5f44a6592927e3500f3b0b7d5
2021-03-08 08:06:00 -08:00
Stefan Filip
51367f0312 error: generalize NetworkError to all network read errors
Summary: Timeouts are another class of errors that are relevant.

Reviewed By: johansglock

Differential Revision: D26855442

fbshipit-source-id: 8ebb83714fa3d7a2f4efcbed8bd512c98301b49d
2021-03-08 08:06:00 -08:00
Andrey Chursin
a43f073d9d checkout: use async_vfs in native checkout
Summary: The goal is to reduce load on tokio scheduler by using threads & channels instead of spawning new task every time

Reviewed By: DurhamG

Differential Revision: D26801249

fbshipit-source-id: a8d9accc721c7ffc981fd538c06ab8cbd908f715
2021-03-05 21:47:51 -08:00
Andrey Chursin
0be8e8ce29 vfs: introduce AsyncVfs
Summary:
AsyncVfs provides async vfs interface.
It will be used in the native checkout instead of current use case that spawns blocking tokio tasks for VFS action

Reviewed By: quark-zju

Differential Revision: D26801250

fbshipit-source-id: bb26c4fc8acac82f4b55bb3f2f3964a6d0b64014
2021-03-05 21:47:51 -08:00
Andrey Chursin
6c7b0134a3 vfs: make clear_conflicts private
Summary: This function is now internal details of vfs, and is not used outside of it. Making it private so it won't be accessed outside

Reviewed By: quark-zju

Differential Revision: D26801251

fbshipit-source-id: 03434e235978fa0745128d90ea0c5975ea662ff1
2021-03-05 21:47:50 -08:00
Lukas Piatkowski
ad106958f2 eden/scm/lib: autogenerate all Cargo.toml files with autocargo
Summary: This diff removes the split between manually managed and autocargo managed Cargo.toml files in `eden/scm/lib`, now all files are autogenerated.

Reviewed By: quark-zju

Differential Revision: D26830884

fbshipit-source-id: 3a5d8409a61347c7650cc7d8192fa426c03733dc
2021-03-05 04:29:49 -08:00
Mateusz Kwapich
34b4972bdd skip deletion of root directory
Summary:
The GitTreeDict throws when we're trying to remove the root directory but there
are valid situations where the Tree becomes briefly empty. One of such is a
commit where all the files in the repo are moved. We process the deletions
first. Then we proceed with additions.

Reviewed By: DurhamG

Differential Revision: D26778717

fbshipit-source-id: 6caa1709ff2c5e78d4745336b0527af4bb20ec60
2021-03-05 02:56:29 -08:00
Durham Goode
ee45deeeb2 clone: add option to enable nativecheckout during clone
Summary:
Native checkout avoids the initial large prefetch, and instead does
small batch prefetches and immediately writes them to disk. This will prevent
the issue where data in the cache is evicted before it's used and has to be
redownloaded in a non-batch fashion later.

In a future diff, using native checkout will also allow us to serialize and
deserialize it's CheckoutPlan, so we can make clones resumable.

Reviewed By: quark-zju

Differential Revision: D26825773

fbshipit-source-id: 6fde90cd7578f6af5fdd4ac78004f7f63af4f287
2021-03-04 17:22:51 -08:00
Liubov Dmitrieva
d1c309ab17 remotebookmarks: check the remote when checking essential selective pull remote bookmarks
Summary: the list of configured default selective pull bookmarks are actually related to the hoist namespace I think when we consider what is protected and what is not.

Reviewed By: quark-zju

Differential Revision: D26814708

fbshipit-source-id: 566f363f1e6b88dd2ebc6e33cfb6eba596493988
2021-03-04 15:23:16 -08:00
Jun Wu
fd1bbe92f8 fsync: sync parent directories on POSIX systems
Summary:
On POSIX systems it's a good practice to fsync directories to ensure metadata
about a file is properly written.

Reviewed By: DurhamG

Differential Revision: D26822211

fbshipit-source-id: fca10c702b480f22020ad184eb55c8879999f0ee
2021-03-04 12:23:48 -08:00
Jun Wu
f10466c9f1 dirsync: do not wrap remote repo
Summary:
Typical mistake of `reposetup` - the `repo` object might be remote and lack of
local repo methods.

Reviewed By: DurhamG

Differential Revision: D26822960

fbshipit-source-id: 54fb95c51b09ef5021b0a10a93b4509e7aa4a115
2021-03-04 11:38:28 -08:00
generatedunixname89002005307016
0124627d4b suppress errors in fbcode/eden - batch 1
Differential Revision: D26753306

fbshipit-source-id: 335f45b534c6544eaf06e9d42fb16d758f8b0a5e
2021-03-04 11:03:06 -08:00
Stefan Filip
07750d0a3a notes: add 2019-10 Manifests, Past and Future
Summary:
I moved the source of the sphinx project to newdoc for newdoc/dev.
I updated the sphinx config for markdown to something that works for recent
versions.
PNG images rendered better than SVG for me.
I moved the TARGETS to newdoc.

Reviewed By: quark-zju

Differential Revision: D26801426

fbshipit-source-id: 3ae51e886d27f848f0f6a48c96056da607d8da45
2021-03-04 08:52:27 -08:00
Stefan Filip
1162e2ba0e gitignore: track Makefile under scm
Summary:
Mercurial uses Makefile here to build stuff. We want to track Makefile under
scm.

Reviewed By: quark-zju

Differential Revision: D26802165

fbshipit-source-id: 1fe8db13d50c07a6a0681180959eba22eaf8d486
2021-03-04 08:52:27 -08:00
Thomas Orozco
2a803fc10d third-party/rust: update futures
Summary:
Those newer versions of Futures have compatibility improvements with Tokio,
notably:

- https://github.com/rust-lang/futures-rs/pull/2333
- https://github.com/rust-lang/futures-rs/pull/2358

Reviewed By: farnz

Differential Revision: D26778794

fbshipit-source-id: 5a9dc002083e5edfa5c614d8d2242e586a93fcf6
2021-03-04 06:42:55 -08:00
Jun Wu
e70d89dd39 py3: fix absorb -i
Summary:
The previous fix D23357655 (d60e80796a) actually only fixes py2 absorb -i. On Python 3,
`b"-"[0]` is `45`, not `b"-"` like Python 2. Fix it again using `b"-"[0:1]`.

Reviewed By: singhsrb

Differential Revision: D26805315

fbshipit-source-id: 07ca850373a6bc49b561466ead478024631ce051
2021-03-03 20:50:31 -08:00
Xavier Deguillard
d9207cbe4e backingstore: do not initialize memcache for debug builds
Summary:
Memcache is dogslow to initialize, taking >30s on debug build. As a
consequence, this slows down every single test by that amount time, with the
guarantee that no blobs will be found in memcache, ie: a total waste of time.

On release builds, Memcache is significantly faster to initialize, so let's
only disable initializing Memcache for debug builds only.

Reviewed By: fanzeyi

Differential Revision: D26800265

fbshipit-source-id: 8b393c603414de68268fdadb385de177e214a328
2021-03-03 20:14:46 -08:00
Durham Goode
f22e274e94 py3: add py3 windows package to hgbuild
Summary:
Adds a new hg py3 windows package to hgbuild for publishing. Currently
the tests don't run. I'll do that next.

Reviewed By: quark-zju

Differential Revision: D26768336

fbshipit-source-id: bd4533abbbc1e1c861aa9995b7a3868a7f6a1a22
2021-03-03 19:52:54 -08:00
Jun Wu
4afd737525 hide: cleanup non-essential remote bookmarks automatically
Summary: Trigger the cleanup logic automatically if there are too many remote bookmarks.

Reviewed By: sfilipco

Differential Revision: D26802251

fbshipit-source-id: 1ab40c7be98c507865ea17001dc9775b6edf4446
2021-03-03 18:30:08 -08:00
Jun Wu
01035df3a4 hide: make --cleanup remove non-essential remote bookmarks
Summary: This is handy to make the `sl` output cleaner.

Reviewed By: sfilipco

Differential Revision: D26802250

fbshipit-source-id: 1b74f3d9a42ab6b0780f07bec59b03a5cd0ea6a9
2021-03-03 18:30:08 -08:00
Jun Wu
e33255b67d remotenames: add a command to clean up remote bookmarks
Summary: Add API and command to remove non-essential remote bookmarks

Reviewed By: sfilipco

Differential Revision: D26802252

fbshipit-source-id: bf715905f146f31aac19dccb90022bea31392323
2021-03-03 18:30:07 -08:00
Jun Wu
4abfeb66e8 remotenames: raise if key bookmarks point to unknown commits
Summary:
Previously remotenames pointing to unknown commits are just ignored.
If key remotename like master is ignored, it can cause very slow operations
in pull, etc. Let's just raise an exception in this case.

Reviewed By: DurhamG

Differential Revision: D26800236

fbshipit-source-id: 13be4af5499da1b9098b4ff1a6ef41c54092824a
2021-03-03 18:20:05 -08:00
Jun Wu
7a759b6075 visibility: remove public heads
Summary:
Remove public heads when using Rust changelog backends. This should address
some issues seen in commit cloud sync.

This is done at the metalog commit time so we get the latest "remotenames" data for
accurate "public()" set calculation.

Reviewed By: singhsrb

Differential Revision: D26792731

fbshipit-source-id: 00b894fee9804740d664dad0ac47be564820da33
2021-03-03 18:06:08 -08:00
Jun Wu
8142c5e5f1 windows: set output encoding to UTF-8
Summary:
The output encoding is used to render the graph log edges. With D26612487 (62ba7447f6), we
switched to Rust IO. The Rust IO requires UTF-8 data. So let's set
outputencoding to UTF-8.

Reviewed By: sfilipco

Differential Revision: D26799551

fbshipit-source-id: aa3e6420067d7c75bef47448e12e48f4cef56a84
2021-03-03 16:45:16 -08:00
Durham Goode
6c4dd778bb peers: allow remote peer ui to inherit help and edenapi configs
Summary:
We have configs that affect peer connections, like help.tlsauthhelp,
that are considered "repo-specific" configs now that they come from
dynamicconfig. Unfortunately repo-specific configs are removed from the ui when
copying it for use in a new remotepeer.

Let's add a few config sections to the allow list for what can go in a remote
peer ui. I have a task for making even repo-less commands load the standard
config, so in the future we can have these new peer objects use the standard
repo-less config, which will remove much of the need for maintaining this
allow-list.

Reviewed By: singhsrb

Differential Revision: D26784364

fbshipit-source-id: 30d9292e48b0f27ce7f4d4904ff6d5ff8dcaf069
2021-03-03 13:40:49 -08:00
Jun Wu
1bde2cd85b doctor: use remotenames serialization APIs from bookmarks.py
Summary: Avoid duplication about the serialization logic.

Reviewed By: DurhamG

Differential Revision: D26707455

fbshipit-source-id: cf2f1926fe74b51bf052f6c2c041b26d6f31de97
2021-03-03 09:33:34 -08:00
Jun Wu
5a155dbb3d remotenames: extract remotenames serialization to a separate method
Summary:
Provide a method that does pure serialization from (name, node) pairs to the
remotenames blob.  This makes it reusable outside `vfs` or `repo` context.

Reviewed By: DurhamG

Differential Revision: D26707454

fbshipit-source-id: c45662922d337e31d17070e5f5828d47e23773b1
2021-03-03 09:33:34 -08:00
Liubov Dmitrieva
02c0705012 previous filter didn't work to get rid of the public commits in commit cloud
Summary:
sometimes in visible heads the hashes of the remote bookmarks are not the latest, so the filtration like it was initially implemented didn't work

if visible heads are polluted, it makes commit cloud operations slow but at least this correct check won't allow public heads to enter workspaces

moreover, after roll out it will fix already existing workspaces with public heads automatically by removing them from workspaces

also, this will allow our magic script to fix remote bookmarks in workspaces to work properly (debugfixcommitcloud), unfortunately now it can break a workspace if we remove bookmarks but not heads

cc quark-zju - could we fix the initial issue how the public heads can enter visible heads in some cases in pull logic? I have a repro if you are interested in.

Reviewed By: singhsrb

Differential Revision: D26778632

fbshipit-source-id: 05dbd4cd415911283ea66ae17772b8d3e458bbd7
2021-03-03 08:56:25 -08:00
Xavier Deguillard
ec1307cacb eden: only fetch data during a prefetch
Summary: EdenFS doesn't need the history, therefore let's not spend time prefetching it.

Reviewed By: fanzeyi

Differential Revision: D26767634

fbshipit-source-id: 7113f4ce79fdef5455a2bb238ab9d51b7339d8b6
2021-03-02 19:37:38 -08:00
Jun Wu
eb56d0ce7c remotenames: extract remotenames parsing to a separate method
Summary:
Parsing the remotenames (blob) into a list of name -> node pairs.
This makes it reusable outside `vfs` or `repo` context.

Reviewed By: DurhamG

Differential Revision: D26707457

fbshipit-source-id: e6c8bd9ff14d0fea9209c25b89fe733675da747e
2021-03-02 18:16:13 -08:00
Jun Wu
2297596687 absorb: use new memctx APIs
Summary:
Use the new memctx.mirror and memctx.__setitem__ APIs. This simplifies the
code.

Reviewed By: DurhamG

Differential Revision: D26726474

fbshipit-source-id: 044616137b883ca250e6d84c0ecfcc70458ec07a
2021-03-02 18:12:35 -08:00
Jun Wu
fb55069903 dirsync: improve performance for codemods
Summary:
Use the Rust tree matcher to rule out files that do not need dirsync quickly.
This should make codemod faster to commit.

I created 5000 files outside dirsync config in fbsource (with 494 lines of
dirsync config), and `hg add` them:

  $ mkdir unused
  $ cd unused
  $ for f in `seq 5000`; do touch $f; done
  $ hg add .

Baseline "status":

  In [3]: %time repo.status();1
  CPU times: user 111 ms, sys: 10.2 ms, total: 122 ms
  Wall time: 148 ms

Before, dirsync overhead is ~8x "status":

  In [1]: %time x.dirsync.dirsyncctx(repo[None])
  CPU times: user 1.37 s, sys: 28.8 ms, total: 1.4 s
  Wall time: 1.79 s
  Out[1]: (<workingctx f23d7c84c5a7+>, set())

  In [2]: %time x.dirsync.dirsyncctx(repo[None])
  CPU times: user 1.07 s, sys: 8.41 ms, total: 1.08 s
  Wall time: 1.11 s
  Out[2]: (<workingctx f23d7c84c5a7+>, set())

After, dirsync overhead is ~1/2 of "status":

  In [1]: %time x.dirsync.dirsyncctx(repo[None])
  CPU times: user 203 ms, sys: 18.9 ms, total: 222 ms
  Wall time: 245 ms
  Out[1]: (<workingctx 8ff14e46c9d8+>, set())

  In [2]: %time x.dirsync.dirsyncctx(repo[None])
  CPU times: user 154 ms, sys: 24.1 ms, total: 178 ms
  Wall time: 202 ms
  Out[2]: (<workingctx 8ff14e46c9d8+>, set())

Reviewed By: DurhamG

Differential Revision: D26726476

fbshipit-source-id: e34218769c779c9a4ee64c654c75298b7c79f213
2021-03-02 18:12:35 -08:00
Jun Wu
7f2e472696 dirsync: add a test about in-memory rebase
Summary: Now dirsync works with IMM rebase. Add a test for it.

Reviewed By: DurhamG

Differential Revision: D26726478

fbshipit-source-id: 6712538d7e903ddb0e3c3df44f7dde638276e99d
2021-03-02 18:12:35 -08:00
Jun Wu
82b71b144c dirsync: add a test about absorb
Summary: Now dirsync works with absorb. Add a test for it.

Reviewed By: DurhamG

Differential Revision: D26726477

fbshipit-source-id: 4505ad6c1e1fd03bfb2cf12b46bd07c98f2bcc2b
2021-03-02 18:12:35 -08:00
Jun Wu
5ceeb5311d dirsync: improve in-memory commit compatibility
Summary:
Previously, dirsync wraps `repo.commit`, requires an on-disk working copy,
and dirstate to work properly. This diff updates dirsync to wrap
`repo.commitctx` instead, do commit edits purely in memory, then sync the
commit back to disk. It makes dirsync compatible with absorb and in-memory
rebase (and potentially other things like drawdag, if drawdag's context APIs
are improved).

To sync the changes made in-memory back to the filesystem, a dirstate callback
is added to write back mirrored files from commit to disk. This works for both
amend and absorb so the special wrapper about amend is dropped. It is
also optimal for absorb, because it only writes the mirrored files once for
the "final" commit, instead of writing the files for each commit in the stack.

Some `O(N^2)`s (N: len(status)) complexities were avoided:
- `applytomirrors` was called N times.
- `allchanges = set(status.modified + status.removed + status.added)` in
  `applytomirrors` was O(N).
- `sourcepath in status.removed` in `applytomirrors` was O(N).
- `mirrorpath in status.removed` in `applytomirrors` was O(N).

Note there is still a suboptimal complexity of `getmirrors` called per changed
path, `O(N*M)` (N: len(status), M: len(dirsync_conig)). That will be addressed
in a later diff.

Reviewed By: DurhamG

Differential Revision: D26726479

fbshipit-source-id: 482c6c830ab65cc0d9cd569a51ec610a1dac49cc
2021-03-02 18:12:34 -08:00
Xin Tong
e882926adb configs: add hostprefix configuration condition to Mercurial
Summary:
## Why this diff
we want hostname prefix to support targeting configs at clients in corp ("corp" means laptop, labs, and other machines that are not in "prod" datacenters), like FRL machines, that don't support our existing tier mechanism.

## Changes
* Extract hostname prefix in `dynamicconfig.rs` and add a getter function `hostname_prefix()` for it.
*A hostname prefix only consists of alphabetical letters and dashes, which is followed by one or more digits in the hostname. If no valid match, the prefix is set to the empty string.*

* Use `gen.hostname_prefix()` in the `evaluate()` fn inside `mod.rs` to check the generator's prefix against a list of given prefixes.
* Copy changes from `configerator/source/scm/hg/hgclientconf/hgclient.thrift` to `fbsource/fbcode/configerator/structs/scm/hg/hgclientconf/hgclient.thrift`.
* Rebuild in `eden/scm/`.

Reviewed By: DurhamG

Differential Revision: D26706686

fbshipit-source-id: 725506a1c1f0983e981b0b3f3993c7c14510b1db
2021-03-02 12:58:05 -08:00
Durham Goode
752c5ccff5 tests: remove test environment when running system hg
Summary:
dynamicconfig has logic to avoid loading remote configs during tests,
by checking the TESTTMP variable. Unfortunately, the tests currently run system
hg with that environment set, which causes it to generate incorrect
configuration for the real repository (i.e. fbsource).

Let's get rid of all test specific environment variables when running the system
hg. There's a comment in the code saying this breaks some tests (from 2017
03a31be593db), but as far as I can see they still work.

Reviewed By: quark-zju

Differential Revision: D26758364

fbshipit-source-id: 945cbd36f7eccc98149772a42421cbc51b157c5b
2021-03-02 12:53:57 -08:00
Durham Goode
6451219968 tests: fix test-doctor.t on OSX
Summary:
The new test case failed on Mac because it didn't want to copy over a
symlink or something. Didn't dig too deep because 'rm -rf' works around it.

Reviewed By: sfilipco

Differential Revision: D26758985

fbshipit-source-id: 22ad7e23813bd6bfe86b91535d46c21ee59dfcd1
2021-03-02 11:47:30 -08:00
Jun Wu
72e808693f context: support nonfilelogfctx.cmp(nonfilelogfctx)
Summary:
`nonfilelogfctx` means the `fctx` does not have a backing filelog, is in-memory.
Previously, one of the `fctx` is assumed to be backed by a concrete filelog,
it will crash if that is no satisfied.

Reviewed By: DurhamG

Differential Revision: D26731810

fbshipit-source-id: f758f43dc140dbf6cc9b6234681c4830482e767a
2021-03-02 11:05:23 -08:00
Jun Wu
5b929eb82c context: fix memctx.status.removed corner case
Summary:
In a corner case, `mctx[f]` is `None`, and `f` does not exist in both parents.
The `f` should not appear in te `added` status list.

Fix it and remove a duplicated call to `managing`.

Reviewed By: DurhamG

Differential Revision: D26726482

fbshipit-source-id: f386ad9eb27bf053fb671e0f187aaada4699e84e
2021-03-02 11:05:23 -08:00
Jun Wu
6a31518480 context: support workingfilectx.cmp(workingfilectx)
Summary:
This is used by next diffs.

Test code:

  In [3]: v=repo[None]['.gitignore']
  In [4]: v.cmp(v)

Before:

  RuntimeError: maximum recursion depth exceeded

After:

  Out[4]: False

Reviewed By: DurhamG

Differential Revision: D26726481

fbshipit-source-id: c27a8f414313f262d0f596b058df580f9216e8fc
2021-03-02 11:05:22 -08:00
Jun Wu
2e52c0da0e context: add memctx.mirror for making context mutable
Summary:
Not all context objects support the `__setitem__` API. Instead of adding supports
for all of them, let's add an API to create a `memctx` that mirrors the changes
from another `ctx` so one can them do mutations on the `memctx`. This will be
used by dirsync.

This might also be useful in other "amend" cases, because the `mirror` API takes
various kinds of context (workingctx, changectx, memctx), and is straihtforward
to use:

  In [2]: v=m.context.memctx.mirror(repo['.'])

  In [3]: v.commit()
  Out[3]: 'b\xdeF\xbb\xbb&\xe5\xdbvJ\x16\xf2\xc3\x92\x96Mr\xb7\x85\xbb'

  In [4]: repo['.'].node()
  Out[4]: 'b\xdeF\xbb\xbb&\xe5\xdbvJ\x16\xf2\xc3\x92\x96Mr\xb7\x85\xbb'

  In [5]: v['x']=v['.gitignore']

  In [6]: v.commit()
  Out[6]: 'b\xdeF\xbb\xbb&\xe5\xdbvJ\x16\xf2\xc3\x92\x96Mr\xb7\x85\xbb'

Reviewed By: DurhamG

Differential Revision: D26726480

fbshipit-source-id: 629cfc721f79d29ef395d4e1d6b3381f0095d573
2021-03-02 11:05:22 -08:00
Jun Wu
691bc90d13 context: make memctx mutable
Summary:
Add `memctx.__setitem__(path, fctx)` API to change a file in memctx. This will
be used in upcoming dirsync changes.

Regarding on `memctx` vs `overlayworkingctx`. Both need some changes to fit the
dirsync use-case (overlayworkingctx needs "amend", not "commit on top of",
memctx needs to be mutable).

The main difference is `overlayworkingctx` uses a concrete `cache` dict for
path, data, and metadata. `memctx` uses a concrete list of file paths, but file
data, metadata is abstracted - it uses a function that returns fctx. I would
like to preserve the laziness of reading files and metadata (especially for LFS),
so I picked the `memctx` instead of `overlayworkingctx` as the starting point.

Reviewed By: DurhamG

Differential Revision: D26726475

fbshipit-source-id: 7c16980ffa1c83fe0ff6d70c60b1daae5e266683
2021-03-02 11:05:21 -08:00
Jun Wu
71adfaf595 http-client: move streaming request report to report_result_and_drop_receiver
Summary: This simplifies the code a bit.

Reviewed By: kulshrax

Differential Revision: D26681779

fbshipit-source-id: 393565790ab711dd09ae6cfa6f9c4b19c930eb93
2021-03-02 10:40:08 -08:00
Jun Wu
24b52eb508 http-client: HandlerExt::monitor_progress -> RequestEventListeners::on_progress
Summary:
Similar to D26670318, use the EventListeners APIs to implement the progress
callback.  Now HandlerExt only has RequestContext related "as_ref" logic.

Reviewed By: kulshrax

Differential Revision: D26681778

fbshipit-source-id: b7f6e07ced43e0ae043e859337c06b69bd5dfc95
2021-03-02 10:40:08 -08:00
Jun Wu
2a63701b19 http-client/progress: drop mut on ProgressUpdater
Summary: This makes it useful in non-mut callbacks.

Reviewed By: kulshrax

Differential Revision: D26681784

fbshipit-source-id: 97312df8bf3f900a36cbeb27206a2946bb6c702c
2021-03-02 10:40:08 -08:00
Jun Wu
3232dd18bd http-client/progress: Rc<RefCell> -> Arc
Summary: This makes ProgressUpdater Send + Sync so it can be used in the new callback APIs once `mut` gets dropped.

Reviewed By: kulshrax

Differential Revision: D26681781

fbshipit-source-id: 9c622b1d78b4091e3359c28972b6624f0b53734d
2021-03-02 10:40:07 -08:00
Jun Wu
33474a3258 http-client/progress: move "if_changed" check from Inner to Reporter
Summary:
This removes more mutable fields. Note the new code is more correct because
curl can call the `progress` callback periodically even if no progress is made.
According to https://curl.se/libcurl/c/CURLOPT_PROGRESSFUNCTION.html:

  This function gets called by libcurl instead of its internal equivalent with
  a frequent interval. While data is being transferred it will be called very
  frequently, and during slow periods like when nothing is being transferred it
  can slow down to about one call per second.

Reviewed By: kulshrax

Differential Revision: D26681780

fbshipit-source-id: 19aa4bcb4c56623e3f0408b06041b3a894f197e7
2021-03-02 10:40:07 -08:00
Jun Wu
bdfed84cb9 http-client/progress: use interior mutability for total_progress
Summary:
This makes the `total_progress` field use lock-free interior mutability. The
goal is to eventually drop Rc and RefCell.

Reviewed By: kulshrax

Differential Revision: D26681782

fbshipit-source-id: ec0a6abbb2115c17c674db2255d196aaec847705
2021-03-02 10:40:07 -08:00
Jun Wu
b5bb45cdbf http-client/progress: Option -> OnceCell
Summary: This removes the need for `mut` for this field.

Reviewed By: kulshrax

Differential Revision: D26681783

fbshipit-source-id: 10ed9adfb62081b0e6839abd9534db92d4e056c5
2021-03-02 10:40:07 -08:00
Jun Wu
1a83932440 http-client/progress: only keep total progress for ProgressInner
Summary:
The ProgressInner only exposes APIs for total (aggregated) progress.  There is
no API to read individual progress. Make it only track the total progress. This
would make it easier to implement interior, lock-free mutability on ProgressInner.

The updater now needs `mut` temporarily, which will be dropped later (D26681784).

A test case is tweaked so progress does not go backwards.

Reviewed By: kulshrax

Differential Revision: D26681777

fbshipit-source-id: 4ad1b9173d5a2c2326e00c030d51f77e9b9458f3
2021-03-02 10:40:06 -08:00
Jun Wu
5bd50aa886 http-client: make request clonable only in tests
Summary: This avoids misuses.

Reviewed By: kulshrax

Differential Revision: D26681776

fbshipit-source-id: 604cc5dd746a596bd6598a9d531261294b809cec
2021-03-02 10:40:06 -08:00
Jun Wu
0e6d628a19 http-client: add tests about event listeners
Summary: Test both the HttpClient and Request events.

Reviewed By: kulshrax

Differential Revision: D26670325

fbshipit-source-id: ffbc4268f7de698830411434a769c8b1a4acd863
2021-03-02 10:40:06 -08:00
Jun Wu
0dbdbcb95a http-client: move with_stats_reporting to event listener
Summary:
This simplifies the code a bit and makes it look consistent with other event
listeners.

Reviewed By: kulshrax

Differential Revision: D26670318

fbshipit-source-id: f6eda9403bb6eb09a074544e672a45c84f38e2b1
2021-03-02 10:40:05 -08:00
Jun Wu
17bc6238bf http-client: impl event listeners on RequestContext
Summary:
Add `RequestContext.event_listeners()` to register callbacks, and trigger the callbacks
when related events happen.

Reviewed By: kulshrax

Differential Revision: D26670323

fbshipit-source-id: 9b92b715444e83957c06b06f1ce696d4de3c0023
2021-03-02 10:40:05 -08:00
Jun Wu
ae7a37fd93 http-client: move HTTP body to RequestContext
Summary:
This simplifies the logic a bit. There is no need for
`HandlerExt::with_payload` that is similar to `Request::body`.

Reviewed By: kulshrax

Differential Revision: D26670326

fbshipit-source-id: 9fe755821062ad6f2a74d6d5ba345620669f0f63
2021-03-02 10:40:05 -08:00
Jun Wu
a5a11c0301 http-client: avoid cloning RequestContext
Summary: We're going to make RequestContext larger. Avoid cloning it.

Reviewed By: DurhamG

Differential Revision: D26670316

fbshipit-source-id: 75f500163391a71947b027b63ea266010b04f751
2021-03-02 10:40:05 -08:00
Lukas Piatkowski
edb679f785 autocargo v2: rollout and replace v1 in all use-cases
Summary:
This diff rollouts V2 of autocargo in an atomic way so there are quite a few things done here.

Arc lint support:

V1 used to be part of the default fbsource `arc lint` engine, but since V2 calls buck it must live in a separate lint engine. So this diff:
- Adds running `autocargo` as part of `arc lint-rust`

Mergedriver update:

- Mergedriver used in resolving conflicts on commits is now pointing to V2
- It handles files in `public_autocargo/` directories in addition to the ones containig generation preamble

Including regeneration results of running `common/rust/cargo_from_buck/bin/autocargo`. All the differences are accounted for:

- Some sections and attributes are removed as they can be autodiscovered by Cargo (like `lib.path = "src/lib.rs"` or empty [lib] section)
- "readme" attribute is properly defined as relative to Cargo.toml location rather than as hardcoded string
- "unittest = false" on a Buck rule propagates as "test = false; doctest = false" to Cargo
- "rusqlite" is not special-cased anymore, so the "budled" feature will have to be enabled using custom configuration if required by the project (for rust-shed in order to not break windows builds a default feature section was added)
- Files generated from thrift_library rules that do not support "rust" language are removed
- Custom .bzl rules that create rust artifacts (like `rust_python_extension`) are no longer ignored

Others:

- Changed `bin/cargo-autocargo` to be a wrapper for calling V2 via `cargo autocargo`
- Updated following files to use V2:
  - `common/rust/tools/reindeer/version-bump`
  - `remote_execution/rust/setup.sh`
- Removed few files from V1 that would otherwise interfere with V2 automatic regeneration/linting/testing

Reviewed By: zertosh

Differential Revision: D26728789

fbshipit-source-id: d1454e7ce658a2d3194704f8d77b12d688ec3e64
2021-03-02 06:43:29 -08:00
Liubov Dmitrieva
02174e14db improve remotebookmark sync logic, so that we can match the remote as well
Summary:
we would like to remove the subscribed bookmarks like:

   infinitepush/fbandroid/stable 971f301a5863
   infinitepush/fbcode/stable 508c293d4050
   infinitepush/fbcode/warm  1d1782a5ce76
   infinitepush/fbobjc/stable 73b842d4156c
   infinitepush/fbsource/stable 656f6bc818db
   infinitepush/master       b5d36aac54d6
   infinitepushbookmark/fbandroid/stable 69a9059a598a
   infinitepushbookmark/fbcode/stable 32b66c6fbc66
   infinitepushbookmark/fbcode/warm 466ecc4b7a1c
   infinitepushbookmark/fbobjc/stable decffe6097ef
   infinitepushbookmark/fbsource/stable decffe6097ef
   infinitepushbookmark/master 7477e72782ae

Reviewed By: markbt

Differential Revision: D26750235

fbshipit-source-id: f1f19c2fa30d8334cb1f2843be2994866db78dd2
2021-03-02 05:21:01 -08:00
Jun Wu
78e4e404fd http-client: impl event listeners on HttpClient
Summary: Expose the HttpClient events via `.event_listeners()` API.

Reviewed By: kulshrax

Differential Revision: D26670315

fbshipit-source-id: eb4c8f3eda1bd292ecd2e5153db0ccd6c12eec72
2021-03-01 23:47:02 -08:00
Jun Wu
25e2e28bd2 http-client: define event listeners on HttpClient and Request
Summary:
Add a way to define event listeners.  Define events on HttpClient and
Request(Info). They will be used by upcoming changes.

The idea is similar to GUI programming. A "control" has a list of "events" that
handlers can be defined on them.

This diff defines lists of events on the "client" and "request" types.

Areas this diff tries to improve:
- Make it easier to add new events (by using macro_rules).
- Make it easier to visually see all possible events.

Reviewed By: kulshrax

Differential Revision: D26670324

fbshipit-source-id: 92f74779f8e546491d0e922db27a4b87f527a5e9
2021-03-01 23:47:02 -08:00
Jun Wu
2b1016d978 http-client: expose RequestContext via HandlerExt
Summary:
This makes it easier to access states defined in `RequestContext` from
`curl::Easy2<H>` types.

Reviewed By: kulshrax

Differential Revision: D26670317

fbshipit-source-id: 27eca9dcc11b14b5d41c8327448f7748ebc62e10
2021-03-01 23:47:02 -08:00
Jun Wu
23ac125da1 http-client: rename Configure to HandlerExt
Summary:
Upcoming diffs extend the trait with new methods unrelated to configuration.
Rename to clarify.

Reviewed By: kulshrax

Differential Revision: D26670314

fbshipit-source-id: 7d33ebe22b26f1a286ae40c78f51f31a1a64957e
2021-03-01 23:47:01 -08:00
Jun Wu
f10921e7f1 http-client: add RequestContext to Buffered Handler
Summary:
Similar to the Streaming curl handler, add a RequestContext field to the Buffered
handler so the curl callbacks on the Handler can provide the Request
information like urls.

Reviewed By: kulshrax

Differential Revision: D26670321

fbshipit-source-id: de7abecf162c4aaed03d927c35516b6f8ac523ce
2021-03-01 23:47:01 -08:00
Jun Wu
7081661c1d http-client: add RequestContext to Streaming Handler
Summary:
Make `RequestContext` available in the streaming request. The `clone` will
be removed by a later change.

`dead_code` is temporarily allowed so the following won't be an error.

  error: field is never read: `request_info`
    --> src/handler/streaming.rs:24:5
     |
  24 |     request_info: RequestContext,
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^
     |

Reviewed By: kulshrax

Differential Revision: D26670319

fbshipit-source-id: 53a1deeece5a2059e7caa9d28ef00e083a27b722
2021-03-01 23:47:00 -08:00
Jun Wu
9f82770488 http-client: assign unique Id for RequestContext
Summary:
Add an "auto incremental" Id to uniquely identify requests.  This allows external
logic to have a map from the Id to extra metadata not owned by this crate. Without
the Id, there is no way to tell if `RequestContext`s with a same url and method are
actually a same request or not.

Reviewed By: kulshrax

Differential Revision: D26670327

fbshipit-source-id: 60fa760432b23ab5334f22806e01304f9c160182
2021-03-01 23:47:00 -08:00
Jun Wu
c43e009712 http-client: move url and method to RequestContext
Summary:
The `RequestContext` is a subset of `Request` that are:
- Independent from curl types.
- Carry useful states, and make them available on Handler callbacks.
- For now, the "useful states" include url and method. They can be extended
  later.

Reviewed By: kulshrax

Differential Revision: D26670320

fbshipit-source-id: 3d71d5fee8927dd57a52f51b212397710379e7fa
2021-03-01 23:47:00 -08:00
Durham Goode
2fc16ce279 tests: fix test-unicode-inputs-t.py on Windows
Summary: This was broken by D26702166 (373d9ade0a).

Reviewed By: sfilipco

Differential Revision: D26736392

fbshipit-source-id: 8bae1599922c05193eba529d7f74c585f20d6f91
2021-03-01 22:23:14 -08:00
Andrey Chursin
9338199ca8 checkout: handle update_meta in sparse profile update
Summary: This treats update_meta collection same way as update_content

Reviewed By: DurhamG

Differential Revision: D26694077

fbshipit-source-id: f2a7afb988eb99afa6e8f62ae6cda57a108a987d
2021-03-01 20:25:18 -08:00
Andrey Chursin
a6fae8602e checkout: tests for sparse checkout
Summary: This diff adds unit test for sparse checkout plan

Reviewed By: DurhamG

Differential Revision: D26673701

fbshipit-source-id: 8f810df317c3447f8445765e3a510559d4f1b378
2021-03-01 20:25:18 -08:00
Andrey Chursin
be0b48333b checkout: wrap record_updates with allow_threads
Summary: Using allow_threads allows python to handle Ctrl+C and update spinner

Reviewed By: DurhamG

Differential Revision: D26670807

fbshipit-source-id: 6506f6aba8a62f0e95d4e04b5ab69539e543f3cd
2021-03-01 20:25:18 -08:00
Andrey Chursin
c8871fd796 checkout: support sparse profile update in python binding
Summary:
This diff integrates CheckoutPlan::with_sparse_profile_change into python code
It also updates test-update-over-sparse-profile-change.t to use native checkout, as this test now passes

Reviewed By: DurhamG

Differential Revision: D26670414

fbshipit-source-id: 73011217b4a0d80ef643b778cdaf75bbada5dcf2
2021-03-01 20:25:17 -08:00
Andrey Chursin
341952f4cd checkout: introduce CheckoutPlan::with_sparse_profile_change
Summary:
This method updates checkout plan to account for sparse profile change
The logic is somewhat similar to sparse.py, except it is smaller because it does not account for merges

Reviewed By: DurhamG

Differential Revision: D26670413

fbshipit-source-id: 54294ad7f1c61e39400450ff139f40ac8fffdd62
2021-03-01 20:25:17 -08:00
Andrey Chursin
2164dd8d29 pathmatcher: introduce XorMatcher
Summary:
This matcher combinator is useful when checking out across sparse profile change, since it allows to list files that has been affected by the sparse profile chane
Python has similar combinator xormatcher

Reviewed By: DurhamG

Differential Revision: D26670412

fbshipit-source-id: 0f84835aad16177e79e87d15b41b2caef4374605
2021-03-01 20:25:17 -08:00
Andrey Chursin
340f8b70f0 checkout: support fixed sparse profile
Summary:
This diff introduces support for fixed sparse profile into native checkout.
Sparse profile change is not yet supported.
This also updates test-sparse.t to use native checkout

Reviewed By: DurhamG

Differential Revision: D26648490

fbshipit-source-id: 516308dba096189e4657715214ad2a5b61816c49
2021-03-01 20:25:17 -08:00
Jun Wu
e2d6665fb6 hgcommands: fsync shared storage files
Summary:
There are some reports about truncated latest files on NFS hosts (where the
hgcache portion might be outside NFS).

Fsync files in hgcache too. With indexedlog the total number of files is
bounded so listing them is considered bounded time.

Reviewed By: kulshrax

Differential Revision: D26741889

fbshipit-source-id: a789396cc5802110eb55fa6b52b5124cd9a3dbf3
2021-03-01 18:40:44 -08:00
Jun Wu
41470e9f49 hgcommands: disable color for tracing output in tests
Summary: It seems there is no "tty" check. So let's disable colors for tests explicitly.

Reviewed By: DurhamG

Differential Revision: D26708620

fbshipit-source-id: 802537af0d3f580c39a746b6aa6a617c9fb4c9c1
2021-03-01 14:10:59 -08:00
Jun Wu
4f0e42a891 pytracing: normalize foo.bar to foo::bar for tracing target
Summary:
The target form `foo.bar` cannot be used in the env filter syntax:

  EDENSCM_LOG=edenscm.hgext.dirsync=debug lhg log -r .
  ignoring `edenscm.hgext.dirsync=debug`: invalid filter directive

Reviewed By: DurhamG

Differential Revision: D26708621

fbshipit-source-id: 370e93fe6abf2311c8b4ae07d0906973c8a9b74b
2021-03-01 14:10:58 -08:00
Arun Kulshreshtha
c9ea13ba77 edenapi: add missing methods on EdenApiBuilder
Summary: A few new config options were added to `EdenApiBuilder` without corresponding setting methods, meaning that they could only be set via an hgrc config file. This diff adds the methods so that Rust code can manually configure these settings.

Differential Revision: D26709471

fbshipit-source-id: 6af645961ed50526ccc04990b82ee201211b6ad2
2021-03-01 13:04:37 -08:00
Arun Kulshreshtha
f2fc83597d edenapi: add Content-Length header to ResponseMeta
Summary: Add `Content-Length` to `ResponseMeta` struct. Will be used for logging purposes.

Differential Revision: D26709386

fbshipit-source-id: 4346627e3883d00350738cca1e71004f8d407c0d
2021-03-01 13:04:37 -08:00
Jun Wu
bb8212e827 tests: fix test-import-merge.t
Summary:
With Rust IO, `hg` is more willing to report "broken pipe" issues:

       $ hg export 'desc(2)' | head -7 > ../a.patch
    +  abort: The pipe is being closed. (os error 232)
       $ hg export tip > out

Fix the test by using a temporary file.

Reviewed By: sfilipco

Differential Revision: D26730868

fbshipit-source-id: 8446528cad72713329b173eaa10ee109e8dfa956
2021-03-01 11:49:57 -08:00
Jun Wu
c6c95137a7 util: avoid using stdout=subprocess.PIPE if stdout is a TTY
Summary:
Te old _isstdout check is no longer effective with Rust IO. That breaks editors
like vim. Fix it by replacing the _isstdout check with istty check.

Reviewed By: sfilipco

Differential Revision: D26729684

fbshipit-source-id: fc79eda30c3a585ba6d5960e1f72bfc0fc9df254
2021-03-01 11:14:40 -08:00
Andrey Chursin
88712f0cd5 tests: switch test-update-{reverse, issue1456}.t to use native checkout
Summary: Switching couple more .t tests to use native checkout

Reviewed By: quark-zju

Differential Revision: D26621668

fbshipit-source-id: 029513fb3b1807e55e1d17769edd6beea5c3db41
2021-03-01 10:41:07 -08:00
Andrey Chursin
06e5afc757 checkout: batch spawn_blocking to VFS
Summary:
Currently running native checkout shows much higher sys time then regular checkout
One theory that this is due to high scheduler overhead due to large number small tasks spawned with spawn_blocking

This diff batches 100 operations before spawning blocking proc

Reviewed By: quark-zju

Differential Revision: D26620395

fbshipit-source-id: f5be84c3ee14ffc55e4332e714a48f55701d5f8f
2021-03-01 10:41:07 -08:00
Mark Juggurnauth-Thomas
d23885a667 upgrade streampager to 0.9.3
Summary: Upgrade the builtin streampager version to 0.9.3.

Reviewed By: singhsrb

Differential Revision: D26711549

fbshipit-source-id: ad95c4b2310bf1f007a544445d9c42f5bd9ba945
2021-03-01 06:12:00 -08:00
David Tolnay
92f96c6555 Format fbsource with rustfmt-2.0.0-rc.2
Reviewed By: zertosh

Differential Revision: D26711985

fbshipit-source-id: 68e6482d041846bc0215b0984c03ef5fed043ebc
2021-02-27 18:46:09 -08:00
Jun Wu
4c79cf6af0 hgcommands: fsync more critical files
Summary:
Recently there are reports about "remote/master" pointing to a non-existed
commit, missing tree data, and general hard-reboot issues. Attempt to reduce
the chance of losing data by adding the critical paths to the fsync list.

Reviewed By: kulshrax

Differential Revision: D26708225

fbshipit-source-id: ae52534fdbf8d9d35498d30c24bdce7f5d9a96a3
2021-02-27 13:16:11 -08:00
John Allen
8df57108e6 Allow phabdiff in blame when HGPLAIN=1
Summary: Currently HGPLAIN=1 will disable the -p flag, even though it's analogue, -n, works fine. This should allow either flag to work with or without HGPLAIN

Reviewed By: DurhamG

Differential Revision: D26440729

fbshipit-source-id: f7058a82c32229f5ff9867f299ed72fe167c7104
2021-02-27 12:18:37 -08:00
Jun Wu
deafa7e539 doctor: fix master pointing to unknown commit
Summary: This should fix issues where master points to an unknown commit somehow.

Reviewed By: DurhamG

Differential Revision: D26648623

fbshipit-source-id: 63f7a4b834bf19a7849a1c3771921e6b1e5919d3
2021-02-26 18:05:08 -08:00
Jun Wu
ddd1901b43 mononokepeer: do not crash if tlsauthhelp is not set
Summary:
Avoid:

    File "edenscm/mercurial/mononokepeer.py", line 232, in _connectionerror
        msg += self.ui.config("help", "tlsauthhelp")
    TypeError: can only concatenate str (not "NoneType") to str

Reviewed By: kulshrax

Differential Revision: D26698546

fbshipit-source-id: 1d5e47bdb2062d5a34989931811b12663976928e
2021-02-26 18:02:22 -08:00
Durham Goode
373d9ade0a py3: fix hg status with unicode characters in OSX
Summary:
hg status was throwing an error on Py3 OSX because a fallback path
returned bytes instead of string. This fixes that.

Reviewed By: sfilipco, singhsrb

Differential Revision: D26702166

fbshipit-source-id: fa32e5b312377a899b6af16f40bca051f44ed6c3
2021-02-26 16:31:45 -08:00
generatedunixname89002005325676
fd9d91a1dd Daily arc lint --take CLANGFORMAT
Reviewed By: zertosh

Differential Revision: D26685857

fbshipit-source-id: 4440e6ccba44740197a71ba05ca0ee85282c2403
2021-02-26 04:01:44 -08:00
generatedunixname89002005287564
cb2cc4ddb1 Daily arc lint --take BLACK
Reviewed By: zertosh

Differential Revision: D26686094

fbshipit-source-id: e382675ff1c32f63467d464bce28f54024af35b9
2021-02-26 03:57:20 -08:00
Stanislau Hlebik
8e29b610ae spawn-ext: bump the number of handles we are closing
Summary:
We got a report about windows in vscode being significantly slower than on
macOs/Linux (https://fburl.com/nv9xwc09) to the point that it can't be
explained by "Windows is just slower". As the post suggests we had a suspicion
it might be related to an issue described in T33479254.

After some debugging I can confirm the following:
1) I can reliably (but not 100% of the time) reproduce the issue on my windows
laptop. I just need to modify a file and do "Quick commit" or "Quick amend" from vscode,
and note that command finished quite fast (just a few seconds, I verified it by
running "hg st" and checking that working copy is now clean, and by running "hg
log -r ." and checking that hash has changed), but vscode takes longer to
notice that (i.e. it keeps spinning and showing that amend is still running).

2) By staring at "Process explorer" I noticed that the problem seem to be in
"hg.exe cloud backup" i.e. when "cloud backup" finishes then vscode stops
spinning. So I suspected it to be a problem.

3) As the next step I started to suspend the process in "Process Explorer"
(note that I started it as admin and SYSTEM user, whatever it means). Then I
looked through file handles in Process explorer and was closing them 1 by 1.
Evetually I noticed that closing handles for named pipes like
"\Device\NamedPipe\uv\0000013E91115170-26220" make vscode stop spinning (it was
usually necessary to close it in hg.exe cloud backup process and all child processes as
well).

4) I also looked at handle value, and noticed that it's bigger than 2048 (0x848).

So currently my suspicion is that the problem is that we don't close enought
handles, and this diff bumps it as a temporary workaround and also walk over handles that multiple of 4 only. quark-zju has an
upstream improvement that would make this hack go away
(https://github.com/rust-lang/rust/pull/75551/commits) but it's not landed yet.
So for now let's try to bump the magic number.

Reviewed By: quark-zju

Differential Revision: D26668773

fbshipit-source-id: ed1c203260a52c3e5449b7b06cf4ecbe4dcf6477
2021-02-25 19:58:31 -08:00
Jun Wu
9cb5d833a2 uiconfig: respect --config for applydynamicconfig
Summary:
See D26671795. The hotfix was ineffective because repo config (and
dynamicconfig) is not loaded. This fix ensures newer versions of
hg do not depend on the hotifx.

Reviewed By: DurhamG

Differential Revision: D26679775

fbshipit-source-id: 5e78051cb7d9ac9ac6b327d895049dca2b025068
2021-02-25 17:17:25 -08:00
Durham Goode
62d44f33e9 py3: fix MS compiler complaint with unusual #ifdef usage
Summary: When building against Python 3.8 the MSVC compiler complains about how this macro splits inside parentheses. Not sure what changed, but looks easy enough to fix.

Reviewed By: quark-zju

Differential Revision: D26434060

fbshipit-source-id: b46059a6e676a52c99f8923b6739cffe578cc6f7
2021-02-25 09:59:56 -08:00
Durham Goode
694ff08e83 py3: fix setup3.py to work with Windows
Summary: Supports Windows by adding mkscratch and scmdaemon and updating it to build python3libs.zip instead of python27.zip. Changed the name to include 'libs' on the end since the zip no longer contains Python itself.

Reviewed By: quark-zju

Differential Revision: D26381051

fbshipit-source-id: 0a2cc40df103525fdc581a4102458e82fda1f670
2021-02-25 09:59:56 -08:00
Durham Goode
371d10ca4d py3: fix path encoding in win32 layer for Python 3
Summary:
In Python 3 the strings are no longer bytes, so we need to convert them before calling Windows native APIs.

I originally attempted to make all C APIs use the W() Windows APIs. This sorta worked and enabled some unicode support for Windows in Python 2, like hg status, but it meant that utf-8 path encodings were being returned and eventually passed to python functions like os.lstat() which weren't expecting utf8 encoding. I gave up and just left the Python 2 C code as is, and made a copy that uses W() APIs for Python 3. This enables unicode support on Windows where it didn't work before (at least in my testing).

Reviewed By: quark-zju

Differential Revision: D26381053

fbshipit-source-id: 69d4e18ba9fb0f3d17bad58fbcc5d0e6e61d4252
2021-02-25 09:59:56 -08:00
Durham Goode
5ad8e5d836 py3: fix Windows tests
Summary:
Windows tests were failing to execute hg clone ssh://user@dummy/... lines because setconfig ui.ssh=C:/foo/bar was being translated to ui.ssh=c;c:\\foo\\bar by mingw, since it detected /foo/bar as a unix-style path. This seems to be caused by this one line reversing the slashes. I'm not sure why it exists, but deleting it makes the tests pass.

My guess is this has been broken for about a year.

Reviewed By: quark-zju

Differential Revision: D26639206

fbshipit-source-id: d89cae1ea3dd055b90ec6ee8f7cdbee2ae08b228
2021-02-25 09:59:55 -08:00
Jun Wu
30ad76433e dag: add a way to describe bytes in indexedlog IdDag store
Summary:
This will be useful to explain bytes in the indexedlog.

Together with `debugdumpindexedlog` this can be used to troubleshoot issues.
For example, `debugdumpindexedlog` has:

  # Entry 11763:
  0004064b: 00 03 01 00 00 00 00 00 05 f1 00 01 ea 8b 80 80  ................
  0004065b: 80 80 80 80 01                                   .....

The entry can then be easily decoded via debugshell:

  In [1]: def e(s):
   ...:     print(b.dag.describebytes(bin(s.replace(' ',''))))

  In [2]: e('00 03 01 00 00 00 00 00 05 f1 00 01 ea 8b 80 80 80 80 80 80 01')
  # 00: Flags = (empty)
  # 03: Level = 3
  # 01 00 00 00 00 00 05 f1: High = N1521
  # 00: Delta = 0 (Low = N1521)
  # 01: Parent count = 1
  # ea 8b 80 80 80 80 80 80 01: Parents[0] = N1514

Reviewed By: sfilipco

Differential Revision: D26654639

fbshipit-source-id: c8438623b7e22e6abaf5c3011be25587f9d68753
2021-02-25 08:32:48 -08:00
Jun Wu
7684e79be6 dag: fix segment format comment
Summary: The first byte is the flag.

Reviewed By: sfilipco

Differential Revision: D26654640

fbshipit-source-id: 4d66f14c73fe40a154ca7c08f9a9dff3a54ae337
2021-02-25 08:32:47 -08:00
generatedunixname89002005287564
dafcfcd0bf Daily arc lint --take BLACK
Reviewed By: zertosh

Differential Revision: D26660579

fbshipit-source-id: 2a6f2ff37e6509a59f4927ad5dfa2a84f3d4dc15
2021-02-25 04:29:50 -08:00
Mark Juggurnauth-Thomas
03301d0d96 templates: add case expressions
Summary:
Add case expressions to the templating language that allow selection of a value based on
a single determinator.  The expression `case(expr, case1, then1, case2, then2, else)`
will expand to `then1` if `expr` matches `case1`, etc.  If it matches none of the cases
then it expands to `else`.

This can be used to simplify long `ifeq` chains in templates.

Reviewed By: quark-zju

Differential Revision: D26631539

fbshipit-source-id: 7543e6f7baa5599c96cac75da17db73e03b918f9
2021-02-25 02:56:17 -08:00
Arun Kulshreshtha
c7d1040701 pyauth: omit unset auth fields
Summary: Make the auth Python bindings match the behavior of `httpconnection.readauthforuri` and omit unset fields in the returned dict.

Reviewed By: quark-zju

Differential Revision: D26439292

fbshipit-source-id: 776d8d9bd59726f5ad8d28973e9c2fdc99a2995c
2021-02-24 17:13:51 -08:00
Stanislau Hlebik
041399df9c lfs: make more errors retryable
Summary:
Facebook
It looks like we have quite a few errors when people cloning fbsource on their
laptops (see https://fburl.com/odo8tii0 for more details).

"Couln't resolve host name" is one of the errors we see often, so let's retry
that. ssl errors seem to be retryable as well.

Reviewed By: ikostia

Differential Revision: D26635252

fbshipit-source-id: 2412c4f09aab3d5d45923c4b05fc350556bf9af6
2021-02-24 13:53:23 -08:00
Jun Wu
f8086063c8 ui: drop progress suspension when writing to ferr and fout
Summary:
The progress suspension is implemented in Rust. Since we're writing to the Rust
"error" and "output" streams, they should handle progress suspension directly.

This also removes the "flakiness" (progress disappears for a while when a line
is printed) when progress is shown in streampager:

  lhg debugprogress -s 100 --sleep 100 --with-output --pager=on --config pager.interface=fullscreen

Reviewed By: sfilipco

Differential Revision: D26612478

fbshipit-source-id: b75bfe726c61d89495b198670f777440506fcecf
2021-02-24 09:33:19 -08:00
Jun Wu
386ccb5119 types: update HgId to use "bytes" serialization by default
Summary:
See D23966992 (2a2971a4c7) for context. This is a continuation of D23966995 (ab88771161)
which toggles the deserialization part.

Without this change, the default tuple serialization is inefficient
in CBOR and is a disaster in Python:

  In [1]: s,f=api.commithashtolocation('fbsource', repo['master'].node(), [bin('375c7ec7442d2bab635f4ae399be6604c5386eb7')])
  In [2]: list(s)
  Out[2]:
  [{'hgid': (55, 92, 126, 199, 68, 45, 43, 171, 99, 95, 74, 227, 153, 190, 102, 4, 197, 56, 110, 183),
    'location': {'descendant': (37, 71, 244, 168, 243, 219, 161, 246, 36, 253, 0, 121, 134, 114, 241, 20, 136, 105, 226, 80),
     'distance': 10000}}]

With this change, the Python serialization works as expected:

  In [2]: list(s)
  Out[2]:
  [{'hgid': '7\\~\xc7D-+\xabc_J\xe3\x99\xbef\x04\xc58n\xb7',
    'location': {'descendant': '%G\xf4\xa8\xf3\xdb\xa1\xf6$\xfd\x00y\x86r\xf1\x14\x88i\xe2P',
     'distance': 10000}}]

Places using HgId serialization directly has opt-in explicit serialization
format: D23966986 (0bb45fcbc4) (zstore), D23966991 (f833f03ba2) (metalog), D24009039 (9c5d20904d) (revisionstore) so
they should not be affected.

EdenAPI protocols used in production should be using `WireHgId` types so they
are not affected.

Reviewed By: sfilipco

Differential Revision: D26562685

fbshipit-source-id: 819b794272ee23a135bbed5b61706944ed0acb9f
2021-02-24 09:20:35 -08:00
Xavier Deguillard
bde9d5f099 eden: fix prefetchtrees argument
Summary:
My edenfs log is filled with the following backtrace:

  Traceback (most recent call last):
    File "/opt/fb/mercurial/edenscm/mercurial/commands/eden.py", line 421, in get_tree
      self._fetch_tree_impl(path, manifest_node)
    File "/opt/fb/mercurial/edenscm/mercurial/commands/eden.py", line 671, in _fetch_tree_impl
      self.repo._prefetchtrees(path, mfnodes, [], [])
    File "/opt/fb/mercurial/edenscm/hgext/treemanifest/__init__.py", line 565, in _prefetchtrees
      return self._httpprefetchtrees(*args, **kwargs)
    File "/opt/fb/mercurial/edenscm/hgext/treemanifest/__init__.py", line 678, in _httpprefetchtrees
      self.edenapi.complete_trees(
  TypeError: Expected type that converts to PySequence but received set

And indeed, the code passes a set instead of a plain list.

Reviewed By: kmancini

Differential Revision: D26545708

fbshipit-source-id: 4164154d9cc8991b596198d9324474f646cc194c
2021-02-24 08:08:16 -08:00
Stanislau Hlebik
ed2669e33f phrevset: allow specifying multiple callsigns
Reviewed By: DurhamG

Differential Revision: D26604669

fbshipit-source-id: 1bd0fa2b4715fd2de19658265ebf8a4bd960b21a
2021-02-24 00:46:01 -08:00
Jun Wu
62ba7447f6 ui: switch to Rust IO for default fout, ferr
Summary:
The Rust IO handles progress and streampager stuff. Switch to it so we don't
need to changing the `fout`, `ferr` when handling streampager in Python.

The chgserver logic is updated to just set raw fd 0, 1, 2 to update stdio,
since `fileno` is no longer exposed from Rust.

Manually tested the following commands, both without chg and with chg:
- lhg log -r . (no pager)
- lhg log (with streampager)
- lhg log --config pager.pager=less (with less pager)
- lhg commit (spawns pager)
- lhg debugprogress -s 100 --sleep 100 --with-output --pager=off (progress in stderr)
- lhg debugprogress -s 100 --sleep 100 --with-output --pager=on --config pager.interface=fullscreen (progress in streampager)
- lhg debugprogress -s 100 --sleep 100 --with-output --pager=on --config pager.pager='LESS= less' (progress is disabled with external pager)

Reviewed By: sfilipco

Differential Revision: D26612487

fbshipit-source-id: 8b4e36b614a0c080b93e41474f9a8fc33f890083
2021-02-23 22:33:48 -08:00
Jun Wu
a6e3b948c9 chgserver: replace the raw stdio fds (0, 1, 2) directly
Summary:
Previously those fds were obtained via `fp.fileno()`. We're going to replace
the `fp` with something backed by Rust that does not have `fileno()`. Update
chg to replace the raw fds (0, 1, 2) directly. This is enough to affect both
Python and Rust's stdio so there is no need to replace `ui.fout`, `ui.ferr`
again.

Reviewed By: sfilipco

Differential Revision: D26612484

fbshipit-source-id: 5cd89e5955a1dcaad3d3132730354ee67c016bf0
2021-02-23 22:33:48 -08:00
Jun Wu
b96559ec94 debugprogress: add missing "\n"
Summary:
Write "\n" to flush the lines. This makes the lines visible instead of being
rewritten by the progress bar.

Reviewed By: sfilipco

Differential Revision: D26612483

fbshipit-source-id: 00cdc4af4dbed479532cc93fe183a19244c8c7c6
2021-02-23 22:33:48 -08:00
Jun Wu
aed852bf21 cpython-ext: add isatty and close to PyObject wrapping Rust Write
Summary:
Expose the Rust `is_tty` to Python `isatty`. This will unblock switching Python
`fout`, `ferr` to Rust objects.

Reviewed By: sfilipco

Differential Revision: D26612486

fbshipit-source-id: 775c47df461e17f1713943d4b1fe5baeb84beca7
2021-02-23 22:33:48 -08:00
Jun Wu
f3a5686a15 io: add IsTty API
Summary:
Add a new API to test if a stream is a tty. This is needed to replace the
Python `fin`, `fout` etc. to Rust objects, because the Python land requires the
`istty` API. It is also useful for properly implement color detection in the
pure Rust land.

Reviewed By: sfilipco

Differential Revision: D26612480

fbshipit-source-id: 5cf79447b1d74e0031a954788db342afd48dc288
2021-02-23 22:33:47 -08:00
Jun Wu
deb50bdef8 io: move clidispatch::IO to a separate crate
Summary:
Move IO to a separate crate so it is easier to be used in other libraries.
Practically, I'm going to add `is_tty()` API, and make some types from
`cpython-ext` implement it. If `cpython-ext` depends on `clidispatch`,
that would be too heavyweight.

Reviewed By: sfilipco

Differential Revision: D26612488

fbshipit-source-id: 00b18dadce3157a357d189aaa7d985efa6b4c80a
2021-02-23 22:33:47 -08:00
Jun Wu
11fde14c74 pyio: match Rust IO APIs
Summary:
Rename `pager` to `IO` matching the Rust IO APIs. This allows us to use the
Rust IO APIs from Python.

Reviewed By: sfilipco

Differential Revision: D26612485

fbshipit-source-id: d78f1c8966429e563fe7d190bbcb3bad1b0710fd
2021-02-23 22:33:47 -08:00
Jun Wu
f40e980428 pypager: rename to pyio
Summary:
I'm going to expose more APIs from the Rust IO such as setting progress
content, etc. Rename the module to clarify.

Reviewed By: sfilipco

Differential Revision: D26612490

fbshipit-source-id: 136ea27a733b09557d02077e68ce51184125ade1
2021-02-23 22:33:46 -08:00
Jun Wu
b3a8cd238e progress: rename write_progress to set_progress
Summary:
Unlike stderr or stdout, writing to progress clears the previous progress text.
Update the function name to clarify.

Reviewed By: sfilipco

Differential Revision: D26612481

fbshipit-source-id: 382182fdcc713f92117d01f53b8da47d195b06cb
2021-02-23 22:33:46 -08:00
Jun Wu
e579864e8b progress: support write_progress for non-streampager cases
Summary:
Update `write_progress` to write the progress to stderr if streampager is not
used.

Reviewed By: sfilipco

Differential Revision: D26612482

fbshipit-source-id: 3034252765024df2a6bda7347eff35f07f3186cb
2021-02-23 22:33:46 -08:00
Jun Wu
dd87b8e568 progress: move streampager "\f" handling to Rust
Summary:
streampager uses "\f" to indicate "the end of progress". Move that logic from
Python to Rust. This hides the streampager implementation detail and allows
us to implement `write_progress` for non-streampager cases.

Reviewed By: sfilipco

Differential Revision: D26612489

fbshipit-source-id: 7f41c3af78a0c098de510f86c86726c43931cb6d
2021-02-23 22:33:45 -08:00
Jun Wu
fe8dada0e6 progress: change write_progress to take &str
Summary:
There seems no need for the progress bar text to be binary (it is not used to
redirect to binary files). Let's change the type to make future changes easier.

Reviewed By: sfilipco

Differential Revision: D26612479

fbshipit-source-id: 1da7950d5ab2b590963f1591e2f1dd5ae8e0116c
2021-02-23 22:33:45 -08:00
Jun Wu
04a147a8db ui: forward ui.debug to tracing.debug
Summary:
This makes existing ui.debug appear in tracing debug output with correct
callsite information. They can then be filtered by the `EDENSCM_LOG`.  For
example:

  $ EDENSCM_LOG=edenscm=debug lhg dbsh
  In [1]: ui.debug('foo')
  Feb 19 20:03:31.795 DEBUG edenscm.hgext.debugshell: foo

Reviewed By: sfilipco

Differential Revision: D26582807

fbshipit-source-id: b3d97d43d8a31c7d42e3b5c86a05142206e2c9f7
2021-02-23 22:33:45 -08:00
Genevieve Helsel
f2d6906665 fix dictionary changed size during iteration in run_tests.py
Summary:
We shouldn't delete from a dictionary while iterating over it, instead we should iterate over a copy and then delete from the original.
`.keys()` returns a view of the dict, while wrapping it in `list` makes a deep copy.

Reviewed By: StanislavGlebik

Differential Revision: D26618782

fbshipit-source-id: 234503aab0a0a2151ae0818282651b547f414016
2021-02-23 16:55:07 -08:00
Andrey Chursin
ec7501a0a1 checkout: prefetch RemoteDataStream in separate thread
Summary: Otherwise prefetching blocks current tokio thread effectively stalling other futures progress

Reviewed By: quark-zju

Differential Revision: D26598765

fbshipit-source-id: cb1a9e8c2831fb307d28c505d5b3b61f2f897fa4
2021-02-23 15:45:04 -08:00
Andrey Chursin
3c1884034f checkout: use allow_threads in native checkout
Summary: This allow python to redraw progress bar

Reviewed By: quark-zju

Differential Revision: D26613054

fbshipit-source-id: 717f2c15fd9f9ccf339b457529c4f070d1f7ab79
2021-02-23 15:45:04 -08:00
Jun Wu
d5ff47783f cpython-async: release GIL on PyFuture.wait
Summary:
The future has a "map" clause that takes GIL too. If they run in different
threads it could deadlock. For example, the following code might hang
forever:

  In [1]: s,f=api.commitdata('fbsource',list(repo.nodes('master')))
  In [2]: f.wait()

Reviewed By: sfilipco

Differential Revision: D26582806

fbshipit-source-id: e3259850c68b8d48a7a69ed9d47ef75f26179382
2021-02-23 15:09:15 -08:00
Jun Wu
4f35095c38 hgcommands: set tracing level to TRACE if EDENSCM_LOG is set
Summary:
Previously, one has to set both EDENSCM_LOG=trace and EDENSCM_TRACE_LEVEL=trace
to enable all logging. That is because the filtering is global - one subscriber
(or layer) filtering out a span or event, then the span or event is gone
forever.

For now, let's just set the TracingCollector Subscriber's filter level
(EDENSCM_TRACE_LEVEL) to TRACE so it solely depends on the EnvFilter
(EDENSCM_LOG) if EDENSCM_LOG is set. That's more friendly.

See `impl<L: Layer<S>, S: Subscriber> Subscriber for Layered<L, S>`:

    fn enabled(&self, metadata: &Metadata<'_>) -> bool {
        if self.layer.enabled(metadata, self.ctx()) {
            // if the outer layer enables the callsite metadata, ask the subscriber.
            self.inner.enabled(metadata)
        } else {
            // otherwise, the callsite is disabled by the layer
            false
        }
    }

See also: https://github.com/tokio-rs/tracing/issues/302

Reviewed By: sfilipco

Differential Revision: D26518017

fbshipit-source-id: 9016b940621fc9a883e6ca3f00eaaeccc051ae74
2021-02-23 15:09:15 -08:00
Jun Wu
278d44ecd1 tracing-collector: stop forwarding to log eco-system
Summary:
Now we use tracing_subscriber for equivalent features (by setting EDENSCM_LOG).
It's no longer necessary to forward to log eco-system.

Reviewed By: sfilipco

Differential Revision: D26518018

fbshipit-source-id: 7cc080faa734ca40eed1ce250df3135ca2626c1f
2021-02-23 15:09:15 -08:00
Jun Wu
e46d5c4295 clidispatch: drop unused mut from IO APIs
Summary: Now IO has internal locking, `mut` is no longer needed.

Reviewed By: sfilipco

Differential Revision: D26518025

fbshipit-source-id: d71e213f6fed24fdefb4c730d576f6cf2fb09d82
2021-02-23 15:09:14 -08:00
Jun Wu
e66a1922f4 clidispatch: drop Clone on IO
Summary:
Cloning IO would make it harder to run the clean-up logic in Drop (ex. flush,
stop the pager). Forbid it.

The weak reference output and error streams can still be cloned. They sastify
the main "clone" use-cases.

Reviewed By: sfilipco

Differential Revision: D26538451

fbshipit-source-id: 6cc59214ec5fe1340cb27c7ee1a09658bb83190a
2021-02-23 15:09:14 -08:00
Jun Wu
ae8a4340f7 clidispatch: add an API to obtain "writable" stdout stream
Summary:
Similar to D26518021 (3aba8d89b0), provide a way to obtain the "output" stream
that implements `std::io::Write`.

The "output" stream is then used to replace the `std::io::Write`
implementation on the `IO` itself.

This has 2 benefits:
- Removes the `&mut` methods on `IO`. So all `&mut IO` can be replaced by `&IO` without exceptions.
- Make it possible to drop `Clone` on `IO` (strong ref is not clonable, but weak ref can). So we can control the lifetime of the streams more predicatably.

Reviewed By: sfilipco

Differential Revision: D26538452

fbshipit-source-id: b00c65ae0ef5ef4a609104111706365028f47ef7
2021-02-23 15:09:14 -08:00
Jun Wu
57adadaf1d pypager: use the global IO state
Summary:
Use the global IO state instead of keeping a separate IO state.

This makes the Python pager logic able to affect the tracing logger's error
output. For example, the following command will write the tracing logs to
the streampager's stderr channel as expected:

    EDENSCM_LOG=trace lhg log -r '.~1000::.' --config pager.pager=internal:streampager

Traditional pager also works:

    EDENSCM_LOG=trace lhg log -r '.~1000::.' --config pager.pager=less

Reviewed By: sfilipco

Differential Revision: D26518024

fbshipit-source-id: c7020b7467f9392af8c2a58d064339d05bce35ce
2021-02-23 15:09:13 -08:00
Jun Wu
242c8fd066 clidispatch: use weakref for IOError
Summary:
This makes the IOError stream used by tracing loggers use weak reference
so the main IO can still be dropped without being affected by potentially
lingering IOError values.

Reviewed By: sfilipco

Differential Revision: D26518022

fbshipit-source-id: df4c847a7a59fff39b7832190a8723c78ffae9ad
2021-02-23 15:09:13 -08:00
Jun Wu
bbe2489e04 hgmain: set the global IO reference
Summary:
Set the global IO reference to the IO created by hgmain. This allows
other crates like `pypager` to use the `IO` without cloning or passing
the reference across layers (Rust references do not actually work for
across the Python boundary).

Reviewed By: sfilipco

Differential Revision: D26518027

fbshipit-source-id: 6144b06035d0ef9384cc1a37245c306071e35a9d
2021-02-23 15:09:13 -08:00
Jun Wu
9bf5d70e29 clidispatch: add a global IO reference
Summary:
This makes it easier to figure out the "main" IO, similar to APIs like
`std::io::stdout`, without passing the IO around. It will be used by
the `pypager` module.

The global reference is a weak reference so it won't affect IO drop
behavior.

Reviewed By: sfilipco

Differential Revision: D26518015

fbshipit-source-id: ab75ec31cbb8f156b72c94a6fe5b2de6fe9e0bff
2021-02-23 15:09:12 -08:00
Jun Wu
edcc730da3 clidispatch: add an API to stop the pager without dropping
Summary: This will be used by pypager.

Reviewed By: sfilipco

Differential Revision: D26518026

fbshipit-source-id: ac8290501ea572cc5ce2067a52d62f4933cbe87b
2021-02-23 15:09:12 -08:00
Jun Wu
92cfc827af hgcommands: print IO types when it cannot be converted to PyObject
Summary:
I encountered the error but it's unclear what happened. Print type_name to
clarify.

Now I get:

  not implemented: converting non-stdio Write (alloc::vec::Vec<u8>) from Rust to Python is not implemented

This turns out to be an error in "clidispatch: make IO clonable" - The `Drop`
should be implemented on `Inner`, instead of `IO`. The fix has been folded
into that commit.

Reviewed By: sfilipco

Differential Revision: D26518016

fbshipit-source-id: ddb5f828c59cbffa9767694558113167bc96db4b
2021-02-23 15:09:12 -08:00
Lukas Piatkowski
279eb2b538 autocargo v1: changes to how thrift-related generation is done to match v2
Summary: Done some reordering of fields in Cargo.toml, added test and doctest = false, name of the target that generated the Cargo.toml file and sorted the cratemap.

Reviewed By: ahornby

Differential Revision: D26581275

fbshipit-source-id: 4c363369438c72d43d8ccf4799f103ff092457cc
2021-02-23 11:38:45 -08:00
Mark Juggurnauth-Thomas
0ef99947cc color: add combined effects in fallback chains
Summary:
Allow color effects to be joined with `+`, e.g. `blue+bold`.  Unlike effects
separated by spaces, these effects must all be available in order for the
effect to apply.  If any of the effects are not available, then the combined
effect is not valid.

This is useful in fallback chains, where some of the fallbacks are combined
effects, for example: `brightred:red+bold`.

Use these to improve the fallback chains for sparse profiles, so that the
profile names are not shown in black on 8 color terminals.

Reviewed By: quark-zju

Differential Revision: D26580365

fbshipit-source-id: 8e204c901566ac03fb4af066ab1a09142750a9fb
2021-02-23 04:47:01 -08:00
Jun Wu
b7a9d6344c debugshell: update locals() with globals()
Summary:
Some features in debushell, like `%time` uses `locals()`. They currently cannot
use common variables like `cl` like:

  In [1]: %time len(cl)
  ---------------------------------------------------------------------------
  NameError                                 Traceback (most recent call last)
  <timed eval> in <module>

  NameError: name 'cl' is not defined

Fix it by updating `locals()`.

  In [1]: %time len(cl)
  CPU times: user 700 µs, sys: 130 µs, total: 830 µs
  Wall time: 1.28 ms

Reviewed By: ikostia

Differential Revision: D26590943

fbshipit-source-id: 2b7fd3274f1ea41f7996edbbdae0af8e103a9c0a
2021-02-22 16:53:54 -08:00
Arun Kulshreshtha
befabb81c0 eden: make the EdenFS import helper use EdenAPI's /trees endpoint instead of /complete_trees
Summary:
The EdenFS import helper's `_fetch_tree_impl` method works by either calling `repo._prefetchtrees` or `repo.prefetchtrees`, both of which are methods from `treemanifest` extension's `treerepository` class. Unfortunately, these methods are lower-level than their names would suggest, and will always perform gettreepack style fetching (see [1]).

If HTTP fetching is enabled, this means that EdenFS will always query EdenAPI's `/complete_trees` endpoint instead of `/trees`, which is needlessly expensive given that EdenFS just wants the exact set of trees specified. As a somewhat hacky workaround, this diff just checks whether HTTP fetching is enabled, and if so, directly calls the appropriate HTTP fetch method.

This solution isn't ideal; it would be better for the import helper to request the trees from Mercurial's `remotetreestore` instead of via methods from `treerepository`. Unfortunately, with the current structure of Mercurial's storage layer, the `remotetreestore` isn't readily accessible because it gets passed into the Rust API's storage hierarchy upon construction.
 ---
[1]: The various `*prefetchtrees` methods  are usually called from Mercurial's `remotetreestore`, which is where the choice of tree fetching strategy is made (i.e., designated nodes vs gettreepack). The `remotetreestore` then calls `*prefetchtrees` for gettreepack-style fetching, or `*getdesignatednodes` for on-demand fetching. As such, a call to `*prefetchtrees` generally implies gettreepack-style fetching.

Reviewed By: quark-zju

Differential Revision: D26560451

fbshipit-source-id: 2eedf50a6e66fac78df77214b777544eb8049714
2021-02-22 14:23:40 -08:00
Johan Schuijt-Li
2c0b490179 fix tests
Summary: D26543635 (1536917be2) changed the output for some tests, update accordingly

Reviewed By: singhsrb

Differential Revision: D26580674

fbshipit-source-id: dc8062cf614268a71440f6e2fe3556339d168601
2021-02-22 14:16:14 -08:00
Liubov Dmitrieva
1ed10dd9c6 cleanup code
Summary: This code has been used to transfer an existing repo to remotenames. After D26460435 (84280e36c3) it doesn't work as designed and should be removed as well.

Reviewed By: quark-zju

Differential Revision: D26544739

fbshipit-source-id: 34c08d4b9997c0b1f298ee1ecd0e8af24f4d8a39
2021-02-22 06:15:48 -08:00
Liubov Dmitrieva
b2f442982b hide: support for scratch remote bookmarks
Summary:
Support for unsubscribing from a scratch remote bookmarks in `hg hide` command.

This is support if you hide via a revision. Hiding by its name will be another change.

Reviewed By: quark-zju

Differential Revision: D26544305

fbshipit-source-id: d10372513dda88903e2cc031ff16883a001c8e34
2021-02-22 06:15:47 -08:00
Mark Juggurnauth-Thomas
2b8d5ab75d undo: expand heuristics for uncommit/unamend hint
Summary:
The `commit` or `amend` command might not have been the first item in the
command list (e.g. there could have been a custom config option).  Expand the
heuristics for detecting the `commit` and `amend` cases to account for this.

Reviewed By: quark-zju

Differential Revision: D26545339

fbshipit-source-id: a5b1fc8ccc87989e742fce1fa79273266892ed79
2021-02-22 02:46:53 -08:00
Johan Schuijt-Li
1536917be2 support dynamicconfig in clones
Summary: Dynamic config only gets applied once the local repo is instantiated, but source peer is created long before that. This causes it to have missing configuration when being instantiated. Apply dynamic config much earlier in case of a clone so that srcpeer can use dynamicconf as well.

Reviewed By: DurhamG

Differential Revision: D26543635

fbshipit-source-id: 88c16d345f5116bfaaf57c593eb09145df81b4fb
2021-02-21 22:25:24 -08:00
Zeyi (Rice) Fan
f1bec6dc68 mkscratch: remove old code
Summary: throw-in-trash-delete

Reviewed By: chadaustin

Differential Revision: D26534019

fbshipit-source-id: 59b0050a3851cb80da7cbeccf3940fd13094165f
2021-02-20 15:42:37 -08:00
Zeyi (Rice) Fan
58a9d11260 scratch: validate subdir path in mirror mode
Summary:
This diff ensures no one can exploit mkscratch's scratch directory. In reality probably no one would do this but just to add it as a precaution.

And also the renaming, I didn't land the rename changes in my previous diff and this diff fix that so we don't roll the "nested" mode name out.

Reviewed By: xavierd

Differential Revision: D26526702

fbshipit-source-id: 04ec883e4d1c0c3e9b54b6274e5113c8b4845b3f
2021-02-20 15:42:37 -08:00
Andrey Chursin
987e6426fc checkout: print removed cwd warning in nativecheckout
Summary:
This warning was printed by old checkout, keeping it in nativecheckout too
The warning tells user that current working directory was removed during checkout

This diff also makes test-update-names.t to use nativecheckout. Otherwise last test fails on remote repo, because pyworker does not emit the deleted cwd warning

Reviewed By: quark-zju

Differential Revision: D26558188

fbshipit-source-id: 1f6ea2ea1ac7358ce2f06fed25069656481b30e6
2021-02-20 01:29:11 -08:00
Andrey Chursin
d8e40c89a0 tests: test-update-names.t to use remoterepo
Summary: After this update, test-update-names.t tests are using native checkout when congfig is set

Reviewed By: quark-zju

Differential Revision: D26558186

fbshipit-source-id: f70f65344b5f2209f313e3edd5fd7f541318459a
2021-02-20 01:29:10 -08:00
Andrey Chursin
78f7bab434 tests: add newremoterepoto tinit.sh
Summary: Those shortcuts can be used to setup remote repo via single line

Reviewed By: quark-zju

Differential Revision: D26558187

fbshipit-source-id: c6fd48ed38cc4dbaad4db714c4dfd76ec26bf608
2021-02-20 01:29:10 -08:00
Andrey Chursin
adb28ae0aa checkout: expose stats to Python
Reviewed By: quark-zju

Differential Revision: D26552742

fbshipit-source-id: fccc812eb1f3ad150580538a1d8fa4e8afd3bd7b
2021-02-20 01:29:10 -08:00
Andrey Chursin
2646ed375b checkout: record updates after checkout
Summary: This is needed to correctly show status after checkout

Reviewed By: quark-zju

Differential Revision: D26551119

fbshipit-source-id: 3ab576df8132b1fb8cccf507717923ecf3084757
2021-02-20 01:29:09 -08:00
Andrey Chursin
6a6471628f checkout: make checkout plan reusable
Summary:
This diff makes CheckoutPlan::apply take &self instead of self, so that CheckoutPlan can be preserved.
This result in cloning of some paths(but realistically, they probably get moved anyway in this code path, so this should not have perf impact)

This will simplify pycheckout as it will allow to keep plan and later use it to update dirstate

This diff also exposes accessors for dirstate update (e.g. removed_files / updated_content_files / updated_meta_files)

Reviewed By: quark-zju

Differential Revision: D26551118

fbshipit-source-id: 4e2d02da0a692345eae7d5e7124663c577e9029c
2021-02-20 01:29:09 -08:00
Andrey Chursin
ae056f1cbf checkout: integrate native checkout into merge.py
Summary:
Currently native checkout works only on simplest cases when there is no merge / rebase and working copy is clean
Additionally, all native checkout logic is gated with experimental.nativecheckout config

Reviewed By: quark-zju

Differential Revision: D26501903

fbshipit-source-id: 2c1b2fd303f1cb1f461d4854ea60a7274ae38732
2021-02-20 01:29:09 -08:00
Jun Wu
f3b00a6c0d edenfs-client: print meaningful warnings for non-utf8 paths
Summary:
Make the status fast path print warnings about non-utf8 names and continue on
other valid utf-8 names. It matches the behavior of the Python status code
path.

Before this change, an invalid utf-8 name would just print:

  abort: invalid utf-8 sequence of 1 bytes from index 7

without telling which file it is.

Reviewed By: markbt

Differential Revision: D26553514

fbshipit-source-id: 6e26a2a8d738e9001d878a80c0dc82ae6d18a97c
2021-02-19 18:32:11 -08:00
Jun Wu
049d411aa0 hgcommands: init EDENSCM_LOG "env_logger" that writes to error stream
Summary:
Similar to D26142175 (324f47b1f0), initialize the logger that writes to the error stream of
IO.

Reviewed By: sfilipco

Differential Revision: D26518014

fbshipit-source-id: 2547f4a8f3dba1f624fd00798672f1148869e250
2021-02-19 15:22:07 -08:00
Jun Wu
568e0d2258 tracing-collector: mark default_collector return LookupSpan
Summary:
`LookupSpan` is needed to chain the fmt logger:

  impl<S, N, E, W> Layer<S> for tracing_subscriber::fmt::Layer<S, N, E, W>
  where
      S: Subscriber + for<'a> LookupSpan<'a>,
      N: for<'writer> FormatFields<'writer> + 'static,
      E: FormatEvent<S, N> + 'static,
      W: MakeWriter + 'static,

Reviewed By: sfilipco

Differential Revision: D26518020

fbshipit-source-id: fda996683e2c68cede4778e653845bd23a1fcb1c
2021-02-19 15:22:06 -08:00
Jun Wu
3aba8d89b0 clidispatch: add an API to obtain "writable" stderr stream
Summary:
Add an API to obtain an `io::Write` object for the error stream.
It will be used by next changes.

Reviewed By: sfilipco

Differential Revision: D26518021

fbshipit-source-id: bc39fa54f83be8ff2c8fbc803700c4fe57e814bd
2021-02-19 15:22:06 -08:00
Jun Wu
25230c0c2a clidispatch: make IO clonable
Summary:
Make it possible for IO to be cloned. This allows, for example, tracing or
progress bar logic to keep a reference of IO.

Reviewed By: sfilipco

Differential Revision: D26518028

fbshipit-source-id: d5ca7f4347251c68f7491f784f647ee80c47d159
2021-02-19 15:22:06 -08:00
Jun Wu
43bee8fbbc clidispatch: make IO fields private
Summary:
We're going to tweak the internals of IO. Making its fields private to allow
that.

Reviewed By: sfilipco

Differential Revision: D26518023

fbshipit-source-id: a1eed46f4f87a3b4b63e56be733102058b4d72d6
2021-02-19 15:22:05 -08:00
Jun Wu
531fa41c8a clidispatch: add parking_lot
Summary: Add parking_lot dep. It will be used later.

Reviewed By: sfilipco

Differential Revision: D26518019

fbshipit-source-id: 76124a2f70731b30017a6d7019eef9dc856fe54a
2021-02-19 15:22:05 -08:00
Lukas Piatkowski
cd0b6d50e2 autocargo v1: changes to match autocargo v2 generation results.
Summary:
The changes (and fixes) needed were:
- Ignore rules that are not rust_library or thrift_library (previously only ignore rust_bindgen_library, so that binary and test dependencies were incorrectly added to Cargo.toml)
- Thrift package name to match escaping logic of `tools/build_defs/fbcode_macros/build_defs/lib/thrift/rust.bzl`
- Rearrange some attributes, like features, authors, edition etc.
- Authors to use " instead of '
- Features to be sorted
- Sort all dependencies as one instead of grouping third party and fbcode dependencies together
- Manually format certain entries from third-party/rust/Cargo.toml, since V2 formats third party dependency entries and V1 just takes them as is.

Reviewed By: zertosh

Differential Revision: D26544150

fbshipit-source-id: 19d98985bd6c3ac901ad40cff38ee1ced547e8eb
2021-02-19 11:03:55 -08:00
Durham Goode
fb30e5ccd0 dynamicconfig: add tracing
Summary: Adds some tracing for debugging dynamicconfigs.

Reviewed By: quark-zju

Differential Revision: D26501257

fbshipit-source-id: ae6cf92552988c4eccb8f5a3bbaf930e84158133
2021-02-19 10:45:03 -08:00
Meyer Jacobs
c74570a4b6 newstore: Add FetchError type for strongly typed fetch errors
Summary: Introduce `FetchError` type, with separates "not found" errors (which require a key), from other errors (which may or may not have an associated key). This allows us to easily fall back for only "not found" errors propagate other fetch errors to the caller. The current version of `FetchError` still does not eliminate redundantly storing the key for cases like EdenApi, where the key may be part of the error type itself. This optimization may not be worthwhile after we refactor these store implementations to use `HgId` instead of `Key`.

Reviewed By: kulshrax

Differential Revision: D26410215

fbshipit-source-id: e6198d54de64b41ff696cabd64affc8dbaa41cf9
2021-02-19 10:41:28 -08:00
Meyer Jacobs
62c0be0bfd newstore: introduce WriteStore adapter for legacy HgIdMutableDeltaStore
Summary: Added `WriteStore` implementation to `LegacyDatastore` wrapper, for types implementing `HgIdMutableDeltaStore`.

Reviewed By: kulshrax

Differential Revision: D26382709

fbshipit-source-id: 1482d43668042045a48a6f0252f72261a19a288d
2021-02-19 10:41:27 -08:00
Meyer Jacobs
347979d283 newstore: introduce LegacyDatastore wrapper to adapt stores implementing HgIdDataStore to new API
Summary: Add a wrapper type, `LegacyDatastore`, along with a `ReadStore` implementation that reads via the `HgIdDataStore` trait, for any wrapped types which implement that trait.

Reviewed By: kulshrax

Differential Revision: D26381207

fbshipit-source-id: d28dc3095adf20403f8b993d5a939d1e41c77462
2021-02-19 10:41:27 -08:00
Meyer Jacobs
0d8a953107 newstore: add EdenApi FileEntry ReadStore adapter
Summary:
Added a new `ReadStore` implementation for EdenApi `FileEntry`s. This is pretty much identical to the `TreeEntry` implementation, but calls the `files` method instead, which does not yet support attributes or per-entry errors (although they are both supported on the wire).

I re-use the type-agnostic indexedlog `Entry` adapter for file support for now, to keep things minimal. This unfortunately means the output type of the `Fallback` combinator is a bare `Entry` for both files and trees, losing us some type safety, but I think this is acceptable for now, until I eventually introduce type-safe constructors and value types. Making the file and tree value output types distinct will only be necessary with the introduction of attribute support, or when we'd like to move away from using an "opaque blob" representation for them.

Reviewed By: kulshrax

Differential Revision: D26348577

fbshipit-source-id: 1a930af6e4b5b4d8bacd266c3e51db96cee92dbd
2021-02-19 10:41:27 -08:00
Meyer Jacobs
bccd649aa0 newstore: add write support to FallbackStore combinator
Summary:
Added write support to the `FallbackStore` combinator, along with a flag to control writing to the write store. This enables the "preferred" store to act as a read-through cache for the "fallback" store, with an optional "read only" mode via the "write" flag.

Currently, errors in the write path are silently ignored.

Reviewed By: kulshrax

Differential Revision: D26233602

fbshipit-source-id: acce020a877b87bfee87763e984923c7c51b2b17
2021-02-19 10:41:26 -08:00
Meyer Jacobs
7bd30eb98e newstore: introduce basic WriteStore trait and adapter for IndexedLog
Summary: Introduces a minimal WriteStore trait, with a basic implementation for IndexedLog. Currently, there's no explicit key in the `WriteStream`. Instead, it is implicit that the value type to be written should contain a key. In the future, we may introduce an abstraction over value types which do and do not contain a key.

Reviewed By: kulshrax

Differential Revision: D26213028

fbshipit-source-id: 75867ff7229d594346e7e7624e8ca91f8205fed4
2021-02-19 10:41:26 -08:00
Andrey Chursin
72dfb176b5 checkout: chunk prefetches during apply_remote_data_store
Summary: This helps with pipelining (once chunk is prefetched it will start rolling out to fs) and also helps with limiting number of keys prefetched at once

Reviewed By: quark-zju

Differential Revision: D26496789

fbshipit-source-id: 9aa6b08c1605ab2a06a02347897f5dcfa22297fd
2021-02-19 10:30:01 -08:00
Andrey Chursin
c7269df47e checkout: impl Display for CheckoutPlan
Summary: Also add __str__ Python binding. Usefull for debugging

Reviewed By: quark-zju

Differential Revision: D26496791

fbshipit-source-id: 8bcfc89918c5fafc9ac8e42ef91c576b160d943c
2021-02-19 10:30:01 -08:00
Andrey Chursin
de6e57e067 checkout: remove allow(dead_code)
Summary: Also removing todo: test from checkout plan as there are tests already

Reviewed By: singhsrb

Differential Revision: D26496790

fbshipit-source-id: eb99771cb0cda7a90477190875997027b25e2482
2021-02-19 10:30:01 -08:00
Jun Wu
3119869537 dag: de-duplicate logic about merging flat segments
Summary:
Move the logic to a common method. A side effect is that
IndexedlogIdDag needs to calculate `last_span.high` again, and
InProcessIdDag needs to calculate `last_store_id` again. But it's
probably okay since the merge is rare and the InProcessIdDag operations should
be considered fast even if it's called frequently.

Reviewed By: sfilipco

Differential Revision: D26504915

fbshipit-source-id: e215ffe9fef7948b7b662dba3ed990e374be989a
2021-02-19 10:30:01 -08:00
Jun Wu
3915e59426 dag: add a few more tests about IdDag segment merging behavior
Summary: Add a few more tests to the generic IdDag tests.

Reviewed By: sfilipco

Differential Revision: D26415514

fbshipit-source-id: 5ef2a1d4e03527b184a07d94de91c64a05427b90
2021-02-19 10:30:00 -08:00
Jun Wu
1503cf6e12 dag: drop merge_commits flag
Summary: It is a constant `true` now. Inline the logic and remove the field.

Reviewed By: sfilipco

Differential Revision: D26414838

fbshipit-source-id: ceace835ecfd263ba16c3dead41ce6ba95087e4f
2021-02-19 10:30:00 -08:00
Jun Wu
7bb35e4356 dag: enable segment merging for IdDag stores
Summary: Turn on the IdDag flat segment merging behavior. Update related tests.

Reviewed By: sfilipco

Differential Revision: D26414843

fbshipit-source-id: f91f4dbd144276e895ad8bc14f37bcc2fa13935e
2021-02-19 10:30:00 -08:00
Jun Wu
34f1ec6959 dag: implement segment merging for inprocess IdDag
Summary:
Similar to the previous diff. Implement the merge behavior for InProcess IdDag.

The feature is not turned on yet for easier review. It is turned on by the
next diff.

Reviewed By: sfilipco

Differential Revision: D26414839

fbshipit-source-id: 2a485e0dffcd9d8e2ad95380159d11342636f9aa
2021-02-19 10:29:59 -08:00
Jun Wu
e5767de7ae dag: implement segment merging for indexedlog IdDag
Summary:
Merge adjacent flat segments to reduce fragmentation.

The merging is done by a special entry that instructs:
- Remove the old segment from index.
- Insert the new segment.

Note: For the parent -> child index we record parent -> child id, not parent ->
segment. So that index does not need to be updated, because the merged segment
has the same "parent -> child id" information.

Note: The merging is a bit expensive (multiple lookups). But most segments are
not mergeable, because their parents are not "span.low - 1". So the slow path
is not hit often.

The feature is not enabled by default in this diff, because it will break IdDag
tests, which assume indexedlog and in-memory IdDags behave the same, and we
haven't updated in-memory IdDag.

Reviewed By: sfilipco

Differential Revision: D26414841

fbshipit-source-id: 6a268bef56b7a56c62bb8ad949f13e503a88b033
2021-02-19 10:29:59 -08:00
Jun Wu
ee97981fd3 dag: extract indexedlog IdDag segment construct to a method
Summary: We'll tweak the construct logic in a future diff.

Reviewed By: sfilipco

Differential Revision: D26414842

fbshipit-source-id: 791bdda8b042b90ff9aeef630cb904a2d9e41cbd
2021-02-19 10:29:59 -08:00
Jun Wu
fa8a04d539 dag: drop max_level state from IdDag
Summary:
With previous refactorings the `max_level` is now maintained by the underlying
IdDag stores. Remove the `max_level` on the wrapper IdDag to simplify the
logic.

Reviewed By: sfilipco

Differential Revision: D26414840

fbshipit-source-id: 084a7f6f75fd53103c45519190607607fef4e161
2021-02-19 10:29:58 -08:00
Jun Wu
04bc45fae0 dag: skip serializing max_level and new_seg_size in IdDag
Summary: We're going to remove the fields. Those add noise to the serialized data.

Reviewed By: sfilipco

Differential Revision: D26504916

fbshipit-source-id: 7fd13bdab4511ceea50195595514fb89a4169419
2021-02-19 10:29:58 -08:00
Jun Wu
a25f03a545 async-runtime: reduce worker_threads to min(nproc, 8)
Summary:
By default it spawns `nproc` threads, which is an overkill on hosts with many cores.
Data shows the max CPU busy % for tokio threads is 30%, avg is 0.1%.

Testing framework will spawn `nproc` tests, meaning it's `nproc ^ 2` threads, which
seems too many.

The number 8 is picked to match the checkout worker count (worker.numcpus), to
ensure checkout tasks won't have bottleneck on the count of tokio threads doing
work like parsing manifest etc.

Reviewed By: sfilipco

Differential Revision: D26437442

fbshipit-source-id: 4dccef83294e64c432ef5ab4be259d41dd890ece
2021-02-19 10:20:57 -08:00
Johan Schuijt-Li
22c1735c5e mononokepeer: don't concat strings when help message not set
Summary:
Fix for error:
  can only concatenate str (not "NoneType") to str

Reviewed By: quark-zju

Differential Revision: D26523879

fbshipit-source-id: 3d15d72be3444df25fb705ce444d6c3621547551
2021-02-18 18:00:27 -08:00
Liubov Dmitrieva
84280e36c3 remove accessed bookmarks feature
Summary:
Remove selectivepullaccessedbookmarks feature because it contains bugs and causes many undesired issues.

This was added to migrate existing repos to selective pull and is not needed anymore.

Main effects are:

* if you enable selectivepull for an existing repo, it won't reduce number of subscribed bookmarks.
* some operations like `hg push` or `hg pull -r` in their underlying implementation update all subscribed bookmarks, not just accessed like before.
This drives changes to the tests. Reminder, the bookmark has been marked as "accessed" if the repo has been ever updated to that bookmark.

All tests fixed accordingly.

Reviewed By: markbt

Differential Revision: D26460435

fbshipit-source-id: f839b9f207bfc478a0336ec807b720d35a0bb12e
2021-02-18 04:02:06 -08:00
Durham Goode
5b5eec156c treemanifest: remove logic that replaces the stores
Summary:
This was added in D26387205 (ca1249c269) to make the treemanifest store usage look
more like the file store usage, but it appears to cause read-after-write
failures. I'm not sure exactly why, but I think it's because something takes a
reference to the old store and writes to it, then something else reads from the
new store. Or vice versa.

Either way, reverting these three lines fixes it.

Reviewed By: singhsrb

Differential Revision: D26497708

fbshipit-source-id: e9afabed8d5f800260e647d5ed1513eed0bc60cd
2021-02-17 14:36:14 -08:00
Andrey Chursin
ceee768281 pycheckout: register checkout module in populate_module
Reviewed By: DurhamG

Differential Revision: D26470216

fbshipit-source-id: cdfda074256ba7dbf90d807904bab9a3b8142a98
2021-02-17 12:02:44 -08:00
Andrey Chursin
6498f4f892 pycheckout: add checkoutplan::apply
Reviewed By: DurhamG

Differential Revision: D26469704

fbshipit-source-id: 010a12b04b7f6a5d08e1aa248130026341306595
2021-02-17 12:02:43 -08:00
Andrey Chursin
51a29c5d7e pycheckout: implement checkoutplan::__new__
Summary: This diff introduces a Python checkoutplan, which will be used later for Python code to interact with the Rust checkout infrastructure

Reviewed By: DurhamG

Differential Revision: D26437080

fbshipit-source-id: fe3517f4e2f15244a7c2cd290a41394e904db51b
2021-02-17 12:02:43 -08:00
Andrey Chursin
6ae7c785ba pymanifest: make treemanifest public
Summary: This diff exposes treemanifest for public use and introduce method to borrow underlyning manifest for usage in rust

Reviewed By: DurhamG

Differential Revision: D26437079

fbshipit-source-id: d2d6cd2a4d1f108881d985932a36d48fed4b238d
2021-02-17 12:02:43 -08:00
Andrey Chursin
11faa47a7d pycheckout: empty pycheckout crate
Reviewed By: DurhamG

Differential Revision: D26435596

fbshipit-source-id: 013070ff918c7b45105c7abdad0950ee96d46d49
2021-02-17 12:02:43 -08:00
Andrey Chursin
eac8385eff vfs: use &[u8] instead of Bytes for content
Summary: This is most universal/flexible interface

Reviewed By: quark-zju

Differential Revision: D26410641

fbshipit-source-id: cae74675f89c0c1c05c84331c3ce0e78fd0b0b2f
2021-02-17 10:45:46 -08:00
Andrey Chursin
3e29269b99 vfs: update existing permissions instead of setting const value
Summary: This better replicates python's logic

Reviewed By: quark-zju

Differential Revision: D26406416

fbshipit-source-id: 1027004ded63a28aa88b81b087255c4ef212dd6b
2021-02-17 10:45:46 -08:00
Andrey Chursin
0ea63a1eaf checkout: test no empty dirs are left
Reviewed By: quark-zju

Differential Revision: D26406420

fbshipit-source-id: 3a9dc818a4a140f2e532c18b2abd81286cfee1eb
2021-02-17 10:45:46 -08:00
Xavier Deguillard
a24e03f76f rust: update libc crate
Summary: The latest libc has fixes for compiling on the M1 mac, let's update it.

Reviewed By: dtolnay

Differential Revision: D26476625

fbshipit-source-id: d9a997e69c428d53c51fc52353289a6510314c50
2021-02-16 22:31:41 -08:00
Durham Goode
4b2ec1b3cc tests: fix test on osx
Summary:
Sort works differently on OSX. Let's set the locale in this case to get
consistent sorting across platforms.

Reviewed By: quark-zju

Differential Revision: D26438678

fbshipit-source-id: 80a5c758795fd9675b8b2b658521c0e9d6807366
2021-02-16 10:09:04 -08:00
Lukas Piatkowski
87ddbe2f74 autocargo v1: update autocargo field format to allow transition to autocargo v2
Summary:
Autocargo V2 will use a more structured format for autocargo field
with the help of `cargo_toml` crate it will be easy to deserialize and handle
it.

Also the "include" field is apparently obsolete as it is used for cargo-publish (see https://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields). From what I know this might be often wrong, especially if someone tries to publish a package from fbcode, then the private facebook folders might be shipped. Lets just not set it and in the new system one will be able to set it explicitly via autocargo parameter on a rule.

Reviewed By: ahornby

Differential Revision: D26339606

fbshipit-source-id: 510a01a4dd80b3efe58a14553b752009d516d651
2021-02-12 23:28:25 -08:00
Arun Kulshreshtha
c97db6b042 auth: rename structs
Summary:
Make the struct and method names in this crate more clearly reflective of what they do:

- `Auth` -> `AuthGroup`
- `Auth::try_from` -> `AuthGroup::new`
- `AuthConfig` -> `AuthSection`
- `AuthConfig::new` -> `AuthSection::from_config`
- `AuthConfig::auth_for_url` -> `AuthSection::best_match_for`

Reviewed By: singhsrb

Differential Revision: D26436095

fbshipit-source-id: a5ec5d9c48d3b75a0ee166b74e5340f9c529eeae
2021-02-12 17:52:29 -08:00
Jun Wu
c08f68a05a crdump: use max( instead of last() to optimize a revset query
Summary:
In a non-segmented-chanelog repo, `last`, the revset function has suboptimal
path that makes the following query:

    last(::b8f917d4c & public())

take a long time. Use `max` to fix it.

Reviewed By: singhsrb

Differential Revision: D26435439

fbshipit-source-id: dc854b4c6978d2925cab2cb8f217365ed9c7f146
2021-02-12 14:57:14 -08:00
Arun Kulshreshtha
916956b264 auth: use scheme from URL prefix if present
Summary: Make `AuthConfig::auth_for_url` match the behavior of the Python `httpconnection.readauthforuri` function when an auth group has a URL prefix with a scheme. Previously, the Rust version did not allow schemes to be specified on the prefix, and instead required them to be specified in the "schemes" fields. The Python code allows a scheme in the prefix, which overrides the contents of the "schemes" field for that auth group if present.

Reviewed By: DurhamG

Differential Revision: D26419721

fbshipit-source-id: 909b52a2e37e2fc908d5eb56740dd41dda826033
2021-02-12 14:47:39 -08:00
Zeyi (Rice) Fan
d552144478 configparser: move conversion related to a separated module
Summary:
Move these conversion related function and trait out of `hg` module so EdenFS can use it too. Changes:

* Moved `get_opt`, `get_or` and `get_or_default` directly into `ConfigSet`.
* Moved `FromConfigValue` and `ByteCount` into `configparser::convert`.

Reviewed By: quark-zju

Differential Revision: D26355403

fbshipit-source-id: 9096b7b737bc4a0cccee1a3883e89a323f864fac
2021-02-12 12:33:47 -08:00
Durham Goode
7ab09f1e5f tests: fix broken test
Summary:
The push-pull test was broken by my recent change to make indexedlog
the default. It wasn't caught because the test is disabled in Python 3. It now
passes with Python 3 so let's enable it.

The repack-remove fix is just some flakiness I've seen lately.

Reviewed By: singhsrb

Differential Revision: D26412998

fbshipit-source-id: be4b648f31bd6dfbf6a6e5d2e382acb084461974
2021-02-12 11:38:43 -08:00
Arun Kulshreshtha
8412d537f8 pyauth: add bindings to auth crate
Summary: Add Python bindings to the Rust `auth` crate, with the intention of replacing `httpconnection.readauthforuri`.

Reviewed By: quark-zju

Differential Revision: D26419447

fbshipit-source-id: dd13bea74961137790beb8c96120ebef99e3c313
2021-02-12 10:04:27 -08:00
Arun Kulshreshtha
92bfc3d63d auth: add extra fields to auth groups
Summary: The Python `readauthforuri` method will include *any* fields specified in the `[auth]` section for a given auth group, even if those fields aren't one of the expect ones (such as `cert`, `key`, etc). This is sometimes used in tests to attach additional information to an auth group. To support this in Rust, let's just collect all unknown fields into a `HashMap`.

Reviewed By: quark-zju

Differential Revision: D26416086

fbshipit-source-id: 0252e340e38850a54e24d54810e9abd77c566f63
2021-02-11 21:06:31 -08:00
Arun Kulshreshtha
9fc3b326fb bindings/pyerror: add CertificateError exception
Summary:
The auth crate is now able to check the presence and expiration of client certificates (D26009207 (9f7d4447fd)). When a problem is detected, it emits an `X509Error`, which specifies exactly what the problem is. Since this error always indicates a certificate issue, we can print out the message configured in `help.tlsauthhelp` (which is more specific than `help.tlshelp` from the previous diff).

Previously, Mercurial would attempt to use the certificate anyway, resulting in a difficult to understand error message. Although the previous diffs in this stack improved the error messages on any TLS failure, the `X509Error` messages are even more helpful.

Users can opt in to this certificate validation with `edenapi.validate-certs`. The functionality is gated on a config option to prevent Mercurial from crashing if certificates are misconfigured, but EdenAPI isn't being used.

Reviewed By: quark-zju

Differential Revision: D26385843

fbshipit-source-id: 9809f612f8aab3f2dd442d6dd8dc348f1af45296
2021-02-11 19:29:22 -08:00
Arun Kulshreshtha
8513949bf2 scmutil: print help.tlshelp on TlsError
Summary: Print out the help text configured in `help.tlshelp` upon hitting a `TlsError`. Note that in this case, we use `help.tlshelp` rather than `help.tlsauthhelp` since all we know in this case is that *some* kind of TLS error occurred.

Reviewed By: quark-zju

Differential Revision: D26385844

fbshipit-source-id: 1fb5280195de75107ecdfc9203ef8ddda2a04052
2021-02-11 19:29:21 -08:00
Arun Kulshreshtha
8b9cf7e7cb bindings/pyerror: add TlsError exception type
Summary: Add a new `TlsError` Python exception type corresponding to `HttpClientError::Tls`.

Reviewed By: quark-zju

Differential Revision: D26385846

fbshipit-source-id: c0df543032461de650a4d24c26c6b8aaab1abbb9
2021-02-11 19:29:21 -08:00
Arun Kulshreshtha
5f0a89ca37 http-client: add HttpClientError variant for TLS errors
Summary:
Add a new `HttpClientError::Tls` variant specifically for TLS errors, separating them from other `curl::Error`s from libcurl.

To determine whether a particular `curl::Error` is a TLS error, we check both the error code and the contents of the error message.

Reviewed By: quark-zju

Differential Revision: D26385845

fbshipit-source-id: fd58f86a3a61fcfb845d19e262fdcb132dc7ec9f
2021-02-11 19:29:21 -08:00
Andrey Chursin
0b03898f89 checkout: add genereated test cases
Summary: This diff adds auto-generated test cases to checkout code. It generates partially overlapping trees and tests transitions between them

Reviewed By: quark-zju

Differential Revision: D26384962

fbshipit-source-id: 6140bbb7ff8b87843a2235f8325f57829cdd8cae
2021-02-11 19:10:25 -08:00
Andrey Chursin
c8d54af98e types: limit PathComponentBuf arbitrary characters to a-z only
Summary: Currently PathComponentBuf::arbitrary generates any characters. Those characters are ok for unit tests on hg abstractions where they are currently used, but many of them do not work with real filesystems

Reviewed By: quark-zju

Differential Revision: D26384961

fbshipit-source-id: dde1e9276114b30262bc477a3e0f828645f1f32a
2021-02-11 19:10:25 -08:00
Andrey Chursin
881b03690d vfs: reset permissions when overwriting file
Summary:
Currently if VFS overwrites executable file with regular, it preserves exec bit[see added test].
This diff makes sure that file has correct permissions after overwrite

This diff also slightly optimizes write_executable, by calling set_mode on the file handle, instead of path

TODO - we can check if calling stats() before set_permissions will save some time

Reviewed By: quark-zju

Differential Revision: D26379824

fbshipit-source-id: 42d0b2fb79ed860ac37b2de077388002ade69449
2021-02-11 19:10:24 -08:00
Andrey Chursin
0240026f36 vfs: do not follow symlink when overwriting
Summary:
Before this diff VFS::write_regular did not handle correctly use case when file already existed as as symlink - it would write into symlink location, instead of replacing symlink with a regular file (see updated  test_symlink_overwrite that is failing on old implementation)

This diff adds O_NOFOLLOW option on unix when overwriting the file. When destination is a symlink, attempt to write fails with E_LOOP and triggers clear_conflict that removes symlink and allows retry write to succeed.

This also allows one of test cases in checkout that previously did not work

Reviewed By: quark-zju

Differential Revision: D26378893

fbshipit-source-id: 28bcdaba78db283ac7a25bb232c198d3d8f73e5d
2021-02-11 19:10:24 -08:00
Andrey Chursin
38499b36e0 checkout: introduce file system tests
Summary: This diff contains basic test setup for checkout tests - we compare transition between two trees without dirty changes

Reviewed By: quark-zju

Differential Revision: D26359502

fbshipit-source-id: ef670c944200bae1652863c91ada92c6fecce4ac
2021-02-11 19:10:24 -08:00
Adam Simpkins
8907208651 update dirsync to allow matching individual files
Summary:
Update the dirsync code to allow mirror and exclude rules to match individual
files rather than just directory prefixes.

This simply appends `/` to all filenames when looking for rule matches.  This
allows us to efficiently match individual filenames in addition to directory
prefixes.

Reviewed By: quark-zju

Differential Revision: D26294583

fbshipit-source-id: 83b283f344f6e0bc0fe53b9068e7e0170f53504b
2021-02-11 15:54:28 -08:00
Stefan Filip
93c1231c55 segmented_changelog: update hash_to_location to gracefully handle unknown hashes
Summary:
One of the primary use cases for hash_to_location is translating user provided
hashes. It is then perfectly valid for the hashes that are provided to not
exist.  Where we would previously return an error for the full request if a
hash was invalid, we now omit the hash from the response.

Reviewed By: quark-zju

Differential Revision: D26389472

fbshipit-source-id: c59529d43f44bed7cdb2af0e9babc96160e0c4a7
2021-02-11 12:17:35 -08:00
Stefan Filip
c9f3ae8fa4 edenapi: add commithashtolocation to python client
Summary: Same approach as locationtohash.

Reviewed By: quark-zju

Differential Revision: D26382616

fbshipit-source-id: a06c62c3eebcbe0b07b5c28fce4789a1334d55a4
2021-02-11 12:17:35 -08:00
Stefan Filip
cfed6bb108 edenapi: add commitlocationtohash to python client
Summary:
The approach is very similar to what commitrevlogdata does. You could say
that it's cargo culted.
I am not sure how appropriate it is to return CommitLocationToHashResponse
but I think that it's fine for now.

Reviewed By: quark-zju

Differential Revision: D26374219

fbshipit-source-id: 61d851d5a4fc4223c65078ef434a0c67314a90cd
2021-02-11 12:17:35 -08:00
Durham Goode
d7a4ce4783 py3: remove duplicate constant definition
Summary: This is defined else where in Python 3, so let's get rid of it here.

Reviewed By: quark-zju

Differential Revision: D26381054

fbshipit-source-id: 9746d2c53f83209d9c795ffdd5841d58ef1153ef
2021-02-11 09:50:25 -08:00
Durham Goode
5c6edef11c py3: fix simple Windows py3 issues
Summary: These are just a few one-liners to fix Python 3 on Windows.

Reviewed By: sfilipco

Differential Revision: D26381055

fbshipit-source-id: d9257f2cf35c05f931d74b7d26bdc79f5bf34185
2021-02-11 09:50:25 -08:00
Durham Goode
9c1b611dff indexedlog: make writing to indexedlog the default
Summary:
We've rolled both of these out to 100%. Let's make this the default so
we can delete those configs.

Reviewed By: quark-zju

Differential Revision: D26233645

fbshipit-source-id: cd7a08c404483f78ab714763870f5bf0fa801e7a
2021-02-11 09:34:55 -08:00
Durham Goode
ca1249c269 packs: prevent creating mutable packs when using rust store
Summary:
We're seeing cases where Mercurial is creating unused .tmp pack files
and leaving them around. It looks like there are two places this can happen, 1)
in the treemanifest python code we manually instantiate some mutable packs, and
2) when doing a read from the rust data store, when it does a read against the
mutable pack store it will unnecessarily create the MutableDataPackInner struct,
which creates the temp file.

Let's fix those.

Reviewed By: quark-zju

Differential Revision: D26387205

fbshipit-source-id: 5a567c886849084bcc8121949dd2fb0f9e66d570
2021-02-11 09:31:00 -08:00
Durham Goode
8c08a42d22 dynamicconfig: introduce configs.allowedconfigs
Summary:
In our upcoming migration away from chef/static rc files, we'll be
marking certain files as "allowed". Our hope is that that list only includes
things like .hg/hgrc, ~/.hgrc, etc.

There are cases however where it's convienent to continue to use chef, for
instance when we condition on machine type. To support this, let's add an
allowed_config option, which will allow configs from non-supported locations.

This will also be useful when remediating issues that come up when we start
enforcing allow_location, without rolling back the entire thing.

Reviewed By: quark-zju

Differential Revision: D26233451

fbshipit-source-id: 71789e0361923a6f80de4aef7f012afc0269440d
2021-02-10 19:30:35 -08:00
Sean Kamath
ae5db40fdd Changing commit hash length to 9 in hg prompt
Summary:
Copied from D17312417 (e1f4dbeb3d), because that did what I needed done, but incremented by 1.

I would like to change the length of the displayed hash in scm-prompt
to 9. Why such an impactful diff? Because hg sl shows 9 characters, and I
always get confused when the hash in my prompt doesn't match hg sl

Reviewed By: kulshrax

Differential Revision: D25934253

fbshipit-source-id: 15f2bc8bc7d666de1a077d2bafd74ab3c9753341
2021-02-10 17:07:35 -08:00
Xavier Deguillard
64c6704fd6 fscap: EdenFS on macOS may be case insensitive
Summary:
On macOS, EdenFS can be configured to be case insensitive, and will soon be
switching its default to be case insensitive. Mercurial however considers that
EdenFS is always case sensistive on unix (linux, macOS), so let's change it on
macOS so it manually checks if the working copy is.

Long term, EdenFS on macOS will always be case insensitive, at which point this
code will be changed again to indicate that and avoid the manual checks.

Reviewed By: chadaustin

Differential Revision: D26357816

fbshipit-source-id: 4022c097f2804da69cfcc176840683a6dca12ffd
2021-02-10 15:03:41 -08:00
Jun Wu
9579b11d7f tests: remove broken test-setdiscovery-t84623377.t
Summary:
The test wasn't meant to be committed. The feature it wants to test was not
easily testable (requires streamclone and pull to have different master,
which is true on Mononoke but false on local hg servers).

Reviewed By: sfilipco

Differential Revision: D26380544

fbshipit-source-id: 6fa720058df8b88ace704d186caa4213d9cd62c9
2021-02-10 14:42:39 -08:00
Jun Wu
334ff0a4ca setdiscovery: include tip in localheads if it's empty
Summary:
Previously we include tip in sample. But that is problematic for fast paths
like:

    if set(commonsample).issuperset(set(localheads) - {nullid}):
        ui.note(_("all local heads known remotely\n"))
        return localheads, True, remoteheads

If `localheads` is empty, then the returned "common heads" are empty, causing
downloading the entire repo inefficiently.

Fix the issue by moving `tip` from `sample` to `localheads` so the common
heads will include tip in the fast path.

Reviewed By: DurhamG

Differential Revision: D26374303

fbshipit-source-id: 45a2a44e4db4c4ec2a341522a257d46a62b058d5
2021-02-10 14:08:16 -08:00
Xavier Deguillard
6f5f2c05f7 win: fix windows build
Summary:
The backingstore crate depends on mio which depends on ntdll. It's not entirely
clear to me why we need to do this manually and why cargo/cmake doesn't pick it
up automatically, but let's fix it this way for now.

Reviewed By: genevievehelsel

Differential Revision: D26376606

fbshipit-source-id: 26714b3f03aabefafdf48c7fb0f442cad501a058
2021-02-10 13:00:24 -08:00
Jun Wu
d3ac72a17e dag: impl max_level caching for indexedlog IdDag
Summary:
Previously the `IdDag` struct has max_level caching. With the previous diff the
cache was gone.  Re-implement it on the indexedlog IdDag to maintain
performance. This has visible performance wins:

Before:

  building segments                                 115.949 ms
  ancestors                                          93.072 ms
  children (spans)                                  495.732 ms
  children (1 id)                                    10.384 ms
  common_ancestors (spans)                            3.567 s
  descendants (small subset)                         25.829 ms
  gca_one (2 ids)                                   258.997 ms
  gca_one (spans)                                     3.718 s
  gca_all (2 ids)                                   440.764 ms
  gca_all (spans)                                     3.732 s
  heads                                             322.552 ms
  heads_ancestors                                    67.567 ms
  is_ancestor                                       165.046 ms
  parents                                           304.392 ms
  parent_ids                                         11.765 ms
  range (2 ids)                                      21.466 ms
  range (spans)                                      18.663 ms
  roots                                             471.934 ms

After:

  benchmarking dag::iddagstore::indexedlog_store::IndexedLogStore
  building segments                                 103.177 ms
  ancestors                                          68.485 ms
  children (spans)                                  451.383 ms
  children (1 id)                                     9.817 ms
  common_ancestors (spans)                            3.096 s
  descendants (small subset)                         24.845 ms
  gca_one (2 ids)                                   201.458 ms
  gca_one (spans)                                     3.185 s
  gca_all (2 ids)                                   357.899 ms
  gca_all (spans)                                     3.239 s
  heads                                             295.462 ms
  heads_ancestors                                    50.991 ms
  is_ancestor                                       146.798 ms
  parents                                           296.667 ms
  parent_ids                                         12.305 ms
  range (2 ids)                                       7.781 ms
  range (spans)                                      17.630 ms
  roots                                             478.574 ms

Reviewed By: sfilipco

Differential Revision: D26360564

fbshipit-source-id: 51f55a5bb4e69321515e02f45545618320c1bce5
2021-02-10 12:28:31 -08:00
Jun Wu
aa9dfeff2e dag: move algorithms from IdDag<Store> to Store
Summary:
Previously, algorithms are defined on `IdDag<Store>`, which requires a type
parameter to use. Move them to be defined directly on `Store` so using the
algorithms no longer require a type parameter. This will make it easier
to write code that calls algorithms on different IdDagStores.

Reviewed By: sfilipco

Differential Revision: D26360561

fbshipit-source-id: 8e0faf741019c4ed4119ad8e754aea9057b31866
2021-02-10 12:28:31 -08:00
Jun Wu
e270d50f75 dag: remove id.rs
Summary: It is not used. The definitions were moved to dag-types.

Reviewed By: sfilipco

Differential Revision: D26360562

fbshipit-source-id: 35e672194918e3f35294d69cad9e6990d8921900
2021-02-10 12:28:30 -08:00
Jun Wu
f23e466539 dag: impl Clone on IdSetIter
Summary:
This allows us to "fork" the iterator so we can "peek ahead" multiple items,
without affecting the original iterator.

Reviewed By: sfilipco

Differential Revision: D26360566

fbshipit-source-id: 4cba280e64338b20fb3e1584609be8fda9b3d616
2021-02-10 12:28:30 -08:00
Jun Wu
6a6c79cb5b dag: add IdSetIter fast paths
Summary:
Implement Iterator::{size_hint,count,last} for potential fast paths (ex.
Collect into a Vec).

Reviewed By: sfilipco

Differential Revision: D26360565

fbshipit-source-id: 227d9c5e615c2a0a624ba88d6d4c3f81b10d7795
2021-02-10 12:28:30 -08:00
Jun Wu
46519a3269 dag: fix benches/inprocess_iddag_serde
Summary:
Benchmark code is out of sync. Fix it.

Example run:

  benchmarking dag::iddag::IdDag<dag::iddagstore::in_process_store::InProcessStore> serde
  serializing inprocess iddag with mincode            0.664 ms
  mincode serialized blob has 707565 bytes
  deserializing inprocess iddag with mincode         42.477 ms

Reviewed By: sfilipco

Differential Revision: D26360563

fbshipit-source-id: f87e7ad53e6b6dadecaa0976e1c61f0399814104
2021-02-10 12:28:29 -08:00
Jun Wu
7f618a6a9e dag: fix benches/dag_ops
Summary:
Benchmark code is out of sync. This is an important benchmark.

Example run:

  benchmarking dag::iddagstore::indexedlog_store::IndexedLogStore
  building segments                                 111.814 ms
  ancestors                                          67.953 ms
  children (spans)                                  484.954 ms
  children (1 id)                                    12.599 ms
  common_ancestors (spans)                            3.337 s
  descendants (small subset)                         27.979 ms
  gca_one (2 ids)                                   216.430 ms
  gca_one (spans)                                     3.297 s
  gca_all (2 ids)                                   371.049 ms
  gca_all (spans)                                     3.348 s
  heads                                             303.232 ms
  heads_ancestors                                    52.821 ms
  is_ancestor                                       149.525 ms
  parents                                           294.633 ms
  parent_ids                                         12.173 ms
  range (2 ids)                                       7.612 ms
  range (spans)                                      16.991 ms
  roots                                             459.869 ms

  benchmarking dag::iddagstore::in_process_store::InProcessStore
  building segments                                  68.869 ms
  ancestors                                           6.683 ms
  children (spans)                                  175.711 ms
  children (1 id)                                     2.061 ms
  common_ancestors (spans)                          408.220 ms
  descendants (small subset)                          6.990 ms
  gca_one (2 ids)                                    16.983 ms
  gca_one (spans)                                   411.237 ms
  gca_all (2 ids)                                    27.921 ms
  gca_all (spans)                                   415.704 ms
  heads                                             110.486 ms
  heads_ancestors                                     5.228 ms
  is_ancestor                                        11.223 ms
  parents                                           108.636 ms
  parent_ids                                          0.746 ms
  range (2 ids)                                       1.539 ms
  range (spans)                                       5.885 ms
  roots                                             172.910 ms

  benchmarking NameDag with many heads
  range (master::draft)                              55.400 ms
  range (recent_draft::drafts)                       12.439 ms

Reviewed By: sfilipco

Differential Revision: D26360567

fbshipit-source-id: 6d3244e3f4655634c239f84a7304540860a7d34a
2021-02-10 12:28:29 -08:00