Summary:
Git does not have command name prefix matching. We now use `commands.names`
config options as a hint to avoid going to the Python land for command
prefix matching. It works but is not "correct". If we drop the prefix matching
feature, then the problems are gone - fast paths won't need prefix matching
aka. the command name list, and slow path (ex. wrong command) can afford
loading Python for all command names.
`hg d` is the single most used prefix matching command. Assign an explicit
alias to it to avoid regression if we do drop prefix matching (or, make
that more expensive than resolving commands direcly).
Reviewed By: sfilipco
Differential Revision: D16733274
fbshipit-source-id: 8904288b8a1ddf1fc6e6ec54ffaa36e503ebdb77
Summary:
This removes Python alias handling so the alias handling is done entirely in
Rust.
There are some subtle changes - alias using prefix mathcing to ambiguous
commands will not show other aliases. Hopefully that won't be a big issue.
Users can always avoid prefix matching in alias to solve the issue.
Reviewed By: sfilipco
Differential Revision: D16733270
fbshipit-source-id: 54a4915d49c2b2f6e8664a225a9c0f25e1c38d17
Summary:
Similar to D14151200, instead of printing a long help that might flush out
important messages, make the error short but still point the user to `hg help`.
This makes the error message much shorter, and make the test change by the
upcoming diff smaller.
Besides, we no longer check disabled extensions, as we don't expect users to
tweak extension config by themselves.
Reviewed By: sfilipco
Differential Revision: D16733273
fbshipit-source-id: b39bd4b2af6f315273484ec582094609b8e331ae
Summary:
Resolve aliases directly in command help. This removes the dependency of the
Python alias handling.
There are some minor behavior changes. But they look reasonable.
Reviewed By: sfilipco
Differential Revision: D16733276
fbshipit-source-id: ad97def2c60828236bbd8784ffd8202abfdeeb15
Summary:
Translate alias like `echo = !echo foo` to `echo = debugrunshell '--cmd=echo
foo'`. This enables the Rust shell alias handling code path. The Python
shell alias handling was removed.
The majority part of `test-alias.t` still passes. That includes some "weird"
shell alias features.
This has some test changes, through:
- `$HG_ARGS` is no longer supported. And tests depending on it are changed.
`$@` will be the alternative for most cases.
Practically, our `$HG_ARGS` users seem to come from
https://stackoverflow.com/a/833387, which does not seem to use `$HG_ARGS`
correctly (since `$HG_ARGS` includes the command name).
- Early-parse commands (ex. `hg log -b '--config=alias.log=!echo
howdy'`) no longer works.
- The warning `--repository ignored` now shows up, since `debugrunshell`
is a "no-repo" command.
- Global flags can no longer be used after shell aliases. Supporting them
is a head-ache.
- `circular alias` error message changed because it's now reported by the Rust
code, which does not report all alias names right now.
Reviewed By: sfilipco
Differential Revision: D16733266
fbshipit-source-id: b06bc7f8fc2f1c2701a17407d6a1656e17e4ba55
Summary:
Alias starting with `!` are considered shell commands. The entire command
string should be passed roughly as-is to the shell.
The current alias handling uses shlex::split to split the alias into arguments,
then replaces things like `$1` in arguments. The problem is, escaping
shlex::split a complex shell alias, then unesape (shlex::quote) it is not
loseless.
To maintain compatibility for existing complex shell alias configuration,
add a new code path that imitates the Python code behavior.
Reviewed By: sfilipco
Differential Revision: D16814144
fbshipit-source-id: 0e5e95f99bf8b8b16bd8d0cbcadd6760f7f77ebb
Summary: This will make shell aliases fit in the normal hg command framework.
Reviewed By: sfilipco
Differential Revision: D16530521
fbshipit-source-id: c1b158bc2895add03fa92099564830e55e02f1b7
Summary:
IPython has fallback code for `import sqlite3`. Make it non-lazy so IPython can
detect missing sqlite3 (on our Windows distribution) and continue working.
Reviewed By: ikostia
Differential Revision: D16897722
fbshipit-source-id: f7d312e10b9806498a03ce0788d436f6d72ddae8
Summary: Updated help text for hg redo and hg metaedit
Reviewed By: markbt
Differential Revision: D16723556
fbshipit-source-id: 9859d921f8e39880a0edc28c87f66d48268069dd
Summary:
Commit cloud and infinitepush currently only back up draft commits, omitting
secret ones. However, commit cloud sync with visibility enabled will try to
sync all visible commits, including the secret ones. This means users with
secret commits won't be able to sync them to their other machines as they won't
have been backed up.
We eventually want to get rid of the secret phase, which means all non-public
commits should be synced. Update commit cloud to backup and sync all
non-public commits, including secret ones.
Currently secret commits become draft when they are received by the other
machine. Since we're planning to get rid of the secret phase, this should be
fine.
Reviewed By: mitrandir77
Differential Revision: D16830832
fbshipit-source-id: 2ce4447ffa750a2edcb194cdf92321c1393ff805
Summary:
Connecting to large workspaces can result in many pulls within a single sync.
This re-uses the connection to the server. We have seen instances where the
server can't serve all of these pulls and crashes with a MemoryError.
Pragmatically close the connection between each pull to prevent this.
Reviewed By: farnz
Differential Revision: D16858728
fbshipit-source-id: 7561c6f01c38df2706bd7fd76f5a7387e9728dc8
Summary:
So far the hashes of manifest/commits may vary, mostly because of
different path separators on different platforms (`/` vs `\\`) and its serialization to string in the snapshot manifest.
Reviewed By: markbt
Differential Revision: D16856130
fbshipit-source-id: a19dff113b9b24f1c7f387b9bc5a5e39e83ef8af
Summary:
Now that we are writing the git hash inside the commit itself, if we are translating
from hg to git hash, we should just use that rather than loading the entire map and
build a dict and look it up.
The performance of this translation will also improve quite a lot.
Some small sample benchmarking:
```
suiting@devvm5006:configerator (659199b|remote/master)$ time ~/fbcode/scm/hg/hg log -r master -T '{node} || {gitnode}\n' --config exte
nsions.fbconduit=! --config extensions.hggit=
659199bf7c7850ea9ffa9e0ad50eb84597977dea || 69f05aeec13f09c44dd00d2a85fe9d461ba6841e
real 0m0.563s
user 0m0.004s
sys 0m0.007s
suiting@devvm5006:configerator (659199b|remote/master)$ time ~/fbcode/scm/hg/hg log -r master -T '{node} || {gitnode}\n'
659199bf7c7850ea9ffa9e0ad50eb84597977dea || 69f05aeec13f09c44dd00d2a85fe9d461ba6841e
real 0m14.706s
user 0m0.006s
sys 0m0.006s
```
Reviewed By: quark-zju
Differential Revision: D16833526
fbshipit-source-id: 7d3096649cf24967d13596e70463bc125081ba4f
Summary:
The upcoming changelog change will *have to* use a different set of numbers.
Some of the numbers might be generated on demand, which has difficulity
resolving a number to a commit hash.
There are a lot of internal (especially, tests) usecases of revision numbers.
The deprecation message is only shown for user-provided inputs (ex. things
that go through `scmutil.revrange`).
This does not affect the use of `{rev}` template yet.
Reviewed By: sfilipco
Differential Revision: D16795522
fbshipit-source-id: 7a5578ecc0afdcc86830238471ff95203c96dc3f
Summary: We follow the Python code-style for APIs exposed to the Python world.
Reviewed By: sfilipco
Differential Revision: D16683786
fbshipit-source-id: 5bc6e76cb621ec93cce6711e794d032857702629
Summary: Pass `uiconfig` to changelog so it can read config options.
Reviewed By: sfilipco
Differential Revision: D16683785
fbshipit-source-id: a64cfbe2cefa6b20ec695d2766bcfe878c764323
Summary:
A large portion of `ui` is config handling. Split it to a separate class so we
can pass that separate class to places that need pure configuration.
Some `develwarn`s are skipped since the new class does not have access to fout
or ferr.
Reviewed By: DurhamG
Differential Revision: D16683787
fbshipit-source-id: d823b9e5fc6f8ed08fff3401ab3502ad3c434f00
Summary:
Allow the user to check out on the snapshot by its revision id.
Snapshot == "a commit with extra containing a key `snapshotmanifestid`".
This corresponding value can be `None`, that would mean that snapshot does not contain untracked/missing/merge files.
Reviewed By: mitrandir77
Differential Revision: D16788479
fbshipit-source-id: bf4a9508acc940290b18123d3dd7b7fefae83782
Summary:
Now `hg debugcheckoutsnapshotmanifest` overwrites files if given the `--force` flag.
It also gives a more detailed output on the changes it makes.
Reviewed By: mitrandir77
Differential Revision: D16786334
fbshipit-source-id: b41d6241ffb478bd6c30a01c154b095d1ea92d78
Summary:
Add the `debugsnapshot` command, which will be renamed to `snapshot` later.
It creates a snapshot manifest that features information about
* untracked files,
* missing files,
* merge state artifacts from `.hg/merge` and `.hg/rebasestate`.
The snapshot manifest is stored in local lfs.
Then it creates the actual snapshot -- a fake commit, which has the snapshot oid in extra data.
It does not handle unresolved merge conflicts and other difficult states on this stage.
~~Finally, it restores the working copy and dirstate to status quo.~~
It doesn't need to be done, now we create only the commitctx, which does not wreck the dirstate.
Reviewed By: mitrandir77
Differential Revision: D16716359
fbshipit-source-id: 743f7427ce89c3fca6f844487bac1c456338e613
Summary:
Whenever a checkout is done, the new commit is sent to commitcloud.
This currently works with the hook on update, but the hooks on commit are not working
Reviewed By: mitrandir77
Differential Revision: D16687423
fbshipit-source-id: a0b861d301c84764f31787454cdec594b0519fa3
Summary:
D16716743 breaks the Windows build. One of the breakages is that `hg status`
stops working and crashes with `RuntimeError: invalid encoding`. This is
because dirstate has special treatment for root directories. Changing the
representation of the root directory stopped the special treatment.
Reviewed By: quark-zju
Differential Revision: D16812743
fbshipit-source-id: 49f96c87f471876993aec332e032ffcd619d268b
Summary:
D15668362 fixed the O(working copy size) behaviour of amend but accidentally
introduced one that's proportional to number of files changed. This fixes the
problem
Reviewed By: markbt
Differential Revision: D16803076
fbshipit-source-id: ad8983c8dfbd28b1958220f8786b8071f50cd0fb
Summary:
The fastlog code says it cannot handle file renames, which is not true as far
as I know. Therefore, try use it for files. This affects the `follow()` revset.
I picked a random file, and fastlog is faster than the alternative code path
even with warm cache:
With fastlog:
% ./hg log edenscm/mercurial/smartset.py --time --pager=off -T '.' --debug --config fastlog.files=1
found common parent at a320f95a23716d0d106d922fa07ffcf0f838d3ff
starting fastlog at a320f95a23716d0d106d922fa07ffcf0f838d3ff
.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
time: real 2.060 secs (user 1.870+0.000 sys 0.290+0.000)
Without fastlog, cold cache:
% sudo rm /var/cache/hgcache/fbsource/packs/*.hist*; ./hg log edenscm/mercurial/smartset.py --time --pager=off -T '.' --debug --config fastlog.files=0
fastlog: not used because fbcode/scm/hg/edenscm/mercurial/smartset.py is not a directory
.fetching content for 1 file over HTTPS
35.56 kB downloaded in 147 ms over 1 request (0.24 MB/s; latency: 147 ms)
fetching history for 1 file over HTTPS
445 B downloaded in 56 ms over 1 request (0.01 MB/s; latency: 56 ms)
running ssh -oControlMaster=no hg.vip.facebook.com 'hg -R '\''/data/scm/fbsource?stage1_read'\'' serve --stdio'
sending hello command
sending between command
remote: 713
remote: capabilities: unbundlehash gettreepack pushkey getfile getflogheads listkeyspatterns knownnodes getbundle lookup treeonly stream_option remotefilelog known unbundle=HG10GZ,HG10BZ,HG10UN clienttelemetry branchmap changegroupsubset unbundlereplay batch bundle2=HG20%0Ab2x%253Ainfinitepush%0Ab2x%253Ainfinitepushmutation%0Ab2x%253Ainfinitepushscratchbookmarks%0Ab2x%253Arebase%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps%0Atreemanifest%3DTrue%0Atreemanifestserver%3DTrue%0Atreeonly%3DTrue streamreqs=generaldelta,lz4revlog,revlogv1 getannotate stream-preferred
remote: 1
sending clienttelemetry command
connected to hg020.prn2.facebook.com
sending getpackv2 command
............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
876 files fetched over 876 fetches - (1 misses, 99.89% hit ratio) over 5.98s
(running background incremental repack)
time: real 11.920 secs (user 5.050+0.000 sys 0.470+0.000)
Without fastlog, warm cache:
quark@devvm33994 ~/fbcode/scm/hg % ./hg log edenscm/mercurial/smartset.py --time --pager=off -T '.' --debug --config fastlog.files=0
fastlog: not used because fbcode/scm/hg/edenscm/mercurial/smartset.py is not a directory
.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
time: real 2.530 secs (user 2.050+0.000 sys 0.070+0.000)
This is one step forward getting rid of the legacy filenode / ancestormap
logic. It regresses on offline experience, but we can build simple caches
around the `follow()` revset later.
Reviewed By: markbt
Differential Revision: D16365331
fbshipit-source-id: 16ffd6c3ec2daa5530fed94fb9c41fe75efd6182
Summary:
Remove has special handling for the root path which wasn't updated when we
updated the root path representation from "." to "".
Reviewed By: singhsrb
Differential Revision: D16794418
fbshipit-source-id: bb769ce67128041c01010fa2d256c1db5091c564
Summary:
We've had a couple of users reporting Rust panics due to an history entry where
its node is also its own parent. The most recent report shows that during a rebase
the commit context contained a removed file while the file itself isn't present
in either parents.
Several fix for this were considered but abandoned, leaving us with a simple
workaround the issue.
Reviewed By: quark-zju
Differential Revision: D16681230
fbshipit-source-id: d5305477792b4450475137d304fe7b22dc0977af
Summary:
This option has been on for several months now, let's enable it by default in
the tests too. Since the behavior is slightly different, the tests had to be
adjusted:
- The packfile hashes are different due to a different repack algorithm,
- test-fb-hgext-remotefilelog-gcrepack.t removed due to gc not being a thing
with the Rust repack,
- test-fb-hgext-remotefilelog-repack-corrupt.t corrupt packs aren't detected
and removed at repack time, but later,
- test-fb-hgext-remotefilelog-repack.t we no longer re-delta context in the
Rust repack
Reviewed By: quark-zju
Differential Revision: D16774858
fbshipit-source-id: 7b7a3d96598c1ded0f64237047c3d97510050e4a
Summary:
When rust repack is default, and the packs directory doesn't exist, we wouldn't
try to run the loosefile repack, even if we had some. Let's move the packs
directory check a bit later to allow the loosefile repack to run.
Reviewed By: quark-zju
Differential Revision: D16774857
fbshipit-source-id: 1d1b67ae93c1b3aa2d07d5d15325e9be16a01196
Summary:
Let's always make options non-None. This was causing some issues when switching
to the Rust repack by default.
Reviewed By: quark-zju
Differential Revision: D16774856
fbshipit-source-id: 16fcda0b5a38327d389ed03f87c73d8bd00d5877
Summary:
Change originally made by martinvonz in the mercurial repo:
https://phab.mercurial-scm.org/D6406
Reviewed By: quark-zju
Differential Revision: D16716741
fbshipit-source-id: 0f55659856f11889907ba14d7f5042db2e6face6
Summary:
Change originally made by martinvonz in the mercurial repository:
https://phab.mercurial-scm.org/D6404
Reviewed By: quark-zju
Differential Revision: D16716744
fbshipit-source-id: f11cba2365d45d8db6e481ab12f891f2baea67ba
Summary:
Change originally made by martinvonz in the mercurial repository:
https://phab.mercurial-scm.org/D6403
> This changes the behavior of test-origbackup-conflict.t so it no
longer errors out when the backup path points to an existing
file. Instead, it replaces the file by a directory. That seems
reasonable to me.
Reviewed By: quark-zju
Differential Revision: D16716742
fbshipit-source-id: b40ff1637fa75ea0c140cb861999d2cea83197cb
Summary:
Change originally made by martinvonz in the mercurial repository:
Backporting https://phab.mercurial-scm.org/D6401
> I think '' is generally a better value for the root directory than '.'
is. For example, os.path.join('', 'foo') => 'foo', while
os.path.join('.', 'foo') => './foo'.
This patch mostly makes it so we use '' internally in
match.py. However, it also affects the API in visitdir(),
visitchildrenset() and files(). The two former now also accept '' as
input. I've updated the callers of these methods. I've also added a
deprecation warning for passing '.' (for external callers). The only
caller I could find that was affected by files() returning '' instead
of '.' was in dirstate.walk(). I've updated that.
The next few patches show some workarounds we can remove by using ''
instead of '.'.
Reviewed By: quark-zju
Differential Revision: D16716743
fbshipit-source-id: 4cc18b8cdf2f8a9dc44c42729fb46796a16c3244
Summary:
Change originally made by martinvonz in the mercurial repository:
https://phab.mercurial-scm.org/D6400
> I think it makes it a little clearer to have the two conditions for
files==['.'] near each other.
Reviewed By: quark-zju
Differential Revision: D16716745
fbshipit-source-id: c0d4eaf7d0fd7064845984b40d8e558264318d70
Summary:
Currently, only contents coming from `getfiles` request can replace
`BLACKLISTED_CONTENT` with `BLACKLISTED_MESSAGE`, because this is implemented
in `basestore.py`. Let us add an additional piace of logic to the
`remotefilelog.revision`, which would handle this the same way.
Note: this diff does not remove the old implementation. I think we need to do
this, but I want to focus on solving immediate problem, which is the absense
of support for censored results in `getpackv1`/`getpackv2`, before I fix the
tech debt. Note also that current doubling of the replacement logic does not hurt,
since it can't apply twice.
Reviewed By: xavierd
Differential Revision: D16735899
fbshipit-source-id: f10b72997614c58432476bcf95a3bde774bc278e
Summary:
This diff adds handling of mergestate and rebasestate -related data from the `.hg` directory.
That is the whole `.hg/merge` folder (both for merge and rebase state) and the `.hg/rebasestate` file.
We do not store any other information in lfs (e.g. number of parents for merge state).
Snapshot manifest oid will be added as an extra field to a fake snapshot commit, which will contain such data.
Differential Revision: D16708733
fbshipit-source-id: efc9b72b7593d85063307528c713c363e061065b
Summary: We were accidentally double-fetching data over both HTTP and SSH due to a missing return statement in the HTTP path. Fix it so that we only fetch data once. (The return was originally there, but was accidentally removed as part of a refactor.)
Reviewed By: xavierd
Differential Revision: D16745110
fbshipit-source-id: e06f129d39dec3801a32f90257367266006bb1cc
Summary:
We don't use statichttprepo. Remove it so future changelog changes won't need
to take it into consideration.
Reviewed By: markbt
Differential Revision: D16683789
fbshipit-source-id: de4f486e8eb6d372acfab5053769f7ad91c12db8
Summary:
We don't use unionrepo. Remove it so future changelog changes won't need to
take it into consideration.
Reviewed By: markbt
Differential Revision: D16683788
fbshipit-source-id: bfc474d51d957959a6266e9c8eceda3c11d3cf0d
Summary:
The only way to operate on millions of commits as input, is to use ids instead
of nodes. Therefore all APIs are changed to take ids / spans, APIs taking
nodes are removed. They can be built easily from the Python world using the
`id2node`, `node2id` translation API.
Reviewed By: sfilipco
Differential Revision: D16675902
fbshipit-source-id: 461e75114c922cb5f6cb344ee2fd1cd5a966da78
Summary:
This exposes the raw `SpanSet` struct to the Python land, and provides glues to
use them in Rust code.
Reviewed By: sfilipco
Differential Revision: D16675904
fbshipit-source-id: e4147cbe20344f7ced65d556a8def6ea354714d2
Summary:
Previously, `ancestors` only takes a single id, `gca_one` and `gca_all` only
take 2 ids. Extend them to accept a set. This is more consistent with the rest
of the APIs, ex. `heads` and `parents`.
Reviewed By: markbt, sfilipco
Differential Revision: D16672417
fbshipit-source-id: 98297486cb01215479e0e16f2189cf3053d60a1d
Summary:
The existing hg APIs support things like getting all the gcas, and testing
"isancestor" without calcuating the gca. Implement them in the dag crate to
match those features.
I picked `gca` to make names shorter. Here is a list of how those features
get named in two codebases:
Name in hg codebase | Name in this crate
-----------------------------------------
ancestor | gca_one
commonancestorsheads | gca_all
isancestor | is_ancestor
ancestors | ancestors
Reviewed By: markbt, sfilipco
Differential Revision: D16672420
fbshipit-source-id: d205d7970623e992e656ae300218239cddbd26c8
Summary:
The binary format allows us to checkin a large repo's dag and use it for
testing. The format is designed to be compat and easy for machine parsing.
`hg debugbindag` was added to generate such format from an existing repo,
and `hg debugpreviewbindag` was added to preview such binary format.
Size of serialized DAGs:
repo | method | size (KB) | size (KB), zstd -19
--------------------------------------------------------
mozilla | debugbindag | 101 | 66
| debugdag | 193 | 72
| changelog.i | 213925 | 80118
--------------------------------------------------------
fbsource | debugbindag | 1400 | 700
| debugdag | n/a * | n/a
--------------------------------------------------------
www | debugbindag | 5.6 | 3.2
| debugdag | n/a | n/a
Note:
`hg debugdag` and `hg debugbuilddag` exist, and they compress
relatively well. However, they have some (critical) issues:
- crashes on fbsource and www (*)
- complex syntax
- does not support selecting a subset of revs (ex. "::master")
Therefore I decided to invent something new.
Reviewed By: sfilipco
Differential Revision: D16294467
fbshipit-source-id: 754ab8942359ef73f5f53c427c7d38d94641fa75
Summary:
We have can have situations where the parsing is broken because we are
parsing an attribute that does not exist. See T48658402 for an example.
Reviewed By: kulshrax
Differential Revision: D16745842
fbshipit-source-id: f693bc5aca29923b074a789b952e24b5ce72cdfd
Summary:
This was used as a way to transition towards Rust only mutable history store.
Now that the transition is over, let's remove the wrapper.
Reviewed By: quark-zju
Differential Revision: D16726163
fbshipit-source-id: d745cc1c04279b8603b072c36fa406d27f014628
Summary:
This was used as a way to migrate away from a Python based mutable datapack.
Now that every write is done in Rust, we can get rid of this.
Reviewed By: quark-zju
Differential Revision: D16726161
fbshipit-source-id: d13277979eb575aee6dcaac09c0a05c22ca1b1a1
Summary:
This class can be used to use a Python store in Python but going through Rust.
We don't need this use case, so let's get rid of it.
Reviewed By: quark-zju
Differential Revision: D16726162
fbshipit-source-id: a0121bf61b178447ad958e2907185e97962046ee
Summary:
This makes `ParseOptions` own all information to do a parse so parsing can be
done without creating a `Parser` struct:
ParseOptions::new().flags(flags).parse_args(args)
`Parser::with_parsing_options` is removed since that will overwrite `flags`.
Some `unwrap()`s in the bindings are replaced with proper error handling.
In the future it might make sense to make `Parser` or `Parser::new` private.
Reviewed By: farnz
Differential Revision: D16703009
fbshipit-source-id: 6119c29d934ae4410b31d906397a902c03e27fe2
Summary:
The "global flags" concept is more coupled with the "hg dispatch" logic.
The "cliparser" crate can stay pure from application-specific flags.
As we're here, update the global flags definition to use `Into::into`,
and return `Vec<Flag>` directly, instead of `Vec<FlagDefinition>`.
That removes one usecase of `FlagDefinition`.
Reviewed By: farnz
Differential Revision: D16700307
fbshipit-source-id: 2688cb06272a249454d92d7d7d5a0b1100805dbd
Summary:
This helps removing references. The internal structure of `Parser` is changed a
bit to avoid storing `Flag` copies.
Reviewed By: farnz
Differential Revision: D16700316
fbshipit-source-id: 01d66feb8bd5cc2fa9394b3635f97e098143597d
Summary: The options decides how the parser works. It is not opening anything.
Reviewed By: farnz
Differential Revision: D16700310
fbshipit-source-id: c0ab69f9d8c50664dc157ef0eb0f12ee1533e81d
Summary:
The logic is currently a bit broken in a weird combination:
The current configurations are
- usefirstpublicancestorinsvninfo=False
- useglobalrevinsvninfo=True
This means hg will have to traverse back to the last hg commit with svnrev. It will get
[slower and slower](https://fburl.com/scuba/skfj8p7u) to find those commits as we are having more commits without snvrev.
Ideally we can turn `usefirstpublicancestorinsvninfo` to True and that will then only traverse back to the last public ancestor. However it will trigger another bug because this public ancestor won't be in the old svn revmap and therefore hg will just bail with "Not a child of an svn revision".
Therefore the fix is to fix that bug by moving the `if pn not in hashes:` into the else part of the config and also get the subdir value from config rather than from the `extras['convert_info']`.
The next step is to set
- usefirstpublicancestorinsvninfo=True
- useglobalrevinsvninfo=True
- usereposubdirinsvninfo=True
once this diff is deployed to stable.
Reviewed By: DurhamG
Differential Revision: D16717554
fbshipit-source-id: c05b9882aa9ddeeeefd9315b478ba085fbc9bae7
Summary:
Created some classes and refactored the code.
Now it looks better. :)
Reviewed By: markbt
Differential Revision: D16690240
fbshipit-source-id: f26127d55c5cace7b88e225c85ec13cc278150c8
Summary:
It would really help to be able to checkout the manifests, restoring all the data from them.
Deleting the missing files, creating the unknown files, adding mergestate info to svfs (not available yet :) ).
Reviewed By: mitrandir77
Differential Revision: D16668312
fbshipit-source-id: 62af8a1fb11541c162f7b5ceb8d6d058cad9a319
Summary:
Add automigrate to commitcloud, which will automatically connect the user's
repo to commit cloud on pull.
Reviewed By: mitrandir77
Differential Revision: D16666810
fbshipit-source-id: a1d0857164d2ce6bf1db5784360681f04d35ed90
Summary:
Running `hg cloud leave` on a repo that was never connected should mark the
repo as explicitly disconnected so that automatic joining will not try to
connect the repo later on.
Reviewed By: quark-zju
Differential Revision: D16687470
fbshipit-source-id: 0552ffa42a1dac40874bba30eeb93509a2227aeb
Summary:
The `SubscriptionManager` is never a long-lived object, and cannot be
constructed if the user is not connected to a workspace. Simplify this to
function calls, which are safe to call at all times.
Reviewed By: quark-zju
Differential Revision: D16687467
fbshipit-source-id: c7f81290a3e8012f7b154af3398771ac9254387f
Summary:
`hg cloud rejoin` limits joining to when the user has an authentication token
and the workspace already exists. If the user uses a different authentication
method, or if the workspace is brand new, the rejoin does nothing.
Change this to always attempting to join, and only printing a message if the
join failed because of an authentication error, prompting the user to authenticate.
Reviewed By: mitrandir77
Differential Revision: D16666365
fbshipit-source-id: 3ea4542125a1b5266711fab2c31d9455ab764cef
Summary:
Add a new command `hg debugexistingcasecollisions` which checks if any
directories contains two or more entries which may have the same filename on
case-insensitive filesystem.
Reviewed By: suitingtseng
Differential Revision: D16687557
fbshipit-source-id: cb032467e9b8a73fc1f6bf107387bc54c223c2ba
Summary:
When `treemanifest.usehttp` is enabled, make `remotetreestore` fetch tree nodes over HTTP rather than SSH.
Note that unlike the SSH prefetch operation, this downloads only a single tree node, which will change the I/O behavior of Mercurial to fetch manifest nodes on demand. In general, this will result in excessive round trips, but for certain commands (such as `hg cat`), this works reasonably well.
Future diffs will expand upon this functionality to make the HTTP behavior more performant. For now, this won't affect anyone unless they specifically enable the aforementioned config option.
Reviewed By: xavierd
Differential Revision: D16663197
fbshipit-source-id: 4117e057996ed30f0bfd186238264e31484c2620
Summary:
Add the `debuguploadsnapshotmanifest oid` command.
It checks that the local lfs has `oid`, then uploads it and all the related blobs to remote lfs.
Differential Revision: D16667158
fbshipit-source-id: 2978a6c0e7c58c3710f8253cf7b9ab36b24886ce
Summary:
Previously, we would use `None` as the start value for HTTP data fetching progress bars so that the bar would be rendered as a spinner until we received a response (which would contain a content size header, allowing us to set the progress bar total).
This would result in incorrect behavior if the server took a long time to return a response, because by default if no start value is provided the progress bar framework will display the number of seconds that have elapsed. Given that we've specified a byte count format function for the progress value, the progress bar would end up displaying the number of seconds elapsed as a byte count, which was very confusing.
Reviewed By: quark-zju
Differential Revision: D16663124
fbshipit-source-id: 0e224b3b670abc803356214cd12205a6f4259cd9
Summary: Matching more of the existing API.
Reviewed By: quark-zju
Differential Revision: D16607233
fbshipit-source-id: 7a71f22089067ecfccbfcb2ad072fbf21e360439
Summary:
The initial attempt at supporting tree fetching over HTTP involved reimplementing the existing Mercurial prefetch functionality (corresponding to the gettreepack wireproto command) in the API server. Unfortunately, while this worked from a functionality perspective, it was far too slow to be usable in practice.
Rather than maintaining this unused code path, let's remove it and repurpose the config flag for a more sensible version of HTTP tree fetching.
Reviewed By: farnz
Differential Revision: D16663198
fbshipit-source-id: a489d5ca177b788f93383b8a9f758316e889ca5b
Summary:
Interesting enough find is expected to throw on missing path.
The funny part is that the documentation in the C++ code says that the find
method will return a tuple of (None, None) in this case. The code then goes
to throw an exception for not found.
Reviewed By: xavierd
Differential Revision: D16610709
fbshipit-source-id: a22fa6e69361bf6f501f7171e492ba7a6515a2ea
Summary: This function verifies if the manifest contains a specific directory.
Reviewed By: quark-zju
Differential Revision: D16610338
fbshipit-source-id: 7d81b3471d6098ae2baa89f626f20a955c912252
Summary:
This allows us to say that the queried path was a directory and simplifies
the API a little bit.
The Python/C++ Manifest API provide inspection of directories through several
functions. We want the Rust manifest to provide the same functionality.
This approach looks to have more consistency as the API evolves.
`FsNode` is a structure that is forward looking. We will want to add an API
that lists a directory and an interator of FsNode fits that well.
I also felt the need for it over the development of the manifest code.
Reviewed By: quark-zju
Differential Revision: D16609253
fbshipit-source-id: f826d7b21e3001f4bef43a35b9d1a9bc5a59eda9
Summary:
The hgcache packs directory is being written to in several places, most of the
files being created there are temporary ones and renamed once ready to be
visible. In some cases, when hg crashes midway, or when the packfile is mmap'ed
on windows, temporary files are left around.
While we were trying to remove these files before, the solution taken involved
removing files we knew were safe to be removed. Unfortunately, that meant we
missed some of the temporary files. Let's instead switch to removing everything
but packfiles and the repacklock.
Reviewed By: kulshrax
Differential Revision: D16657105
fbshipit-source-id: f4dd45aa71c02acba52a745b9bec3019d20e03c4
Summary:
Add `not public()` to the unhide revset to improve its performance. We can't
unhide public commits anyway, as they can't be hidden.
Reviewed By: mitrandir77
Differential Revision: D16645983
fbshipit-source-id: f9f23e7e31050e652f1389489734416fe3278219
Summary:
Add a self-descriptive command `debugcreatesnapshotmanifest`.
For now it supports only deleted and unknown files.
1) Uploads all the untracked files to the local lfs storage.
2) Creates a json-like snapshot with the following structure:
```
{
"deleted": {
"path/to/file": None, # this is done for consistency
"path/to/another/file": None
},
"unknown": {
"added": {
"oid": "oid in local blobstore",
"size": 42
}
"another/added": {
"oid": "another oid in local blobstore",
"size": 24
}
}
}
```
...and stores it in the local blobstore.
Reviewed By: markbt
Differential Revision: D16621864
fbshipit-source-id: 6c497d1bb756561b3c3368483b838a2307b0b5f9
Summary:
The original code path is extremely slow because it has to iterate all files in manifest.
The new path instead only has to lookup the entries in keptdirs and therefore is O(change).
Reviewed By: mitrandir77
Differential Revision: D16646075
fbshipit-source-id: cb2c152d236ffa6f01349c223c9470205c540379
Summary:
To avoid the scenario where we are incorrectly uploading the data that we're
supposed to upload, we need to reset the file pointer to read from the
beginning so that for each retry of uploading we get the correct data.
Previously before this patch, Mercurial would have nothing to upload on a retry
and the connection would 'hang' waiting for the data to be send to the server.
Reviewed By: krallin
Differential Revision: D16620072
fbshipit-source-id: 2238b99ff612e06dc0640717bc42fe345c35037d
Summary:
The KeepAlive HTTP implementation is bugged in it’s retry logic, it supports reading from a file pointer, but doesn’t support rewinding of the seek cursor when it performa a retry. So it can happen that an upload fails for whatever reason and will then ‘hang’ on the retry event.
The sequence of events that get triggered are:
- Upload file A, goes OK. Keep-Alive caches connection.
- Upload file B, fails due to (for example) failing Keep-Alive, but LFS file pointer has
been consumed for the upload and fd has been closed.
- Retry for file B starts, sets the Content-Length properly to the expected file size, but since file pointer has been consumed no data will be uploaded, causing the server to wait for the uploaded data until either client or server reaches a timeout, making it seem as our mercurial process hangs.
This is just a stop-gap measure to prevent this behavior from blocking Mercurial (LFS has retry logic). A proper solutions need to be build on top of this stop-gap measure: for upload from file pointers, we should support fseek() on the interface,
Since we expect to consume the whole file always anyways, this should bafe. This way we can seek back to the beginning on a retry.
Reviewed By: quark-zju
Differential Revision: D16604844
fbshipit-source-id: 9a0d418f00520bda499272b864ff24c99e888aa2
Summary:
This exposes the stackdesc feature to Python. The API is polished to use Python
decorators.
Reviewed By: sfilipco
Differential Revision: D16023307
fbshipit-source-id: edcee59e77e7fe55cdb52d031a4fa3e483909ea0
Summary: Make the number of retries for HTTP operations configurable. Previously, they were hardcoded to 3, which may not be ideal in situations where the retries are caused by server side timeouts. (If a single timeout takes 30 seconds it would take 90 seconds to fall back to SSH.)
Reviewed By: quark-zju
Differential Revision: D16592862
fbshipit-source-id: a9ba5273a1271532ff9814bcc47cb32e60ee87b7
Summary:
Similar to diff, the `match` argument can't be easily expressed using CPython
crate bindings. This argument is not used a lot so we can rename it.
Reviewed By: quark-zju
Differential Revision: D16571840
fbshipit-source-id: 19c7dea82924b7ec4c0b66d1675b9ad4569f8b62
Summary:
Various bindings methods.
I started running:
```
./run-tests.py --extra-config-opt="treemanifest.rustmanifest=True"
```
I would see tests complaining about various methods and then I
implemented them and reran the tests. The majority of failures
now are about finalize not being implemented.
Reviewed By: quark-zju
Differential Revision: D16571837
fbshipit-source-id: 58db35d58522dd7d2b5208e0614293ae55a83bf8
Summary:
There is no good reason to return a reference for FileMetadata. It is a relatively
small object that implements the `Copy` trait so returning a copy is
approapriate.
Reviewed By: quark-zju
Differential Revision: D16571838
fbshipit-source-id: 0c315c9f405e425832d39da5c67809dd15b4ab5e
Summary:
I wasn't sure how to test this. I implemented `diff` then got it to work
with `hg show` by adding the missing methods.
Reviewed By: quark-zju
Differential Revision: D16497354
fbshipit-source-id: 727979ad8ce4a4615e85ea96c3fe6413aa20b267
Summary:
D16452925 accidentally made HGENCODING the single source of truth of encoding
and always fallback to `ascii` if `HGENCODING` is not set. The correct behavior
is to fallback to system locale setting if `HGENCODING` is not set.
Reviewed By: HarveyHunt
Differential Revision: D16600586
fbshipit-source-id: 83c3518f7a0ca6367191ebc4cd8ba5d8b300800d
Summary:
`match` is a keyword in Rust. This is causing troubles in adding Rust bindings
for functions that use that as a keyword argument. Renaming the argument to
something else seems to be the easiest path forward.
Reviewed By: quark-zju
Differential Revision: D16496134
fbshipit-source-id: c923f49577564527a99d43dda3d3d9da43122b3e
Summary:
The diff algorithm takes the `clean` flag. When `clean` is used all the files
that are not changed between the two manifests are returned. In short the set
of files is equal to |files(M1) U files(M2)|.
This functionality would have to be implemented in the Rust manifest. I don't
feel that a flag on the diff algorithm should be used in this case. First, I
don't like how it interacts with the core diff algorithm, it changes it to the
point where it feel like it should be a different function. Second is that this
behavior can be achieved by getting all the files in the manifest and removing
the items in the diff. Third is that this operation is done quite rarely, being
so expensive.
The downside is that the places where this flag is used get a bit more
expensive.
Reviewed By: quark-zju
Differential Revision: D16496136
fbshipit-source-id: 205dcc23517b896de5c14634683bcbd5f2aa6666
Summary:
Function returns a new instance of a treemanifest that contains the same data
that the base manifest does.
Reviewed By: quark-zju
Differential Revision: D16496135
fbshipit-source-id: 04f8260278ce6c14bb018a05831ff25f81ab3231
Summary:
This is used by Jellyfish and sent to Phabricator. In the future, we won't have svnrev
and therefore we should use globalrev instead.
More context: https://fb.workplace.com/groups/248282915800791/permalink/372855146676900/
Reviewed By: singhsrb
Differential Revision: D16561651
fbshipit-source-id: 284ad26b1bf77f222086bb7e2104b1c2dbf65449
Summary:
This command uses svnrev directly. However once we migrate to www-hg, this fields will
go and we can only use globalrev instead.
Let's add that and put it behind a config.
More context: https://fb.workplace.com/groups/248282915800791/permalink/372855146676900/
Differential Revision: D16560447
fbshipit-source-id: de3100ed1e6cc39eaaeff2fe11af04d2f1e2c41a
Summary:
context: Mercurial is slow for peoople that can't use watchman and eden https://fb.workplace.com/groups/scm/permalink/2133433800039562/
Please let me know if this approach (hacking the wctx) is acceptable in your
opinion
Reviewed By: quark-zju
Differential Revision: D15668362
fbshipit-source-id: a94f39be2d845e751a8bb69ca8ca000ef46d9d2d
Summary:
When doing command name prefix match, if there are a unique match for non-debug
commands, use it. This solves `hg d` regression.
Note: we cannot simply use `starts_with("debug")` to test debug commands. That
is because debug commands can have aliases (ex. `debug|dbsh` as the command
name definition, and `dbsh` is also a debug command that does not starts with
`debug`). Therefore it gets a bit complex.
Reviewed By: kulshrax
Differential Revision: D16557266
fbshipit-source-id: 42d814940c9217d9e554bd0fe2769a53e0ee467f
Summary: Suggested by kulshrax, `I` and `l` are harder to distinugish. Rename it to clarify.
Reviewed By: kulshrax
Differential Revision: D16556868
fbshipit-source-id: 5892f0730f5205534851c5f7c024ff98f751423d
Summary:
Use the "first argument position" reported by the parsing library to expand the
command name correctly.
Before this patch:
--repo foo foo
^^^ this foo gets expanded (incorrectly)
After this patch:
--repo foo foo
^^^ this foo gets expanded
Reviewed By: kulshrax
Differential Revision: D16556869
fbshipit-source-id: 8eca98d80cdd8f0d3d329040d6f2eb81653db99f
Summary:
This gives `expand_aliases` a chance to handle things like `$1`, `$2`, etc.
Related Python code assuming `expand_aliases` does not change args was removed.
Reviewed By: kulshrax
Differential Revision: D16530712
fbshipit-source-id: b81c2d29b9b9b5b93ce01627268a999a2cfd1ef0
Summary:
With the previous change, handling `[defaults]` and `[alias]` can be done
together.
Logic handling `[defaults]` separately is removed.
Unfortunately the new logic is duplicated in clidispatch and
bindings/clidispatch. In the future, bindings/clidispatch might just call
clidispatch.
Reviewed By: kulshrax
Differential Revision: D16530608
fbshipit-source-id: 5040d02da98d04a3f5cb43cc7f9cf0ef39a0f8ed
Summary:
This avoids calculating the full alias map, and provides more flexibility (ex.
the function can take care of `defaults` handling).
Reviewed By: kulshrax
Differential Revision: D16530514
fbshipit-source-id: 63558da5c9af36b2f8bc7689174fed71593a8186
Summary:
Make `expand_prefix` a public API to expand a command prefix to a full command
name.
Make Python binding handle the `strict` flag so `cliparser` does not have to.
This avoids calculation of `command_map` if strict is True.
Reviewed By: kulshrax
Differential Revision: D16530520
fbshipit-source-id: 5bf9c9f74ae074eac5e350a4db0ebc43f286cebf
Summary: This is the first step to support expanding things like `$1` in aliases.
Reviewed By: kulshrax
Differential Revision: D16530515
fbshipit-source-id: 3e81c92c2e2021b99815974f53286ec789ba0733
Summary:
When the alias cannot be split via shlex::split, raise an error directly
instead of silently ignoring it and fallback to Python error handling.
Reviewed By: kulshrax
Differential Revision: D16530519
fbshipit-source-id: d81534b198555b256f062dc4e6520fa40ace7700
Summary: This makes IPython work without disabling demandimport.
Reviewed By: xavierd
Differential Revision: D16509106
fbshipit-source-id: d4443d8b58c90a0fd7a34c620756e88f4f788337
Summary: Added shortcuts a, d that allow you to skip 1 day forward or back in the historical smartlogs interactive view
Reviewed By: mitrandir77
Differential Revision: D16438722
fbshipit-source-id: e61a126ed7390b5ee77ee71694d8b23f3351854a
Summary: The interactive view doesn't support the pager, so it is problematic for longer smartlogs. As a quick fix the interactive view only contains two weeks of commits. The full version is accessible through hg cloud sl --version_number
Reviewed By: mitrandir77
Differential Revision: D16496065
fbshipit-source-id: 7224258b426724872bf796af618ef70cbf4c9d0b
Summary: Replace original Python `hg root` implementation with Rust `hg root` implemented with the new command line dispatch library.
Reviewed By: quark-zju
Differential Revision: D16497604
fbshipit-source-id: e3d0e60d4bd4203897260c16e070ca3768ff1d22
Summary:
Implement `hg root` in Rust with the `clidispatch` library as well as adding all current Python commands so that prefix matching still works as expected.
This diff does not remove `hg root` from Python or expose native command documentation to Python, which will be the next diff.
Reviewed By: quark-zju
Differential Revision: D16454053
fbshipit-source-id: 78a9c70aeefb9adbb85c77001b15eab652417b2c
Summary:
Add a method to wrap a Python `io` object (with `read` or `write` methods, ex.
`sys.stdin`, `ui.fout`, or `util.stringio()`) in a native Rust object so it can
be used in Rust code expecting Read / Write traits.
This will be used to expose the Rust "dispatch" logic to Python.
Reviewed By: sfilipco
Differential Revision: D16511017
fbshipit-source-id: cb1f5c20e392311cd648abe0528b971ab0266845
Summary:
With fastdatapack gone, the cdatapack bindings are no longer necessary and can
be removed.
Reviewed By: singhsrb
Differential Revision: D16476584
fbshipit-source-id: 130a9c5aed4e4f005876c420961f09d398f6e6aa
Summary: This is no longer used anywhere, we can remove it.
Reviewed By: singhsrb
Differential Revision: D16476582
fbshipit-source-id: fe6a8f33cbc3c37fb1d8fb33226352e41bcbaa2a
Summary: This code isn't used anywhere, let's get rid of it.
Reviewed By: singhsrb
Differential Revision: D16476583
fbshipit-source-id: d42376dbb2cf631a170ade3e2764d1f70922d882
Summary: This code is no longer used anywhere.
Reviewed By: singhsrb
Differential Revision: D16462343
fbshipit-source-id: 3e11994575a6de75562cb1ebd8839f7058abc075
Summary:
Our reverse sync job is too slow when pushing to svn. It seems like the slowness comes
keep doing push-pull-rebase which doesn't seem necessary in our case.
From my understanding, we need to do push-pull-rebase because we have multiple writers.
In our sync job, we only have one writer and therefore can we skip the pulls and rebases?
Reviewed By: DurhamG
Differential Revision: D16442559
fbshipit-source-id: 926d1c516e8e6d59298d310fc67927ace37f72c9
Summary:
Make `import edenscm` take care of `sys.path` so as long as `import edenscm`
works, 3rd party pure Python dependencies and edenscmnative should be
importable.
This reduces adhoc sys.path handling in testutil.dott, and fixes an issue where
testing on Windows where `testuitl.dott` fails to run hg commands due to
missing 3rd party dependencies (because `edenscm.mercurial.entrypoint.run` is
not called, and edenscmdeps.zip is not in sys.path).
Reviewed By: sfilipco
Differential Revision: D16499458
fbshipit-source-id: 17e6e5754614dfcf352127d471c649ded4189e1a
Summary:
Add support for color prefix highlighting when Mercurial encounters an ambiguous command name. Currently ambiguous commands will print a list of possibilities such as:
```$ hg i
hg: command 'i' is ambiguous:
id or identify
import
in or incoming
init
isbackedup
```
Now the prefix, in this case `i` will be highlighted in all possibilities. This works no matter how long `prefix` is so in the case of `$ hg debug` it will highlight `debug` in all the possible choices.
Reviewed By: quark-zju
Differential Revision: D16451342
fbshipit-source-id: 87f58dd6bd77c2a609e5f423f7c769d444abc66d
Summary:
Util method to generate Enum, since some machines don't have the
python library installed.
Reviewed By: suitingtseng
Differential Revision: D16491020
fbshipit-source-id: e06470a609605c482f591418583b516918c49d93
Summary:
Make it possible to change the internal state of HGENCODING so we can run hg
logic within a single process without shelling out in the new dott test
framework.
Update testutil/dott to use it.
Reviewed By: xavierd
Differential Revision: D16452925
fbshipit-source-id: d21329854eeee171cc5d02d4f42f11dd273f2150
Summary: There no users left, let's get rid of it.
Reviewed By: kulshrax
Differential Revision: D16423137
fbshipit-source-id: 6898e681f800ab677010d7b6cdd36d377e3ef644
Summary: The Rust code is the default.
Reviewed By: kulshrax
Differential Revision: D16423134
fbshipit-source-id: 30baf041a5e7c786a28b31cfe5025e893b34594c
Summary:
The Rust code is now always taken, let's start removing all the references to
the python mutabledatapack code.
Reviewed By: kulshrax
Differential Revision: D16392287
fbshipit-source-id: dfccd4f4ec052a46975b6f9144106b51c3282988
Summary: This is now enabled for the entire fleet, let's hardcode this in the code now.
Reviewed By: kulshrax
Differential Revision: D16392289
fbshipit-source-id: 462152ded12d00cf8218526d51a911d6fe5975ca
Summary: Checks if the retrieved content of a file is equal to a `magic string` representing a blacklisted file. If so, then the content is replaced by a readable text which suggests a `rebase` or `update` to a newer commit.
Reviewed By: ikostia
Differential Revision: D16260011
fbshipit-source-id: ac1d40132b9c947927271d8e6efda98b19dce984
Summary: The debug messages from Eden API provide Source Control team members with useful diagnostic information about HTTP data fetching, but they have the potential to be spammy when written to log files. To prevent log spam, let's only print these messages during interactive usage.
Reviewed By: quark-zju
Differential Revision: D16445346
fbshipit-source-id: 001dc75e440eaf797f4f953648453086421f624e
Summary:
When using fetchpacks, memcache will write to an indexedlog, which can't be
repacked. I'm also suspecting that there is a race between this repack, and
hg_memcache_client opening the newly created packfiles which can cause the
misses to not be sent to memcache.
Reviewed By: kulshrax
Differential Revision: D16432538
fbshipit-source-id: 62362682474883bcd58249791c02b9fed5cb8fea
Summary:
Most operations do not work on iterate on all the files of the repository.
Most operations filter the data set in some way. In many cases this filtering
is to a set of files and in some cases using patterns or subdirectories.
The Python code uses `match.py` to represent this filtering. The parallel
data structure in the rust code is `pathmatcher::Matcher`.
This diff adds `files` integration with `pathmatcher::Matcher`.
Reviewed By: quark-zju
Differential Revision: D16352527
fbshipit-source-id: 8b61ac7399f581773bf61ff648634cbc6e1a27b6
Summary:
This allows us to use python matcher objects in rust. Particularly we are
looking at using these in the manifest implementation for filtering the
file set that is returned.
Reviewed By: quark-zju
Differential Revision: D16352533
fbshipit-source-id: fd6bde6d9223203c69593d5e8830946170363243
Summary: Bindings so that the rust manifest code can be used in Python.
Reviewed By: quark-zju
Differential Revision: D16352532
fbshipit-source-id: 34d4522f5e084f531f31bcd21770950f15f2fe13
Summary: Remove final fancyopts call to have all python parsing being done through native rust codepath, as well as clean-up some deprecated flags that would be special handling.
Reviewed By: quark-zju
Differential Revision: D16156284
fbshipit-source-id: ec5ccaeb982c78426e12ff1d7342b4ea6653e98e
Summary: Add errors and map them to python exceptions to emulate the original python error handling behavior.
Reviewed By: quark-zju
Differential Revision: D16136571
fbshipit-source-id: eb999162cad040566e30b460f2b873efb05fc67a
Summary:
Replace the second to last fancyopts call with pure rust code parsing and error handling.
Make slightly nicer help messages for ambiguous commands instead of just saying every possible command possible.
Reviewed By: quark-zju
Differential Revision: D16063049
fbshipit-source-id: bfd9e58649b1de2d3485069ce8d5646927bc77f4
Summary: Expose the alias expansion native rust code to the Python code to be able to utilize the earlier alias expansion as well as custom Rust errors.
Reviewed By: quark-zju
Differential Revision: D16063040
fbshipit-source-id: 58cd8c9f16e07687545ebf19332b32fce8db278d
Summary: Replacing another fancyopts call to be parsed by native Rust code. This diff introduces slightly hacky feeling behavior in order to handle cycles and resolving aliases, but will be fixed in a follow-up diff where Rust will fully expand the aliases completely removing the need for this confusing alias resolving, chaining, and execution.
Reviewed By: quark-zju
Differential Revision: D15902758
fbshipit-source-id: 11d9a479989a23de09bf96f8020d2fded6c06351
Summary:
Copytrace modified the global definitions table which was making it very difficult to keep track of side-effects as the code was executed, as well as making it harder to replace the fancyopts calls with native Rust.
Since the copytrace behavior can be achieved through a configuration, it now will no longer modify the global definitions table, and will display the correct flag for a user to use in order to get this same behavior.
Reviewed By: quark-zju
Differential Revision: D15902449
fbshipit-source-id: 1c254162d56823e65085b7047bb37513f187b487
Summary: Replace the next usage of fancyopts in dispatch.py with native rust code, and ensure all tests pass with this replacement.
Reviewed By: quark-zju
Differential Revision: D15857997
fbshipit-source-id: ec8722bfe661731a14cb324e97846f861bd60bc8
Summary:
The current Python parsing library fancyopts does an early parse for global flags, as well as slightly different logic for parsing out flags.
Switching this fancyopts call should allow fancyopts to be completely replaced by the native code path, and start using Rust parsing for hg.
This enforces command line arguments to be utf8. At Facebook, our `hg` wrapper already crashes if that is not the case. So it shouldn't cause new issues.
Reviewed By: quark-zju
Differential Revision: D15837079
fbshipit-source-id: 95634ebc814f8865960181f23282e5283068057c