Summary:
- reduce aliases
- tweak wording
- use commit hashes in example instead of rev number
- remove mention of old behavior
Reviewed By: bolinfest
Differential Revision: D41222455
fbshipit-source-id: 40bcd0289a72f26663ed5ce5f61d2e60b63e8dbb
Summary: Clarify that the specified patterns filter "files" rather than "names".
Reviewed By: bolinfest
Differential Revision: D41222451
fbshipit-source-id: c67cedc3e3b656771e6d7bd88a72a102c1758073
Summary: This makes it clearer that "hg" isn't going to show up in sl docs.
Reviewed By: bolinfest
Differential Revision: D41222458
fbshipit-source-id: 80f2e9a51c2b668a8506965d313f7e644d733ae9
Summary: Add a "legacyaliases" keyword to the command decorator that can be used instead of the command_name helper. This is more ergonomic (don't need to import command_name), and it is nice to not have an extra level of indirection for generating command name. Also, we are back to only having a single way to specify aliases.
Reviewed By: bolinfest
Differential Revision: D41222449
fbshipit-source-id: 5151d9474ab29dfae09acac0c862e59e1a31946a
Summary:
lazy execute debug statement by putting it under `debugflag`,
this is easier and performant than creating a general lazy debug method
with closure
Reviewed By: bolinfest
Differential Revision: D41248656
fbshipit-source-id: 894a526d483f74ab69c898e5b36809423d70a7b1
Summary: prefetching multiple PRs' status at the same time can significantly improve the speed of `sl ssl`, not it's less than 1s for 15 PRs/commits
Reviewed By: bolinfest
Differential Revision: D41234916
fbshipit-source-id: 9dcf7f3aebcc7d23e4c28b5f633865d3008c62cb
Summary:
Currently, fetching PR data serially is very slow, add batch method
for fetching multiple PR data at the same time.
Reviewed By: bolinfest
Differential Revision: D41232364
fbshipit-source-id: f1a004960a02d733a418f4c1b19f6400eca0611a
Summary:
Currently, `sl ssl` is very slow if you have a tall stack, this diff is
to optimize that with prefetch, this can reduce the time from **22s -> 5s**
from my test with 15 PRs.
Currently, the GitHub GraphQL query does not support multiple PRs, the
next step is to make the prefetch in parallel.
Reviewed By: bolinfest
Differential Revision: D41225480
fbshipit-source-id: 96ba55737960ff1fe83507b0fffff9b87885f5f3
Summary: In OSS mode, make "sl init" error out and direct the user to "sl init --git". Git mode works better for playing with things when you don't have a repo name since we won't complain about edenapi and other config settings.
Reviewed By: quark-zju
Differential Revision: D40985057
fbshipit-source-id: 042385761fab32970bb558599b685a41069b9d1f
Summary:
On Windows your working directory can be a UNC path such as \\?\C:\whatever. UNC paths allow for longer paths, and allow you to use otherwise reserved words in paths such as "com", "prn", "aux", etc.
Recently EdenFS switched to use UNC paths to gain these benefits. However, they discovered Mercurial does not work when CWD is a UNC path. The main reason is that UNC paths do not normalize "/" to "\". So if you do "\\?\C:\whatever".join("foo/bar"), you end up with the invalid path "\\?\C:\whatever\foo/bar". This diff fixes a few places to convert "/" to "\" on Windows, or to use os.path.join instead of hard coding "/". There were more places impacted than I imagined, and I'm sure I didn't get them all.
Reviewed By: sggutier
Differential Revision: D41161268
fbshipit-source-id: 3aa27b795ab6b5627a934aa95399ba6dc8eb3282
Summary: this diff is for hiding merged GitHub PRs for smart log
Reviewed By: quark-zju
Differential Revision: D40984562
fbshipit-source-id: 13e857800c147875d1c8709ffc4aa4b170674b85
Summary:
Instead of declaring the first argument to the `command` decorator
as a string literal, this introduces a `command_name()` helper function
that distinguishes:
- the primary name
- official aliases
- legacy aliases
This diff employs `command_name()` to declare `bo` and `book` as the
only "officially supported aliases" of the `bookmark` command.
Reviewed By: DurhamG
Differential Revision: D41003310
fbshipit-source-id: bcb7e0ec6d1b2af0c653ac674e2d2dfa2bbd222f
Summary:
Note that `bookmarks` will continue to be supported
as an alias of `bookmark` internally.
This sets up the work to declare certain aliases
as "legacy" in D40999729.
Reviewed By: DurhamG
Differential Revision: D40999729
fbshipit-source-id: 20d4dabd1a64ade4d3e71f685f62311be0bff284
Summary: Move checklocalrevisions close to its usages, this will avoid unnecessary computation and improves readability.
Reviewed By: quark-zju
Differential Revision: D40940473
fbshipit-source-id: 97e94bbcad468721175c846440ec525515139745
Summary: get_pr_state will be used for auto-hide merged PRs in smart log.
Reviewed By: quark-zju
Differential Revision: D40942012
fbshipit-source-id: 5076371ca2c1ed1c7d509d0831a82aa063c996ad
Summary: Currently, the 'sl pr' does nothing, which is not a good user experience, this diff is to make 'submit' the default subcommand of 'sl pr'.
Reviewed By: bolinfest
Differential Revision: D41045878
fbshipit-source-id: 2d74c1719d75d69f082c47a35b8940293380f11f
Summary:
As noted by the TODO in `eden/scm/ghstack/github_gh_cli.py`,
this code was initially copypasta'd because I thought I was
going to have to maintain both synchronous and asynchronous
versions. In the end, I was able to use the async version in ghstack
by wrapping it with `asyncio.get_event_loop()` and `loop.run_until_complete()`.
While iterating on the ghstack version, I ended up making some
improvements to (1) support the GitHub REST endpoints as well
as (2) boolean arguments, so now the
`eden/scm/edenscm/ext/github/gh_submit.py` code can get the
benefits of this, as well.
Reviewed By: jordanwebster
Differential Revision: D41053270
fbshipit-source-id: e36032088df02bdd68693d03276b3571cf6cfcc7
Summary: Sets `notepad.exe` as the default editor on Windows instead of vi.
Reviewed By: bolinfest
Differential Revision: D41071209
fbshipit-source-id: a47f7f10d627ea60d677ffba3035925178030794
Summary:
Update instructions to:
- suggest `--user` instead of `--edit`
- edit config via CLI directly without opening an editor
I also noticed that currently, on Windows, trying to open an
editor to edit a config attempts to use `vi` by default, which fails.
Reviewed By: zzl0
Differential Revision: D41062921
fbshipit-source-id: faac2a897a63939d7fb03d3ab6d11851e951c05f
Summary:
improve signal for scm daemon logs by compacting "Subscription is
alive" lines
This allows us having more meaningful lines in `hg rage` output for scm daemon
logs
Reviewed By: RajivTS
Differential Revision: D40938849
fbshipit-source-id: efc14bee1e3047095392643e6cfe561ed29fa824
Summary:
Updated the logic in `minirst.py` to provide better support for inline code.
Specifically:
- double backticks to mark inline code are now converted to single backticks
when the style is Markdown
- the special `:hg: <command>` pattern is now turned into inline code for
Markdown, as well
Regenerated the `.md` files via:
```
~/fbsource/fbcode/eden/scm$ make oss
~/fbsource/fbcode/eden/website/scripts$ HGIDENTITY=sl HG=/Users/mbolin/bin/lhg ./generate-command-markdown.py --full-build
```
Reviewed By: sggutier
Differential Revision: D40970293
fbshipit-source-id: 21d3ec1ef60d6c4b28877fb00e1abf938f51a6f0
Summary:
fix broken print of backed up heads
files have been moved to different place but `hg rage` has never been fixed
Reviewed By: yancouto
Differential Revision: D40938022
fbshipit-source-id: a4b2556e69626c4790b68e4c30a78f003407a513
Summary:
add `hg cloud copy` command for copying commits and bookmarks between commit cloud workspaces
having `hg cloud move` without `hg cloud copy` seems a bit like an incomplete feature. Let's add `hg cloud copy` as well since it is very easy to add.
Reviewed By: mitrandir77
Differential Revision: D40856240
fbshipit-source-id: 48435073e2d24b99c063a3c130af2552ae96a7d8
Summary:
Use dynmatcher if possible, this is for migrating more matcher build
logic to Rust.
Reviewed By: quark-zju
Differential Revision: D40767733
fbshipit-source-id: dd78490d2cc85715c36490f2887662fb7203b5b3
Summary:
infinitepush server is basically just used for unit tests nowadays, and is used with "indextype=disk" and "storetype=disk"
this diff removes the code that is not used
After that, we could, as a followup, separate sever part code to ext/infinitepushtestserver
from the client side code for bundle exchange.
Reviewed By: RajivTS
Differential Revision: D40798209
fbshipit-source-id: d400eaae7fdc52db202f987a74ae53b458bf178d
Summary:
Previously we only enabled force_terminfo_render_to_use_ansi_sgr when a pager was in use. This prevented us from emitting valid terminfo escape sequences that the pagers didn't handle (e.g. "<0F>" showing up everywhere).
I've since learned that there are other cases with a similar problem, such as the "watch" utility which has a "--color" flag that causes it to interpret escape sequences similar to pagers. Because we can't reliably detect or predict all cases where the terminal is not handling escape sequences itself, let's just always enable the compat flag. I don't think there is much practical downside/risk.
This commit is a backout of 567d43a0ded8177170720064f68b1ea45628171a (D40082948 (38acea0fda)), followed with an unconditional enablement of force_terminfo_render_to_use_ansi_sgr.
Reviewed By: sggutier
Differential Revision: D40810215
fbshipit-source-id: 7c7b55925b98d1603f43eca9e17b299d5141d893
Summary:
patterns normalize function has side effects such as print
warnings to users. In order to integrate Rust dyn matcher, we move
those normalization earlier, so the normalized kindpats can be reused by Rust dyn
matcher (D40767733) and existing Python logic.
Reviewed By: quark-zju
Differential Revision: D40762666
fbshipit-source-id: eb0c86f7a3bda412267c178228b84555d6486416
Summary:
Currently `slb -h` shows `hg`, this diff is to fix that:
```
$ slb -h
Sapling SCM
hg COMMAND [OPTIONS]
These are some common Mercurial commands. Use 'sl help commands' to list all
commands, and 'sl help COMMAND' to get help on a specific command.
```
Reviewed By: sggutier
Differential Revision: D40808570
fbshipit-source-id: 63d5984b3d608810856c5a822308958d50020d86
Summary:
1. Modify build_windows_zip.py to actually build isl. This requires node and yarn to be present.
2. Modify setup.py to copy edenscm-isl into the resultant embedded zip (the outer zip, not the inner python zip).
3. Tweak the sl "isl" command to look for the new location on Windows.
Reviewed By: sggutier
Differential Revision: D40745628
fbshipit-source-id: 665bca8feb4454087018aa2389ff4ae0030160b5
Summary: We don't need to manually replace "edenscm.mercurial" with "edenscm" in python-base64 extensions anymore because the "edenscm.mercurial" compatibility is handled more generically by the mercurialshim module.
Reviewed By: sggutier
Differential Revision: D40762356
fbshipit-source-id: 709426461112791bef2404118b7ae5003039c96d
Summary: There were cases where "hg log" could hang indefinitely when closing the pager. I think there are various cases where we would block inserting into a full Queue when the reader had gone away. Tweak things a bit so we use a timeout when enqueueing and check if the log operation is already stopped.
Reviewed By: zzl0
Differential Revision: D40611533
fbshipit-source-id: fe4a29d752cb9a404081d66f0328b322aec0cd58
Summary:
We already added support for '^' in regex matcher, this diff
is to update the outdated comment
Reviewed By: quark-zju
Differential Revision: D40762084
fbshipit-source-id: 89574aa6726e94ffc0df827db6c01aab3e10bf59
Summary: This test was failing on macOs due to the user config location for the Sapling identity being located in a different place than on Linux. Additionally, this diff makes the necessary changes for enabling the test for Windows.
Reviewed By: DurhamG
Differential Revision: D40736712
fbshipit-source-id: 03ae921ea37ab89bf41ddd90fb8fb4a857f55033
Summary:
Use `rcutil.editconfig()` to write the `github_username`
to save us a GraphQL call for subsequent invocations
of `sl ghstack`.
Reviewed By: muirdm
Differential Revision: D40737642
fbshipit-source-id: 6db061b1be6f511c6f9feaf6306454ad352055e4
Summary:
This isn't present in the OSS build, so defer import to avoid issue.
This particular object isn't thrift specific, so probably better is to move it somewhere more neutral.
Reviewed By: bolinfest
Differential Revision: D40703554
fbshipit-source-id: 985d2965218e5688f93a909a319bae214676dc78
Summary:
We're getting reports of people hitting this metadata mismatch during
rebases. This was probably introduced after I made Rust the source of truth for
the treestate. Let's add some more output so we can see what the expected and
actual values were.
Reviewed By: yancouto
Differential Revision: D40651393
fbshipit-source-id: bd6eff9527911554a53dfdfe603f0ce580c89bf4
Summary: Small tweak based on feedback, to not show a hint when not needed.
Reviewed By: bolinfest
Differential Revision: D40604996
fbshipit-source-id: 8c00428414aa2eecb835712fd5a0b4679901e154
Summary:
The new treematcher case insensitivity support doesn't work with "too many" rules. In case insensitive mode, the glob library turns all the patterns into one giant regex with a 10MB size limit (which seems like a reasonable limit).
Disable case insensitive support in Python and Rust sparse matcher for now. This should be reverting to previous behavior, so I don't think anything should break.
For sparse in particular, it doesn't seem like the Python sparse stuff supported case insensitive matching before because it didn't go through match.match() which is the only place that normalizes the matcher patterns for case insensitive matching.
Reviewed By: quark-zju
Differential Revision: D40600642
fbshipit-source-id: da692c3689c1b0fb28115a995b986630157815ea
Summary: Change "hg" to prog@ and run the sample configs through _() when used.
Reviewed By: bolinfest
Differential Revision: D40496655
fbshipit-source-id: cd60425a6928725b4f4af37e74db6c849b701ddf
Summary: Get system config path from Rust rather than the legacy logic that had become completely disconnected from where we actually load configs from.
Reviewed By: bolinfest
Differential Revision: D40492820
fbshipit-source-id: 6ab6fc2b8243fa92dbd55b638f85f5fcbf6f27bd
Summary: Output an informational message that shows you the location of the config file.
Reviewed By: bolinfest
Differential Revision: D40486335
fbshipit-source-id: c85677ba0b696ab081dbe3bae6f0569466f38331
Summary:
Wrap dirs::home_dir() to respect USERPROFILE (which is what we use to override home dir in tests).
I also had to tweak "~" handling in debugruntest so the $HOME (AKA $TESTTMP) backslashes on Windows didn't disappear.
Reviewed By: zzl0
Differential Revision: D40525035
fbshipit-source-id: c164f452ba0e4468c9122ccfe819f666db2d8452
Summary:
Now we set the repo config (in particular paths.default) as we initialize the repository. The ever important remotefilelog.reponame is inferred from paths.default, so everything is easier if paths.default is there from the get-go.
For example, updating the repo's config later left the repo._rsrepo object with a stale config with the wrong reponame.
Reviewed By: bolinfest
Differential Revision: D40474871
fbshipit-source-id: 6973b1c7c7041df96929647b11e803eb53a31ecd
Summary:
The case sensitive change broke a number of other tests. This wasn't
caught earlier because it only happens on OSX.
Reviewed By: muirdm
Differential Revision: D40557023
fbshipit-source-id: aae6564f355b6370a37ee0e3eaf098115c079d87
Summary:
The git objects assume everything coming in is a hash. The context.py
code however occasionally produced -1 (i.e. the nullrev). This caused crashes in
some circumstances. This diff fixes it by removing nullrev from context.py
Reviewed By: quark-zju
Differential Revision: D40517513
fbshipit-source-id: bcabca05be9ba43ab1f095903ca86fa8c938927f
Summary:
Add new "--user" flag to replace "--edit". "--user" edits the user config, analagous to "--local" and "--system".
"--edit" is still allowed for backwards comapt.
Also, rename "--global" to "--system". "--global" is still allowed for backwards compat.
Reviewed By: bolinfest
Differential Revision: D40321860
fbshipit-source-id: 5858e7a75f40ce233a8f944c67f9c4ff04f139e5
Summary:
This was broken by 1) a race between my case sensitivity diff landing
and Zhaolong's regex matcher diff landing, and 2) the doctest specified an
invalid path which then failed the case sensitivity check.
Reviewed By: muirdm
Differential Revision: D40486482
fbshipit-source-id: b02dccbda0e43fbbd9faccf899ed314e628d07b3
Summary:
X-link: https://github.com/facebook/sapling-staging/pull/26
Now the template prefix (e.g. "HG: " in commit templates) is derived based on your identity.
The substitution to remove the prefixed lines supports all defined identities. This handles the case a "SL: " template is interpreted by an "hg" invocation and vice verse.
Reviewed By: sggutier
Differential Revision: D40431010
Pulled By: muirdm
fbshipit-source-id: cd02454be6a88d2ee6ba1b326574aaaf53694b65
Summary: The recently added git url detection would accidentally trigger on Windows file paths like "C:\foo\bar".
Reviewed By: sggutier
Differential Revision: D40449282
fbshipit-source-id: 824e9f5c1a33b66b5f4177c2837d7cb5a0d6ba69
Summary: Support case insensitive matching in the TreeMatcher.
Reviewed By: quark-zju
Differential Revision: D40164596
fbshipit-source-id: 14fcd7f429aa34e68971b72f8d5818447f9ac442
Summary: Support case insensitive matching in the GitIgnore matcher
Reviewed By: quark-zju
Differential Revision: D40164601
fbshipit-source-id: 7711c2ea84bf26e1349e22c8f073dd35ee83dc28
Summary: Uploading snapshots with a large number of files can overwhelm the snapshots database. This diff adds a configurable file count limit that defaults to 1000.
Reviewed By: quark-zju
Differential Revision: D40355946
fbshipit-source-id: 62d226444d65df83dfc8d7628fb79a37ad33b56b
Summary:
Across the Python part of our codebase we seemed to have previously supported the `untrusted` parameter in various config related methods. Since these parameters were not actually used, they can be deleted.
This in particular affects the `config` command, which previously seemed to do something with the `--untrusted` option.
Reviewed By: quark-zju
Differential Revision: D40355828
fbshipit-source-id: f467e564f59564fb63ef4a194957a79971303656
Summary: Now we won't leave incomplete repo if the clone is interrupted by the user.
Reviewed By: quark-zju
Differential Revision: D40357936
fbshipit-source-id: 704875e60f09f8b13bc47e96dbbf14c58888647b
Summary: Move repo init into the try/except so the destination directory gets cleaned up if we fail initializing the hg repo.
Reviewed By: quark-zju
Differential Revision: D40357938
fbshipit-source-id: 03c34de3c319e184eb27f6e18a3659db9aa168ad
Summary:
Instead of showing a stacktrace or cryptic error like "cannot create new bundle repository", we have an explicit check that reports "destination ... already exists".
hg clone allows the destination to exist if it is an empty directory, but I opted to skip that complexity here.
Reviewed By: quark-zju
Differential Revision: D40357937
fbshipit-source-id: c486d912a1ec464cd2414b2090ae1656d9f37212
Summary:
Roll sniff_env into the DEFAULT identity computation. In particular, if HGIDENTITY/SLIDENTITY is set, that will override the sniffing of executable name.
Update sniff_env users to instead just refer to the default identity.
Reviewed By: quark-zju
Differential Revision: D40279959
fbshipit-source-id: 3a7b6b8c5037d56ec1f52e3c8b1dbd1b36b9bf8f
Summary: Reset identity state so that tests that depend on changing the identity between commands work.
Reviewed By: quark-zju
Differential Revision: D40279964
fbshipit-source-id: 6125c3c0ff1dc80c43759b0fee568896413d5b01
Summary: It was confusing to have DEFAULT and IDENTITY. IDENTITY was intended to by updated as the repo's identity was sniffed, but that didn't happen (and doesn't seem necessary anymore).
Reviewed By: quark-zju
Differential Revision: D40279960
fbshipit-source-id: 56781e4a36dfae754bd52dcdaf530ffe5c6c1afb
Summary:
introduce `hg cloud archive` command
the command is similar to the `hg cloud move` command but a bit more convenient to use for
purpose of tidy up the default workspace (by moving unfinished work to another
special workspace, not to get distracted by a big growing default workspace)
Reviewed By: markbt
Differential Revision: D40228894
fbshipit-source-id: 9c73a48c1121bc6fdb41bb96bfcbb2f3d2c4c991
Summary:
Technically, `git@github.com:foo/bar.git` is not a valid URL. But it's
widely used so let's just support them, by converting this format to
proper `ssh` url during clone.
This allows copy-pasting GitHub clone commands without manually changing them
to valid `ssh://...` urls.
Reviewed By: muirdm
Differential Revision: D40326031
fbshipit-source-id: 25b01072dca7ab34e55e26b6757ae62c52adc7c5
Summary:
We want to pass `--command` to the isl-server spawned from `sl isl` / `hg isl`. This way ISL will respect whether you spawn it with `sl` or `hg` or a dev/beta build like `slb`. This ability was added in D40245796.
`util.hgcmd()` seems to appropriately find `argv[0]`. I don't know if it will return an absolute path or just command name when run on production sl (e.g. `sl` vs `/usr/local/bin/sl`). Either should work for ISL since it's just a command path used to spawn subcommands.
Reviewed By: bolinfest
Differential Revision: D40323894
fbshipit-source-id: 9d9127972973850af96ded7b37c8212c43a2c9ab
Summary: Following D40243978 and D40243977, expose these flags to the sl/hg CLI so that --kill and --force are usable from there
Reviewed By: bolinfest
Differential Revision: D40283072
fbshipit-source-id: d701b7ce85f57e313ec7cd350f80b9ba4cabc010
Summary: Now we pass along util.hgcmd() as sapling_cli when setting up the ghstack logging. This fixes the last place where ghstack would invoke "hg" (instead of "sl").
Reviewed By: bolinfest
Differential Revision: D40321912
fbshipit-source-id: dfb4fc767e20d56afa4e6f3054defa52d3533f7a
Summary:
Use the new ghstack.logs.setup() function to enable stderr and file logging. We default to WARN level for stderr, but --verbose turns on INFO, and --debug turns on DEBUG. File logging I left at DEBUG.
We also call the rotate() function to make sure the log directories get cleaned up.
Reviewed By: bolinfest
Differential Revision: D40321913
fbshipit-source-id: 404108bfd405567b1563a395c15de21c0520b229
Summary: Pass along util.hgcmd() to so EdenShell invokes hg/sl appropriately based on whether the user is running hg or sl.
Reviewed By: bolinfest
Differential Revision: D40306286
fbshipit-source-id: ac6a78829b25d1ef94a85853699aff20943f85ac
Summary:
remove legacy code
those bits are unused, they are leftover from token related code to auth to
deprecated commit cloud auth proxy
token related code has been already removed, these bits I forgot to remove
Reviewed By: YousefSalama
Differential Revision: D40340413
fbshipit-source-id: e0d5dfb7b3131c632c8ac55d7baa6a3fa44d08f3
Summary:
The "abstract base classes" in collections were moved to a submodule,
collections.abc in Python 3.3. There was a redirect added for backwards
compatibility, but this is getting removed in Python 3.10. As such, we need to
update all callsites to use the newer module or we can't upgrade Python.
This diff is brought to you by:
fbgr -l -f '.py$' "collections\.$(~/codemod-regex.py)" | xargs ~/add-abc.py
where codemod-regex.py is P536570839 and add-abc.py is P536570878.
Reviewed By: itamaro
Differential Revision: D40308442
fbshipit-source-id: 09cb7fd52b5e1de5d4715f052ad5041989d3cd36
Summary:
workspace presence check has been implemented incorrectly in several
places across commit cloud client codebase.
We used prefix lookup API for it and checked that the result contains exactly single
entry or sometimes 'at least some entry'. This is incorrect without underlying name check. For example, assuming
there is a workspace named 'user/liubovd/archive1' and the lookup checks the
workspace named 'user/liubovd/archive'. It will return True instead of False.
The preffered fix is to use the `get_workspace` API instead that the Commit
Cloud Service also provides. That one uses exact match in mysql query but the migration to that
API will be done in next steps. The api needs some minor improvements.
I also checked that all the remaining usages of `getworkspaces` legit.
Reviewed By: markbt
Differential Revision: D40299141
fbshipit-source-id: 06307a3d70ba28d03f0b20b021d24b3d99da6604
Summary: `hg` was wrongly renamed to `command@` in D40162909 (41b41de101) where `prog@ was intended. This diff fixes that by using the proper template for displaying the proper cliname for the identity.
Reviewed By: bolinfest
Differential Revision: D40272870
fbshipit-source-id: 3850a8ed1f73f0d92bb7161678844d8db02539ba
Summary:
check the result of the update operation in `hg cloud hide` and `hg
cloud move`
The result of the operation wasn't checked in previous existed implemetation of
the `hg hide` command and it wasn't aslo checked in the implementation of `hg
move` command
The updates don't need to be transactional. It's ok if the second one fails and the first one succeeds. In this case it will be rather a 'copy' operation rather than a 'move', but it still can be fixed by a retry (as we advice here in the diff) due to the deduplication logic we have in place when we update the destination workspace. So, the changes won't be applied twice, and it will not fail if we try to apply twice, we will just ignore the duplicated update.
Reviewed By: markbt
Differential Revision: D40295995
fbshipit-source-id: 5e612bd97f5601e4ec2f5ea8e7316d8c115d1615
Summary:
implement `hg cloud move` command
the feature has been requested by several users
it provides a convenient way to move commits and bookmarks between commit cloud workspaces
Reviewed By: markbt
Differential Revision: D40227931
fbshipit-source-id: fb542fabab091704e7ca23fb2ea8525508de9265
Summary: Set a stable TERM of xterm-256color to avoid control sequence variations based on your local TERM.
Reviewed By: sggutier
Differential Revision: D40084042
fbshipit-source-id: 61aa0084e7c83097eae4c668bcf05d92480b7194
Summary:
There were a couple of bugs when running `hg config --edit`:
- If using sapling on a `.hg` repo, it would try to edit the `~/.hgrc` file even if the current identity was `sl`.
- It would not create the file if the parent directory did not exist.
This diff fixes both of those bugs.
Reviewed By: bolinfest
Differential Revision: D40253707
fbshipit-source-id: b070dd9e4e9d840c179f45f9d224aa252a3fa6e9
Summary:
do not skip the '--full' option in `hg cloud sync` help
The option should now works for all users (thanks to the "old commits cleanup"
project) and it is not horribly slow nowadays due to unhydrated bundles and
other optimizations.
So, we shouldn't really skip it from the help, because it is a way how users can learn about this option.
Differential Revision: D40259500
fbshipit-source-id: dd254e0ceea88648633bcefe0297d38e50b4a43a
Summary:
execute cloud sync in foreground after `hg cloud hide` if it runs
for the current workspace. If it runs in background, this may be a bit
confusing not to see actual hiding if the command was executed for some commits
that are present locally. Also, the background sync maybe disabled, in this
case the effect from the hiding will not be seen.
If hiding was executed for another workspace rather than for the current one, the background cloud sync call is not needed. Let's disable it.
Reviewed By: markbt
Differential Revision: D40223525
fbshipit-source-id: aeedc1cb85ba8236f4649b67520ff119f89e06d5
Summary: Similar to D40162909, but exclusive to help text (i.e. `helptext.py` and other files inside of `edenscm/help`) since this file is big enough.
Reviewed By: bolinfest
Differential Revision: D40165740
fbshipit-source-id: 69c88f3196035ece87ffd6829150319aa41b4373
Summary:
Makes help text (e.g. the output of `hg help`) and strings that use the `_()` function use the identity of the current binary instead of using hardcoded strings for the name of the binary and the product.
For the sake of clarity, replacements for `helptext.py` are done in D40165740
Most of the rename was done using sed + some manual edits. The regex strings for the rename were:
- `"s/\(_(\".*\)\([^.]+\)hg\([^[:alpha:]\/]\)\(.*\")\)/\1\2@prog@\3\4/g"`
- `"s/\(_(\".*\) hg \(.*\")\)/\1 prog@ \2/g"`
- `"s/\(_(\".*\)\([^.]\)hg\([^\/[:alpha:]]\)\(.*\")\)/\1\2@prog@\3\4/g"`
- `"s/\(_(\".*\)\([^.]\)hg\([^\/[:alpha:]]\)\(.*\")\)/\1\2@prog@\3\4/g"`
- `"s/\(_(\".*\)\([^.]\)hg\([^\/[:alpha:]]\)\(.*\")\)/\1\2@prog@\3\4/g"`
Reviewed By: bolinfest
Differential Revision: D40162909
fbshipit-source-id: 34d92ef3e667caad278643690e69bd608fc9fdf9
Summary: Makes internationalization strings (i.e. those that start with `_()` to use the Default identity, which is mainly based on the name of the current binary. These strings are used in a bunch of places for help text.
Differential Revision: D40157345
fbshipit-source-id: c70ee9ece543c2ef0285f8b1a16e2f48f54e424e
Summary:
With certain graphs, `gcaall` can produce lots of commits, making smartlog
unreadable.
Reviewed By: metacpp
Differential Revision: D40127752
fbshipit-source-id: e493e684b59f02ce66f4e3f22a382a7e9910e605
Summary:
We suspect AppNap can make chgserver very slow.
Disable AppNap to see if it helps.
Differential Revision: D40185563
fbshipit-source-id: 0740ed0b3e7e68c82c40cc905136365bc6386f8c
Summary:
The Rust config parser provides byte-indexed start, end offsets instead of just
line numbers. This makes it easier to handle multi-line config values.
Differential Revision: D40051035
fbshipit-source-id: ab1dbe2181f37cecbcb501c16e63fce47e62941e
Summary:
This allows updating config using one-liners without popping up editors or
hacks like `HGEDITOR='printf "[a]\nb=c" >>' hg config --edit`.
The command is implemented in Python since there is already an API to update
config files.
Note: If this were to be implemented via Rust, we should use
the source location information and support multi-line config editing.
We should probably design the API to take multiple edits in batch
so multiple arguments won't write a same file multiple times.
Reviewed By: bolinfest
Differential Revision: D40048924
fbshipit-source-id: 45609b05eb43ff2fdb5aa324976158351e562f00
Summary: Remove a reference to now dead help section "config.web".
Reviewed By: DurhamG
Differential Revision: D40127378
fbshipit-source-id: 3eed84dc184c81c81b8aae70c3cfb221bf8f647f
Summary: Even though it's not necessary to use '^' in regular expressions (RegexMatcher checks for a match only at the beginning of the string by default), but we found many usages of '^' from the metrics. So we decide to support it instead of communicating with users and updating the current usages.
Reviewed By: quark-zju
Differential Revision: D40101477
fbshipit-source-id: 5a13804f65a15b4d923bb6d8ddd1e78669569ab7
Summary:
Adding more type information will provide more confidence
when modifying `pullrequeststore.py` in D39907745.
Reviewed By: jordanwebster
Differential Revision: D40092084
fbshipit-source-id: d3a05e7a32772b2688d5be43ceba93e7750ce2a5
Summary: Made sure that there were no remaining uses of it by grepping the `lib/` and `edenscm/` directories in the repo. Most of the documentation still references `.hgrc`, however.
Reviewed By: bolinfest
Differential Revision: D40081677
fbshipit-source-id: 728278cd5e3ae8070d8c0b9d441cc2fb2b3c138e
Summary:
During repo init Python might change the repo requirements. We need
Rust to be aware of the new requirments. This happens during 'hg init --git'.
Ideally there'd be one source of truth for requirements, so we wouldn't need
such invalidation, but for now it's probably easier to invalidate. Later we can
remove python hg init entirely and stop needing this.
Reviewed By: bolinfest
Differential Revision: D40107731
fbshipit-source-id: 57a58bcb49e1ae8a6fc11d46ed85125a24ded2b9
Summary: Expose list of all valid identities to inform ui.path._isvalidlocalpath.
Reviewed By: jordanwebster
Differential Revision: D39867738
fbshipit-source-id: dc1b80474a6d71dd348035cacc7b40d8b7096fe9
Summary: The "reset" command used to need to look through bundle backups to revive old changesets that may have been deleted from the repo. We don't delete things anymore, so this isn't necessary. (And I don't have to deal with the ".hg" references anymore.)
Reviewed By: quark-zju
Differential Revision: D39867737
fbshipit-source-id: 81202332827ffdf4b60a17b4c5bc92a008679309
Summary: I think the only user of this was hgweb, which is dead now. Killing it is convenient because it had a direct reference to ".hg" that I no longer have to deal with.
Reviewed By: quark-zju
Differential Revision: D39867745
fbshipit-source-id: 564baa5f10f4b36f7ad698fda2597e630e3d5f64
Summary: Add a bit of sniffing to the git support.
Reviewed By: quark-zju
Differential Revision: D39867744
fbshipit-source-id: e93d54cad57f2d416726c2a7ebcbff48594b45c8
Summary: Most ".hg" uses are gone in Python, but there are a few loose ends left.
Reviewed By: quark-zju
Differential Revision: D39867743
fbshipit-source-id: 2fde21be22603751f184844c9963e8ff197f7f65
Summary: Sniff the identity and adjust ".hg" checks accordingly. Note that we fall back to the global identity so the doc tests have some identity.
Reviewed By: quark-zju
Differential Revision: D39867736
fbshipit-source-id: 57e791acaf08e6983ab6279de914f0a12a33a5d5
Summary:
Memoize sniffdir since this goes to the filesystem and could be called a lot in codepaths where the identity is not otherwise available (i.e. the "ui" object is not around).
I also aliased other pyidentity methods in the Python module so Python code can use the Python "identity" module consistently instead of the bindings.
Reviewed By: quark-zju
Differential Revision: D39867741
fbshipit-source-id: 85a8ebee78d9e8fab9c1777da963de8ce94fb0dc
Summary: This is no longer used and we are purging the "hg" name, so now is a good time to clean it up.
Reviewed By: jordanwebster
Differential Revision: D39867739
fbshipit-source-id: f92508235f22d4f22fc563e3a40ad7f85d3f957e
Summary: Enable the force_terminfo_render_to_use_ansi_sgr option when the pager is active. This makes termwiz use default ANSI codes to render effects rather than following the terminfo db entry exactly. This improves compatibility with pagers such as less and streampager which don't handle all escape sequences.
Reviewed By: sggutier
Differential Revision: D40082948
fbshipit-source-id: 567d43a0ded8177170720064f68b1ea45628171a
Summary:
clean up token code
Client Certs based authentification (user_agent based or X.509 certificate
based, the same as for monoke/edenapi services) is now the only supported way to talk to the Commit Cloud service.
Historically, we had another way to access the Commit Cloud Service, via an
interngraph proxy. The proxy has been shut down a while ago. The auth there was
token based. We supported CAT & OAUth tokens there.
The proxy shut down happened here after all traffic has been migrated to the certs: D29934907
Reviewed By: mzr
Differential Revision: D40098326
fbshipit-source-id: 63a3a8705eb14858ac11c7f8e8784202d08fc481
Summary:
tidy up: remove extra cloud sync attempts
The extra attempts were a hack to provide best possible sync result for workspaces
with old commits issue. As a result of the "old commits cleanup project &
infinitepush deprecation", all workspaces have been fixed and no longer contain any references to any commit that is not in
Mononoke.
So, nowadays, syncing "2 years, 3 years and then everything" logic just
significantly slows down `hg cloud sync --full` command.
Reviewed By: yancouto
Differential Revision: D40096067
fbshipit-source-id: d9b69140164c38d91d2793b3e0b8c4416d801909
Summary:
fix backed up status after `hg cloud switch`
Backed up status was wrong for commits just after a `hg cloud switch` command.
The status was "(Not backed up)".
The status was only correct for newly pulled commits, but not for those that
were present locally but just invisible.
Reviewed By: RajivTS
Differential Revision: D40063876
fbshipit-source-id: f3db5964d0b4a37a7e7b4c5f7598609d6d5927bb
Summary: This diff adds the necessary code changes to integrate the client with the `ShareWorkspace` endpoint on the `CommitCloud` service. The command `hg cloud share` can be used by workspace owners to provide access to their workspaces to other users.
Reviewed By: liubov-dmitrieva
Differential Revision: D39609834
fbshipit-source-id: f8c4781848d2d18023516cf9242ac518e903f88e
Summary:
allow server to skip listing of the heads to reduce network
footprint & cpu
After old commits have been fully deprecated, the server always returns dates
for all the commits. We can now allow server to skip listing the heads to
reduce network footprint.
It can help us to reduce duplication in data, especially for big workspaces.
We have workspaces up to 2000 of heads.
Examples of big ones: P532903681, P532901737
Later we can deprecate heads from our schemas & APIs.
Reviewed By: RajivTS
Differential Revision: D40062072
fbshipit-source-id: ab8720dd932f4aa7d27f9103d32eea7709d7c533
Summary: We enabled regexmatcher for patternmatcher in D39741975 (765e18ea07). This diff will enable regexmatcher for includematcher as well.
Reviewed By: quark-zju
Differential Revision: D40062577
fbshipit-source-id: 8c5f68237f173f11ff51e0616aee414b8b97d05b
Summary:
I am planning to make `_buildpatternmatcher` factory method support `includematcher` by adding a `fallbackmatcher` like below, so I need to move `patternmatcher` before `_buildpatternmatcher`. The reason why I do this in a separate diff is because it will make it easier to see the difference when I change `_buildpatternmatcher` and `includematcher`.
```
def _buildpatternmatcher(
root, cwd, kindpats, ctx=None, badfn=None, fallbackmatcher=patternmatcher
):
```
Reviewed By: quark-zju
Differential Revision: D40062735
fbshipit-source-id: feeecdb6975831abd27c255d88c86f9ff282d278
Summary: When persisting the watchman state we need to call flush on the underlying treestate and write the new root id to the dirstate. This fixes the fsmonitor-refreshclock.t test which I have also turned on.
Reviewed By: quark-zju
Differential Revision: D39472164
fbshipit-source-id: 851250391c8e6341a84ec281dce11b32529da7b9
Summary:
Because `sl pr submit` relies on force-pushing to GitHub,
we run the risk of commits from previous versions of a PR
getting reaped, as GitHub periodically garbage collects
commits (and trees and blobs) that are no longer reachable
via a public branch.
To ensure we can always see previous versions of a PR in its
entirety, we merge the head of the development branch to a
special branch named `sapling-pr-archive-{username}`.
The idea is that this branch is not intended for development,
but to defend against GitHub's garbage collection process.
To support this, we add some new methods to `gh_submit.py`:
- `get_username()`
- `create_branch()`
- `merge_into_branch()`
These do what their names suggest via GitHub's GraphQL API.
Because `merge_into_branch()` has some "expected" error cases
(such as "branch does not exist"), we had to update the logic in
`make_request()` to ensure we can read the error back out of the
response to check whether it is one of these *expected* errors.
Over in `submit.py`, we introduce new functions to test the response
contents to see if it corresponds to an expected error:
- `is_already_merged_error()`
- `is_branch_does_not_exist_error()`
Finally, `add_pr_head_to_archives()` is where we put it all together
to merge the head of the development stack into the archive
branch, creating the branch, if necessary.
Reviewed By: quark-zju
Differential Revision: D39919020
fbshipit-source-id: 3822e7cb22d0b6f308a912fe98eec8106a87b5d9
Summary: Uses the identity module for deciding the location of the main user config file. For the sapling identity, it tries to read from the `SL_RC_PATH` environment variable and `$XDG_CONFIG_HOME/sapling/sapling.conf`
Reviewed By: bolinfest
Differential Revision: D39952994
fbshipit-source-id: c5902a08452d969027f8aba9e9c6a530c7492f1e
Summary:
Now that the python-to-rust status path uses the same entry point as
the pure-rust status, let's enable the python-to-rust in tests.
Disables it for a few tests that are still failing. Many of these are because
the tests are still using legacy configurations that the Rust code doesn't work
with.
Reviewed By: jordanwebster
Differential Revision: D39753911
fbshipit-source-id: b1e27ef1926bc7b196a59b65bcc96881bd9e23b2
Summary: Adds the necessary boilerplate for having a `goto` (`update`) command in Rust. Falls back to the Python command for now.
Differential Revision: D39890856
fbshipit-source-id: c4216653c4ebbf884c4a2b52be106f9dce2c2af7
Summary:
EagerRepo should not be lazy. That was previously not enforced.
This diff enforces the check on changing commits (add commit or update
reference) to ensure that the EagerRepo is not lazy.
The check on commit insertion can be made smarter (O(working copy) ->
O(changes)) performance-wise. That requires API changes that are out
of scope in this diff.
Differential Revision: D39525541
fbshipit-source-id: 1955bffc69b8cecea93189d48794ef327ddc3ef4
Summary:
fix mercurial tests if executed with buck2
Many of mercurial unit tests are failing with buck2.
As I discovered, this code path that is used for test compatibility with buck
doesn't work for buck2 because some naming convention has been changed.
With buck, the main hg binary is a _bash_ script setting up a bunch of things
instead of a standalone single executable. It is named with .sh for buck1 and
just hg for buck2.
Reviewed By: krallin
Differential Revision: D39923275
fbshipit-source-id: 8c5281150943e288b6ea78e77e9edc8ee151a051
Summary:
remove unused code
follow up clean up from the previous clean up
Reviewed By: jordanwebster
Differential Revision: D39886293
fbshipit-source-id: e0d4d5bea3c2865b7b9c5b362cda9b7dbe7eb5e5
Summary:
D27144492 (48cd15ab14) broke hg undo -i by changing the way integers are formatted
into revsets. This was done to do some rev validation, but undo used the integer
formatting for non-rev cases and this broke undo's usage. Let's just move to
normal python string formatting for undo's case.
The migration to Python 3 also broke hg undo -i by causing the repr() output to
change, which messes up the interactive ui handling. Let's fix that as well, and
drop the repr stuff.
Reviewed By: zzl0
Differential Revision: D39892760
fbshipit-source-id: 96655f743e4187f7345f7f3c6a2fe74fb326335e
Summary:
By adjusting the identities list we can now adjust which plain
environment variables are supported.
Reviewed By: bolinfest
Differential Revision: D39738363
fbshipit-source-id: 46ae208bc3a86c9bad4c726530db27557e6be413
Summary:
In a future diff we'll enable using the Rust status logic for Python
commands. This requires that the Rust commit/file/tree stores remain in sync
with the Python ones, even as the Python ones are mutated. Ideally we'd just use
the same store instances for Python and for Rust, but that's a bit more work and
somewhat risky. For now, let's just add invalidation methods on the stores.
Note, even in the future we may need invalidation methods, since it's possible
for an external process to change the repo and the internal repo instance will
need to pick up those changes.
Reviewed By: jordanwebster
Differential Revision: D39777412
fbshipit-source-id: 21ba25444a67142c6757b3446305864d2b6a520d
Summary:
Now that we share a working copy between Rust and Python, we can just
call status on it, instead of building a working copy in the static status
invocation.
Also moved last_write to become a parameter to status. Since we no longer create
a WorkingCopy explicitly for the status, we don't have the opportunity to set it
at that time. It probably didn't make sense to set it at working copy creation time
anyway.
Reviewed By: jordanwebster
Differential Revision: D39753347
fbshipit-source-id: c03777c084d3eea5b9d6f0b0cb59126c19f06588
Summary:
Now that Rust creates and persists a TreeState, let's change Python to
use it instead of creating it's own.
Differential Revision: D39715993
fbshipit-source-id: 1e40df3b8f4710068b563b3e2802935b1d829e8b
Summary:
In this series of diffs we want to move the source of truth for the
working copy down into Rust. In a Python command, we'll need some place to store
it though, so let's put it on the py repo object.
In Python, there's largely assumed to be a 1:1 relationship between a repo and
the working copy, so storing them together is fine. In Rust, there may be a
1:many relationship between the repo and working copies, so we don't want to
store these together on the Rust repo object.
Differential Revision: D39715994
fbshipit-source-id: d7331677e3d6411f154272da0c44b5402eb55f28
Summary:
Implements a number of useful GitHub API calls by shelling
out to the `gh` CLI. We will likely move these to Rust later to
avoid the overhead of an extra process for each call, which
is likely material on Windows.
Reviewed By: DurhamG
Differential Revision: D39797781
fbshipit-source-id: 979e127e70bd1a98e6ab88c47068e314eddcaf3b
Summary:
This exposes the following extra fields that prove to be useful:
- `id` (needed for the `updatePullRequest` GraphQL mutation)
- `number` so it doesn't have to be parsed back out of `url`
- `ref_oid` to see if the local commit already matches the commit on GitHub
- `ref_name` branch to update when running `submit`
Reviewed By: DurhamG
Differential Revision: D39797782
fbshipit-source-id: 71047e5bed8e85eb45250ae9fb2b89cf6842c857
Summary:
While we could get the username using the token, that would
cost an extra GraphQL call, so we might as well grab it while
we are parsing `hosts.yml`.
Reviewed By: DurhamG
Differential Revision: D39797780
fbshipit-source-id: dcfc6b566dba7f38c8f0b39970bcedc424ba0eda
Summary:
Somehow, I created `PullRequest` and `GitHubPullRequest`
classes that were essentially the same thing with slightly
different field names and rules for instantiation.
This consolidates those two classes into `PullRequestId`,
while also introducing a new class, `GraphQLPullRequest`,
which has a different function. Specifically:
- `PullRequestId` is effectively a handy container for the
standard `(owner, name, number)` tuple that identifies
a pull request.
- `GraphQLPullRequest` represents the full set of data
about a pull request that we fetched via GraphQL.
This is required when you need information like the
name of the `head` branch associated with the PR,
or its status to support things like `hg ssl`.
Reviewed By: DurhamG
Differential Revision: D39796946
fbshipit-source-id: efc54b73a7acafafb72292a99686ce6400ee25ad
Summary:
For GraphQL requests, we often need the `(owner, name)`
of the GitHub repo. In practice, we get the URI from
`ui.config("paths", "default")`, so this moves the parsing
logic to a common location.
Reviewed By: DurhamG
Differential Revision: D39777664
fbshipit-source-id: be10d7fb4038434c66bfc4d84573ab12d63c7f60
Summary:
Previous to this diff, `submit.py` was using
`PullRequestStore.find_pull_request()` to find a pull
request associated with a commit, but that did not
consider the commit's description as
`get_pull_request_url_for_rev()` does, so this diff
refactors `get_pull_request_url_for_rev()`, moving
the reusable bits into
`github_repo_util.get_pull_request_for_node()`.
This diff also tightens up the code in `submit.py` a
bit so the next set of diffs can focus on taking the
stack and exchanging the appropriate local commit
data with GitHub.
Reviewed By: DurhamG
Differential Revision: D39760383
fbshipit-source-id: bc1d1a48ccca55f2ee7db5e992a7b97d42d8a2a5
Summary:
Because `github_repo` was added as a `templatekeyword`
function in `eden/scm/edenscm/ext/github/__init__.py`,
that caused problems when trying to import the file
named `github_repo.py` in the same folder.
Do the simplest thing and rename the file to `github_repo_util.py`
and update the `import` statements.
Reviewed By: DurhamG
Differential Revision: D39759919
fbshipit-source-id: 139f21e789296e1f2187b93017540b8daf94421c
Summary:
Followed the pattern in `sparse.py` to take advantage
of subcommands so that GitHub-specific commands
are scoped under the `pr` subcommand. We'll go with
`pr` for "pull request" because `gh` subcommand could
be easily confused with https://cli.github.com/.
Reviewed By: DurhamG
Differential Revision: D39759566
fbshipit-source-id: 09e81914c0f28012933eeb73b856132db866576c
Summary:
Add a `PullRequestStore.unlink()` method that
inserts a special value for a commit in the metalog
that means, "I have no PR associated with me even
if one of my predecessors does."
Reviewed By: DurhamG
Differential Revision: D39759565
fbshipit-source-id: 7af0066e7a466a0d7360d2c6d652e3be4fcf61f8
Summary:
The treestate file name was currently being decided in multiple places,
like dirstate.py and the Rust clone crate. Let's make a new TreeState::new()
function that creates a new TreeState with a new name.
Let's also remove the filename tracking from dirstate.py, and just read it out
of the treestate. This will make a future diff possible, where we move the
source of truth for the treestate into the Rust working copy.
Reviewed By: jordanwebster
Differential Revision: D39714712
fbshipit-source-id: 2c91f61bd6b6b3527945b3e6ce4a233cf65485c2
Summary:
Eden performance is drastically impacted by having file aux data
prefetched. Eden already enables this functionality in it's backingstore usage
of edenapi, but we didn't do it in Mercurial's usage of edenapi.
This diff adds a config to make that happen.
Reviewed By: chadaustin
Differential Revision: D39833163
fbshipit-source-id: 6290c82bddc341eb402e357cbb610e7cc40bd5cc
Summary: remove unused imports that left from earlier clean up
Reviewed By: quark-zju
Differential Revision: D39814310
fbshipit-source-id: ed3df79b801af71265cf53cf51b130ebb52628a4
Summary: Use regexmatcher if possible. If some patterns are regexp, and the rest are globs, use a unionmatcher(rust_treematcher, rust_regexpmatcher) to construct it.
Reviewed By: quark-zju
Differential Revision: D39741975
fbshipit-source-id: 0d3ea89befe658b29c8f65636a3eb7690bed1c8e
Summary:
When using a pager, we want to inherit the "is tty?" determination from before we fiddle with stdout to point to the pager. Python had some special logic for this we lost when we switched to Rust to answer "should color?". Streampager still worked because Rust handles that pager. "Less" is handled in Python, so Rust only saw that stdout wasn't a tty, so it disabled colors.
Interestingly, the "should color?" determination happens before we enable the pager. However, we re-initialize the "color" extension after starting a non-streampager pager, so that disables colors in this case. Fortunately, we can just remove the re-initialization because the motivating config "color.pagermode" is apparently no longer supported. This works around the issue because now we only ask Rust "should color?" before the pager is activated.
Reviewed By: sggutier
Differential Revision: D39749806
fbshipit-source-id: a5ce205200b555fbfcbadcdf030d5f2b9ab08b38
Summary: this diff is for introducing regexmatcher, its usage is in D39741975
Reviewed By: quark-zju
Differential Revision: D39731271
fbshipit-source-id: 3367aea7edc0121dba767e96597a8c521c81b7ed
Summary:
The internal fastlog batches are 100 commits each - so that's the right size
for page size here too.
The timeout constant wasn't used anywhere (which made the timeout 10s). I'm
upping it because in very mergy repos the fastlog traversal is unfortunately
0(merges on the path).
Reviewed By: quark-zju
Differential Revision: D39738299
fbshipit-source-id: 2eb2cf450f433302494ea2a523bd6af158fc6998
Summary: This diff is a preparation for using Rust RegexMatcher.
Reviewed By: quark-zju
Differential Revision: D39706345
fbshipit-source-id: ce4f978aa58f43ca3321e146b4892fd57abc67e5
Summary:
Replace Python color mode detection with Rust's.
Windows Virtual Terminal mode is enabled in hgmain, so we don't need the Python code anymore.
Reviewed By: quark-zju
Differential Revision: D39621631
fbshipit-source-id: eca87ea4d13b226211c601abe9b7113b9207b5d1
Summary:
This will replace most of edenscm.color._modesetup in the following commit.
This logic should match Python logic closely, except Rust has a subset of the logic implemented on the io::IsTty "can_color()" method. can_color() says whether colors appear to be supported by the io handle and environment. should_color combines that information with the user's configuration to determine whether we should try coloring output.
Reviewed By: quark-zju
Differential Revision: D39621630
fbshipit-source-id: 40cfef1e4682c844c69f2905315b16bfaf4d9a0f