Summary: Some commands in extensions have incorrectly defined usage. Correct these.
Reviewed By: phillco
Differential Revision: D10446707
fbshipit-source-id: e606314892a31fa09f4a655042d66d87929fc2ec
Summary: Make a few help messages clearer.
Reviewed By: phillco
Differential Revision: D10356915
fbshipit-source-id: 277d4cecbd17b647d6dd01209ff6f93a926d37d4
Summary:
Update most locations in the hg extensions to use `repo.localvfs` instead of
`repo.vfs`.
Reviewed By: quark-zju
Differential Revision: D9699153
fbshipit-source-id: 48d5f9678caa4961063db30477d6fbe0d6f34347
Summary: Mostly empty lines removed and added. A few bugfixes on excessive line splitting.
Reviewed By: quark-zju
Differential Revision: D8199128
fbshipit-source-id: 90c1616061bfd7cfbba0b75f03f89683340374d5
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
Summary:
For the smartdate template function, when displaying commits in the last week
using the day name, we compare the exact times. This means commits made late
in the day on one day, will still show using the day name early in the day the
following week.
Instead, compare just the dates. We can simplify the other date-based
comparisons, too.
Reviewed By: farnz
Differential Revision: D8113953
fbshipit-source-id: b9bed59ccf349e7274ad65d7ed5a7e08c50d4b53
Summary:
The ancestorcache function requires a db in the cache directory, but if
the cache directory did not exist, the db would fail to get created, resulting
in slow smartlogs forever. Let's ensure the cache directory exists first.
This also switches to using cachevfs, which causes it to use the source repo's
cache directory instead of the shared one, which will mean better cache hits.
Reviewed By: quark-zju
Differential Revision: D7664296
fbshipit-source-id: b99acc22ba4f87af6e1edac1c9f15d39e8451ecc
Summary:
sl assumed that the masterrev is missing from revset if any revset was
specified so it was failing back to current commit. This fixes this
behaviour by checking if masterrev is available.
Differential Revision: D7535692
fbshipit-source-id: 033088149b52293dce219b1dc7a04186bfc461b9
Summary:
Adds two new template functions:
* `simpledate` formats recent dates in a human-friendly way, for example `Today
at 12:00`, `Wednesday at 07:30`, or `Jan 05 at 23:45`. The timezone used
can be overridden.
* `smartdate` shows different results depending on whether a date is recent
or not, where "recent" is defined by a threshold parameter.
Reviewed By: quark-zju
Differential Revision: D7123734
fbshipit-source-id: 7b68207e4debc85c0bfa72bba9b375a4aa11d7c6
Summary:
obsshelve: highlight shelved changes in smartlog (you can see with --hidden)
we highlighted only active shelved changes, those that has been unshelved are just ordinary hidden changes.
Reviewed By: ryanmce
Differential Revision: D7383800
fbshipit-source-id: 2df4092514d58315a6a204411feed99819df5c93
Summary:
Smartlog is supposed to show the latest public ancestor of all draft commits,
however this doesn't always happen.
The reason is a boundary error in the test for finding public commits. If the
latest public ancestor is also the common ancestor (fairly normal), then it
will be excluded.
Reviewed By: quark-zju
Differential Revision: D7140139
fbshipit-source-id: 6999f7ad14f86653ebe4d4f6543b9c7533871cf2
Summary:
anydbm uses bsddb by default. bsddb is slower than gdbm and
is not available in buck build. Therefore use gdbm instead.
Differential Revision: D6994367
fbshipit-source-id: 948b991df31436d02f478d7a95f9924e1f8e0ed5
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:
`formatteropts` already give us the `-T`.
Depends on D6683245
Test Plan: - run `test-duplicateoptions`, see this particular thing disappear
Reviewers: #sourcecontrol
Differential Revision: https://phabricator.intern.facebook.com/D6683248
Summary:
These fixes are related to documentation-related check-style tests.
Depends on D6675344
Test Plan: - more tests pass
Reviewers: #sourcecontrol
Differential Revision: https://phabricator.intern.facebook.com/D6675351
Summary:
This commit moves most of the stuff in hgext3rd and related tests to
hg-crew/hgext and hg-crew/test respectively.
The things that are not moved are the ones which require some more complex
imports.
Depends on D6675309
Test Plan: - tests are failing at this commit, fixes are in the following commits
Reviewers: #sourcecontrol
Differential Revision: https://phabricator.intern.facebook.com/D6675329