Commit Graph

3262 Commits

Author SHA1 Message Date
Durham Goode
7a0f35af62 githelp: fix references to hg
Summary:
githelp was still referencing hg, Mercurial, and internal concepts.
This diff fixes all of that.

Reviewed By: akushner

Differential Revision: D41231820

fbshipit-source-id: 15026173f9f6816af049ca277a1439c4bc3061d2
2022-11-14 08:10:30 -08:00
Muir Manders
9ed50e6b20 doctor: fix check for commitcloud extension
Summary: Avoid KeyError checking for commitcloud extension.

Reviewed By: bolinfest

Differential Revision: D41226070

fbshipit-source-id: bca070e3787782fa3a1edbffc8d83f2b2eb9dbc1
2022-11-14 07:04:22 -08:00
Liubov Dmitrieva
97a137c43a fix slow pull with --config pull.httpcommitgraph=True
Summary:
fix slow pull with --config pull.httpcommitgraph=True

the pull with the httpcommitgraph was very slow in many cases due to thousands
of sequential commit_hash_to_location calls without batching.

the change reduces number of network calls from thousands to one

this is a follow up for: D36208033

Reviewed By: singhsrb

Differential Revision: D41264290

fbshipit-source-id: 044fab69740a213f7ac502266b488f3ab3b30edd
2022-11-14 04:54:19 -08:00
generatedunixname89002005307016
a5a452bf52 Add annotations to eden/scm/edenscm/hook.py
Reviewed By: yancouto

Differential Revision: D41218851

fbshipit-source-id: 7eb258a2e93dbb7f98b63bc9c4615cd64c9d01fa
2022-11-14 03:36:51 -08:00
Muir Manders
2285b1aba2 fold: update docstring
Summary:
- Normalize nomenclature
- Update examples to use commit hashes

Reviewed By: bolinfest

Differential Revision: D41229880

fbshipit-source-id: f8139eb04cc2e212bffb21f143108d532f38a218
2022-11-13 23:38:55 -08:00
Muir Manders
7832524c0f diff: update docstring
Summary:
- minmize aliases
- normalize some terminology
- replace rev numbers w/ hashes in examples

Reviewed By: bolinfest

Differential Revision: D41229879

fbshipit-source-id: eb8b0418b6cecdeefd61fd5f097b28c83ef93e09
2022-11-13 23:38:55 -08:00
Muir Manders
a3d4cdd23b commit: update docstring
Summary:
- reduce aliases
- deprecate amend/rebase flags (added more prominent pointer to "amend" command in help)
- deprecate legacy --no-automv flag
- tweak formatting

Reviewed By: bolinfest

Differential Revision: D41222447

fbshipit-source-id: 3e140165c8d001f00af34bd1fb399df5e05ed693
2022-11-13 23:38:55 -08:00
Muir Manders
ff0a3115db purge: rename to "clean" and update docstring
Summary:
- Rename to "clean" which matches git's terminology (and is a better name than "purge")
- Rename "--all" flag to "--ignored". "--all" wasn't a good name because it didn't delete everything possible (e.g. doesn't delete empty directories).
- Reword docstring to make it more concise and make interplay of flags clearer.

Reviewed By: bolinfest

Differential Revision: D41222448

fbshipit-source-id: c726173890cb14c189d02759bb6a21ba348c06c8
2022-11-13 23:38:55 -08:00
Muir Manders
8721888a60 purge: prepare to rename to "clean"
Summary: Move purge.py to clean.py to prepare for rename.

Reviewed By: bolinfest

Differential Revision: D41222452

fbshipit-source-id: a4664fdc9077974929f739ce093d04393c63023b
2022-11-13 23:38:55 -08:00
Muir Manders
27d43929fb backout: update docstring
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
2022-11-13 23:38:55 -08:00
Muir Manders
73433f2d3c amend: update docstring
Summary:
- reduce aliases
- tweak wording and formatting

Reviewed By: bolinfest

Differential Revision: D41222457

fbshipit-source-id: 2b7a5e797626c51e75ec1a1366d817682f978ff0
2022-11-13 23:38:55 -08:00
Muir Manders
cd0c2352eb addremove: udpate docstring
Summary:
- reduce aliases
- tweak some wording
- improve formatting

Reviewed By: bolinfest

Differential Revision: D41222454

fbshipit-source-id: 8014560f5a3eabadda01273b64d646ae3a8261f6
2022-11-13 23:38:55 -08:00
Muir Manders
1c3974b0a9 docs: clarify help for "-I" and "-X" flags
Summary: Clarify that the specified patterns filter "files" rather than "names".

Reviewed By: bolinfest

Differential Revision: D41222451

fbshipit-source-id: c67cedc3e3b656771e6d7bd88a72a102c1758073
2022-11-13 23:38:55 -08:00
Muir Manders
8ed51e769d docs: replace ":hg:" with ":prog:"
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
2022-11-13 19:24:12 -08:00
Muir Manders
0bdcce807a add: update docstring
Summary:
- Reference .gitignore isntead of .hgignore
- Simplify wording

Reviewed By: bolinfest

Differential Revision: D41222456

fbshipit-source-id: dfbebd671d8616b2e3c30c44f4eae583e4c85a65
2022-11-13 19:24:12 -08:00
Muir Manders
f2b2ea82f0 absorb: update docstring
Summary:
- minimize aliases
 - rename "changeset" to "commit"
 - simplify and tweak some wording

Reviewed By: bolinfest

Differential Revision: D41222450

fbshipit-source-id: 9fbc0b5ee71c1e3b7d3b4bee0bf56f81008cbc23
2022-11-13 19:24:12 -08:00
Muir Manders
7841f4bef3 commands: integrate legacy aliases concept into @command
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
2022-11-13 19:24:12 -08:00
Zhaolong Zhu
f167d5d653 github: lazy execute debug statement
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
2022-11-12 15:34:56 -08:00
Zhaolong Zhu
ea71c5a394 github: use batch method for prefetching PR status
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
2022-11-12 04:32:20 -08:00
Zhaolong Zhu
2cd5a7bbdf github: add batch method for getting multiple PR data
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
2022-11-12 04:32:20 -08:00
Zhaolong Zhu
3afe76fdab github: prefetch PR status using smartset.prefetch
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
2022-11-11 20:08:19 -08:00
Michael Bolin
560aed4414 fixed docstring for metaedit
Reviewed By: muirdm

Differential Revision: D41194510

fbshipit-source-id: 3cc25445ae3daefcb2aa1d31edb6f32a1694e435
2022-11-11 11:09:32 -08:00
Liubov Dmitrieva
b707c94608 introduce hg cloud rollback command
Summary: introduce `hg cloud rollback` command

Reviewed By: RajivTS

Differential Revision: D41080977

fbshipit-source-id: d0a9bcae372a0b350065375d0ed0a9cf6d6ec0fa
2022-11-11 07:15:10 -08:00
Muir Manders
de0c8c03d6 init: prefer "--git" in oss mode
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
2022-11-10 16:54:36 -08:00
Michael Bolin
25859e5315 create prs in ascending stack order
Reviewed By: zzl0

Differential Revision: D41195334

fbshipit-source-id: e7a7b98b07fcefa33e2acebda6426d11ce3eef50
2022-11-10 14:10:08 -08:00
Zhaolong Zhu
c2a3c6b0e7 pullrequest: add error handling for getting landed commits
Summary: add appropriate error handling for getting landed commits from GitHub

Reviewed By: bolinfest

Differential Revision: D41062410

fbshipit-source-id: 916fc0d24552ca4e69d063269256f3d56448cd98
2022-11-10 10:17:06 -08:00
Muir Manders
16ff3c9f41 windows: fix things when CWD is a UNC path
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
2022-11-10 10:01:23 -08:00
Zhaolong Zhu
c7c74e9b87 pullrequest: add debugprmarker command
Summary: this diff is for hiding merged GitHub PRs for smart log

Reviewed By: quark-zju

Differential Revision: D40984562

fbshipit-source-id: 13e857800c147875d1c8709ffc4aa4b170674b85
2022-11-10 09:36:21 -08:00
Michael Bolin
b7976bb872 introduce mechanism to phase out legacy command aliases
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
2022-11-09 22:58:09 -08:00
Michael Bolin
f04b00a82a rename "bookmarks" command to "bookmark"
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
2022-11-09 22:58:09 -08:00
Zhaolong Zhu
c9e5203654 pullcreatemarkers: move checklocalrevisions close to its usages
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
2022-11-09 15:13:47 -08:00
Zhaolong Zhu
8c1e61d837 pullrequest: add get_pr_state to get merged flag and merged commit
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
2022-11-09 08:52:21 -08:00
Durham Goode
b54775542f checkout: fix output when no args are passed
Summary: This matches the Python checkout behavior.

Reviewed By: yancouto

Differential Revision: D40742607

fbshipit-source-id: e5e378064ff3cfb6f375b9ea1c17197c7e1100d8
2022-11-08 15:55:26 -08:00
Zhaolong Zhu
123b9a0959 pullrequest: pullrequest: add default subcommand for 'sl pr'
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
2022-11-07 16:35:30 -08:00
Michael Bolin
633392b183 shell out to GitHub CLI instead of using Rust bindings for GraphQL requests
Reviewed By: quark-zju

Differential Revision: D39758354

fbshipit-source-id: 8e62dbe0dac6e0332747c4ed18f889cc6e1d1a86
2022-11-07 13:31:12 -08:00
Michael Bolin
2eb27acfc0 unify wrapper code for GitHub CLI
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
2022-11-07 13:31:12 -08:00
Saul Gutierrez
f9e6d2e951 config: make notepad the default editor for Windows
Summary: Sets `notepad.exe` as the default editor on Windows instead of vi.

Reviewed By: bolinfest

Differential Revision: D41071209

fbshipit-source-id: a47f7f10d627ea60d677ffba3035925178030794
2022-11-07 12:56:06 -08:00
Michael Bolin
91272802fb improve suggestion for setting username
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
2022-11-07 08:33:48 -08:00
Michael Bolin
c2b84cc9e6 add missing login field to GraphQL query
Summary:
Fix a bug I discovered in the GraphQL query when `parent`
comes back non-null. Note that in this case, it is passed to
`_parse_repository_from_dict()`:

https://www.internalfb.com/code/fbsource/[ca22adc861ea]/fbcode/eden/scm/edenscm/ext/github/gh_submit.py?lines=104

which expects the `login` field to be set on `owner`:

https://www.internalfb.com/code/fbsource/[ca22adc861ea]/fbcode/eden/scm/edenscm/ext/github/gh_submit.py?lines=158

Reviewed By: jordanwebster

Differential Revision: D41062851

fbshipit-source-id: 31c3c1c737aea95b25be8d875a4e9b93ed236e32
2022-11-07 07:30:07 -08:00
Liubov Dmitrieva
6877de5f32 improve signal for scm daemon logs by compacting "Subscription is
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
2022-11-07 03:05:42 -08:00
Michael Bolin
120196a75c process backticks in rst-to-md
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
2022-11-03 16:26:28 -07:00
Liubov Dmitrieva
3024c951b5 fix broken print of backed up heads
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
2022-11-03 08:30:58 -07:00
generatedunixname89002005307016
9b61abe54b Add annotations to eden/scm/edenscm/hg.py
Reviewed By: jordanwebster

Differential Revision: D40978785

fbshipit-source-id: c39a89bf84107df17f74c7d3ff2f177bcd866059
2022-11-03 06:43:01 -07:00
Liubov Dmitrieva
447da7d879 add hg cloud copy command
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
2022-11-02 05:14:22 -07:00
Yan Soares Couto
f144bcd480 Add annotations to eden/scm/edenscm/hg.py
Reviewed By: quark-zju

Differential Revision: D40633838

fbshipit-source-id: 668f4195cf8eb22c1e82d5e82578c4f923c7b1ac
2022-10-31 15:52:11 -07:00
Zhaolong Zhu
d0f6ca3ab4 match: use dynmatcher if possible
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
2022-10-31 11:44:55 -07:00
Liubov Dmitrieva
07ac140324 remove old code
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
2022-10-31 09:27:35 -07:00
Muir Manders
ca321c8836 colors: always enable the termwiz sgr compat flag
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
2022-10-31 08:40:54 -07:00
Zhaolong Zhu
8a17e79f4e match: refactor match API to move patterns normalization earlier
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
2022-10-31 07:45:09 -07:00
generatedunixname89002005307016
92e45a6341 Add annotations to eden/scm/edenscm/transaction.py
Reviewed By: yancouto

Differential Revision: D40835395

fbshipit-source-id: a6b7c4a134dedbe7de385ce63e62c44fa9b11e9f
2022-10-31 05:07:50 -07:00
generatedunixname89002005307016
66f31e92b1 Add annotations to eden/scm/edenscm/phases.py
Reviewed By: yancouto

Differential Revision: D40829215

fbshipit-source-id: 0e18d47e8474ca49a1e98ccae2bcea1da84d7b2e
2022-10-31 05:06:43 -07:00
Michael Bolin
2fe03dfb14 do not use debugshell to find gitdir
Reviewed By: evangrayk

Differential Revision: D40811734

fbshipit-source-id: ffd9da684ab968fde356e001e89ddacc2e02330e
2022-10-28 14:54:32 -07:00
Zhaolong Zhu
ee0139b148 help: update 'hg' -> '@prog@' and 'Mercurial' -> '@Product@'
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
2022-10-28 12:29:06 -07:00
Muir Manders
7d0050be4d oss: fix "sl isl" on Windows
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
2022-10-28 12:17:44 -07:00
Muir Manders
fff01dd219 extensions: clean up handling of "edenscm.mercurial"
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
2022-10-28 08:47:37 -07:00
Muir Manders
3af50537d7 fastlog: try to fix hangs when stopping log operation
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
2022-10-28 08:45:47 -07:00
Zhaolong Zhu
bbb5fedba1 match: update comment of building regex matcher
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
2022-10-28 07:21:20 -07:00
Yan Soares Couto
5d4ef8078d Add annotations to eden/scm/edenscm/ext/tweakdefaults.py
Reviewed By: quark-zju

Differential Revision: D40587512

fbshipit-source-id: 208bed74a4aa4cb3ff0f367dffc0a5b033294dae
2022-10-27 16:17:29 -07:00
Saul Gutierrez
a324829ca1 tests: fix test-configfile-t
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
2022-10-26 21:04:01 -07:00
Michael Bolin
26b2836e95 write ghstack.github_username back to .sl/config
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
2022-10-26 17:12:01 -07:00
Muir Manders
cb39143849 defer importing of eden.thrift.windows_thrift.WindowsSocketHandle
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
2022-10-26 17:03:07 -07:00
Michael Bolin
6105df18ea use the GitHub CLI to make requests for ghstack
Reviewed By: muirdm

Differential Revision: D40708686

fbshipit-source-id: 77648168ed6672af8a37801c1b83bf6cad242336
2022-10-26 16:53:42 -07:00
Michael Bolin
e768bf69b5 rename ghstack.eden_shell to ghstack.sapling_shell
Reviewed By: muirdm

Differential Revision: D40707034

fbshipit-source-id: 824b43da89442c16730b4802c578b1165d3fdffa
2022-10-26 16:53:42 -07:00
Michael Bolin
11f532e3ab fix commit archival logic to tolerate merge conflicts
Reviewed By: muirdm

Differential Revision: D40699123

fbshipit-source-id: 54eb7919e8aca9edac6037eb028124b8ffa43a50
2022-10-26 16:53:42 -07:00
Michael Bolin
8202967e20 make "web" the default name for the "isl" subcommand
Reviewed By: evangrayk

Differential Revision: D40724624

fbshipit-source-id: e142a890f31a3a1aa1ce2719c08bb09cfaa10a24
2022-10-26 14:13:56 -07:00
Yan Soares Couto
515b5724d8 Add annotations to eden/scm/edenscm/ext/globalrevs.py
Reviewed By: jordanwebster

Differential Revision: D40509213

fbshipit-source-id: 478329cd6049548dfff103d712cc50a88e579f80
2022-10-26 02:30:26 -07:00
Yan Soares Couto
609833aa2e Add annotations to eden/scm/edenscm/ext/rebase.py
Reviewed By: jordanwebster

Differential Revision: D39967227

fbshipit-source-id: 6bbdb85b05d2127c9c322956c8b91212e3828c08
2022-10-26 02:29:54 -07:00
Facebook Community Bot
1f7fd8a072 Re-sync with internal repository 2022-10-25 12:19:26 -07:00
Durham Goode
d338b4000f treestate: improve error message of metadata mismatch
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
2022-10-25 09:43:28 -07:00
Evan Krause
fecd07ba85 Don't show hint to run with --foreground if foreground already provided
Summary: Small tweak based on feedback, to not show a hint when not needed.

Reviewed By: bolinfest

Differential Revision: D40604996

fbshipit-source-id: 8c00428414aa2eecb835712fd5a0b4679901e154
2022-10-21 16:49:10 -07:00
Muir Manders
811483529c match: disable new case insensitive logic for now
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
2022-10-21 15:54:47 -07:00
Muir Manders
36cf300898 config: templatize "hg" usage in example configs
Summary: Change "hg" to prog@ and run the sample configs through _() when used.

Reviewed By: bolinfest

Differential Revision: D40496655

fbshipit-source-id: cd60425a6928725b4f4af37e74db6c849b701ddf
2022-10-21 15:17:26 -07:00
Muir Manders
e615b04866 config: use correct system config path when editing
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
2022-10-21 15:17:26 -07:00
Muir Manders
9af34451e4 config: output message when editing config
Summary: Output an informational message that shows you the location of the config file.

Reviewed By: bolinfest

Differential Revision: D40486335

fbshipit-source-id: c85677ba0b696ab081dbe3bae6f0569466f38331
2022-10-21 15:17:26 -07:00
Muir Manders
c802faed53 config: fix user config edit test on windows
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
2022-10-21 15:17:26 -07:00
Muir Manders
d4ccc1196d git clone: set up repo config earlier
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
2022-10-21 14:45:29 -07:00
Durham Goode
e0b16f04e3 tests: fix test-doctests.py, test-manifest.py, test-match.py
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
2022-10-20 11:58:48 -07:00
Jun Wu
2e791b657b chgserver: remove logic about appnope
Summary:
It turns out that initializing objc types before (disabling appnap) and after
(via libcurl [2]) fork() would abort the program like:

  objc[<pid>]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.

It seems objc really dislikes fork. Disabling the objc logic before fork seems
to be the only way to unblock the issue.

Other approaches considered:
- Avoid `fork()`: not really fesiable for performance (startup, Python GIL) reasons.
- Ensure chgserver does not create threads (see https://bugs.python.org/issue33725).
  Not possible since appnope implicitly creates a (short-lived?) thread.
- Disable AppNap without using objc: does not seem trivial.
- Set `OBJC_DISABLE_INITIALIZE_FORK_SAFETY` to `YES`. Abort with a different
  message [1].

[1]:

```
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec(). Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
```

[2]:

```
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
  * frame #0: 0x00007ff81395f067 libobjc.A.dylib`objc_initializeAfterForkError
    frame #1: 0x00007ff81395f187 libobjc.A.dylib`performForkChildInitialize(objc_class*, objc_class*) + 274
    frame #2: 0x00007ff81394a479 libobjc.A.dylib`initializeNonMetaClass + 617
    frame #3: 0x00007ff813949f12 libobjc.A.dylib`initializeAndMaybeRelock(objc_class*, objc_object*, mutex_tt<false>&, bool) + 232
    frame #4: 0x00007ff813949c93 libobjc.A.dylib`lookUpImpOrForward + 1087
    frame #5: 0x00007ff81394e02f libobjc.A.dylib`object_getMethodImplementation + 153
    frame #6: 0x00007ff813b12934 CoreFoundation`_NSIsNSString + 55
    frame #7: 0x00007ff813b128dc CoreFoundation`-[NSTaggedPointerString isEqual:] + 36
    frame #8: 0x00007ff813b05609 CoreFoundation`CFEqual + 533
    frame #9: 0x00007ff813b0b2a3 CoreFoundation`_CFBundleCopyBundleURLForExecutableURL + 220
    frame #10: 0x00007ff813b069cb CoreFoundation`CFBundleGetMainBundle + 116
    frame #11: 0x00007ff813b28ade CoreFoundation`_CFPrefsGetCacheStringForBundleID + 71
    frame #12: 0x00007ff813b2f52f CoreFoundation`-[CFPrefsPlistSource setDomainIdentifier:] + 92
    frame #13: 0x00007ff813b2f46c CoreFoundation`-[CFPrefsPlistSource initWithDomain:user:byHost:containerPath:containingPreferences:] + 99
    frame #14: 0x00007ff813b2f351 CoreFoundation`__85-[_CFXPreferences(PlistSourceAdditions) withManagedSourceForIdentifier:user:perform:]_block_invoke + 156
    frame #15: 0x00007ff813c622a7 CoreFoundation`-[_CFXPreferences withSources:] + 60
    frame #16: 0x00007ff813cac80f CoreFoundation`-[_CFXPreferences withManagedSourceForIdentifier:user:perform:] + 240
    frame #17: 0x00007ff813b2a1ab CoreFoundation`-[CFPrefsSearchListSource addManagedSourceForIdentifier:user:] + 98
    frame #18: 0x00007ff813c83a18 CoreFoundation`__108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke.160 + 287
    frame #19: 0x00007ff813c836e8 CoreFoundation`-[_CFXPreferences withSearchLists:] + 60
    frame #20: 0x00007ff813b29f50 CoreFoundation`__108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke + 279
    frame #21: 0x00007ff813c83879 CoreFoundation`-[_CFXPreferences withSearchListForIdentifier:container:cloudConfigurationURL:perform:] + 374
    frame #22: 0x00007ff813b29a42 CoreFoundation`-[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:] + 137
    frame #23: 0x00007ff813b29978 CoreFoundation`_CFPreferencesCopyAppValueWithContainerAndConfiguration + 101
    frame #24: 0x00007ff8145c672b SystemConfiguration`SCDynamicStoreCopyProxiesWithOptions + 155
    frame #25: 0x000000010272a315 hg`Curl_resolv(data=0x00007f8dea888a00, hostname="api.github.com", port=443, allowDOH=true, entry=0x000000030a12be10) at hostip.c:675:30 [opt]
    frame #26: 0x000000010272a68c hg`Curl_resolv_timeout(data=<unavailable>, hostname=<unavailable>, port=<unavailable>, entry=<unavailable>, timeoutms=<unavailable>) at hostip.c:908:8 [opt] [artificial]
    frame #27: 0x0000000102753e1e hg`create_conn at url.c:3440:12 [opt]
    frame #28: 0x0000000102753cfe hg`create_conn(data=0x00007f8dea888a00, in_connect=0x000000030a12bed8, async=0x000000030a12bf8f) at url.c:4077:12 [opt]
    frame #29: 0x000000010275026b hg`Curl_connect(data=0x00007f8dea888a00, asyncp=0x000000030a12bf8f, protocol_done=0x000000030a12bfb2) at url.c:4156:12 [opt]
    frame #30: 0x000000010273dbd1 hg`multi_runsingle(multi=<unavailable>, nowp=0x000000030a12c020, data=0x00007f8dea888a00) at multi.c:1858:16 [opt]
    frame #31: 0x000000010273d6ae hg`curl_multi_perform(multi=0x00007f8deb0699c0, running_handles=0x000000030a12c074) at multi.c:2636:14 [opt]
    frame #32: 0x0000000102726ada hg`curl_easy_perform at easy.c:599:15 [opt]
    frame #33: 0x0000000102726aa8 hg`curl_easy_perform [inlined] easy_perform(data=0x00007f8dea888a00, events=false) at easy.c:689:42 [opt]
    frame #34: 0x00000001027269a4 hg`curl_easy_perform(data=0x00007f8dea888a00) at easy.c:708:10 [opt]
    frame #35: 0x00000001025e1cf6 hg`http_client::request::Request::send::h13a4e600f6bc5508 [inlined] curl::easy::handler::Easy2$LT$H$GT$::perform::h2ba0ae1da25a8852(self=<unavailable>) at handler.rs:3163:37 [opt]
```

Reviewed By: bolinfest

Differential Revision: D40538471

fbshipit-source-id: cd8611c8082fbe2d610efb78cb84defdb16d7980
2022-10-20 11:28:38 -07:00
Durham Goode
39ea4d0bd5 git: fix crash when encountering -1 identifier
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
2022-10-20 09:06:10 -07:00
Muir Manders
0b045ac4f4 config: deprecate "--edit" flag in favor of "--user"
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
2022-10-18 21:21:03 -07:00
Muir Manders
ed7c697b3c config: move config editting logic to separate function
Reviewed By: bolinfest

Differential Revision: D40484807

fbshipit-source-id: 2323c51349395e1ece7b66d0f80871a6d080510c
2022-10-18 21:21:03 -07:00
Durham Goode
c194832b8d tests: fix test-doctest.py
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
2022-10-18 18:50:11 -07:00
Muir Manders
b4f372b5cd identity: support "SL: " template prefix (#26)
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
2022-10-17 17:01:40 -07:00
Durham Goode
3604413c64 git: prevent accidental git detection on Windows
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
2022-10-17 16:48:23 -07:00
Durham Goode
452b3d0eb9 matcher: TreeMatcher case insensitive support
Summary: Support case insensitive matching in the TreeMatcher.

Reviewed By: quark-zju

Differential Revision: D40164596

fbshipit-source-id: 14fcd7f429aa34e68971b72f8d5818447f9ac442
2022-10-17 11:56:11 -07:00
Durham Goode
da02641391 matcher: GitIgnoreMatcher case insensitive support
Summary: Support case insensitive matching in the GitIgnore matcher

Reviewed By: quark-zju

Differential Revision: D40164601

fbshipit-source-id: 7711c2ea84bf26e1349e22c8f073dd35ee83dc28
2022-10-17 11:56:11 -07:00
Youssef Ibrahim
bef8452af7 Add a limit to the number of files allowed in a snapshot
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
2022-10-17 04:21:25 -07:00
Saul Gutierrez
8ed6435e37 remove usages of untrusted option for config related code in Python
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
2022-10-16 09:56:58 -07:00
Muir Manders
5b1bb04628 clone: clean up repo if user ctrl-C's
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
2022-10-14 08:56:57 -07:00
Muir Manders
ec0becf027 git clone: clean up directory if hg repo init fails
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
2022-10-14 08:56:57 -07:00
Muir Manders
8e59cacab2 git clone: give better error when destination exists
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
2022-10-14 08:56:57 -07:00
Muir Manders
ee5f69f92a identity: get rid off sniff_env()
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
2022-10-14 08:24:59 -07:00
Muir Manders
56b06b454f testing: reset identity global state in debugruntest
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
2022-10-14 08:24:59 -07:00
Muir Manders
70ac3c1a6c identity: get rid of identity::IDENTITY
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
2022-10-14 08:24:59 -07:00
Liubov Dmitrieva
074d2134b2 introduce hg cloud archive command
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
2022-10-14 07:10:07 -07:00
Jun Wu
aeb3885984 config: support section.name value as separate args for editing
Summary: Add support for git's style `config --edit section.name value`.

Reviewed By: muirdm

Differential Revision: D40353774

fbshipit-source-id: bbc05c895dc4c656a80a8f5477ff1a90d31c003c
2022-10-13 15:06:31 -07:00
Jun Wu
a36e322834 git: support scp-like path for clone
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
2022-10-13 12:48:20 -07:00
generatedunixname89002005307016
038f9439b3 Add annotations to eden/scm/edenscm/ext/fastannotate/context.py
Reviewed By: quark-zju

Differential Revision: D40341362

fbshipit-source-id: 953556360989318b0d0d656c5b0266b94ce3bb6a
2022-10-13 12:07:48 -07:00
Evan Krause
90cd0a5025 Pass command into isl run-proxy from sl isl
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
2022-10-13 10:10:59 -07:00
Evan Krause
587de2eb31 Add hg args for --kill and --force
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
2022-10-13 10:10:59 -07:00
Muir Manders
2f6c89ab15 ghstack: fix "hg" reference in ghstack.logs
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
2022-10-13 09:59:21 -07:00
Muir Manders
c87380b095 ghstack: enable logging in extension
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
2022-10-13 09:59:21 -07:00
Muir Manders
daf3ea30b2 ghstack: specify proper sapling cli path to EdenShell
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
2022-10-13 09:59:21 -07:00
Liubov Dmitrieva
b37bcf65ed py3 - improve error text in exceptions
Summary: py3 - improve error text in exceptions (convert bytes to string)

Reviewed By: YousefSalama

Differential Revision: D40341544

fbshipit-source-id: 73c27740e2695d2c1dc3c3435bde8b1701540e9d
2022-10-13 07:43:19 -07:00
Liubov Dmitrieva
947e2946de remove legacy code
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
2022-10-13 07:27:03 -07:00
Michael Bolin
54f37eba6e --no-git should skip git.maybegiturl() check
Reviewed By: muirdm

Differential Revision: D40292625

fbshipit-source-id: 03713c0df060f992a36d67c91b016cad05a34aa5
2022-10-12 18:36:42 -07:00
Alex Malyshev
b2a9c53829 Replace deprecated uses of collections.$ABC_CLASS
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
2022-10-12 12:04:29 -07:00
Liubov Dmitrieva
aa512c4059 fix workspace presence check
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
2022-10-12 10:16:18 -07:00
Saul Gutierrez
a19227763b help: fix incorrect usage of @command@
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
2022-10-12 10:09:38 -07:00
Liubov Dmitrieva
fcd4f89728 check the result of the update operation in hg cloud hide and `hg
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
2022-10-12 05:16:22 -07:00
Liubov Dmitrieva
1fa0c8f52f implement hg cloud move command
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
2022-10-12 04:24:01 -07:00
Facebook Community Bot
d482135604 Re-sync with internal repository 2022-10-11 16:23:54 -07:00
generatedunixname89002005294178
c25fed4357 Update isl component on FBS:master
Differential Revision: D40266144

fbshipit-source-id: 2f547990f9ef33082c044af6938540e90624b83a
2022-10-11 11:40:39 -07:00
Muir Manders
0dfbdde820 tests: use a stable TERM
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
2022-10-11 09:52:36 -07:00
Saul Gutierrez
15a82fa8e5 config: create parent directory properly for Sapling identity
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
2022-10-11 08:50:52 -07:00
Liubov Dmitrieva
311dbb0bda do not skip the '--full' option in hg cloud sync help
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
2022-10-11 04:38:30 -07:00
Liubov Dmitrieva
037ee9c1fe execute cloud sync in foreground after hg cloud hide if it
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
2022-10-11 03:28:51 -07:00
Saul Gutierrez
54f6c427be replace hardcoded hg and Mercurial with @prog@ and @Product@ in help text
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
2022-10-10 16:39:36 -07:00
Saul Gutierrez
41b41de101 replace hardcoded hg and Mercurial with @prog@ and @Product@ outside of helptext.py
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
2022-10-10 16:39:36 -07:00
Saul Gutierrez
6b46daf35b i18n: show current product name in i18n strings for Python code
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
2022-10-10 16:39:36 -07:00
Jun Wu
917c8a6348 smartlog: use gcaone instead gcaall
Summary:
With certain graphs, `gcaall` can produce lots of commits, making smartlog
unreadable.

Reviewed By: metacpp

Differential Revision: D40127752

fbshipit-source-id: e493e684b59f02ce66f4e3f22a382a7e9910e605
2022-10-10 10:10:02 -07:00
generatedunixname89002005307016
2b688371cd Add annotations to eden/scm/edenscm/templatekw.py
Reviewed By: jordanwebster

Differential Revision: D40205593

fbshipit-source-id: 747542f52e1eca5ace6ee476aeb2e56fc5f809e5
2022-10-10 05:09:04 -07:00
Michael Bolin
90a2f1c17d wire up ghstack subcommand in Sapling
Summary:
This wires up the `sl ghstack` subcommand by mirroring the logic
in ghstack's own `__main__.py`:

https://www.internalfb.com/code/fbsource/[528d083ee35a]/xplat/scm/ghstack-0.6.0/ghstack/__main__.py

Differential Revision: D40161187

fbshipit-source-id: 47b24c146fca6e8f0c9c3c1532b6180d29e70d68
2022-10-07 20:42:25 -07:00
Michael Bolin
7dd7ae4c90 make fork of ghstack available to Sapling
Differential Revision: D40123042

fbshipit-source-id: 6dae12e2bd3838a13fd23a03ca093234a84b644c
2022-10-07 20:42:25 -07:00
Jun Wu
ea03d0f012 chgserver: disable AppNap on macOS
Summary:
We suspect AppNap can make chgserver very slow.
Disable AppNap to see if it helps.

Differential Revision: D40185563

fbshipit-source-id: 0740ed0b3e7e68c82c40cc905136365bc6386f8c
2022-10-07 14:34:45 -07:00
Liubov Dmitrieva
b39e4ce539 fix service call in hg cloud shared
Summary: fix service call in `hg cloud share`

Reviewed By: YousefSalama

Differential Revision: D40180467

fbshipit-source-id: 024712e8c9b1f22e313c51ae67d96df488f8b1d8
2022-10-07 10:51:11 -07:00
Jun Wu
4104f7348a rcutil: use Rust config parser for editconfig
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
2022-10-07 09:39:18 -07:00
Jun Wu
ecdb1bc500 config: support --edit section.name=value without spawning editor
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
2022-10-07 09:39:18 -07:00
generatedunixname89002005307016
5875ebbf4f Add annotations to eden/scm/edenscm/templatekw.py
Reviewed By: jordanwebster

Differential Revision: D40175790

fbshipit-source-id: 776cc80dd040297efb0adfc1766b0c6b358ff6cb
2022-10-07 06:30:21 -07:00
Jun Wu
36ad8e4574 chg: change server process name
Summary: Change 'serve --cmdserver chgunix2' to '--pfc-server'

Differential Revision: D40127990

fbshipit-source-id: 5d3a40b88a5e53b1a881da13006a55e796359b55
2022-10-06 13:03:25 -07:00
Jun Wu
376463505a chg: change worker process name
Summary: Change `chg[worker/pid]` to `pfc[worker/pid]`.

Differential Revision: D40127991

fbshipit-source-id: ae49639f0f97efd71a195d106990a3635d0c42f0
2022-10-06 13:03:25 -07:00
Muir Manders
98841f586f fix test-check-help.t
Summary: Remove a reference to now dead help section "config.web".

Reviewed By: DurhamG

Differential Revision: D40127378

fbshipit-source-id: 3eed84dc184c81c81b8aae70c3cfb221bf8f647f
2022-10-06 08:21:25 -07:00
generatedunixname89002005294178
f8cd1f5452 Update isl component on FBS:master
Differential Revision: D40134768

fbshipit-source-id: 66331beb68165a4ba43b284c93ed81e338905295
2022-10-06 03:46:14 -07:00
Zhaolong Zhu
894eb2988a regexmatcher: make RegexMatcher support '^'
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
2022-10-05 20:53:30 -07:00
Michael Bolin
9b124b5088 if PR has more than one commit, note that in PR body
Reviewed By: quark-zju

Differential Revision: D39915885

fbshipit-source-id: a29b0e826a13d669b0dbbe6f87088c2ac300335b
2022-10-05 18:34:53 -07:00
Michael Bolin
56a0676f0a support pr follow to create PR with more than one commit
Reviewed By: quark-zju

Differential Revision: D39907745

fbshipit-source-id: 4a0de8cdb93d4040ca8ff1b45de4e6066c2a65bc
2022-10-05 18:34:53 -07:00
Michael Bolin
e8536f69a6 add more Python types around serialization
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
2022-10-05 18:34:53 -07:00
Saul Gutierrez
73c79602f3 config: remove hardcoded uses of .hgrc
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
2022-10-05 18:15:48 -07:00
Durham Goode
7c29cb8e1e repo: add ability to invalidate Rust repo requirements
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
2022-10-05 14:59:47 -07:00
Muir Manders
3997a0ca5d path: respect ".sl" as a valid looking repo
Summary: Expose list of all valid identities to inform ui.path._isvalidlocalpath.

Reviewed By: jordanwebster

Differential Revision: D39867738

fbshipit-source-id: dc1b80474a6d71dd348035cacc7b40d8b7096fe9
2022-10-05 12:20:12 -07:00
Muir Manders
51b597c292 reset: kill bundle related logic
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
2022-10-05 12:20:12 -07:00
Muir Manders
370a4da42d scmutil: kill walkrepos functionality
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
2022-10-05 12:20:12 -07:00
Muir Manders
6be3f26b04 git: support ".sl" identity
Summary: Add a bit of sniffing to the git support.

Reviewed By: quark-zju

Differential Revision: D39867744

fbshipit-source-id: e93d54cad57f2d416726c2a7ebcbff48594b45c8
2022-10-05 12:20:12 -07:00
Muir Manders
daf3902d4b identity: replace more Python ".hg" references w/ identity
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
2022-10-05 12:20:12 -07:00
Muir Manders
959c9da5ef pathauditor: support .sl repos
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
2022-10-05 12:20:12 -07:00
Muir Manders
07275971cb identity: memoize sniffdir in Python
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
2022-10-05 12:20:12 -07:00
Muir Manders
0722c116dd replace various ".hg" instances w/ identity.dotdir()
Reviewed By: jordanwebster

Differential Revision: D39867740

fbshipit-source-id: 6f1451db87e092e5aa9b2183336d0c4d60771b6a
2022-10-05 12:20:12 -07:00
Muir Manders
fbfd276cdb kill hgweb
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
2022-10-05 12:20:12 -07:00
Muir Manders
38acea0fda color: use new termwiz flag to improve pager compat
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
2022-10-05 10:42:09 -07:00
Liubov Dmitrieva
f92f4bcbae clean up token code
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
2022-10-05 10:10:47 -07:00
Liubov Dmitrieva
1077d0a560 tidy up: remove extra cloud sync attempts
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
2022-10-05 10:10:47 -07:00
Liubov Dmitrieva
e16912e1b0 fix backed up status after hg cloud switch
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
2022-10-05 10:10:47 -07:00
Rajiv Sharma
210d0f5723 Client side integration for ShareWorkspace endpoint
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
2022-10-05 07:21:48 -07:00
generatedunixname89002005307016
a47fef4ec3 Add annotations to eden/scm/edenscm/mutation.py
Reviewed By: jordanwebster

Differential Revision: D40098680

fbshipit-source-id: 9956cbf3aa6c20aa49185aa1e7b8656cfc52b251
2022-10-05 06:00:38 -07:00
Liubov Dmitrieva
c5566b8434 allow server to skip listing of the heads to reduce network
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
2022-10-05 02:11:56 -07:00
Zhaolong Zhu
4717169a77 match: use regexmatcher for includematcher
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
2022-10-04 19:37:36 -07:00
Zhaolong Zhu
47c25aa79a match: move the _buildpatternmatcher after patternmatcher definition
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
2022-10-04 17:01:27 -07:00
Jordan Webster
ec07b73fc6 status: flush watchman treestate
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
2022-10-04 11:51:14 -07:00
Muir Manders
7106c80d79 status: add metrics for status flavor
Summary: Log status_mode=python|rust|fastpath and status_detail (currently only python fallback reason).

Reviewed By: jordanwebster

Differential Revision: D39930450

fbshipit-source-id: e43fa3947546a5b798d077a0ca1bb274fe6ac9c6
2022-10-04 10:39:37 -07:00
generatedunixname89002005294178
b5ed06a04e Update isl component on FBS:master
Differential Revision: D40064403

fbshipit-source-id: c4cdcbeb889172a1491a21dc612ff98b13ad7f7b
2022-10-04 10:25:17 -07:00
generatedunixname89002005307016
dd58f06d3f Add annotations to eden/scm/edenscm/ext/githelp.py
Reviewed By: jordanwebster

Differential Revision: D40057933

fbshipit-source-id: 4e80f0e62e97e3593cc6dcca2ad4156e46670b35
2022-10-04 07:07:38 -07:00
Michael Bolin
57e8b788df backup commits to sapling-pr-archive branch
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
2022-10-03 23:23:09 -07:00
Saul Gutierrez
2a2f37685a config: make user config loading depend on identity
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
2022-10-03 19:13:36 -07:00
Durham Goode
1ab1ffa329 status: enable workingcopy.ruststatus=True in tests
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
2022-10-03 14:59:18 -07:00
Saul Gutierrez
6b72e4bff5 goto: add skeleton for command in Rust
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
2022-10-03 10:50:47 -07:00
Jun Wu
8fc93d02d1 eagerepo: check trees and files references
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
2022-09-29 18:32:19 -07:00
Liubov Dmitrieva
0cdc8168b8 fix mercurial tests if executed with buck2
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
2022-09-29 04:29:43 -07:00
Liubov Dmitrieva
7759a044f1 remove unused code
Summary:
remove unused code

follow up clean up from the previous clean up

Reviewed By: jordanwebster

Differential Revision: D39886293

fbshipit-source-id: e0d4d5bea3c2865b7b9c5b362cda9b7dbe7eb5e5
2022-09-29 02:41:00 -07:00
Durham Goode
8fc51a190f undo: fix undo -i
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
2022-09-28 18:35:42 -07:00
generatedunixname89002005307016
7c5d9b9328 upgrade pyre version in fbcode/eden - batch 1
Differential Revision: D39895180

fbshipit-source-id: d315985383e88838777d6edf0673e761232686f9
2022-09-28 17:52:03 -07:00
Durham Goode
9e0d3cb248 identity: support SAPLING_SCRIPT in addition to HGPLAIN
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
2022-09-28 13:41:46 -07:00
Durham Goode
c4bb6f9f1b store: allow refreshing Rust file and tree stores
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
2022-09-28 09:28:48 -07:00
Durham Goode
a2842e2d85 status: use WorkingCopy status instead of static status
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
2022-09-28 09:28:48 -07:00
Durham Goode
6b0448a753 treestate: use the Rust constructed TreeState from Python
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
2022-09-28 09:28:48 -07:00
Pyre Bot Jr
8d0d413866 Add annotations to eden/scm/edenscm/store.py
Reviewed By: jordanwebster

Differential Revision: D39884072

fbshipit-source-id: 6675d9b2995eb16f032992215c43ba2fb293e1f1
2022-09-28 06:09:51 -07:00
Michael Bolin
d5f0063fd0 move stat extension into core
Reviewed By: quark-zju

Differential Revision: D39866927

fbshipit-source-id: c12c8f7ec191b876fd0a4fd75fa4b195672487b4
2022-09-27 22:40:25 -07:00
Durham Goode
96501e8e09 pyrepo: store a pyworkingcopy on a pyrepo
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
2022-09-27 13:53:47 -07:00
Michael Bolin
438ed8cde5 implement pr submit using an overlapping commit strategy
Reviewed By: DurhamG

Differential Revision: D39772263

fbshipit-source-id: 2b78eb4df5b72631bf3254bff04d4ce0e6eaa48c
2022-09-27 12:37:40 -07:00
Michael Bolin
df187bd667 introduce utilities for using the GitHub CLI
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
2022-09-27 12:37:40 -07:00
Michael Bolin
55bfd95442 expose more fields on GraphQLPullRequest
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
2022-09-27 12:37:40 -07:00
Michael Bolin
7242369f98 try_parse_oauth_token_from_gh_config() return username, as well
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
2022-09-27 12:37:40 -07:00
Michael Bolin
669a5faa08 consolidate PullRequest and GitHubPullRequest classes
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
2022-09-27 12:37:40 -07:00
Michael Bolin
8b415c5b0d introduce parse_owner_and_name_from_github_url helper function
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
2022-09-27 12:37:40 -07:00
Michael Bolin
6b1281eec7 use variable that was meant to be used
Reviewed By: DurhamG

Differential Revision: D39777663

fbshipit-source-id: 2d38d1e09b35e7e6049a27aeda533651c5894046
2022-09-27 12:37:40 -07:00
Michael Bolin
ecd4e6ae5a update pr submit to use a better internal API
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
2022-09-27 12:37:40 -07:00
Michael Bolin
403f968625 fix naming collision between function and file
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
2022-09-27 12:37:40 -07:00
Michael Bolin
e32b8fca8c consolidate GitHub actions under pr subcommand
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
2022-09-27 12:37:40 -07:00
Michael Bolin
8cf4e72a68 implement unlink command for GitHub extension
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
2022-09-27 12:37:40 -07:00
Michael Bolin
cba64467b3 read GitHub CLI hosts.yml for OAuth token
Reviewed By: DurhamG

Differential Revision: D39759269

fbshipit-source-id: 56deb6b33213f0be6fef98a87eeb3b5ee9a4fa33
2022-09-27 12:37:40 -07:00
Michael Bolin
c785e70967 check metalog for associated PR info
Reviewed By: DurhamG

Differential Revision: D39756566

fbshipit-source-id: 70a05a00974132277ccba9944e7df5c3ca7f54f8
2022-09-27 12:37:40 -07:00
MSDK Bot
2b5133c62a Update isl component on FBS:master
Differential Revision: D39851553

fbshipit-source-id: 0580ba726f1ba0265e5037d5a37180b78c69b8c6
2022-09-27 09:35:47 -07:00
Durham Goode
a1ab700e34 treestate: move treestate file name decision into the treestate
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
2022-09-27 08:53:26 -07:00
Durham Goode
f8da3efae0 auxdata: add option to fetch aux data during tree fetches
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
2022-09-27 08:40:11 -07:00
Liubov Dmitrieva
c42a6fec23 remove unused imports
Summary: remove unused imports that left from earlier clean up

Reviewed By: quark-zju

Differential Revision: D39814310

fbshipit-source-id: ed3df79b801af71265cf53cf51b130ebb52628a4
2022-09-27 03:51:33 -07:00
Michael Bolin
a65f69ea92 update message about VPN
Reviewed By: evangrayk

Differential Revision: D39824647

fbshipit-source-id: 578001989674fdf0ad447f98bcd1aa2c55218c55
2022-09-26 13:24:26 -07:00
Michael Bolin
e330afc08a suggest VPN check for internal users if it fails to launch
Reviewed By: zertosh

Differential Revision: D39818522

fbshipit-source-id: 6fa9942f96dc178c0004758bef3cd51070d0bed0
2022-09-26 11:37:56 -07:00
Zhaolong Zhu
765e18ea07 matcher: use regexmatcher if possible
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
2022-09-26 06:54:04 -07:00
Pyre Bot Jr
5111891f6f Add annotations to eden/scm/edenscm/store.py
Reviewed By: jordanwebster

Differential Revision: D39811574

fbshipit-source-id: 3e8dc73afff656444201b4891c391491ca3ef468
2022-09-26 05:38:12 -07:00
Michael Bolin
26321dd222 introduce issensitiveargname() check
Differential Revision: D39775123

fbshipit-source-id: b08757afb0e84d7b03e2fb6060907e80853e4599
2022-09-23 15:41:41 -07:00
Muir Manders
4233063555 color: fix colors when using "less" pager
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
2022-09-22 16:04:07 -07:00