Commit Graph

159 Commits

Author SHA1 Message Date
Saurabh Singh
16da1518e5 perforce: remove p4fastimport
Summary:
I think we moved the last perforce based repository into `fbsource`.
From the Scuba logs, this doesn't seem to be used any more:
https://fburl.com/scuba/lc6vgy3v. We can revive the extension if required for a
future Perforce repository import.

Reviewed By: quark-zju

Differential Revision: D17630314

fbshipit-source-id: e3ca1a97974aff5fc262b8c724b70d4548280325
2019-09-27 16:31:34 -07:00
Xavier Deguillard
efad0cf903 cstore: remove py-cdatapack
Summary:
With fastdatapack gone, the cdatapack bindings are no longer necessary and can
be removed.

Reviewed By: singhsrb

Differential Revision: D16476584

fbshipit-source-id: 130a9c5aed4e4f005876c420961f09d398f6e6aa
2019-07-26 10:35:46 -07:00
Jun Wu
84ae2cbc73 test-revset: comment out a test case that cannot be translated
Summary: This makes the test translatable. The second next diff will recover the test case.

Reviewed By: xavierd

Differential Revision: D16452923

fbshipit-source-id: ca45c42538012152f384a0cd8334a9c513507cad
2019-07-24 14:32:26 -07:00
Xavier Deguillard
ec9ec06360 run-tests: add testpilot test runner
Summary:
Testpilot can give us a lot of things for free, including the automatic
detection of flaky tests, disabling of them, re-enabling too, easy retries on
failure, timeouts, better tracking, and the list goes on.

At a first step, I'd like to make the testpilot runner the default in hgbuild
to get all the benefits listed above.

Reviewed By: quark-zju

Differential Revision: D16294182

fbshipit-source-id: aadfbac9eb05e9d64336daba7a50a6263e38c162
2019-07-19 11:47:04 -07:00
Brian Strauch
93780344d2 debugedenimporthelper get file size
Summary: `hg debugedenimporthelper --get-file-size PATH:REV` will print the size of the given file

Reviewed By: chadaustin, xavierd

Differential Revision: D16009279

fbshipit-source-id: 6edb01dd154a467cdd26c0ced1d4ae82411088f1
2019-06-26 17:09:14 -07:00
Kostia Balytskyi
a61dbb725b branches: delete hgsubversion test related to branches
Summary: It fails the build currently.

Reviewed By: quark-zju

Differential Revision: D14108628

fbshipit-source-id: 5721a3513c5234df1c96756a3ab48b3b6c9c350f
2019-02-15 11:26:56 -08:00
Jun Wu
c12e300bb8 codemod: move Python packages to edenscm
Summary:
Move top-level Python packages `mercurial`, `hgext` and `hgdemandimport` to
a new top-level package `edenscm`. This allows the Python packages provided by
the upstream Mercurial to be installed side-by-side.

To maintain compatibility, `edenscm/` gets added to `sys.path` in
`mercurial/__init__.py`.

Reviewed By: phillco, ikostia

Differential Revision: D13853115

fbshipit-source-id: b296b0673dc54c61ef6a591ebc687057ff53b22e
2019-01-28 18:35:41 -08:00
Jun Wu
ea51d92c68 commands: move debugcommands to commands/debug
Reviewed By: DurhamG

Differential Revision: D12910540

fbshipit-source-id: 1f4413db6294cbdf0333b88cac1e7d22f81ccc9c
2018-12-12 21:03:38 -08:00
Jun Wu
fe6f7ecf7b rust: reinvent Python's threading.Condition
Summary:
Python 2's `threading.Condition` and `threading.RLock` implementation are in
pure Python. Part of `RLock.acquire` looks like (simplified):

    def acquire(self, blocking=1):
        me = _get_ident()
        if self.__owner == me:
            self.__count = self.__count + 1
            return 1
        rc = self.__block.acquire(blocking)
        ########## Here #########
        if rc:
            self.__owner = me
            self.__count = 1
        return rc

If an interruption (ex. SIGTERM) happens at "HERE". The lock would be in an
inconsistent state. And if some `finally` block, or `__exit__` in a context
manager tries to release the lock, it could deadlock.

Similar problems also apply to `release`, `_acquire_restore`, and
`_release_save`. Basically, `self.__owner`, `self.__count` and `self.__block`
(i.e. the real lock) cannot be guaranteed in a consistent state in pure Python
world, because interruption can happen before any Python bytecode instruction
(but not inside a single Python bytecode instruction).

Therefore the interruption-safe implementation cannot be done in pure Python.
Use Rust to rescue.

The added test `streetest-condint.py` has a high chance to reproduce the
deadlock issue with Python 2.

Python 3 has a native RLock implementation, which makes things better. The
"Condition" implementation is not native and I haven't checked whether it
is sound or not.

Unfortunately, as part of testing, I hit https://bugs.python.org/issue29988 and
confirmed from the Rust world. That is, `__exit__` is not guarnateed called (!!)

That means native implementations still have a chance to be wrong, and there is
no easy way to fix it. `streetest-condint.py` was then updated to expose the
issue more easily.

The implementation is better than Python 2 stdlib, though.

Reviewed By: markbt

Differential Revision: D10517920

fbshipit-source-id: 394c9050c512ce2a0f9743c28ccfafe0f560141a
2018-10-25 13:12:00 -07:00
Durham Goode
574d6e98a1 hggit: change git-mapfile to be append only
Summary:
This changes the git-mapfile to be append only. It then makes gitlookup
find hashes by scanning from the end of the mapfile backwards. Since most
lookups are for recent commits, this should greatly speed up hg->git hash
lookups and remove the need to sort the mapfile before writing.

Reviewed By: singhsrb

Differential Revision: D10521208

fbshipit-source-id: 7073d3f4796674416ae05e0ac9f36035ca0835db
2018-10-24 08:39:19 -07:00
Durham Goode
3713a821f8 hggit: sort git-mapfile and use bisect to do git-getmeta
Summary:
Previously, git-getmeta would have to scan through the entire git map
file, which was extremely expensive. Let's shift this cost to write time by
sorting the map file before writing, then using bisect to lookup nodes.

A while ago we switch hggit to only serialize the mapfile every 100 commits or
so, so the additional time here shouldn't be excessive.

Reviewed By: quark-zju

Differential Revision: D10470293

fbshipit-source-id: 47e23d251adde5456e7b593bfcc5976259a497f2
2018-10-19 15:42:18 -07:00
Mark Thomas
ab55bd31c6 newdoc: fix test failures and warnings
Summary:
Remove newdoc from test-check-code - it's a Sphinx project, so MiniRST
checks don't apply.  Also remove the unused imports from the Sphinx config
file.

Reviewed By: farnz

Differential Revision: D9851834

fbshipit-source-id: c17e83fd96d39423eeedfb8a6cfae382f88c4d5f
2018-09-17 08:56:40 -07:00
Saurabh Singh
c5a2f465ca globalrevs: support global revs for commits created using hgsubversion
Summary:
This commit enables embedding global revisions in commits created via
the `hgsubversion` extension.

Reviewed By: quark-zju

Differential Revision: D8925897

fbshipit-source-id: 17f320dd7b6ca560acb78ba8e5ee26a8a3a6b045
2018-07-23 18:53:16 -07:00
Phil Cohen
f4ea2a98c3 tests: remove some archaic shell rules from check-code.py
Summary:
Generally `$()` is preferred over `\`\`` -- so I was surprised it was here. And `(( ))` is Bash's useful arithmetic operator.

Per IRL discussion with quark-zju, we don't really care about non-Bash shells, which this is meant to support.

Reviewed By: quark-zju

Differential Revision: D8721467

fbshipit-source-id: 2a05ca486036fcbdb45d127dbe18e5539f0c956a
2018-07-11 21:09:31 -07:00
Phil Cohen
b0f6461d61 tests: make test-check-code 2x faster
Summary:
Use the fast "hg files PATH" construct added by D8721759 now that it's available in system hg.

Laptop: 19s -> 9s
Devserver: 6.18s -> 3.55s

Reviewed By: quark-zju

Differential Revision: D8787327

fbshipit-source-id: 23f539ae8422bf184d882893accb3e8d0bfa3b5f
2018-07-11 11:23:04 -07:00
Phil Cohen
0cc316cdc4 tests: run check-code.py in parallel via xargs (2x-4x speedup)
Summary:
This cuts the total time for this test from:

Laptop: 24s -> 12.4s
Devserver: 23s -> 5.8s

Reviewed By: quark-zju

Differential Revision: D8721177

fbshipit-source-id: f2922093a72c29f05d08967a77d83fbc65c0ed14
2018-07-03 11:36:17 -07:00
Phil Cohen
cd0765f073 tests: make check-code.py output in a sortable way, and sort it
Summary:
Print the output from check-code.py in a way amenable to sorting (mostly, print each offense on one line instead of several)

The next diff will explain why.

Reviewed By: quark-zju

Differential Revision: D8721178

fbshipit-source-id: d814f94c151c6251f827ed6fe099e170e0b5353a
2018-07-02 23:50:57 -07:00
Phil Cohen
b879f0f5b3 tests: fix legitimate test-check-code.t failures
Summary: Mostly os.getcwd() or os.environ issues.

Reviewed By: DurhamG, quark-zju

Differential Revision: D8721169

fbshipit-source-id: 6615382775ce29dff814d830841f0c7eb4cad901
2018-07-02 23:50:56 -07:00
Phil Cohen
1064b3d79c tests: remove check-code complaint about grep's context flags
Summary:
It blames to here: https://www.mercurial-scm.org/repo/hg-committed/rev/0c09afdf5704

I'm pretty sure we don't care about Solaris :)

Reviewed By: DurhamG

Differential Revision: D8721170

fbshipit-source-id: 0c500ccb28828862136f6fcc44181477f5a21eee
2018-07-02 19:21:01 -07:00
Phil Cohen
b5f65c2cff tests: move "no new files in root" check to its own file
Summary:
This takes about 4.5s on my laptop. By moving it to its own file, we can run it in parallel and save from the total check-code time.

Laptop: 31.74s -> 25.53s
Devserver: 24.5s -> 22.21s

Reviewed By: quark-zju

Differential Revision: D8721156

fbshipit-source-id: 6d4d2c86517239f1762a413bc5d3dfefe184eaca
2018-07-02 19:21:01 -07:00
Adam Simpkins
71dc89f250 generate __version__.py during the buck build
Summary:
The chg code now always attempts to import __version__.py
Previously this was not generated during buck-based builds.  This updates the
buck build to generate a __version__.py file now.

Reviewed By: ryanmce

Differential Revision: D8601650

fbshipit-source-id: 59bd0605394feeabcc41766a7e55cbdd253f07ad
2018-06-25 15:52:25 -07:00
Mark Thomas
51d851c20a dagop: handle wdir() in dagrange expressions
Summary:
Using `wdir()` in dagrange expressions (e.g. `master::wdir()`) causes Mercurial
to crash with `IndexError: head out of range`.  This is because the dagrange
operations can't use the wdir rev number as it is out of range for the
changelog.

Instead, modify the revisions that we are passing in to calculate the matching
revs, and add the wdirrev at the last moment if appropriate.

Reviewed By: ryanmce

Differential Revision: D8592129

fbshipit-source-id: 8742cb72c22d1ba26f5d03f9fcf56bfdb785c25a
2018-06-25 05:19:58 -07:00
Jun Wu
584656dff3 codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).

Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.

Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.

An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.

As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.

Reviewed By: wez, phillco, simpkins, pkaush, singhsrb

Differential Revision: D8173629

fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-25 22:17:29 -07:00
Adam Simpkins
5682d5e0db move scm/hg/.clang-format to scm/hg/mercurial/
Summary:
The clang-format file in scm/hg basically only applies to things in the
scm/hg/mercurial directory.

There are 180 C and C++ files under scm/hg, and the vast majority of them do
not follow the style specified in this clang-format file.  All but 11 of these
files were present in scm/hg/contrib/clang-format-blacklist.

Of the 11 files that do follow this style, 10 are in the scm/hg/mercurial/
directory.  (10 of the 21 files in this directory use this style.)  The 1
other file is in scm/hg/contrib/xdiff.

The majority of the C/C++ files in scm/hg/hgext/extlib and scm/hg/lib/ follow
a style closer to Facebook and Google's C++ style guidelines.

Therefore this moves the .clang-format file to scm/hg/mercurial, and lets the
main fbsource clang-format file apply to the other files under scm/hg

Reviewed By: quark-zju

Differential Revision: D8131512

fbshipit-source-id: 622a33abc39eb240eff4ca27f69a675a7ed54a89
2018-05-25 14:35:51 -07:00
Michael Bolin
54b487b301 Move hgext/fsmonitor/pywatchman/ to hgext/extlib/pywatchman/
Summary:
This is a precursor to splitting the fsmonitor extension, as both
it and the new extension will use pywatchman.

Reviewed By: quark-zju

Differential Revision: D8002713

fbshipit-source-id: 37983fe2898d23223d1178eb3f15685f17ff8868
2018-05-15 12:06:47 -07:00
Jun Wu
b055d6aace cleanup: remove "fb/" from test-check tests
Summary:
Either fix or ignore issues in `fb/` so the test is consistent if run
externally.

Reviewed By: DurhamG

Differential Revision: D7850647

fbshipit-source-id: 0f7faa3be2dff1dcf61a3b765c1827583fafc14f
2018-05-02 14:01:09 -07:00
Jun Wu
3368506521 tests: fix test-check-code.t
Summary:
There is a proper way [1] to skip the dict check-code check. Let's use it.

[1]: a61ed1c2d7

Reviewed By: DurhamG

Differential Revision: D7831336

fbshipit-source-id: a5e654e9e94cbfb1c5a07b047eb6e5451904c48e
2018-05-01 14:17:43 -07:00
Mateusz Kwapich
3e05d1c44a fix test outputs to unbreak the builds
Reviewed By: markbt

Differential Revision: D7831727

fbshipit-source-id: 65b2c5047a6738cda2e07d9bd319cfdc3db20b3f
2018-05-01 11:11:54 -07:00
Martijn Pieters
a9f4167218 sparse: add filtering on field contents
Summary: This lets you select on substrings in fields and paths.

Reviewed By: quark-zju

Differential Revision: D7788826

fbshipit-source-id: f92b8cc646fd36f4cb3b8a4dc6116576db80eb42
2018-04-30 14:16:44 -07:00
Alexandre Marin
69005698f4 importer - call p4 where with multiple paths
Summary:
We currently call p4 where with one path at a time, but it accepts a list.
This change takes advantage of that, batching p4 where calls, which speeds up
importing.

Differential Revision: D7676378

fbshipit-source-id: 4a6747458555a60dd5f385604f2a25d595af947d
2018-04-19 17:08:30 -07:00
Martijn Pieters
926a3c222b fbclone: silence check-code test failure
Summary: Yes, the path to the script is hardcoded, because we want to make sure we test the right version, and not anything else found on the path.

Reviewed By: DurhamG

Differential Revision: D7600431

fbshipit-source-id: d08a2e98fa40823412e3d2925a3b2862ffb0f1a2
2018-04-13 21:51:54 -07:00
Mateusz Kwapich
323157e712 add a hint about hg undo to hide
Summary:
I know that `hg undo` is useful for undoing most of the commands
but hide is the one that a bit more sensitive because it's
the command to remove commits from your smartlog.

Also I'm planning on introducing additional, more powerful options
for hide and that could be useful for undoing them.

Reviewed By: ryanmce

Differential Revision: D7350795

fbshipit-source-id: fbc42674fe0ca4ac6300c08095897f624d41a2f3
2018-04-13 21:51:52 -07:00
Kostia Balytskyi
fa03821500 hg: fix test-checks broken in windows treemanifest stack
Reviewed By: quark-zju

Differential Revision: D7560133

fbshipit-source-id: 98b016d0911aaecc1058263c134a5e4ecd0be9e5
2018-04-13 21:51:50 -07:00
Jun Wu
18c17ec9f1 tweakdefaults: use hint framework for prev
Summary:
A side effect is, the hint won't be printed out if fbamend is not enabled,
which is more "correct".

Reviewed By: markbt

Differential Revision: D7392130

fbshipit-source-id: 5b7aa4cc3083b03546c54965ce51040fab958b87
2018-04-13 21:51:49 -07:00
Liubov Dmitrieva
e3276c7e7b introduced secure token injection
Summary:
new command `hg cloudregister`

storing user token

Reviewed By: DurhamG

Differential Revision: D7367301

fbshipit-source-id: e8eb3d51cf62e9c1e91c39be45e0ad8b49a74442
2018-04-13 21:51:47 -07:00
Liubov Dmitrieva
1c8877987d https connector
Summary: https connector for commit cloud

Reviewed By: mjpieters

Differential Revision: D7306672

fbshipit-source-id: c95388964a1aced82579c0d55ccdd0a9ef391e81
2018-04-13 21:51:35 -07:00
Mark Thomas
52d272277f fastannotate: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329490

fbshipit-source-id: 3c8bf8b0590b1d3e5bf567849de4b7c88ea8b894
2018-04-13 21:51:33 -07:00
Ryan McElroy
2e2949fcbf revsetlang: add a hint for more useful parse errors
Summary:
This logic is largely based on the similar logic added to template error
messages in D2608 and D2609, but with a few tweaks based on how revsets
actually work.

Differential Revision: D7148779

fbshipit-source-id: fb435788711a2c4ef881dfaeac5176fc1972c07a
2018-04-13 21:51:30 -07:00
Durham Goode
7c43ca7c6b hg: fix tests on OSX
Summary: sed -i without arguments doesn't work on OSX.

Reviewed By: farnz

Differential Revision: D7195193

fbshipit-source-id: a8eead927c94404a37ce5df956de82d29bc1b6a8
2018-04-13 21:51:24 -07:00
Mateusz Moneta
4cfb665650 Update markers during hg pullbackup
Summary:
Before this change `hg pullbackup` did not set correct markers on commits.

This change make possible to see what changes already landed even when we are restoring repository from backup.
Before the change `fbclone` + `hg pullbackup` of repo with `C1` commit landed would result in:
```
o  o C2
|    |
o  o C1
|  /
|
o
```
after:
```
o  o C2
|    |
o  x C1
|  /
|
o
```

Reviewed By: StanislavGlebik

Differential Revision: D7032572

fbshipit-source-id: ffee3c7cc23c24a3df9a89c999c9dd2de226dbff
2018-04-13 21:51:23 -07:00
Saurabh Singh
cc2a9a760d hg: remove facebook-hg-rpms related code
Summary:
Don't think this is required or used anymore and reveals information
about the structure of our project if we open source our mercurial.

Reviewed By: quark-zju

Differential Revision: D7128203

fbshipit-source-id: 4cdfa008631d08321a4d5a1c8f18cef429c35077
2018-04-13 21:51:20 -07:00
Martijn Pieters
42ac84e8cf sparse: clean up path handling, making it platform agnostic
Summary:
There is no need to strip path separators from the normalised path; normpath
will never leave any.

We also ensure that the path prefix we test ends in a path separator, to avoid
matching on sibling paths that happen to share a prefix.

Reviewed By: ryanmce

Differential Revision: D7056649

fbshipit-source-id: 10b78a78ba44fbc8d9c05fb7ffd0ffd1c1496a67
2018-04-13 21:51:18 -07:00
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