Summary: Trigger the cleanup logic automatically if there are too many remote bookmarks.
Reviewed By: sfilipco
Differential Revision: D26802251
fbshipit-source-id: 1ab40c7be98c507865ea17001dc9775b6edf4446
Summary: This is handy to make the `sl` output cleaner.
Reviewed By: sfilipco
Differential Revision: D26802250
fbshipit-source-id: 1b74f3d9a42ab6b0780f07bec59b03a5cd0ea6a9
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
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
Summary: Now dirsync works with IMM rebase. Add a test for it.
Reviewed By: DurhamG
Differential Revision: D26726478
fbshipit-source-id: 6712538d7e903ddb0e3c3df44f7dde638276e99d
Summary: Now dirsync works with absorb. Add a test for it.
Reviewed By: DurhamG
Differential Revision: D26726477
fbshipit-source-id: 4505ad6c1e1fd03bfb2cf12b46bd07c98f2bcc2b
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
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
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
Summary: This was broken by D26702166 (373d9ade0a).
Reviewed By: sfilipco
Differential Revision: D26736392
fbshipit-source-id: 8bae1599922c05193eba529d7f74c585f20d6f91
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
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
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
Summary: This should fix issues where master points to an unknown commit somehow.
Reviewed By: DurhamG
Differential Revision: D26648623
fbshipit-source-id: 63f7a4b834bf19a7849a1c3771921e6b1e5919d3
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
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
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
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
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
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
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
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
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
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
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
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
Summary: Those shortcuts can be used to setup remote repo via single line
Reviewed By: quark-zju
Differential Revision: D26558187
fbshipit-source-id: c6fd48ed38cc4dbaad4db714c4dfd76ec26bf608
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
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
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
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
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
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
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
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
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
Summary:
The test is broken in master. I might be using a stale binary running that
test in D26245424 (1392673a95). Revert the test to before D26245424 (1392673a95) fixes it.
Reviewed By: sfilipco
Differential Revision: D26321855
fbshipit-source-id: 4ada61211d3b354ae6f94f7fc8364f4550e9aeb8
Summary: Introduce a minimal version of an async, typed `ReadStore` trait and corresponding `EdenApi` implementation, along with a debug command, `debugnewstore` to exercise it.
Reviewed By: DurhamG
Differential Revision: D26050641
fbshipit-source-id: 2c14c3715e7067f9ecd1e649e6ca146a1ce249bf
Summary:
The warning is noisy if the wait is short and can make users dislike commit cloud.
Make sure we don't print the warning earlier than defaultlockwaitwarntimeout.
This is a follow up on D25587459 (18b8c66439) that doesn't fully work if warntimeout is passed equal to zero.
The default threshold has been introduced earlier in D25587459 (18b8c66439). This is just a fix.
A new test has been added. Also, the api should allow to pass value 0 meaning to show the warning always.
Reviewed By: quark-zju
Differential Revision: D26251321
fbshipit-source-id: c3beb5fec6a65f1816f667df70c1a39dd65ef083
Summary:
Optimize the `x~n` revset function using Rust.
Note: This changes the behavior a bit, `x~n` no longer returns `null`.
Reviewed By: sfilipco
Differential Revision: D26142683
fbshipit-source-id: d6a45b7e67352d74986274e52002a769bbae772e
Summary:
For `nameset OP baseset` or `baseset OP nameset`, convert baseset to nameset
automatically for fast paths. This is motivated by a slow query in pushrebase:
# pushrebase/__init__.py:validaterevset
if onto != donotrebasemarker and onto in repo:
rebased = list(repo.set("(successors(%r) & ::%s) - %r", revset, onto, revset))
if rebased:
raise error.Abort(
_("commits already rebased to destination as %s")
% ", ".join(str(c) for c in rebased)
)
Depending on the complexity of `revset`, `successors(revset) & ::onto` might
generate a filterset that is very inefficient - iterating through a large set `::%s`.
Optimize them by using the Rust nameset for calculations.
Before:
In [4]: repo.revs("(successors(1001) & ::1000) - 1000")
Out[4]: <filteredset <filteredset <baseset+ [1001]>, <nameset- <spans [06b96ec2a8b60d984606f36c30d3dbc899d804df:e890940eb1c34a06967bb9e38a0317ad7a0eb518+0:1000]>>>, <not <baseset [1000]>>>
After:
In [1]: repo.revs("(successors(1001) & ::1000) - 1000")
Out[1]: <nameset+ <spans []>>
This can change the ordering of sets. Therefore some test changes.
Reviewed By: DurhamG
Differential Revision: D26245424
fbshipit-source-id: 2e3ab891c586bb80cf947fff4bbdcd453c01ae70
Summary: The function is used in many places and I noticed there are some issues with commit cloud due to the bug that visible heads can contain public commit.
Reviewed By: quark-zju
Differential Revision: D26250556
fbshipit-source-id: e57e447dee803719fcf38cf376ad5af569d8020d
Summary:
Reduce local heads from unfiltered raw heads to visible heads. Reduce remote
heads from all heads to selected heads, plus those explicitly specified via
`-r`, `-B`, or via `repo.pull`.
This should speed up both pull and push for repos with lots of heads (ex.
fbsource), and make fastdiscovery less necessary.
Reviewed By: DurhamG
Differential Revision: D26207588
fbshipit-source-id: b64485566e0651ad47a5d1ee47e68301ba371e57
Summary:
Previously, remotenames lists all server-side bookmarks to check flags
like --delete, --create, --non-forward-move. That is inefficient. This
diff makes it use the listkeyspatterns API to reduce overhead.
Reviewed By: DurhamG
Differential Revision: D26213969
fbshipit-source-id: 2e51433829e80ebe685755049339c2dc03158717