Commit Graph

117 Commits

Author SHA1 Message Date
Kostia Balytskyi
7d4f6a9033 hg: start using imported mman-win32 in the portability headers
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
2018-04-13 21:51:10 -07:00
Jun Wu
f1c575a099 flake8: enable F821 check
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
2018-04-13 21:51:09 -07:00
Jun Wu
0daed9e7f6 flake8: resolve some F checks
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
2018-04-13 21:51:09 -07:00
Jun Wu
2946a1c198 codemod: use single blank line
Summary: This makes test-check-code cleaner.

Reviewed By: ryanmce

Differential Revision: D6937934

fbshipit-source-id: 8f92bc32f75b9792ac67db77bb3a8756b37fa941
2018-04-13 21:51:08 -07:00
Jun Wu
88dccd4a14 test-check: port some check-commit rules to check-code
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
2018-04-13 21:51:08 -07:00
Peter Na
0911201aa9 fbsparse: add progress output for refresh
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
2018-04-13 21:51:04 -07:00
Jun Wu
1cde63d99c codemod: drop hacks changing PYTHONPATH in tests
Summary:
Now they are unnecessary since `run-tests.py` will set up `PYTONPATH`
correctly.

Differential Revision: D6865042

fbshipit-source-id: ca95314f725968e14349a9d916434aa832c596f9
2018-04-13 21:51:00 -07:00
Mark Thomas
4b7dab149a hg: improve perf interactions with treedirstate
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
2018-04-13 21:50:58 -07:00
Durham Goode
2c5a125383 hg: fix check-code test
Summary: N/A

Reviewed By: quark-zju

Differential Revision: D6814855

fbshipit-source-id: bb98a13974205bdaef90d39db1271a5ed5b9c485
2018-04-13 21:50:58 -07:00
Durham Goode
8d8353d5e3 hg: fix check code
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
2018-04-13 21:50:56 -07:00
Phil Cohen
1678b89caf test-check-code: fix legitimate failure
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
2018-04-13 21:50:56 -07:00
Kostia Balytskyi
e45985d846 hggit: skip, not fail a test if dulwich is missing
Summary: This manifests itself on MacBooks where dulwich is not installed.

Differential Revision: D6759617

fbshipit-source-id: c90c35ebaa4fd2a14b1ad2fa0fadaca3c6ea8c29
2018-04-13 21:50:54 -07:00
Siddharth Agarwal
af0f79a556 watchman: add an empty .watchmanconfig
Summary:
This ensures that watchman doesn't complain when it starts watching this
directory.

Differential Revision: D6757821

fbshipit-source-id: 30b3e71b9601e74af51ad7ac18e1f197777b9e72
2018-04-13 21:50:54 -07:00
Jun Wu
7fa918cefd perftweaks: move commit head detection removal logic to core
Summary: Also change the internal API so it no longer accepts the "heads" argument.

Reviewed By: ryanmce

Differential Revision: D6745865

fbshipit-source-id: 368742be49b192f7630421003552d0a10eb0b76d
2018-04-13 21:50:52 -07:00
Kostia Balytskyi
62064c1381 hgsubversion: accept some test-check line reshuffles
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
2018-01-17 03:23:44 -08:00
Phil Cohen
66cb3160e1 sparse: don't materialize sparse files during IMM
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
2018-01-16 17:43:19 -08:00
Phil Cohen
5b330bb027 testsdir: fix for fb/packaging
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
2018-01-10 21:19:51 -08:00
Saurabh Singh
fddb5ec798 test-check-code: fix path to correct value
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
2018-01-10 20:05:57 -08:00
Saurabh Singh
cf825689ed facebook-hg-rpms: fix the tests due to D6700605
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
2018-01-10 19:19:46 -08:00
Mateusz Kwapich
6da99d7b2a hgsubversion: fix core tests
Summary: Mostly just check code updates.

Test Plan: Ran the tests

Reviewers: singhsrb, #mercurial

Reviewed By: singhsrb

Differential Revision: https://phabricator.intern.facebook.com/D6698640

Signature: 6698640:1515628510:7b80ef593d2007810064d8226a3b45e2a1ee370f
2018-01-10 16:20:45 -08:00
Durham Goode
7f67b6a618 tests: update check code tests for fb/facebook-hg-rpms/ 2018-01-10 13:27:59 -08:00
Ryan McElroy
559e7547a0 remotenames: re-enable hggit-related test
Summary: Backed out changeset 213f1f4306c1

Test Plan: `run-tests.py`

Reviewers: ikostia, #mercurial

Reviewed By: ikostia

Differential Revision: https://phabricator.intern.facebook.com/D6693062

Signature: 6693062:1515600922:d8380108fd3129ee6b739a47e72523e1c19b86ce
2018-01-10 08:15:55 -08:00
Saurabh Singh
567b4fad29 infinitepush: fix test-check-code.t related errors
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
2018-01-10 08:10:27 -08:00
Ryan McElroy
4488942ef2 infinitepush: move infinitepush from fb-hgext to hgext
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
2018-01-10 08:10:27 -08:00
Mark Thomas
75980fb243 build: vendor in Rust dependencies
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
2018-01-09 17:48:32 -08:00
Saurabh Singh
163b35ec2e fastmanifest: fix test-check-code.t related errors
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
2018-01-09 11:13:10 -08:00
Saurabh Singh
ad7d64e944 fastmanifest: move fastmanifest from fb-hgext to hgext
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
2018-01-09 11:13:10 -08:00
Saurabh Singh
9da30944be cfastmanifest: move to hgext/extlib/
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
2018-01-09 10:36:54 -08:00
Ryan McElroy
66bd74e558 hggit: internalize extension
Test Plan: run-tests-.py

Reviewers: mitrandir, #mercurial

Reviewed By: mitrandir

Subscribers: ps, terrelln

Differential Revision: https://phabricator.intern.facebook.com/D6675896

Tasks: T24908724

Signature: 6675896:1515448382:df8d80cd7356ae8f5fb04586dc4a0a651bc498fd
2018-01-09 06:08:01 -08:00
Ryan McElroy
86609d7d59 hggit: fix check-code issues
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
2018-01-09 05:53:20 -08:00
Kostia Balytskyi
c40bd9954a fb-hgext: temporarily accept failures for test-check-code.t
Summary: This is a temporary commit, meant to be fixed later.

Test Plan: - test passes now

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D6675412
2018-01-09 04:45:57 -08:00
Durham Goode
fe980ff373 remotefilelog: move to hgext/
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
2018-01-08 18:58:08 -08:00
Durham Goode
228e6a901e cstore: move to hgext/extlib/
Summary: Moves cstore to hgext/extlib/ and makes it build.

Test Plan: make local && run-tests.py

Reviewers: #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D6678852
2018-01-08 17:55:53 -08:00
Durham Goode
3ae4bd8cf5 ctreemanifest: move to hgext/extlib/
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
2018-01-08 17:55:53 -08:00
Durham Goode
eb099b7fe1 cdatapack: move to lib/
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
2018-01-08 17:55:53 -08:00
Jun Wu
1055b4aeae test-remotenames-basic: skip hggit test cases
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
2018-01-08 13:55:19 -08:00
Durham Goode
0938fe19a3 clib: move fb-hgext/clib/ to lib
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
2018-01-08 15:08:18 -08:00
Durham Goode
1ab0bb112d sha1: add sha1detectcoll library to setup.py
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
2018-01-08 12:54:57 -08:00
Mark Thomas
34c6eb7ccf hgsql: update check-code test output
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
2018-01-04 10:54:02 -08:00
Ryan McElroy
00e6e6f4bd hgsubversion: changes to pass check-code 2018-01-03 11:51:20 -08:00
Richard Langston
6debc1248f hg-git: exclude hg-git from checks 2018-01-03 10:03:16 -08:00
Kostia Balytskyi
a8eac4349b fb-hgext: ignore test-check-code failures 2018-01-03 09:46:16 -08:00
Mark Thomas
355f57bd1a hgsql: accept new test failures 2018-01-03 07:03:21 -08:00
Stanislau Hlebik
23dd2cf1eb remotenames: accept test failures 2018-01-03 06:28:53 -08:00
Yuya Nishihara
655da40532 thirdparty: move selectors2 module to where it should be 2017-11-30 22:43:03 +09:00
Anton Shestakov
9c20612eac hgweb: add .jshintrc with some basic rules
This file is picked up automatically by jshint, so no extra changes required in
test-check-jshint.t.
2017-11-22 22:18:06 +08:00
Augie Fackler
8616945a99 clang-format: configuration for the clang-format source formatter
Differential Revision: https://phab.mercurial-scm.org/D1129
2015-01-24 17:04:25 -05:00
David Demelier
f8643ab014 doc: rename README to README.rst
Many hosting services consider README without extension as plain text. By using
.rst extension, we bring better formatting on many services (e.g. bitbucket).
2017-09-26 08:37:17 +02:00
Siddharth Agarwal
4247de0b07 tests: disable lints on mercurial/thirdparty
In the next patch, this directory will be used to vendor in some third-party
code.

Differential Revision: https://phab.mercurial-scm.org/D866
2017-10-01 03:24:19 -07:00
Alex Gaynor
dbc20f0fe6 phabricator: include the suggested arc config in the repo
Test Plan:
I uploaded this revision with `arc diff`

Differential Revision: https://phab.mercurial-scm.org/D171
2017-07-21 14:22:08 +00:00