Commit Graph

8 Commits

Author SHA1 Message Date
Jun Wu
9cf21d7754 obsshelve: remove 100 patches per branch limit
Summary:
Backports the `shelve.py` change [1] to `obsshelve.py`.

[1]: 4107eb8a56

Reviewed By: DurhamG

Differential Revision: D7691913

fbshipit-source-id: 642eade39c50f6a161dae5af51b7ab54025de322
2018-04-19 15:05:28 -07:00
Liubov Dmitrieva
3ab4155a04 obsshelve: bugfix with old format shelves
Summary:
fix bug with new shelved() revsetpredicate

it failed if old format shelve files were present

Differential Revision: D7414883

fbshipit-source-id: 7b96abe7abf950ba339c22d0e9025f7423004911
2018-04-13 21:51:37 -07:00
Liubov Dmitrieva
d0972892e5 shelve: add revsetpredicate to select shelved commits
Summary:
add revsetpredicate to select shelved commits

if we are going to backup shelved commits, we should be able to select them

Reviewed By: ryanmce

Differential Revision: D7381561

fbshipit-source-id: 35aa0ad9a77fa9df94e91b571279eaa4301c85f3
2018-04-13 21:51:36 -07:00
Liubov Dmitrieva
f776a334b5 obsshelve: use real user for shelve commits
Summary:
The reason why we would like to have a real user there is that

we may want to start push shelved changes in commit cloud, so

we should have correct user on the commit

Reviewed By: ryanmce

Differential Revision: D7380732

fbshipit-source-id: 27b07f992a3e394016ce69e1dc9694a4dd1c336b
2018-04-13 21:51:36 -07:00
Liubov Dmitrieva
8eb1968255 obsshelve: do not use secret phase
Summary: obsshelve: do not use secret phase

Reviewed By: ryanmce

Differential Revision: D7380531

fbshipit-source-id: 21538d42a43f019b894dd1a77ba0adc67798936a
2018-04-13 21:51:35 -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
Phil Cohen
45c4a072f9 hgext: use relative imports wherever possible
Summary:
Port of D6798134 to fbsource. It eliminates module-import failures as well as errors like this:

```
mercurial.error.ForeignImportError: hgext.extlib.treedirstate: /home/phillco/.local/lib/python2.7/site-packages/hgext/extlib/treedirstate.so lives outside /..../hg
```

....that block other tests, like test-help.t

(Note: this ignores all push blocking failures!)

Reviewed By: quark-zju

Differential Revision: D6799259

fbshipit-source-id: b77d1b565dbf52165e0847002be498648658e064
2018-04-13 21:50:56 -07: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