This implements the dirs function, which returns a collection set that can
answer the question of if a directory is in the manifest. Currently we do a
naive solution of using util.dirs(), which iterates over all the files. Given
that we have a tree already, we should be able to return something smarter in
the future.
The diff algorithm assumed every tree already had a node. If we are iterating
over an uncommitted tree, it may have tree entries with NULL as their node. We
need to always recurse in these cases.
hg has an optional 'clean' arg on diff, which causes it to also return files
that aren't different between the two diffs. This implements it on our
treemanifest diff algorithm.
Summary:
Previously `--to` bookmark was not set locally.
This diff fixes it by setting this bookmark to the head after push happened.
This is correct because it's guaranteed that we'll push only one head.
Test Plan: Run `test-infinitepush-bundlestore.t`
Reviewers: durham, rmcelroy, mitrandir
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D4001168
Tasks: 12479677
Summary: `_` does not take two arguments while `ui.status` does.
Test Plan: Added a test case
Reviewers: #sourcecontrol, durham
Reviewed By: durham
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D4010079
Signature: t1:4010079:1476298648:81e678fbe433aa8cca8b03c9eba50d9b78bbc9bb
Blame Revision: D2811887
Summary:
This change adds a `--restack` option to `hg rebase`. When invoked, the command will rebase all descendants of precursors of the current changeset onto the current changeset. This is similar to the behavior of `hg evolve --all`, except it only handles unstable changesets, and not other issues that can arise from shared mutable history such as divergence or bumping.
I've been playing around with some of the more advanced features (such as allowing the command to be run from anywhere in the old stack or new stack, as well as allowing the user to specify the number of changesets to rebase), but I wanted to upload the most simple iteration of this command for feedback.
Test Plan:
See unit tests for complete commands.
1. Create a stack of commits.
2. Somewhere in the middle of the stack, amend a commit, potentially several times.
3. Run `hg rebase --restack`.
4. The top half of the stack should be rebased onto the amended commit, and the preamend bookmark should be gone.
Reviewers: #sourcecontrol, durham
Reviewed By: durham
Subscribers: rmcelroy, quark, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3972103
Tasks: 13651947
Signature: t1:3972103:1476230834:8f77eac4e8d8681dd9f8125747c1ff75c8da1ad8
Summary:
Non-fast-forward pushes were disallowed. But having a
mutable shared history for scratch branches is a very
nice feature. Let's use --force option to force
non-fast forward push.
Test Plan: Run test-infinitepush-bundlestore.t
Reviewers: durham, rmcelroy, mitrandir
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3994813
Tasks: 12479677
Summary:
The vanilla annotate command takes diffopts, let's add it to fastannotate.
This is also useful to support hgweb correctly.
Test Plan: Added a new test
Reviewers: #sourcecontrol, simonfar
Reviewed By: simonfar
Subscribers: simonfar, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3992672
Signature: t1:3992672:1475944204:2fbdf6a90d8c965775e3b7d5bc55fdb37c8909e7
Summary:
Upstream 4718718ed358 requires a `readfast` method for manifestctx.
`hybridmanifestctx` does not have such method so let's add it.
Test Plan: Added a test.
Reviewers: durham, ttung, #sourcecontrol, rmcelroy
Reviewed By: rmcelroy
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3955478
Signature: t1:3955478:1475582074:f80c9eb97bcd42846625727ef1da4bce3256c88c
Summary:
Previously error was thrown if mysql.connector wasn't present on client hosts.
But there is no need for mysql.connector to be installed on clients.
Remove global imports to fix it and create bundlestore() only for server repo.
P. S.
Changes in test is required because bundlestore() is not created if
infinitepush.server=True is not present in config.
Test Plan:
Uninstall mysql.connector: `sudo yum remove mysql-connector-python`
Enable infinitepush extension in any repo and run any hg command (hg st,
for example). Make sure it doesn't throw exceptions.
Install mysql.connector: `sudo yum install mysql-connector-python`.
Run `test-infinitepush-bundlestore.t`
Reviewers: durham, mitrandir, quark, rmcelroy
Reviewed By: rmcelroy
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3967189
Tasks: 12479677
Signature: t1:3967189:1475581802:fbaafceac298242d0a449267ec0d68e290c3f262
Summary: Seems the output has changed somehow and needs an update.
Test Plan: Run the test
Reviewers: #sourcecontrol, rmcelroy, mjpieters
Reviewed By: rmcelroy
Subscribers: mitrandir, rmcelroy, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3955443
Signature: t1:3955443:1475332010:d2a0e33b509d198312d71458aaf0dfd7f5ce73d7
Summary:
the nuclide team would like to be able to get the commit template
message without actually invoking a commit. This small extensions allows them
to do this.
Caveats: ignores subrepositories.
Test Plan: new test
Reviewers: #mercurial, most
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3960557
Tasks: 12771006
Summary:
Hack to fix interaction with remotenames. Remotenames push '--to' bookmark to the server but we don't want to push scratch bookmark to the server. Let's delete '--to' and '--create' and also set allow_anon to True (because if --to is not set remotenames will think that we are pushing anonymoush head).
Test Plan: Run `test-infinitepush-bundlestore.t`
Reviewers: durham, mitrandir, rmcelroy
Reviewed By: rmcelroy
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3937202
Tasks: 12479677
Signature: t1:3937202:1475170335:fa4d39e1e17bea67b62b99dfc4cd2ffa4e5d6bea
Summary:
It's possible to push new scratch bookmark which points to existing scratch
commit. Previously it has failed with a stack trace.
Unfortunately it still doesn't allow to push scratch bookmark that points
to non-scratch commit. It requires more complex changes so
it will be fixed later if necessary.
Test Plan: Run `test-infinitepush-bundlestore.t`
Reviewers: rmcelroy, mitrandir, durham
Reviewed By: durham
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3936728
Tasks: 12479677
Signature: t1:3936728:1475078059:ac4588e086b0344070a90f806b6f518c6e187c3b
Summary:
infinitepush bundle2 part should be run before pushrebase bundle2 part. This is a bit tricky since both pushrebase and infinitepush change the `extensions._order` and both of them try to load before bundle2 `changeset` part.
I suggest to load before 'changeset' or pushrebase part whichever is earlier. Then we have two situations:
1) pushrebase comes first. It sets it's part before 'changeset' part, then infinitepush sets it's part before pushrebase part.
2) infinitepush comes first. It sets part before 'changeset' and pushrebase part, then pushrebase sets it's part before 'changeset' part. Since infinitepush part comes before 'changeset' part it still be before pushrebase part.
This solution is not robust but it should be fine for now. The proper solution requires changes upstream that will introduce dependencies between bundle2 parts.
Test Plan: Run `test-infinitepush-bundlestore.t`
Reviewers: rmcelroy, mitrandir, durham
Reviewed By: durham
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3930697
Tasks: 12479677
Signature: t1:3930697:1475079064:1b5851df4d2067ec21ec01e7510ddf83ff1684ad
Summary:
Use wrappers around ui functions to exclude interactive
and log the results to scuba.
Test Plan:
USE_DIST_HG= FB_HG_DIAGS= CHGDISABLE= hg --config 'extensions.profiling=~/facebook-hg-rpms/fb-hgext/hgext3rd/profiling.py' --pager=off --config profiling.enabled=False amend --edit
chg: disabled by CHGDISABLE
internal stats file: /tmp/scm-internal-statsx9EXSw
hg profiling mode: SKIPPED
stats: {
"int": {
"builddate": 1471281577,
"cachehitratio": 75,
"consumed": 425,
"diffcachehitratio": -1,
"elapsed": 1921,
"errorcode": 0,
"filesnotincachehitratio": -1,
"interactive_time": 1534,
"internal_time": 1701,
"time": 1473459054
},
Tested both with and without chg to make sure both modes work, otherwise
there are some subtle bugs that can come up under hg (timer becomes persistent
if invoked too early in uisetup).
Check out scuba table, new columns are showing up. I still need to clean up the table as I accidentally added data as string first.
Reviewers: #sourcecontrol, ttung, quark, durham
Reviewed By: durham
Subscribers: giorgioc, mjpieters, akushner
Differential Revision: https://phabricator.intern.facebook.com/D3844697
Tasks: 12879683
Signature: t1:3844697:1475250469:a46aff22781e0e07596e2880d6477a62754f1397
Summary:
This change updates the behavior hg next --rebase. Specifically:
- Only one changeset can be rebased at a time. If there are multiple candidate changesets, the command aborts.
- Each time a changeset is rebased, its precursor is marked as obsolete, inhibition markers are stripped from it and its ancestors, and its preamend bookmark is deleted, if one exists.
- The result of this is that if no non-obsolete changesets depend on the existence of the pre-rebased changeset, that changeset and its ancestors will be stripped, resulting in a cleaner user experience.
- This change also adds back the --evolve flag, but makes it show in error instead of working. It turns out that removing the flag outright breaks the evolve extension.
Test Plan:
See updated unit tests for the exact commands to run to test this, as well as an overview of all of the new situations where behavior was changed.
A basic test plan would be:
1. Initialize a new repository, and create a stack of 4 commits.
2. Amend the second commit in the stack.
3. Do `hg next --rebase`. It should work as before.
4. Do `hg next --rebase` again. This time, the entire old stack should "disappear" from hg sl.
Additionally, attempting to run `hg next --rebase` when there are multiple possible child changesets should fail.
Reviewers: #sourcecontrol, durham
Reviewed By: durham
Subscribers: quark, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3941922
Tasks: 13570554
Signature: t1:3941922:1475205056:58a8d1726cfcccbf14a38727be0220a09532ec97
Summary:
This fixes a crash that `hybridmanifestctx` does not have `readdelta`
after upstream's b404425704fa. `readdelta` should be fast for vanilla
manifest so just forward the call there.
Test Plan: Modify a file that `.` touched, run `hg amend` and it won't crash.
Reviewers: ttung, #sourcecontrol, durham
Reviewed By: durham
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3948989
Signature: t1:3948989:1475198696:d8ae194500fc093c03cc115f4613a9b8c8bfbff2
Summary:
The test is just a copy of the existing one but with perfhack enabled. It's
expected to generate the same test result.
Test Plan: Run the newly added tests
Reviewers: #sourcecontrol, stash
Reviewed By: stash
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3937109
Signature: t1:3937109:1475166970:4c39d9b15878458cd8b4a26323749224a4c3c746
Summary:
`_decorate` backported from upstream does not handle empty file correctly.
It would raise an assertion error when annotating an empty file:
File "fastannotate/commands.py", line 138, in fastannotate
not showdeleted))
File "fastannotate/context.py", line 331, in annotate
return self._refineannotateresult(result, revfctx, showpath, showlines)
File "fastannotate/context.py", line 503, in _refineannotateresult
if len(lines) != len(result):
AssertionError
This patch fixes it.
Test Plan: Run the modified test.
Reviewers: #sourcecontrol, stash
Reviewed By: stash
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3944132
Signature: t1:3944132:1475166894:e2610c6364806b77c8533315a1a0a08b6c158fe5
Summary:
We need to reserve ".l", ".m" and ".lock". So encode directory names to
avoid collision.
Test Plan: Run the modified test
Reviewers: #sourcecontrol, stash
Reviewed By: stash
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3944069
Signature: t1:3944069:1475166648:055811239514cb699a0ebe1cfab809b661c6cfd2
Summary:
This feature uses the linelog to show all lines ever existed (even deleted) in
a file. Helpful to see the history all the way back to the beginning.
Sadly it has to be inefficient currently as we have chosen to not store line
content (but only numbers) in linelog. Calculating the revisions and line
numbers is very fast because of linelog but resolving the line contents is
painfully slow. We may want a key-value database in the future, answering the
query:
(path, node, linenum) -> content
How slow is it? With the linelog pre-built, generating the output for
`mercurial/commands.py` needs resolving 400+ revisions and is about 10+
seconds.
Test Plan: Run the changed `test-fastannotate.t`
Reviewers: #sourcecontrol, rmcelroy
Reviewed By: rmcelroy
Subscribers: rmcelroy, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3849503
Signature: t1:3849503:1475086235:83077c571746a7515b5ba75c4df37a1a400d9232
Summary:
This diff adds a config option to replace the default annotate command using
fastannotate.
Test Plan: Run the modified test
Reviewers: #sourcecontrol, stash
Reviewed By: stash
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3837499
Signature: t1:3837499:1475076620:65dc656c74e9c8a969f68cc4a2480f5dcbeb6361
Summary: This diff adds a simple test for the `fastannotate` command.
Test Plan: Run the newly added test.
Reviewers: #sourcecontrol, stash
Reviewed By: stash
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3836677
Signature: t1:3836677:1475076179:fa8b8ff3711a8dad9410a15f77e23adaeb676d5e
Summary:
This patch removes the unused line and space so it looks a bit better:
```
.
.
.
| o o
| | |
| | |
| o o
|/ /
| |
o o
. .
. .
(before) (after)
```
Due to the current implementation of graphlog, it's a bit hacky to achieve the
above effect.
Test Plan: Run `test-smartlog*.t`
Reviewers: #mercurial, ttung, mjpieters, durham
Reviewed By: durham
Differential Revision: https://phabricator.intern.facebook.com/D3881516
Signature: t1:3881516:1475170264:477c66b2372d04c4e5d7c8fbb69de30599706e5d
Summary:
Previously `absorb` does not care too much about copies or renames and
assumesa file path only exists in every changeset of `stack[k:len(stack)]`,
but does not exist in any of `stack[0:k]`. If this assumption is not true,
absorb will likely crash.
This patch implements copy or rename handling correctly. After this patch,
renames happens to a single file is tracked correctly. Copies are ignored
by default. For the "double move" case, like:
hg cp a a1
hg cp a a2
hg rm a
We only follow the first path (sorted alphabetically). In this case, changes
to "a1" could affect the content of "a" in a previous changeset, while changes
to "a2" couldn't.
Test Plan: Added a new test
Reviewers: durham, #sourcecontrol, rmcelroy
Reviewed By: rmcelroy
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3941438
Signature: t1:3941438:1475166850:97461174619d469750146e25f6bff16dae19bd3d
Summary:
--bundle-store option makes push go to bundle store
even if bookmark is not specified or bookmark doesn't match scratch branch pattern.
The main reason for the `--bundle-store` is to be able to push not a scratch bookmark, but a scratch commit, for example, `hg push -r . --bundle-store`.
It will be useful when we will save all the local commits in the bundlestore.
To do this:
1) Wrap `discovery.checkheads()` to allow push to scratch branch even if new head is created.
2) Make scratchbranchpat params advisory because now bookmark may not be specified.
Test Plan: Run `test-infinitepush-bundlestore.t`
Reviewers: mitrandir, rmcelroy, durham
Reviewed By: durham
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3862665
Tasks: 12479677
Signature: t1:3862665:1475077612:7e02a5bdc1da28161e45029b1e3a38fe8223a305
Summary:
bc720745268b added a ui argument to the mutabledatapack() and
mutablehistorypack() constructors, but did not update the tests to pass in a ui
object, causing the tests to fail.
Test Plan: Ran the tests.
Reviewers: #fastmanifest, durham
Reviewed By: durham
Subscribers: net-systems-diffs@, yogeshwer, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3934065
Signature: t1:3934065:1475077643:4c0c32f5efdb25d482128cc58f4ba903611cc959
Summary:
The order of `find` output is not guaranteed, so sort them and make the
output determined.
Test Plan: Run the test.
Reviewers: #sourcecontrol
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3925502
Summary:
`mysql` is required for the test. Otherwise it would error out:
```
$ hg init repo
+ abort: No module named mysql!
+ [255]
$ cd repo
```
Test Plan: Remove mysql python package and run the test, make sure it's skipped.
Reviewers: stash, #sourcecontrol
Differential Revision: https://phabricator.intern.facebook.com/D3925440
Summary:
This diff adds the --rebase option to the `hg next` command by extending
the evolve extension in the fbamend extension.
The --rebase option finds any child commits of the obsolete precursor to the
current commit, and rebases them onto the current commit before performing
`hg next`. This way, one can be in the middle of a stack of commits, amend one
in the middle, and do `hg next` without running `hg amend --fixup`. The next
commit will be correctly found, rebased, and updated to.
This is equivalent to:
hg rebase -d . -r "children(OLD_HASH)" -k && hg next
Test Plan:
I tested this command by hand and created some unit tests. The basic way to test it is:
1. `hg init` a new repository.
2. Create a chain of 3 commits.
3. Amend the 2nd commit.
4. Run `hg next --rebase` and confirm that the 3rd commit was rebased and switched to.
The exact commands to do this are in tests/test-fbamend-nextrebase.t. This file also
contains test cases in which there are multiple child commits on the precursor, and cases
where there is a rebase conflict.
Reviewers: #sourcecontrol, durham
Reviewed By: durham
Subscribers: mjpieters, nain
Differential Revision: https://phabricator.intern.facebook.com/D3910568
Tasks: 13347995
Signature: t1:3910568:1474650102:8c7dd712afb9d36f29e1e73bb781e1d8e0870371
Summary: We need to start fixing test failures to test hgbuild e2e :)
Test Plan: run-tests.py against changed files shows that these ones were fixed
Reviewers: quark, mjpieters, rmcelroy, simonfar
Subscribers: mjpieters, #sourcecontrol
Differential Revision: https://phabricator.intern.facebook.com/D3907217
Previously, the test would attempt to import the system ctreemanifest, which is
not what we should be testing. This fix adjusts the PYTHONPATH so that we load
the extensions from our repo, instead of the system.