Summary:
Let's create a new portability header, which can be used on both Windows and
Posix.
Reviewed By: quark-zju
Differential Revision: D6970928
fbshipit-source-id: a3970c50260f52bfc0a9420a4ff11d93ace304b0
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:
Port the double blank line and "foobar" naming rules to check-code.
check-commit checks "changes" while check-code checks "snapshot".
Checking changes would have a couple of disadvantages:
- No check after code is committed
- Could have difficulity dealing with commits involving other changes
in a mono repo.
Facebook
Context: https://fb.facebook.com/groups/scm/permalink/1558174000898881
Reviewed By: DurhamG
Differential Revision: D6928820
fbshipit-source-id: 9ea998731778150b60112840bce702d9584ba15b
Summary: Adds output to hg sparse --refresh for long running calculations, --verbose adds more notes on progress.
Reviewed By: ryanmce
Differential Revision: D6886545
fbshipit-source-id: 9fe176724bec0cb56bc8da4939f42a6e7745cf41
Summary:
Now they are unnecessary since `run-tests.py` will set up `PYTONPATH`
correctly.
Differential Revision: D6865042
fbshipit-source-id: ca95314f725968e14349a9d916434aa832c596f9
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:
This was timing out when run in a large repo. This patch fixes it to be
faster.
Reviewed By: singhsrb
Differential Revision: D6800750
fbshipit-source-id: 7021ab17b30727cafa4fc0654a7409c43793b3e9
Summary: These files were removed and one was added, so add to the expected test output.
Reviewed By: quark-zju
Differential Revision: D6799790
fbshipit-source-id: 514cb095cb727f465aa82b06465a49f17f0e0eb2
Summary: This manifests itself on MacBooks where dulwich is not installed.
Differential Revision: D6759617
fbshipit-source-id: c90c35ebaa4fd2a14b1ad2fa0fadaca3c6ea8c29
Summary:
This ensures that watchman doesn't complain when it starts watching this
directory.
Differential Revision: D6757821
fbshipit-source-id: 30b3e71b9601e74af51ad7ac18e1f197777b9e72
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:
Since we moved some files, these failures changed.
Depends on D6719894
Test Plan: - ./run-tests, see passing
Reviewers: #sourcecontrol
Differential Revision: https://phabricator.intern.facebook.com/D6719911
There's no need to do this and not doing so speeds up IMM tremendously when the sparse profile had to be adjusted.
(This is the grafted version from the fb-hgext repo)
Test Plan:
I ran an IMM before and after this change. Both succeeded but the later version was
much faster.
Differential Revision: https://phab.mercurial-scm.org/D1805
Summary:
Moving stuff into fb/packaging broke a few tests since they're
trying to apply the Mercurial linters on scripts that don't conform.
Let's exclude these directorites for now.
Test Plan: This fixes a test.
Reviewers: #sourcecontrol
Differential Revision: https://phabricator.intern.facebook.com/D6701215
Summary: D6700784 encoded the the incorrect path. This commit addresses that.
Test Plan: Ran all the tests
Reviewers: singhsrb, #mercurial, #sourcecontrol
Reviewed By: singhsrb
Differential Revision: https://phabricator.intern.facebook.com/D6700869
Signature: 6700869:1515643366:9de76782a770b7ddc42b09bd06d07038f25c20b7
Summary:
D6700605 exposed new code to tests which resulted in some issues. This
commit addresses those test failures.
Test Plan: Ran all the tests.
Reviewers: phillco, #mercurial, #sourcecontrol
Reviewed By: phillco
Differential Revision: https://phabricator.intern.facebook.com/D6700784
Signature: 6700784:1515640770:034c3ccd602abc0b546d3936a31418803c17247b
Summary:
We changed the location of infinitepush which exposed it to the
additional test that failed. This commit fixes infinitepush to address that
test.
Test Plan: Ran all the tests.
Reviewers: rmcelroy, #mercurial, #sourcecontrol
Reviewed By: rmcelroy
Subscribers: rmcelroy
Differential Revision: https://phabricator.intern.facebook.com/D6691723
Signature: 6691723:1515578651:230bafc88354ecf10a31487967b43ab46a5a1279
Summary:
This is part of the overall plan to move extensions from fb-hgext to
hgext. Follow up commits will address some of the test issues and move the
infinitepush related tests out of fb-hgext to hgext.
Test Plan: Ran all the tests.
Reviewers: rmcelroy, #mercurial, #sourcecontrol
Reviewed By: rmcelroy
Differential Revision: https://phabricator.intern.facebook.com/D6691670
Signature: 6691670:1515578586:8d7836aebb474856559c6dbe6fe2f572c8bdf7f1
Summary:
Rust dependencies are vendored in by downloading a package containing all Rust
dependencies.
The package can be updated using the new `vendorcrates.py` script.
Test Plan: Build using the vendored packages.
Reviewers: quark, #mercurial
Reviewed By: quark
Differential Revision: https://phabricator.intern.facebook.com/D6689642
Tasks: T24908724
Signature: 6689642:1515548647:8051ec3dadd98873f0312bb67978846ba029b558
Summary:
D6685044 changed the location of fastmanifest which exposed it to the
additional test that failed. This commit fixes fastmanifest to address that
test.
Test Plan: Ran all the tests.
Reviewers: #mercurial, #sourcecontrol
Differential Revision: https://phabricator.intern.facebook.com/D6685170
Summary:
This is part of the overall plan to move extensions from fb-hgext to
hgext. Follow up commits will address some of the test issues and move the
fastmanifest related tests out of fb-hgext to hgext.
Test Plan: Ran all the tests.
Reviewers: durham, #mercurial, #sourcecontrol
Reviewed By: durham
Subscribers: durham
Differential Revision: https://phabricator.intern.facebook.com/D6685044
Signature: 6685044:1515524660:7cb9f8f28478e7bbf816f3823406c788b79a053a
Summary:
Moves ctreemanifest into hgext/extlib/. D6679698 was committed to scratch branch
by mistake.
Test Plan: make local && cd tests && ./run-tests.py
Reviewers: durham, #mercurial, #sourcecontrol
Reviewed By: durham
Differential Revision: https://phabricator.intern.facebook.com/D6684623
Signature: 6684623:1515522634:9bec363d00990d9ff7d5f655e30ab8cae636155c
Summary:
Some issues are difficult to fix right now so I'm just checking a few
errors in.
Test Plan: run-tests.py
Reviewers: mitrandir, #mercurial
Reviewed By: mitrandir
Subscribers: mitrandir, terrelln
Differential Revision: https://phabricator.intern.facebook.com/D6675890
Tasks: T24908724
Signature: 6675890:1515493853:bfdd6c504be2bd0208c2e272183354c688019ac9
Summary:
Moves the remotefilelog extension into hgext/ and it's tests into
tests/.
I did not fix up all the check-module errors, since it's a ton of work for
very little impact at this point.
Test Plan: make local && ./run-tests.py
Reviewers: #mercurial
Differential Revision: https://phabricator.intern.facebook.com/D6680030
Summary:
Moves ctreemanifest into hgext/extlib/. It will be built in a later
step when we add cstore to the build.
Test Plan: make local && cd tests && ./run-tests.py
Reviewers: #mercurial
Differential Revision: https://phabricator.intern.facebook.com/D6678844
Summary:
This moves the cdatapack code to the new lib/ directory and adds it to the main
setup.py.
Test Plan: hg purge --all && make local && cd tests && ./run-tests.py -S -j 48
Reviewers: #mercurial
Differential Revision: https://phabricator.intern.facebook.com/D6677491
Summary:
hggit is not guaranteed available in the repo. So let's skip the test
temporarily.
Test Plan:
Run the test with clean PYTHONPATH and it does not complain about failed to
import hggit.
Reviewers: durham, #mercurial
Reviewed By: durham
Differential Revision: https://phabricator.intern.facebook.com/D6678488
Signature: 6678488:1515453639:bf9c4b53273c9b00d7c09c947af9849ebd272ad0
Summary:
cdatapack depends on clib, so let's move it to lib/ outside of fb-hgext.
None of the consumers of these files were changed. They will be changed as they
are moved into the main part of the repo.
Test Plan: hg purge --all && make local && cd tests && ./run-tests.py -S -j 48
Reviewers: mitrandir, #mercurial
Reviewed By: mitrandir
Differential Revision: https://phabricator.intern.facebook.com/D6677197
Signature: 6677197:1515447873:399fb3e7beb5cc1ad8db18f42b359ffbfbeb21f2
Summary:
cdatapack depends on sha1detectcoll, so let's add the library to setup.py before
we add cdatapack.
Test Plan:
hg purge --all && make local && cd tests/ && ./run-tests.py -S -j 48
Verified sha1dc was in the build output and the tests passed.
Reviewers: quark, #mercurial
Reviewed By: quark
Differential Revision: https://phabricator.intern.facebook.com/D6676405
Signature: 6676405:1515444508:2da65c6c3a18267a1d3c151c8e9acf60b674ffc2
Summary: Update check-code test output to reflect new locations of hgsql.
Test Plan: Run tests.
Reviewers: rmcelroy, #sourcecontrol
Reviewed By: rmcelroy
Differential Revision: https://phabricator.intern.facebook.com/D6661008
Tasks: T24908724
Signature: 6661008:1515089234:3c082103ebe6ec083b02281777c1f1d159528c27
Many hosting services consider README without extension as plain text. By using
.rst extension, we bring better formatting on many services (e.g. bitbucket).