Summary:
If treemanifest finds there are too many shared packs (more than
`packs.maxpackfilecount`) then it will purge them. This is a shame if there is
currently a repack in progress, as it will purge the packfiles from underneath
the repack, deleting lots of cache data that will be imminently repacked).
Skip the purge if there is a repack ongoing.
Reviewed By: mitrandir77
Differential Revision: D17155854
fbshipit-source-id: 20d46f29c252e508177b1fde08ca7a69841dcd7e
Summary:
Instead of hardcoding `--target <target>` and hardcode `$2` in the script.
Let's just use environment variables so `target` and other things have explicit
names.
Explicit set `REAL_CWD` so the script can learn the current directory before
it gets reset to the repo root.
Reviewed By: xavierd
Differential Revision: D17213186
fbshipit-source-id: 6a4fc4cf2cbf6e2c623400bc6bc13f7758a46c49
Summary:
This makes metaedit support `-M / --reuse-message`, which I found handy when
rewriting prototype commits to formal commits.
Reviewed By: xavierd
Differential Revision: D17168991
fbshipit-source-id: fa768a2916ea3ef4db4c31a48989d10897379e92
Summary:
Change `cmdutil.logmessage` to take a `repo` instead of `ui`. This makes the
next change easier.
Reviewed By: xavierd
Differential Revision: D17168990
fbshipit-source-id: 47c1707e5a9dbf06d07452b4c400903453992379
Summary:
I have seen multiple user complaints about slow hg commands that turned out to
be fsmonitor scanning the whole working copy. Print a warning in those cases.
Hopefully this can reduce our oncall burden a bit.
Reviewed By: xavierd
Differential Revision: D17170520
fbshipit-source-id: 8fd5721d123853136c84229d936c3e0c999f3d87
Summary:
Make sigtrace use smarttraceback so it prints more context.
As we're here, also make it print to stderr so we don't need to find the
traceback from /tmp.
Reviewed By: xavierd
Differential Revision: D17066277
fbshipit-source-id: 9a1000803fed27a71ec381b8ddbd76400dae99c9
Summary: It will be used by snapshot extension too.
Reviewed By: markbt
Differential Revision: D17132134
fbshipit-source-id: 6c9fc285e0f1eb445bfa0abe0b6f4de4a1bd1db0
Summary:
It is somewhat difficult to fetch the raw entry on the p1 side in the Rust
Manifests. These entries are used to write deltas to revlogs or to datapacks.
Reviewed By: xavierd
Differential Revision: D17143551
fbshipit-source-id: 6624116324664354d199d5f6ac55712c8ed29b9d
Summary:
In general, mutation tracking doesn't care about divergence. However, in the
case of rebase, it doesn't make sense to allow divergence to occur if we can
avoid it by omitting some of the commits to rebase.
This makes rebase behaviour more like old obsmarker-based behaviour. This
breaks a test for mutation copying markers, so update those to use metaedit,
which has the copying behaviour for both obsmarkers and mutation. At some
point we should make rebase behave better in these cases.
Reviewed By: quark-zju
Differential Revision: D17136480
fbshipit-source-id: 9e465b7fc8bda33e7a746e4df68410713e2be37e
Summary:
Convert the test case `test-amend-nextrebase` to use new mutation and visibility tracking.
In doing so, reveals a bug where `hg next --rebase` can rebase obsolete commits.
Reviewed By: quark-zju
Differential Revision: D17136483
fbshipit-source-id: dcda88d1e8c1f435d6211cf5b76791c5a76ee343
Summary:
Add a new test for `hg next --rebase` for when a predecessor of the commit
being rebased is also visible. The predecessor should not be rebased.
Reviewed By: quark-zju
Differential Revision: D17136482
fbshipit-source-id: fa2c91ebc14c72f6a8c13c4549447809090489b3
Summary:
The loosefiles repack was made incremental to greatly reduce the repack time
for users. Since the amount of local loosefiles should be way smaller than the
amount of shared ones, let's always run a full repack on the former. This
should allow us to kill all the local loosefiles, which will help in no longer
supporting them.
Reviewed By: quark-zju
Differential Revision: D17135975
fbshipit-source-id: 9480993b31aa57d0d6e6b7caffd282929183f782
Summary:
This illustrate that the local data repack isn't a full one. Note that the test
is a bit flaky due to 1) the underterministic nature of what folder to repack,
and 2) the choice of folder to repack being done twice (one for data, one for
history). Since I won't land this without the next one, this is probably fine.
Reviewed By: quark-zju
Differential Revision: D17135978
fbshipit-source-id: 641d257d0e308b2bb4d91fdc4c214b22e45b4911
Summary:
Rust repack has been the default for a while now. Let's stop pretending we're
going to switch back to the Python repack by removing the config entirely.
Reviewed By: quark-zju
Differential Revision: D17135977
fbshipit-source-id: 5aaa0faa48e2b40a7314d5ab455f5eeaa4e4984d
Summary:
The inline revlog format merges `.i` and `.d` into one `.i` file. It was intended to reduce the
number of files for filelogs. For the changelog one extra file does not hurt.
This makes it easier to write native code parsing the changelog revlog index.
Reviewed By: xavierd
Differential Revision: D17125922
fbshipit-source-id: f48ffe0d2df71abec007a80e05b684dcbac71883
Summary:
ignore-conflict-markers
This updates Mercurial to add a loggetpack option for wire proto logging that
allows capturing getpack responses. This will be useful to verify correctness
for ovrsource on Mononoke (right now, Mononoke isn't serving traffic for hosts
that use getpack).
Reviewed By: StanislavGlebik
Differential Revision: D17091537
fbshipit-source-id: 755a429949d7645010dddab95202c613025f2984
Summary:
While working on a stack, I noticed that `hg amend -e` would sometimes download
a lot of history information. For a 4 files change, I saw 738 history entry
fetched individually...
Looking at the profile, this pointed towards remotefilectx.parents requesting
the entire ancestormap. Since that function really only need the nodeinfo,
let's only get that.
Reviewed By: DurhamG
Differential Revision: D17104263
fbshipit-source-id: fae1f673b2d2a641ae4f22d1099317cc5abd8447
Summary:
This makes it possible to execute Rust commands from the Python tests.
Test changes:
- test-command-template-t: non-utf8 command-line arguments are rejected at the
function signature level
- test-dispatch-debug-prefix-t: the error is now printed by Rust code, which
uses spaces instead of tabs.
- test-root-t: the test now passes
Reviewed By: xavierd
Differential Revision: D16866459
fbshipit-source-id: 386931c5497b04c53efc08fbb4de708812517ad9
Summary:
This gives the Rust code path hints to names of Python command names.
Ideally, the Rust command dispatch logic can just load the Python command table
and figure out it more accurately, and more parts of dispatch.py (ex. extension
loading, debugger, profiler, atexit, etc) are moved to Rust clidispatch or
hgcommands. But that would be a larger change.
Reviewed By: xavierd
Differential Revision: D16866462
fbshipit-source-id: eb993091d5644710686b8f720fd07258b9a5968c
Summary:
So far we missed the metadata if there were no changes in the WC.
A metadata file was created but was not attached to the commit.
Differential Revision: D17070211
fbshipit-source-id: 646c8bceb575f4302ec60e35472cc55de086d7e0
Summary:
The Rust Manifests prevent having both a file and a directory with the same
name. This is a problem for the localrepo commit logic which will first add
the new entry, be that file or directory, and then remove the old one.
Reviewed By: quark-zju
Differential Revision: D16775350
fbshipit-source-id: 4515e42f9d2b1b2bc4861c16a39d291225cddc2a
Summary:
There is no custom implementation for manfiest.dirs(). Generally speaking
the custom implementation is a good thing but doing the migration in the
current python codebase doesn't seem worth while at the moment.
Reviewed By: quark-zju
Differential Revision: D16775351
fbshipit-source-id: c428860d21088a50a0f754dc20d6ee224d2eae32
Summary:
If `smartlog()` is the user input, the revnum detection is enabled for the
whole scope of smartlog revset implemenation. The use of rev numbers triggers
the warning. But the user didn't use any rev number.
Change smartlog to disable the revnum detection for its internal calculation.
Carefully choose the scope so `smartlog(1+2)` will still be warned.
Reviewed By: singhsrb
Differential Revision: D16954997
fbshipit-source-id: 1a3d32c1c2bcba08bfac908623b6416cf1cd63a8
Summary:
Instead of `debugsnapshot` and `debugcheckoutsnapshot` we will use
`snapshot create|checkout`.
Reviewed By: markbt
Differential Revision: D16961037
fbshipit-source-id: 142d072672376c2ce6a248a4dceffdd94d56a4df
Summary:
Aliases with `:doc` in name are not real commands. Do not treat them as
commands.
The upstream patch https://phab.mercurial-scm.org/D5087 added other metadata
including `:help` and `:category`. We might end up having some in the future
so I blacklisted names with `:` in them, not just `:doc`.
Reviewed By: chadaustin
Differential Revision: D16955596
fbshipit-source-id: b6f3e1129b632e0ba43c800e7e6fdd2b52d3b40c
Summary:
Change error type in clidispatch from `DispatchError` to `failure::Error`.
Pros:
- `failure` will attach a backtrace for free. (otherwise, backtrace handling is
manual)
- Wrapping other errors (ex. `io::Error`, `cliparser::Error`) is optional.
(otherwise, wrapping other errors is mandatory, and needs to be careful to
not lose information)
Cons:
- No longer able to enumerate *all* possible error types. (but can still
downcast to specific errors)
This seems to be a good tradeoff especially because of the backtrace handling - I
ran into a few issues where the location where the error happened really helped
debugging.
Since we can no longer enumerate all possible error types, the enum was changed
to individual structs to make the code shorter (ex. the struct can be downcasted
directly, instead of down-casting to the enum, then matching its variant).
The `HighLevelError` handling was simplified and moved to `hgmain`.
The new code path falls back to Python less aggressively, therefore some behaviors
were tweaked (ex. `-R` takes a bundle path).
Reviewed By: sfilipco
Differential Revision: D16796400
fbshipit-source-id: 1b17eb8d62503644b118c6b799778182bf222538
Summary: Convert global flags to `HgGlobalOpts` struct to make code shorter.
Reviewed By: sfilipco
Differential Revision: D16796407
fbshipit-source-id: b9d4c3dbec68c81908d439da4c353249347ca74a
Summary:
The `Dispatcher` provides lots of features but its internal state only contains
the command table. Replace it with `CommandTable` and make the methods free
functions.
This makes function dependencies more cleaner, for example things like "locating
a repo", "getting the args" etc. won't require a `Dispatcher`.
A side effect of this change is the non-utf8 command line arguments are no longer
supported. This is already broken since our hg wrapper (accidentally) enforced
utf-8 command line. Therefore related tests are removed.
Reviewed By: sfilipco
Differential Revision: D16796395
fbshipit-source-id: a793ce7b8befe7caf62405c582fc932eb3daa099
Summary:
At first, that aim was to create a good and consistent test plan of snapshots:
```
# Snapshot test plan:
# 1) Empty snapshot (no changes);
# 2) Snapshot with an empty manifest (changes only in tracked files);
# 3) Snapshot with a manifest (merge state + mixed changes);
# 4) Same as 3 but test the --clean flag on creation;
# 5) Same as 3 but test the --force flag on restore.
```
Then I discovered some bugs while writing the tests.
1) In case of an empty manifest the `snapshotmanifestid` extra should be an empty string, not `None`.
This is because of the extra serialization rules.
2) The initial approach for doing the checkout did some unnecessary operations with dirstate,
which required it to rollback later.
Now the overhead is gone, and the strategy of checking out is as follows:
```
1. Regular hg update to the (1st) parent of the snapshot;
2. Apply all the changes via mergemod.update without pushing it to the dirstate;
3. Register these changes in the dirstate;
4. Tie the second snapshot parent to the working context, if it exists.
Reviewed By: markbt
Differential Revision: D16929417
fbshipit-source-id: 0319ac0e81f80956cdef5b2a696b642cc782f48d
Summary: Snapshots have invisible commits underneath them, so that flag is redundant.
Reviewed By: markbt
Differential Revision: D16916268
fbshipit-source-id: 294f34af5aa7942be0bb2b58f0dc65979d593157
Summary: Due to a bug the missing files from the snapshot manifest were marked as removed after checkout.
Reviewed By: markbt
Differential Revision: D16831796
fbshipit-source-id: 200ccf34b16392a73d38294f1fcb43bfa9a94690
Summary:
A revset optimization pass rewrites revsets like 1+2+3 to use the `_list`
revset function that has a fast path to bypass the `stringset` function.
Change `_list` to detect revision numbers too.
Reviewed By: singhsrb
Differential Revision: D16910791
fbshipit-source-id: 51036b7d6f16b5388bbaf996864946df91a9f093
Summary:
Use of revision number is being deprecated. Change the moverelative commands
(`next`, `previous`, ...) to use nodes internally.
Reviewed By: mitrandir77
Differential Revision: D16898856
fbshipit-source-id: 71f6fc32776e2912795f086d11897d36b942b608
Summary:
Previously, the command table state in `Dispatcher` is confusing:
command_table: BTreeMap<String, CommandFunc>,
commands: BTreeMap<String, CommandDefinition>,
Question: In what case do these BTreeMaps have different keys?
It does not make much sense. Therefore merge `CommandFunc` into
`CommandDefinition`, and remove the `command_table` field.
This affects the `register` API:
fn register(&mut self, command: CommandDefinition, f: FN)
`f` is part of `CommandFunc`, which duplicates with `CommandDefinition`.
`CommandDefinition` contains 3 things: name, doc, and flags.
In the new `define_flags!` world, `flags` can be inferred from the type
of the function, so only `name` and `doc` are needed. Therefore change
the register function to:
fn register(&mut self, f: FN, name: &str, doc: &str)
Update `hgcommands` to use the newer APIs. Commands can now be registered
without going through `CommandDefinition` explicitly.
Reviewed By: sfilipco
Differential Revision: D16733275
fbshipit-source-id: 68e404a5b271b72aad52f640123b1c083f31d76c
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:
This test is currently broken if lfs-test-server is installed. Disable it
instead of relying on the test system does not have lfs-test-server.
Reviewed By: sfilipco
Differential Revision: D16733271
fbshipit-source-id: de0c9beb8e981e33e32e43435e2d06181cbae70e
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:
The shell alias tests are hard to read because:
- It uses `cat << EOF`, which will escape the heredoc block.
- It uses `sh -c`, which adds another layer.
Change `EOF` to `'EOF'` to prevent escaping heredoc, and remove `sh -c` to make
the test easier to read. The `escaped3` test now works as expected.
Reviewed By: sfilipco
Differential Revision: D16819451
fbshipit-source-id: 687e9ce78dfed7d76b53cf90e6d871dffd3ab84d
Summary: This will make shell aliases fit in the normal hg command framework.
Reviewed By: sfilipco
Differential Revision: D16530521
fbshipit-source-id: c1b158bc2895add03fa92099564830e55e02f1b7
Summary:
The latest update in the documentation references the `hg fold` subcommand
from the "core" mercurial files. This makes the `test-check-help.t` test
want to verify the `help` for `fold`. The problem is that the test does not
enable the `amend` extension that provides the fold command.
Following a previous fix to this test, I am enabling the amend extension for
the test. It makes sense to me given the current setup.
Reviewed By: singhsrb
Differential Revision: D16907781
fbshipit-source-id: b0ba31518b6d4c210eb5b8cc7985a945ab1180e4
Summary:
Essentially the commit hashes changed and thats fine. See D16836997
for more context.
Reviewed By: quark-zju
Differential Revision: D16860590
fbshipit-source-id: ddd82dfbcdfbea9d5ace68adaedeb05bda6e3d7a
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:
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: New degbugstore command prints contents of blob in store give filenname and hash.
Reviewed By: xavierd
Differential Revision: D16791780
fbshipit-source-id: d4529f3f368677b4f65a5772f82a1655552fefa5
Summary:
Since D16681230, a commit made with no file changes will re-use it's parent
manifest. This can trigger the commit hash to be different, which broke some
subversion tests. Since hgsubversion will be going away soon, I took the
approach of using run-tests.py -i and in test-hgsubversion-custom-layout.py to
not run the test that fails.
Reviewed By: sfilipco
Differential Revision: D16836997
fbshipit-source-id: 58e50a9147c8c263fca74158af120ec8ec5d8c52
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:
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:
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:
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 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 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:
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: Rebase tests can be unpredictible otherwise.
Reviewed By: farnz
Differential Revision: D16701186
fbshipit-source-id: 3c7af531c27ada15ace16c616799e0f569e285a2
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:
`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:
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:
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: Previously, `|` was treated as an argument of a command. Fix it.
Reviewed By: singhsrb
Differential Revision: D16473729
fbshipit-source-id: 0c9a76cd01fc3a22bd43cd0b7d96ce9c6e61ce37
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: The test lists noticable features provided by the translator.
Reviewed By: xavierd
Differential Revision: D16473727
fbshipit-source-id: 617296886243a77b2af8e26d4ea576e63ff88fd3
Summary:
`util.shellquote` is platform-dependent. In case of the translator, it always
uses `shlex.split`. Therefore the posix shell quote should be used.
This makes the the test stable across multiple platforms. Namely, `"` is not
used on Windows.
Reviewed By: xavierd
Differential Revision: D16606904
fbshipit-source-id: 879e06b54fc427a6ad1aa959927a0df52f33269a
Summary:
`parsecmd` uses `for name in dictobj`, which can get different results due to
different random seed being used. Use an explicit list instead to avoid the issue.
Reviewed By: xavierd
Differential Revision: D16596261
fbshipit-source-id: c81665cb550a0ce76885aa7f3caee959d63f7b67
Summary:
This makes it possible to test the translate behavior without writing anything
to filesystem.
Reviewed By: xavierd
Differential Revision: D16473728
fbshipit-source-id: 3c07b2b5e41d40444b98e7f02de840d2105082fe
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:
`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:
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:
Fix the regression caused by D16557266 on error message. The fix is not the
most efficient, though. But it should restore the behavior.
Reviewed By: singhsrb
Differential Revision: D16557654
fbshipit-source-id: 2eb6956f99c931f94201b875c8bebb2219a794f0
Summary:
The last diff D16557266 caused a regression on the error message. Update the
test to show that.
Reviewed By: singhsrb
Differential Revision: D16557653
fbshipit-source-id: ce4a039f4c91a7bd61ea8e570de960880abae937
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:
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:
Patterns like `--globalopt name name` could confuse the current logic. Add test
cases for it.
Reviewed By: kulshrax
Differential Revision: D16553454
fbshipit-source-id: dac5fd1a9f98093d13dbd85794e3b455c17dcf64
Summary:
The loop body can be changed to reduce some identation.
This changes the behavior a bit - an alias expanding to an emtpy string is now
an error. That's consistent with the original behavior.
Reviewed By: kulshrax
Differential Revision: D16530516
fbshipit-source-id: 3f5c2ebe9d8d1727cac706e4ff11f2678567c525
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: 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:
When we had a "--no-something" flag registered providing "--something"
did the same thing as providing "--no-something" which is highly undesirable
(see task)
Reviewed By: quark-zju
Differential Revision: D16520376
fbshipit-source-id: 9d407b830067d095abdbd9c0cee674f424ffc0f9
Summary:
The shenanigan was introduced in D16337012 where I tried to reuse pushrevisionwithconfigs.
I am breaking the chain now as it's tooooo hard to reuse and we've spent 4-5 diffs on this now.
Reviewed By: xavierd
Differential Revision: D16520271
fbshipit-source-id: 94cf8580cf3b852ecf7897861893bb51ce03d564
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:
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:
This was removed in D16381346. The problem is in the ui which is always new. Lets keep a
reference to it when adding configs.
Reviewed By: xavierd
Differential Revision: D16494854
fbshipit-source-id: d206b6211c004e0fec57a2aeef6549b2f96cec17
Summary: Set timezone to UTC to produce the same commit hashes.
Reviewed By: sfilipco
Differential Revision: D16501046
fbshipit-source-id: 4d36da07c08a4337ff6b8cb4135eaea22404ad39
Summary: Fix various Windows compatibility issues in the test.
Reviewed By: sfilipco
Differential Revision: D16501049
fbshipit-source-id: 72de26fc80a5f9e023e4b30cc2111810c7ff4626
Summary:
The old code replaces `\foo (esc)` to `/foo (esc)`, and break the `(esc)`
decoding. Change the order so we decode `(esc)` first before normalizing
the path.
Reviewed By: sfilipco
Differential Revision: D16501047
fbshipit-source-id: ac49fa89fe0123436a994548b045edc0cef0a982
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:
The `output` API is the thing that stops infinite output from being used.
If endless output is needed, it can be expressed using something like Python
generator. Then the callsites using `stdin` needs update as well.
Reviewed By: xavierd
Differential Revision: D16464660
fbshipit-source-id: 1b81c44c5089f03687aa63ed3ffda9a5399c199b
Summary:
Fix the Python code so the test actually runs.
The test took 102s, and now takes 4.8s.
Reviewed By: xavierd
Differential Revision: D16435788
fbshipit-source-id: 8dc2219fd05fd5915a592396ff72dd54f1ec730b
Summary:
This is done via:
python -m testutil.dott.translate --black --verify test-glog.t
hg mv --after test-glog.t test-glog-t.py
The test is currently broken (and skipped). It will be fixed in the next diff.
Reviewed By: xavierd
Differential Revision: D16452933
fbshipit-source-id: 40deb3c7f4c8d077de58ef4277be2129274b139c
Summary:
Remove logic printing rev numbers and comparing them with `log --no-graph`.
The test still tests rev numbers. But does not compare them with non-graph
log. This test is about `-G` after all.
This removes usage of programs including `sed`, `grep`, `cmp`, and `diff`.
Reviewed By: xavierd
Differential Revision: D16435790
fbshipit-source-id: 8d78a1d88ac0fb6feb32b8ec8516bac8a91fbdac
Summary:
This is the slowest `.t` test (108s). We're migrating away from obsmarkers.
The test also uses tricky shell functions that are hard to translate to `.py`.
Therefore just remove it.
Reviewed By: markbt
Differential Revision: D16435789
fbshipit-source-id: d8fca36d90525ed1db856239d1dafbcec73e7464
Summary:
Fix the Python code so the test actually runs.
The test took 114s, and now takes 6.7s.
Reviewed By: xavierd
Differential Revision: D16435786
fbshipit-source-id: 84caa4985a1b40189d31f163a479401206425b58
Summary:
This is done via:
python -m testutil.dott.translate --black --verify test-log.t
hg mv --after test-log.t test-log-t.py
The test is currently broken (and skipped). It will be fixed in the next diff.
Reviewed By: xavierd
Differential Revision: D16452930
fbshipit-source-id: 3376cebfe81bf9d103d041b2a79f53e7b303f7bd
Summary: This makes the test translatable. The second next diff will recover the test case.
Reviewed By: xavierd
Differential Revision: D16452922
fbshipit-source-id: 179b536d22f11a7a6a1501b289a84dd63d36a17c
Summary:
Fix the Python code so the test actually runs.
The test took 118s, and now takes 11s.
Reviewed By: xavierd
Differential Revision: D16452927
fbshipit-source-id: 6a975b76f64ec26c36c15aae4b21da3f4764276e
Summary:
This is done via:
python -m testutil.dott.translate --black --verify test-shelve.t
hg mv --after test-shelve.t test-shelve-t.py
The test is currently broken (and skipped). It will be fixed in the next diff.
Reviewed By: xavierd
Differential Revision: D16452928
fbshipit-source-id: d5dde98055230e1ad5730bb0f73fe3b6221542b5
Summary: The t -> py translator is not smart about ` >>` in output. Workaround it.
Reviewed By: xavierd
Differential Revision: D16452934
fbshipit-source-id: 234b24a793cfc629650d63b9b0f56b17cdfa9a65
Summary:
In production we use remotenames, which is a very different code path and
covered by remotenames tests. Therefore remove the non-remotenames pushpull
test.
The test took 247s.
Reviewed By: xavierd
Differential Revision: D16435787
fbshipit-source-id: dd35a9fdd3412c4b0391edcce8b7668ccb7bcf34
Summary:
Fix the Python code so the test actually runs.
The test took 143s, and now takes 5.5s.
Reviewed By: ikostia
Differential Revision: D16435791
fbshipit-source-id: 7eac98c371f78a90a5bb528350b9ff17f51a551c
Summary:
This is done via:
python -m testutil.dott.translate --black --verify test-revset.t
hg mv --after test-revset.t test-revset-t.py
The test is currently broken (and skipped), though. It will be fixed in the next diff.
Reviewed By: xavierd
Differential Revision: D16452931
fbshipit-source-id: 281d3b9edae86d536d4ed4872dc4e38afcda5589
Summary: This makes the test translatable. The second next diff will recover the test case.
Reviewed By: xavierd
Differential Revision: D16452923
fbshipit-source-id: ca45c42538012152f384a0cd8334a9c513507cad
Summary:
This is the 2nd slowest `.t` test. We're migrating away from bundles and
obsmarkers. The test also uses tricky shell functions that are hard to
translate to `.py`. Therefore just remove it.
Reviewed By: markbt
Differential Revision: D16435785
fbshipit-source-id: 93160ca12000c48c9cbd2b90de3631194cb913b1
Summary:
Manually fix the test so it runs. This is done by removing incompatible
features (cmp, diff), and rewritting bash for loops to Python loops.
It took 183s before, and 6.6s now.
Reviewed By: xavierd
Differential Revision: D16435711
fbshipit-source-id: abf8889caa8b9b7b4137c873f3926ce1c6792f55
Summary:
This is done via:
python -m testutil.dott.translate --black --verify test-command-template.t
hg mv --after test-command-template.t test-command-template-t.py
The test is currently broken, though. It will be fixed in the next diff.
Reviewed By: xavierd
Differential Revision: D16450199
fbshipit-source-id: 73f80fd616e34c402016ff82a37eb68651a75b6e
Summary: This makes the test auto-translatable.
Reviewed By: xavierd
Differential Revision: D16450198
fbshipit-source-id: 93bba2359d5d375995f8e18efc6274b3318b95b0
Summary:
This makes it possible to write:
sh % 'command' | 'head -2'
in tests
Reviewed By: xavierd
Differential Revision: D16452932
fbshipit-source-id: 8af1355cebc40085fb7af67ceb24a4d54783d388
Summary:
In case the command is `hg --cwd ...`, the side effect of changing pwd should
be reverted at the end of the command.
Reviewed By: xavierd
Differential Revision: D16452924
fbshipit-source-id: 82f96b66ad3fed123cb2e906fc51d6627b16c1f0
Summary: The "succeed" code path was missing in the `test` command.
Reviewed By: xavierd
Differential Revision: D16452921
fbshipit-source-id: a276b774c528edaf60e0ecbbad00c15ddd8ba1d1
Summary:
The `_repr` implementation can generate docstrings with trailing spaces if
`indent` is > 0.
Fix it by special handling the blank line case.
Reviewed By: xavierd
Differential Revision: D16452935
fbshipit-source-id: 99704ba3fb30b93aa35ba4fb16c1d853c58c6635
Summary:
In case there are multiple commands in a line, and the first command uses
redirections:
foo > bar && baz
The `> bar` got lost after translation. This is because the same `opts` Python
object (including `> bar` information) was returned and it was mutated.
Solve it by returning a copy of `opts` per command.
Reviewed By: xavierd
Differential Revision: D16452936
fbshipit-source-id: a7ab55cc44ebe628817f821412576e17f6f68a6f
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: Only one place was using it, remove it.
Reviewed By: quark-zju
Differential Revision: D16423138
fbshipit-source-id: 8a679c5d841f9e404099ba69023d98e02fa6a65b
Summary: There is no longer any code depending on the python mutabledatapack.
Reviewed By: kulshrax
Differential Revision: D16392286
fbshipit-source-id: 7fa2a622d1df4e32846c5ab93639fd2d5b509a3e