Summary:
Check to see if the module documentation is None before trying to call
`splitlines()` on it.
Reviewed By: singhsrb
Differential Revision: D6919043
fbshipit-source-id: 93c458cde9643a3f1b2d6fe6eb56fa312ae2a192
Summary:
Previosuly, we would miss anything logged in the `ui.atexit`-registered
handler, since the actual logging would happen before those handlers were
called.
Reviewed By: quark-zju
Differential Revision: D6912321
fbshipit-source-id: 77600b7ae535b4da56fef1f92b51998de8e304e2
Summary:
With certain setup, the file history could be incorrect. That makes
`adjustlinknode` much slower since it has to scan the full history.
It is extremely slow if there is a commit with a massive renames.
This is undesirable since `hg log FILE` would give a wrong result.
But it does make the repo usable. Automation that does not care
about `hg log FILE` correctness can probably enable this relatively
safely.
This patch changes both shallow and full repos.
Reviewed By: DurhamG
Differential Revision: D6912051
fbshipit-source-id: 23d6f6c8dd91d4f72b43bc560cf26686bd6c4b47
Summary:
Calling revdiff with non-zero flags is a sign of a hard-to-debug
error. Raise ProgrammingError in this case.
The change is straightforward. Apply it to both shallow and full
repos.
Reviewed By: DurhamG
Differential Revision: D6910080
fbshipit-source-id: cbcf1a444de90e104867cc9f1525629b7edda851
Summary:
This happens when the client with LFS revisions applies a bundle
with a delta base pointing to an LFS revision stored in the repo.
Reviewed By: DurhamG
Differential Revision: D6906210
fbshipit-source-id: 8b47f8304f8ef5ae4b02d7239b680f70106a4d83
Summary:
This is similar to what we have done for changegroups, but for non-changegroup
(addrawrevision) case. This is needed to make sure the delta application code
path can assume deltas are always against vanilla (non-LFS) rawtext so the next
fix becomes possible.
Reviewed By: DurhamG
Differential Revision: D6906202
fbshipit-source-id: a7d62dfed4206d45b42299f1dabf013620ae52b3
Summary:
There is no way to distinguish whether a delta base is LFS or non-LFS.
If the delta is against LFS rawtext, and the client trying to apply it has the
base revision stored as fulltext, the delta (aka. bundle) will fail to apply.
This patch forbids using delta on LFS revisions.
Note: this does not solve the problem entirely. Since the problem could also be
a client with base file revision being LFS tries to apply a non-LFS delta
(bundle).
Reviewed By: DurhamG
Differential Revision: D6878326
fbshipit-source-id: 9c3951e4673b8de61aae73a51e1bfff422f38d0f
Summary:
This is similar to `debugdata`, but instead of taking a file revision (or
file node in remotefilelog's case), it takes a revset.
This is more useful practically, since the user would know commit hashes
easily but file nodes are hidden from the UI.
This is intended to make it easier to investigate LFS contents.
Reviewed By: DurhamG, ryanmce
Differential Revision: D6891770
fbshipit-source-id: 415da9b773c30830a48c09eda9f1854c416e3222
Summary:
This diff fixes hg pullbackup so it retrieves commits in the same order that there were pushed. This was caused by commits being stored in sets and dictionare which are by unorered types. These have been replaced by OrderedDict to mantain the order.
**Description of the task:**
Infinitepush is a mercurial extension that allows sharing commits easily. Among other things it also backs up all local commites that were made on devservers and laptops. That means that we always have up-to-date backup You can read more about it here - https://our.intern.facebook.com/intern/dex/mercurial-workflow/infinitepush/ .
Backup is triggered whenever mercurial transaction is triggered i.e. during commit, rebase or any other operation that changes mercurial repo. `hg pullbackup` is the way to pull backed up commits.
There is a problem. Let's say host A has this repo:
` o`
` |`
` o C1`
` | /`
` | C2`
` | /`
` o`
So we have two draft commits: C1 and C2. C2 is probably an older commit. But if we restore it on another host we can get another output:
` o`
` |`
` o C2`
` | /`
` | C1`
` | /`
` o `
This happens because `hg sl` orders commits by it's revision number in revlog - https://www.mercurial-scm.org/wiki/Revlog .
The point of the task is to make sure commits are ordered by their creation date.
Link to comment: http://www.facebook.com/groups/scm/permalink/1504906422892306/?comment_id=1505017576214524&reply_comment_id=1506426179406997
Reviewed By: StanislavGlebik
Differential Revision: D6884670
fbshipit-source-id: 3281dbc1e25e24662a4b6ba78b96b85d5bae78c9
Summary: ipdb/ipython is more friendly than the default.
Reviewed By: phillco
Differential Revision: D6767252
fbshipit-source-id: 50028a9681965c868f2bcd5a025debe0f1130dbc
Summary: `fastverifier` was sometimes being overriden by `shallowverifier` when remotefilelog was enabled. Since the latter is a subset of the former, let's just fold both into the core verifier code backed by a config, `verify.skipmanifests`, that we can default to true.
Reviewed By: DurhamG
Differential Revision: D6882222
fbshipit-source-id: 9f337ca031a070425ccdc9ee02f6765e68436da9
Summary:
A lot of tests rely on `python` interpreter being able to do
things like `import mercurial`. This becomes tricker if hg is
built as a single binary by buck.
Therefore also add a interpreter target that can be used as
a drop-in replacement of `python` in tests.
Reviewed By: DurhamG
Differential Revision: D6879868
fbshipit-source-id: 2b1d2b6306e74ceff86750d1f86387b9fa493f9a
Summary:
The old mercurial.dispatch entry point works, except it breaks
extensions wrapping `dispatch.*` (ex. `dispatch.runcommand`).
That is because things happen in this order:
- Buck's python wrapper imports `mercurial.dispatch` as mod1.
- hgdemandimport is enabled.
- An extension imports `mercurial.dispatch` and it got mod2.
- mod2 != mod1. So any changes to mod2 won't be used.
Using a separate module (`mercurial.main`) as the entry point
solves the problem.
Reviewed By: DurhamG
Differential Revision: D6879873
fbshipit-source-id: 9779edac64bbeb53dd98dfab1b21575c3a60af01
Summary:
So the use of `os.path.dirname(__file__)` which won't work in buck
python binary can be removed.
Reviewed By: DurhamG
Differential Revision: D6881306
fbshipit-source-id: b6504beaf07fe9853abff08b9721a17b31ac7515
Summary:
This allows `HGDATAPATH` to override where to look for data files
like builtin configs, templates, help texts.
It'll be useful for running tests with a packed hg binary.
Reviewed By: DurhamG
Differential Revision: D6879865
fbshipit-source-id: 4638a9eff62a5fab088215cbeb72740bb67cac04
Summary:
Let's collect how long we wait for a pager so that we can later subtract it
from the elapsed time.
Currently, it's impossible to compute `elapsed - pager - editor - stdio`, which
would include startup time.
Reviewed By: quark-zju
Differential Revision: D6875447
fbshipit-source-id: d055e4ba5bf1ab7ee9e567c99b6708321ab7705b
Summary: backout: use only first line of original commit message (title) for backout default message.
Reviewed By: phillco
Differential Revision: D6846109
fbshipit-source-id: 68efbff9db698599a12cef45de7ab4af96cf184f
Summary:
When pushing a treeonly commit to a tree+flat hybrid server, the server
needs to execute the hooks in treeonly mode so we never try to access the flat
manifests. Previously we did this for shell hooks by setting some environment
variables, but we didn't do it for python hooks that ran in process.
This diff makes the python hooks run against a bundle repo that is instantiated
in treeonly mode. No changes to any hooks are required, as the repo object they
are given is already in the correct mode.
Reviewed By: quark-zju
Differential Revision: D6840971
fbshipit-source-id: 9fcb97d972076911b35bccf3f79b60972bcafc33
Summary:
Since we have `debugbuilddag` as a builtin command, and `drawdag` is
pretty useful for writing clean test cases. Let's inline it. This would
simplify many tests since `drawdag=..." is no longer needed.
Reviewed By: DurhamG
Differential Revision: D6827925
fbshipit-source-id: b749f57fd5c55b2cb000dd2da2c2f9bc2386a519
Summary:
crecord locked out the amend functionality to older versions of
Mercurial. Since it's packaged in core now, let's always enable it.
Reviewed By: quark-zju
Differential Revision: D6837724
fbshipit-source-id: 2a0dae2e03346734f7d8298e5a073f776849005e
Summary:
smartlog, among other places, would benefit from being able to
strictly limit the size of text output to the terminal. Provide two functions:
one truncates long lines in a filled block, the other limits the number of
lines of output. Both can optionally add a truncation marker.
Reviewed By: markbt
Differential Revision: D6819153
fbshipit-source-id: d95b654f4a6fef49ad4840f26ef74a18c370bdd8
Summary:
There are a couple of ways that dirstate and fsmonitor interact with
treedirstate that are sub-optimal.
When iterating over all files in the dirstate map, use the iterator of keys
(`__iter__` rather than `iteritems`) to hit the treedirstate fastpath that
doesn't build the dirstate tuples.
Use `__getitem__` and catch the `KeyError` rather than `__contains__` followed
by `__getitem__`, as the latter involves two look-ups in the tree.
Skip the indirect call to `hastrackedfile` and `hasremovedfile` as these add
noticable overhead when called many times.
Also fix up the `test-check-code` failure for treedirstate.
Reviewed By: ryanmce
Differential Revision: D6818952
fbshipit-source-id: d49907c282a1b97c66a3d24257bdf54800d7da70
Summary:
Adds some basic building blocks to build hg using buck.
Header files are cleaned up, so they are relative to the project root.
Some minor changes to C code are made to remove clang build
warnings.
Rust dependencies, fb-hgext C/Python dependencies (ex. cstore,
mysql-connector), and 3rd-party dependencies like python-lz4
are not built yet. But the built hg binary should be able to run
most tests just fine.
Reviewed By: wez
Differential Revision: D6814686
fbshipit-source-id: 59eefd5a3ad86db2ad1c821ed824c9f1878c93e4
Summary:
Suggesting disabled extensions uses extensions.loadpath, which is no
longer supported for core extensions. Since this test is just testing that the
extension can be disabled, let's not worry about the exact output.
Reviewed By: phillco
Differential Revision: D6802719
fbshipit-source-id: 2a602e086f4809676ef8dd36ffc30f021b3186fc
Summary:
check-execute was failing because the filesets are too slow (about 45+s
each). This fixes the performance by optimizing some internal fileset logic, and
by fixing a fileset to be scoped to the current working directory instead of the
whole repo.
Unfortunately the fileset implementation optimization needs to be deployed
before the test can benefit from it (since the test runs the system hg), so we
need to leave the test disabled until the fix rolls out.
Reviewed By: quark-zju
Differential Revision: D6802078
fbshipit-source-id: 26767c989e15b6d0ae5f5d9560309dafa5c380ff
Summary:
Port of D6798134 to fbsource. It eliminates module-import failures as well as errors like this:
```
mercurial.error.ForeignImportError: hgext.extlib.treedirstate: /home/phillco/.local/lib/python2.7/site-packages/hgext/extlib/treedirstate.so lives outside /..../hg
```
....that block other tests, like test-help.t
(Note: this ignores all push blocking failures!)
Reviewed By: quark-zju
Differential Revision: D6799259
fbshipit-source-id: b77d1b565dbf52165e0847002be498648658e064
Summary: Otherwise this test will fill up with default-on tests that will be a pain to filter manually. Plus it's a sensible flag to have.
Differential Revision: D6760553
fbshipit-source-id: 083cb2d8a7cffe28eef812edad2f4c5d997db981
Summary:
`_peerorrepo` calls `extensions.extensions()` to figure out on which modules to run reposetup. This uses a slightly
different code path than that patched by D6716674 and double-checks if an extension is enabled. So we need to patch here too.
Reviewed By: quark-zju
Differential Revision: D6758486
fbshipit-source-id: b5bfe2d11e5e2aeb2d3a0ee7c9d6e3e2c213233d
Summary:
This was blocking us default-enabling `fbsparse`; however, this function is actually incredibly fragile and can break with a variety of extensions enabled (even blackbox).
E.g., try this on the latest release and you'll get an exception!
```
cd $(mktemp -d); hg init a; hg share a b; cd b; hg unshare
```
That particular breakage is called by blackbox trying to look at `repo[None]` to do some logging, but anything that tries to read `repo.dirstate` after this will print the exception. The root cause is this line which is trying to override `repo.root`:
```
repo.unfiltered().__init__(repo.baseui, repo.root)
```
It's trying to update the repo's path to indicate that it is independent and no longer shared. But, the initializer isn't really designed to be called twice, AFAICT, and doing so here leaves the property caches out of sync with properties of the repo (namely `_filecache`).
Durham's suggestion was just to nuke `hg unshare`. This patch works around it for now, though, in case we want to keep it alive.
Reviewed By: quark-zju
Differential Revision: D6758397
fbshipit-source-id: 90d3773d9340f2a5b2e6e900a2194d8b931f410d
Summary:
...instead of '(untested!)'.
Partly this is necessitated by the `hg debugextensions` call in test-extension.t (post
D6758486). But it also seems like the right thing to do.
Reviewed By: ryanmce
Differential Revision: D6758599
fbshipit-source-id: 3ecfa52b0c9c1a028201d2eda0eaa706d80225c0
Summary:
The isgooddelta tweak was introduced in D2693043 (perftweaks: change revlog
delta heuristic, 2015-11-24). Comparing with the existing version, the only
change is that we removed `dist > maxdist` check.
Note that the upstream commit 895ecec31 (revlog: add an experimental option
to mitigated delta issues (issue5480), 2017-06-23) also introduces a config
option to override `maxdist` to make the condition fail, which basically does
a same thing.
Instead of introducing new config options or adding more "if"s to the
codebase to make it more obscure, let's just simplify it by disabling the
check entirely, and removing the `dist` concept, removing two config
options: `experimental.maxdeltachainspan` and `perftweaks.preferdeltas`.
The `chainlen > self._maxchainlen` check should be enough for keeping
delta chain length bounded.
Reviewed By: DurhamG
Differential Revision: D6752529
fbshipit-source-id: e8fd8ec39240191db5fb274190fc661e97087a78
Summary:
This enables clindex for its nodemap. Verification is turned off by default
for the performance win since we have been running verification in
production for a while.
Reviewed By: phillco
Differential Revision: D6751412
fbshipit-source-id: bc3e87df86e86a758392bdd4aef3e282f397fe04
Summary: Also change the internal API so it no longer accepts the "heads" argument.
Reviewed By: ryanmce
Differential Revision: D6745865
fbshipit-source-id: 368742be49b192f7630421003552d0a10eb0b76d
Summary: This removes the effectflag logic from both core and perftweaks.
Reviewed By: ryanmce
Differential Revision: D6745769
fbshipit-source-id: 55ed1676e7117bca358471c256805ded7bc83f3c
Summary:
Previously it's `:. & follow(FILE)` and there is a Python loop iterating
`:.`. This patch makes it `follow(FILE) & :.`.
In the common case, `_logrevs` returns a large revset in desc order. So it
makes sense to put it at the right side of `&` operator. The only exception is
when `_logrevs` uses user-specified revset (`-r`), whose order needs to be
respected and size is unknown.
Test Plan:
Ran all tests.
Facebook:
This reduces `hg log FILE` from ~3 seconds to ~0.5 seconds.
```
# Before
% time hg log cmd_util.py --pager=off --config extensions.fastlog=! -T'{oneline}\n'
11e9d4 D5997870 mbolin Use --home-dir to compute the config dir, if specified. 2017-10-06
5041e2 D4888633 simpkins [eden] move eden/fs/cli to eden/cli 2017-04-14
7dc2bd D4760528 simpkins [eden] an "eden debug" CLI command and thrift APIs to support it 2017-04-03
hg log cmd_util.py --pager=off --config extensions.fastlog=! -T='{oneline}\n' 2.88s user 0.09s system 99% cpu 2.975 total
# After
% time hg log cmd_util.py --pager=off --config extensions.fastlog=! -T'{oneline}\n'
7dc2bd D4760528 simpkins [eden] an "eden debug" CLI command and thrift APIs to support it 2017-04-03
5041e2 D4888633 simpkins [eden] move eden/fs/cli to eden/cli 2017-04-14
11e9d4 D5997870 mbolin Use --home-dir to compute the config dir, if specified. 2017-10-06
hg log cmd_util.py --pager=off --config extensions.fastlog=! -T='{oneline}\n' 0.42s user 0.03s system 98% cpu 0.456 total
```
Fastlog is disabled since a network request makes the time less stable.
Logging a single file is answered locally by remotefilelog ancestor handling.
Reviewers: durham, #mercurial
Reviewed By: durham
Subscribers: durham
Differential Revision: https://phabricator.intern.facebook.com/D6735007
Signature: 6735007:1516163080:0d7ddae9f24933d795ba7aaa4461916c7fdd2309
Summary:
It's pretty handy. The implementation is simple and clean. So move it from
contrib and enable it by default. "import"s are adjusted to make the module
checker happy.
Security and UX wise, since we have `--debugger` already, adding another
REPL seems fine.
Test Plan: Ran all tests
Reviewers: phillco, #mercurial
Reviewed By: phillco
Differential Revision: https://phabricator.intern.facebook.com/D6741283
Signature: 6741283:1516225662:ddc19a663e7ecef2a1fdaa5041f308dc838a8471
Summary:
This if statement is testing whether we ever set any data, not whether the data is truthy.
This can cause a bug where rebasing an empty file can cause IMM to fail and restart.
Test Plan: ./run-tests.py
Reviewers: durham, #mercurial
Reviewed By: durham
Differential Revision: https://phabricator.intern.facebook.com/D6687459
Signature: 6687459:1515535581:c2018237f3ca9daed6a0cb2f5a1475d1dc8e4865
Summary:
Before, we would raise whenever the `usemergedriver` condition was set when merging in-memory,
which equated to "any merge with (cd, dc, or m) actions in a repo with a mergedriver script".
This was done to be as conservative as possible.
However, a better solution is to run the preprocess() script and only raise if any files are
marked to actually be driver-resolved. That way we only restart the merge if we absolutely need
to.
Since some of our preprocess() scripts aren't ready yet, I also added
experimental.inmemory.nomergedriver in a previous change so we can deploy this in a build before the preprocess scripts are good to go.
Test Plan: ./run-tests.py
Reviewers: quark, #sourcecontrol
Reviewed By: quark
Subscribers: durham
Differential Revision: https://phabricator.intern.facebook.com/D6668426
Signature: 6668426:1515185050:a640208454caf053f8213b831d0f8e645ebe682c
If the user specifies a ui.origbackuppath, we used to always copy the file
there, but if the source file is in memory we must write it instead of copying.
Differential Revision: https://phab.mercurial-scm.org/D1806
Summary: Log whichever paths were driver-resolved but not in experimental.inmemorydisallowedpaths, so we can update experimental.inmemorydisallowedpaths and keep the experience of rebasing with IMM and
mergedriver a pleasant one.
Test Plan: .
Reviewers: #sourcecontrol
Differential Revision: https://phabricator.intern.facebook.com/D6656159
Summary: Fixing a bug that causes a fatal crash when a user attempts to delete a bookmark by inputting it's name twice, for example:
# hg bookmark --delete name name
Test Plan: The following test has been added in the test/test-bookmarks.t file
https://pxl.cl/bmTf
to test the new functionality:
~~~
kosullivan-mbp:hg-crew kosullivan$ hg diff tests/test-bookmarks.t
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -288,6 +288,10 @@
abort: bookmark 'A' does not exist
[255]
+ensure bookmark names are deduplicated before deleting
+ $ hg book delete-me
+ $ hg book -d delete-me delete-me
+
bookmark name with spaces should be stripped
$ hg bookmark ' x y '
~~~
Reviewers: rmcelroy,rafeca
Subscribers: suiting
Tags: python,bootcamp,source_control
Tasks: 22525999
Differential Revision: https://phabricator.intern.facebook.com/D6711774