Summary:
We were already hacking the ui object onto the manifestlog via the
treemanifest extension, but it didn't cover all cases. Let's just put it on the
manifestlog via the constructor and get rid of the hack. An upcoming change
required this
Reviewed By: phillco
Differential Revision: D7083032
fbshipit-source-id: 4c577cb80193a9c4799853d75a71c26719348e8c
Summary:
As part of moving the manifest mutable pack logic to be used optionally
without transactions, let's move the lifetime logic
out to the repo.transaction() function instead of being part of the primary manifest
write logic.
Differential Revision: D7083035
fbshipit-source-id: 9947d78db61a41896cc8bdfaaa20504ebb03a125
Summary:
Previously the mutable packs were kept on the transaction and had a
lifetime that corresponded with it. In a future patch we want to enable mutable
packs that span for longer than the lifetime of the transaction, so let's move
the mutable pack maintenance on the manifestlog. For now the lifetime is still
maintained by the transaction, but a future diff will change that as well (and
will get rid of _writeclientmanifest entirely).
Differential Revision: D7083034
fbshipit-source-id: 3735eadfc18e5dd1015bfb82dbf5b9e9e6965cdf
Summary:
D6867913 did a bunch of refactoring which can be extended for the write
manifest wrapper. This commit achieves the same.
Reviewed By: singhsrb
Differential Revision: D6867921
fbshipit-source-id: c86cf1d54ecd3503127d91acf7a114d4d99f50ff
Summary:
A future patch will need the ability to convert a linknode to a linkrev and vice
versa without having access to the changelog (when converting a flat manifest
into a treemanifest we need to get the linknode from the flat manifest, and all
we're given is a linkrev). Let's stick the changelog on the manifestlog. Since
they are generally created together and have the same lifetime, this seems safe.
Reviewed By: ryanmce
Differential Revision: D7034091
fbshipit-source-id: df6915f894c6ef975ffd214c8e229f1085141fbc
Summary:
The root issue is described in the new ``workingflags()`` function -- ``workingfilectx.flags()`` ought to read from the working copy, but instead reads from the working copy's p1.
Rather than force a big rewrite to adapt all the old code (which might be a waste if we end up rewriting the context classes), let's add a new function with the behavior we want, and callers can detect for it and call it.
simplemerge is the only callsite that needs this behavior, AFAICT.
Previous attempt: D6694292
Reviewed By: singhsrb
Differential Revision: D7083239
fbshipit-source-id: 6f30b877958d40106203e088fe724ab491b541b9
Summary:
Add a new `--only-files-in-revs` option to `hg diff`. This filters the files
that are considered down to the set of files that are touched in either of the
two revisions.
Reviewed By: ryanmce
Differential Revision: D7070102
fbshipit-source-id: b9140cd3a212af9554ef5b76785210c1dbba8ee0
Summary:
Exposed by UBSAN:
```lang=bash
scm/hg/mercurial/cext/pathencode.c:61:40: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
#0 0x7f60c372b2e7 in inset scm/hg/mercurial/cext/pathencode.c:61
#1 0x7f60c373022c in _encode scm/hg/mercurial/cext/pathencode.c:424
#2 0x7f60c372a605 in basicencode scm/hg/mercurial/cext/pathencode.c:480
#3 0x7f60c3729f90 in pathencode scm/hg/mercurial/cext/pathencode.c:744
```
Use unsinged 1 in the shift operation to fix the UB
Reviewed By: wez
Differential Revision: D7073320
fbshipit-source-id: 8e714c41e94474c4c62b3b6730df6fe99f9c0391
Summary:
Turns out this function can read from the working copy because it calls `match`. `experimental.merge.checkpathconflicts` does what this function does without that problem and without a perf hit. So, nuke it!
Also add a test.
Previous version: D7070540
Reviewed By: singhsrb
Differential Revision: D7072247
fbshipit-source-id: a217ffd575daf8271411a77c422e1dcdd387dfbb
Summary:
Let's try to be consistent and print relative path names during merge. Note
that it changes test output for mq and subrepos, but we don't use these
features often, so it should be fine.
Differential Revision: D7067050
fbshipit-source-id: 3aba66e67657a1b1b30fcf239c03abd605eb5d9a
Summary:
"hg" only ignored ENOENT errors when including files (so it didn't abort when an included file didn't exist). But it aborted on every other error (e.g EPERM).
This diff makes it ignore any IOError and just print a warning.
Reviewed By: quark-zju
Differential Revision: D7029320
fbshipit-source-id: b1b8137cd575fc89fb5967e8d18fe82ab84a8f85
Summary:
Update the treemanifest extension to also add a 'gettreepack()' function to
localpeer, and add the 'gettreepack' capability to localpeer if the repository
supports acting as a treemanifest server.
Also update the _addmanifestgroup() wrapper to only forbid it from being called
in a treemanifest server repository. When pulling from a local treemanifest
server repository this function may need to be invoked in the client
repository.
Reviewed By: DurhamG
Differential Revision: D6980931
fbshipit-source-id: 61519c7deeaa0347650323a0002b89597e91d9cc
Summary:
Previously some of this code had undefined behavior because it was performing
signed shifts that could overflow into the sign bit, as the result could not be
represented in a signed `int`. This caused failures when built with UBSAN.
This updates the code to consistently use the built-in `_byteswap_*` functions
when compiling with Microsoft Visual Studio and the `__builtin_bswap*` when
compiling with gcc or clang.
Reviewed By: quark-zju
Differential Revision: D7008197
fbshipit-source-id: adbe22032f05a35468195922ee00ccc3ff5efff9
Summary:
Currently, commits adding LFS files are not verified server-side since the LFS
extension explicitly skips hash checking during unbundle, to avoid overhead
downloading/reading LFS objects.
We'd like those commit hashes to be verified. However, the existing verify
command does not scale with a huge repo. So let's add `verify -r REV` support
to be able to incrementally verify a repo.
Reviewed By: quark-zju
Differential Revision: D6947227
fbshipit-source-id: 6ffda3a814822942630339fc7de62c3fcb284fda
Summary:
hgweb's file view must determine if the displayed file revision is
the head of the filelog graph. As remotefilelog does not implement file
revision, we have to check if headrevs is implemented.
Reviewed By: DurhamG
Differential Revision: D6954143
fbshipit-source-id: 0657e58110112537dc5baadf743c657d4ecf372a
Summary:
inhibit has a very hacky way to disable obsmarker cycle check.
Move that to core to clean up the code.
Reviewed By: ryanmce
Differential Revision: D6956217
fbshipit-source-id: 18370721ec80e74008232e09049a057ee080e7d5
Summary:
This is a backport of e49c39ffeac2 from upstream.
It is more efficient to pass down one large string to the output streams
than many small ones. For a ``hg diff`` test case, it improves time from
2m26s to 2m8s.
Reviewed By: quark-zju
Differential Revision: D6951390
fbshipit-source-id: 5f6faacb4c77678a6abca863bf931de4bce2dfde
Summary:
This backports upstream rev a9d07bd8f758. This continues a patch series
that Augie thought was well worth the speed up it provided.
Reviewed By: quark-zju
Differential Revision: D6951332
fbshipit-source-id: a35fce1560a3e2b182faf5871ceb9068a52d697b
Summary:
This check is useful and detects real errors (ex. fbconduit). Unfortunately
`arc lint` will run it with both py2 and py3 so a lot of py2 builtins will
still be warned.
I didn't find a clean way to disable py3 check. So this diff tries to fix them.
For `xrange`, the change was done by a script:
```
import sys
import redbaron
headertypes = {'comment', 'endl', 'from_import', 'import', 'string',
'assignment', 'atomtrailers'}
xrangefix = '''try:
xrange(0)
except NameError:
xrange = range
'''
def isxrange(x):
try:
return x[0].value == 'xrange'
except Exception:
return False
def main(argv):
for i, path in enumerate(argv):
print('(%d/%d) scanning %s' % (i + 1, len(argv), path))
content = open(path).read()
try:
red = redbaron.RedBaron(content)
except Exception:
print(' warning: failed to parse')
continue
hasxrange = red.find('atomtrailersnode', value=isxrange)
hasxrangefix = 'xrange = range' in content
if hasxrangefix or not hasxrange:
print(' no need to change')
continue
# find a place to insert the compatibility statement
changed = False
for node in red:
if node.type in headertypes:
continue
# node.insert_before is an easier API, but it has bugs changing
# other "finally" and "except" positions. So do the insert
# manually.
# # node.insert_before(xrangefix)
line = node.absolute_bounding_box.top_left.line - 1
lines = content.splitlines(1)
content = ''.join(lines[:line]) + xrangefix + ''.join(lines[line:])
changed = True
break
if changed:
# "content" is faster than "red.dumps()"
open(path, 'w').write(content)
print(' updated')
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
```
For other py2 builtins that do not have a py3 equivalent, some `# noqa`
were added as a workaround for now.
Reviewed By: DurhamG
Differential Revision: D6934535
fbshipit-source-id: 546b62830af144bc8b46788d2e0fd00496838939
Summary:
Solves issues below:
```
hgext/backups.py:18:1: F811 redefinition of unused 'registrar' from line 17
hgext/catnotate.py:1:1: F811 redefinition of unused 'util' from line 1
hgext/remotenames.py:57:5: F811 redefinition of unused 'registrar' from line 34
hgsubversion/setup.py:103:5: F401 'mercurial' imported but unused
hgsubversion/setup.py:109:5: F401 'hgsubversion.svnwrap.svn_swig_wrapper' imported but unused
i18n/polib.py:1281:29: F841 local variable 'exc' is assigned to but never used (Python 2)
i18n/polib.py:1427:13: F841 local variable 'typ' is assigned to but never used
i18n/polib.py:28:1: F401 'sys' imported but unused
mercurial/manifest.py:411:5: F811 redefinition of unused '_lazymanifest' from line 168
mercurial/posix.py:419:5: F811 redefinition of unused 'normcasefallback' from line 362
mercurial/posix.py:425:5: F811 redefinition of unused 'checkexec' from line 167
mercurial/posix.py:431:5: F811 redefinition of unused 'checklink' from line 234
mercurial/pycompat.py:29:5: F401 'http.cookiejar as cookielib' imported but unused
mercurial/pycompat.py:30:5: F401 'http.client as httplib' imported but unused
mercurial/pycompat.py:31:5: F401 'pickle' imported but unused
mercurial/pycompat.py:33:5: F401 'socketserver' imported but unused
mercurial/pycompat.py:34:5: F401 'xmlrpc.client as xmlrpclib' imported but unused
mercurial/statprof.py:573:36: F812 list comprehension redefines 'parent' from line 562 (Python 2)
mercurial/util.py:1076:5: F811 redefinition of unused 'nogc' from line 1051
mercurial/util.py:3221:5: F811 redefinition of unused 'dirs' from line 3184
tests/silenttestrunner.py:24:5: F811 redefinition of unused 'main' from line 6
tests/test-context.py:90:1: F811 redefinition of unused 'scmutil' from line 4
tests/test-fb-hgext-cstore-treemanifest.py:146:5: F811 redefinition of unused 'testDeeplyNested' from line 134
tests/test-fb-hgext-extutil.py:46:5: F811 redefinition of unused 'testbgcommandfailure' from line 37
tests/test_hgsubversion_util.py:47:1: F811 redefinition of unused 'svnwrap' from line 31 (Python 2)
tests/test_hgsubversion_util.py:49:1: F811 redefinition of unused 'svnwrap' from line 47 (Python 2)
```
Reviewed By: ryanmce
Differential Revision: D6934533
fbshipit-source-id: 8b51851a76fec88bb59107ed05a901d42c7326f8
Summary: D6937883 turns out to be ineffective. Let's fix it in another way.
Reviewed By: DurhamG
Differential Revision: D6940006
fbshipit-source-id: 082d0ddcf464d7056426bde2feab52a7717eb057
Summary:
It seems the non-standard xar layout could conflict with the foreign
import check somehow.
Reviewed By: singhsrb
Differential Revision: D6937883
fbshipit-source-id: b7c4dfc6836f6f1c8a693775dc42c16c537dc8e6
Summary:
Some actions can take a long time, and not all of them have progress bars.
When this happen the user is left with an empty prompt and doesn't know that
Mercurial is actually working.
This adds a context manager which can be used to give long-running processes a
spinner-style progress bar, indicating that something is happening in the
background.
Reviewed By: farnz
Differential Revision: D6937079
fbshipit-source-id: 396d7b11157b4f13e0c12dac1e2403d9269938ab
Summary:
This allows us to specify `-p 0 --port-file X` to get the port assigned in
an atomic way. So there won't be "server failed to start" caused by race
conditions in tests.
Reviewed By: DurhamG
Differential Revision: D6925397
fbshipit-source-id: 5bbb61b7eb2695f0a673afdb0730d2a61827f8b3
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
Summary:
Demonstrate the full power of this batte station with the first extension to be default-enabled, `githelp.py`. This also lets us write a test for `DEFAULT_EXTENSIONS`
(`test-extensions-default.t`)
All other test changes are actual fallout from enabling the githelp extension.
Test Plan: Added a test.
Differential Revision: https://phabricator.intern.facebook.com/D6717098
Summary:
Based on in-person discussion in the warroom, we think this is the right path forward to "upstream" certain extensions without actually folding them into the mercurial/ codebase.
Enabling extensions by default achieves most of our goals (testing _everything_ in tests, reducing configuration permutations) without having to pay an up-front cost of fixing all the code today or accepting subpar code in mercurial/.
Test Plan: ./run-tests.py.
Reviewers: quark, #mercurial
Reviewed By: quark
Subscribers: quark
Differential Revision: https://phabricator.intern.facebook.com/D6716674
Signature: 6716674:1515803845:a209ec288341e4de8e79fd3759250e834a3573e3
Summary: Based on feedback to D6687860.
Test Plan: n/a
Reviewers: durham, #mercurial
Reviewed By: durham
Differential Revision: https://phabricator.intern.facebook.com/D6714211
Signature: 6714211:1515788399:386b8f7330f343349234d1f317e5ac0a594142cf
Summary: This avoids issues where a wrong (outside the repo) extension was used.
Test Plan: Ran all tests
Reviewers: durham, #mercurial
Reviewed By: durham
Subscribers: durham
Differential Revision: https://phabricator.intern.facebook.com/D6690534
Signature: 6690534:1515632034:1353c9272650cf925dd299d252592afd52970e98
Summary:
clindex is an hg extension, so moved to `hgext`.
linelog is not an hg extension, but is only used by hg extensions, not
`mercurial/`, so moved to `hgext/extlib`.
Test Plan: `make local` and `run-tests.py` without `-l` and with an empty `PYTHONPATH`.
Reviewers: durham, #mercurial
Reviewed By: durham
Subscribers: fried
Differential Revision: https://phabricator.intern.facebook.com/D6685080
Signature: 6685080:1515525106:88ebb275d0cac041911f243a3e82b82482b6cd34
This wasn't broken, but should mirror the non-in memory case to save an extra write.
Differential Revision: https://phab.mercurial-scm.org/D1807
(grafted from d592d5905ae972407fb6f9d649db1e2d41bf6c85)
(grafted from 9111386f1fe8316b9079669d0bd0e33704ba2a0c)
Summary:
`hg help` shows a list of all disabled extensions, which is gets by looking at
all submodules in the `hgext` modules. Exclude the new `extlib` submodule,
which is actually just a container for extension libraries.
Test Plan: Re-run `test-help.t`.
Reviewers: durham, #mercurial
Reviewed By: durham
Differential Revision: https://phabricator.intern.facebook.com/D6679750
Tasks: T24908724
Signature: 6679750:1515458834:8813e9ea9aaf6a4d55d24bc8a48ddc628f6070fa
Summary:
The `lib/linelog` directory contains pure C code that is unrelated from
either Mercurial or Python. The `mercurial/cyext` contains Cython extension
code (although for linelog's case, the Cython extension is unrelated from
Mercurial).
Cython is now a hard dependence to simplify the code.
Test Plan: `make local` and check `from mercurial.cyext import linelog` works.
Reviewers: durham, #mercurial
Reviewed By: durham
Subscribers: durham, fried
Differential Revision: https://phabricator.intern.facebook.com/D6678541
Signature: 6678541:1515455512:967266dc69c702dbff95fdea05671e11c32ebf28
The old code here was overly broad and would raise in cases when we didn't end
up calling `xmerge` and resolved using an internal tool (such as when
`premerge=True`).
Instead, let's swap out _xmerge if IMM is enabled and have the new tool raise
when called, which is the behavior we want.
Differential Revision: https://phab.mercurial-scm.org/D1739
This enables the SIGCHLD handler to work properly if some buggy program
started chg server with SIGCHLD blocked.
A test of this probably requires C code, but we don't have such kind of
tests already. Since this is a simple and clear fix, I'm leaving it as
"untested" but I did a manual test and there were no longer zombie workers.
Differential Revision: https://phab.mercurial-scm.org/D1737
Signals could be blocked by something like:
#include <unistd.h>
#include <signal.h>
int main(int argc, char * const argv[]) {
sigset_t set;
sigfillset(&set);
sigprocmask(SIG_BLOCK, &set, NULL);
execv("/bin/hg", argv);
return 0;
}
One of the problems is if SIGCHLD is blocked, chgserver would not reap
zombie workers since it depends on SIGCHLD handler entirely.
While it's the parent process to blame but it seems a good idea to just
unblock the signal from hg. FWIW git does that for SIGPIPE already [1].
Unfortunately Python 2 does not reset or provide APIs to change signal
masks. Therefore let's add one in osutil. Note: Python 3.3 introduced
`signal.pthread_sigmask` which solves the problem.
`sigprocmask` is part of POSIX [2] so there is no feature testing in
`setup.py`.
[1]: 7559a1be8a
[2]: http://pubs.opengroup.org/onlinepubs/7908799/xsh/sigprocmask.html
Differential Revision: https://phab.mercurial-scm.org/D1736
It's causing issues with pushrebase. See https://fburl.com/hd5yz5w6
(grafted from 431521982e6add35955b5b5e8b74d9e317d9ca0c)
(grafted from 8e34bb24dfc0436a65724f30e601efd08b6f2abd)
(grafted from 72e1214d63bd8de353fd1e9d1ffedc4d338fadde)
(grafted from 3588155212ad313a7abd52e44f7ebde5fedbfe06)
(grafted from de91755cc930607220d0926effc69506ca85eabc)
(grafted from 8a44eb22d38c9a60ec6102d43f5b7b5ba60100ab)
(grafted from 396b563d93e5645d4a4ec60ecf56bd91ab28f3be)
(grafted from 14a53b4cf2b352e88a3bcfda5075f9679d067b61)
(grafted from 457c63699089270e6658e1186c70a5bc3426f183)
(grafted from 5e525709296041b77cda5d9f04176a31784afbb7)
(grafted from 80926668f057e712eb11fdc580f65501830f4f8c)
(grafted from a350ecb9b0e94a332fdfebb7f0bba72d87a687ca)
This fixes treemanifest-infinitepush.
(grafted from 0364e7f0f9ef7eb92c7ca6f825cd252d1ecdac2e)
(grafted from c62ae0604a5124ae799f3ba7e309c23696fbd03d)
(grafted from e4b056930eb739c01d34a04e852643bf9c175d77)