Commit Graph

13 Commits

Author SHA1 Message Date
Wez Furlong
c83849e5af enable Black python formatting and apply to eden
Summary: No functional changes

Reviewed By: simpkins

Differential Revision: D7945989

fbshipit-source-id: e267e6134d87570427b3fdf5974006dce5774113
2018-05-09 21:37:07 -07:00
Adam Simpkins
b2251c9f7a change mercurial to look up the correct Eden mount path
Summary:
Update the Eden mercurial extension to read the `.eden/root` symlink to
determine what Eden thinks the mount path is.  This might be different from
what directory mercurial thinks it is in if a parent directory of the Eden
mount has been bind-mounted to an alternate location.

Maybe in the future we should update thrift clients to pass in the client ID
(currently readable via `.eden/client`) rather than the mount path.  That would
make it less likely for clients to accidentally forget to read `.eden/root` and
pass in the wrong mount path.

Reviewed By: wez

Differential Revision: D7705655

fbshipit-source-id: 7bd1e8013b99a52ff06dd45f63d6669b66bdf577
2018-04-24 13:11:35 -07:00
Adam Simpkins
9f2e17bf41 add type annotations to eden CLI code
Summary:
Update most of the Eden CLI code to include python type annotations.

I believe the stats.py and stats_print.py are the only CLI files that do not
have complete typing information now.

Reviewed By: chadaustin

Differential Revision: D7433368

fbshipit-source-id: dfd6a064cacffeeed9147739da7064f3303de789
2018-03-28 22:22:31 -07:00
Chad Austin
b0fac29b0b enable python typechecking from buck
Summary: Turn on check_types for CLI's python_binary.

Reviewed By: simpkins

Differential Revision: D6668636

fbshipit-source-id: abde1e1cedf2a5104cdaa5433377b1d2adc372fd
2018-01-08 12:10:19 -08:00
Michael Bolin
457f4f52e2 Include the directory that Eden was looking at in the exception message.
Reviewed By: simpkins

Differential Revision: D5997873

fbshipit-source-id: 0f598b873f6cc18ce1cd29c08b546e4884db0a66
2017-10-06 12:28:41 -07:00
Wez Furlong
4218700735 deal with idle timeouts for thrift clients
Summary:
I noticed that when running `hg push --to master`, the implicit
pull took about a minute to collect all the commits from the remote, then
we tried to make a thrift call to set the parents only to fail with a
python EPIPE stack trace.

I opted to simply make a new client for each call; this is similar to how
things were running with the lame thrift client but doesn't have as terrible
an impact on rebase performance as lame thrift client did.

It feels like things might be better if we made the client retry on transport
errors, but this is quite fiddly so let's defer that until we really need
to cut out the unix domain socket connection overheads.

```
$ hg ci
note: commit message saved in ../.hg/last-message.txt
Traceback (most recent call last):
  File "/usr/bin/hg.real", line 47, in <module>
    dispatch.run()
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 81, in run
    status = (dispatch(req) or 0) & 255
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 163, in dispatch
    ret = _runcatch(req)
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 314, in _runcatch
    return _callcatch(ui, _runcatchfunc)
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 365, in _callcatch
    if not handlecommandexception(ui):
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 993, in handlecommandexception
    ui.log("commandexception", "%s\n%s\n", warning, traceback.format_exc())
  File "/usr/lib64/python2.7/site-packages/hgext3rd/sampling.py", line 79, in log
    return super(logtofile, self).log(event, *msg, **opts)
  File "/usr/lib64/python2.7/site-packages/hgext/blackbox.py", line 163, in log
    parents = ctx.parents()
  File "/usr/lib64/python2.7/site-packages/mercurial/context.py", line 286, in parents
    return self._parents
  File "/usr/lib64/python2.7/site-packages/mercurial/util.py", line 862, in __get__
    result = self.func(obj)
  File "/usr/lib64/python2.7/site-packages/mercurial/context.py", line 1546, in _parents
    p = self._repo.dirstate.parents()
  File "hgext3rd/eden/eden_dirstate.py", line 163, in parents
  File "hgext3rd/eden/eden_dirstate.py", line 157, in _getparents
  File "/usr/local/fb-mercurial/eden/hgext3rd/eden/EdenThriftClient.py", line 145, in getParentCommits
    parents = self._client.getParentCommits(self._root)
  File "facebook/eden/EdenService.py", line 7330, in getParentCommits
  File "facebook/eden/EdenService.py", line 7339, in send_getParentCommits
  File "thrift/transport/THeaderTransport.py", line 411, in flush
  File "thrift/transport/THeaderTransport.py", line 516, in flushImpl
  File "thrift/transport/TSocket.py", line 315, in write
thrift.transport.TTransport.TTransportException: Socket send failed with error 32 (Broken pipe)
```

Reviewed By: bolinfest

Differential Revision: D5942205

fbshipit-source-id: 464e5035075476f47232ca975e107e165057c912
2017-10-02 18:21:44 -07:00
Wez Furlong
9c634a9ce2 readlink .eden/socket before connecting
Summary:
The eden mount may be in a deep tree (for instance, in the
watchman integration tests) and be too long to fit in the unix domain
socket address.

The failure that we see in that case mistakenly informs the user that
eden is not running, rather than that we have a broken address.

Reviewed By: simpkins

Differential Revision: D5948497

fbshipit-source-id: 3bde8b83bf08b82bdd08758382ac0e218cc12829
2017-10-02 11:30:11 -07:00
Wez Furlong
fd073f1961 use .eden/socket in hg extensions
Summary:
This avoids hard coding knowledge of the FB-specific `local` dir.
This is only suitable for use on already-mounted eden instances,
so the function accepts either the mounted path or the eden
configuration dir.

Reviewed By: bolinfest

Differential Revision: D4829166

fbshipit-source-id: df9daed6024cdec6222be90f5cb624dd9ca0da0b
2017-04-06 10:52:06 -07:00
Adam Simpkins
e31889d295 fix a variety of lint issues
Summary:
Fix issues flagged by running "arc lint" on all eden files.  There are still 6
warnings outstanding, but these are either false positives or advice that we
intentionally are ignoring for legitimate reasons.

Reviewed By: bolinfest

Differential Revision: D4446615

fbshipit-source-id: 992f3c146f99d63935f849aa775dd6d611a04acf
2017-01-23 18:03:09 -08:00
Adam Simpkins
251da81f36 update all copyright statements to "2016-present"
Summary:
Update copyright statements to "2016-present".  This makes our updated lint
rules happy and complies with the recommended license header statement.

Reviewed By: wez, bolinfest

Differential Revision: D4433594

fbshipit-source-id: e9ecb1c1fc66e4ec49c1f046c6a98d425b13bc27
2017-01-20 22:03:02 -08:00
Adam Simpkins
859a4c265b update the python client library to be python 2.x compatible
Summary:
Python 2.x requires the current class name be passed into super().
Add arguments to super so that we can use this inside a mercurial extension.
(Mercurial only supports python 2.x.)

Reviewed By: bolinfest

Differential Revision: D3942573

fbshipit-source-id: 06df55f217631a398004c0d25448d3a612f772e9
2016-09-30 19:13:13 -07:00
Adam Simpkins
98db6e0e01 make sure to close the thrift socket
Summary:
Update the CLI to always close the thrift client socket, to avoid resource leak
warnings on exit.

I also updated the code to just monkey-patch a nicer EdenError.__str__()
method, rather than having to explicitly catch and modify this exception in
multiple different places.

Reviewed By: bolinfest

Differential Revision: D3560662

fbshipit-source-id: 900fe74c793ffd99f4a2c1f1ddd94b96e48f5eb7
2016-07-22 17:33:05 -07:00
Michael Bolin
6e4cb1ebf1 Refactor logic to create a EdenService.Client in Python.
Summary: This logic should be shared by the Eden CLI as well as unit tests.

Reviewed By: simpkins

Differential Revision: D3348300

fbshipit-source-id: c87b1f03f16560323f3d7685063bb6466c39efe2
2016-05-25 21:44:07 -07:00