Commit Graph

18 Commits

Author SHA1 Message Date
Mark Thomas
8b012b264d tidy up command usage
Summary: Some commands in extensions have incorrectly defined usage.  Correct these.

Reviewed By: phillco

Differential Revision: D10446707

fbshipit-source-id: e606314892a31fa09f4a655042d66d87929fc2ec
2018-10-19 06:51:42 -07:00
Mark Thomas
f18bd9714d help: improve some help messages
Summary: Make a few help messages clearer.

Reviewed By: phillco

Differential Revision: D10356915

fbshipit-source-id: 277d4cecbd17b647d6dd01209ff6f93a926d37d4
2018-10-15 09:37:19 -07:00
Kostia Balytskyi
294884234e shelve: fix configs after renaming obsshelve as shelve
Summary: See title.

Reviewed By: singhsrb

Differential Revision: D10261259

fbshipit-source-id: 24df3f7f337da8bbf982fc3cb849fe5ba7dab5a3
2018-10-12 06:30:04 -07:00
Mark Thomas
463cc8f299 hgext: use repo.localvfs instead of repo.vfs
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
2018-09-28 07:23:01 -07:00
Lukasz Langa
dfda82e492 Upgrade to 18.5b1
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
2018-05-30 02:23: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
Mark Thomas
3a1c10039e smartlog: compare dates not time when determining one week ago
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
2018-05-23 09:02:50 -07:00
Durham Goode
bda8c04368 hg: fix smartlog.useancestorcache in shared workdirs
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
2018-04-17 20:34:31 -07:00
Mateusz Kwapich
0865966eb6 use masterrev even if revset is specified
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
2018-04-13 21:51:49 -07:00
Mark Thomas
2fed5ca134 smartlog: add smart date display to smartlog
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
2018-04-13 21:51:40 -07:00
Liubov Dmitrieva
ee6457a0fb obsshelve: add highlight
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
2018-04-13 21:51:36 -07:00
Mark Thomas
629b2a9ec4 smartlog: always show latest public ancestor of draft commits
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
2018-04-13 21:51:21 -07:00
Jun Wu
6ecd47c391 smartlog: prefer gdbm to anydbm
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
2018-04-13 21:51:11 -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
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
Kostia Balytskyi
925e76d0c6 smartlog: do not specify -T twice
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
2018-01-09 06:48:08 -08:00
Kostia Balytskyi
0e4d95b67e fb-hgext: fix gendoc-related issues
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
2018-01-09 03:44:33 -08:00
Kostia Balytskyi
e75b9fc1b1 fb-hgext: move most of hgext3rd and related tests to core
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
2018-01-09 03:03:59 -08:00