Fix #2: Establish SSH connection in a thread-safe way

Use an Event(), rather than a boolean, to determine whether or not
the remote is connected.

Protect the connection logic with a Lock().

Change-Id: Ifc5888894a90b7e3a11e21ec3f9bf69f0a7608a8
Remove redundant `exec_command` method

The `exec_command` overrides the method of the same name from the
parent class unnecessarily.

Remove it and call the parent `exec_command` method directly from the
`run_gerrit_command` method.

Change-Id: I977000a372c9b6e9143ca0e740b971a606a83146
Add __repr__ methods on event and model classes

This gives more meaningful output when doing:

  print(event)

and means it's not necessary to use str(event).

Change-Id: I3c1546ab89c481bec24fbc4445ed7f33aa05eff8
Fix #4: Keep event's raw json data in the event object

If any future versions of Gerrit add data elements that are not
encapsulated by the event class, clients will be able to access them
via the raw json data.

Change-Id: Ia689acb808f9d200f53b86c60f024e865dd12a18
Fix #3: Don't treat unhandled event types as errors

If an unknown event is received on the event stream, for example if a
new event has been added in a later version of Gerrit, do not raise
an error.  Instead, generate an "UnhandledEvent" event.

Change-Id: Ia1902bf4a54883011b7ad3e004f58a2ba8739b21
Improved logging in the example script

- Add --verbose option to enable DEBUG logging.

- Add timestamp and log level to the output format.

Change-Id: I11ca42095d7ee24782d39141fae20b8b26695fff
Fix #5: Move json parsing and error handling into the event factory

Pass the raw string into the event factory and parse it to a json
object there.  If the string is not valid json, generate an error
event.

Add a unit test for handling of invalid json on the event stream.

Change-Id: I209a89fd28c3a594b71443fc106e25d58c5cc1ea
Fix #6: Support the "merge-failed" stream event

Change-Id: I3308b44dc1bbfcaa70e38cb4857c2241c551cfa4
Fix #7: Support the "reviewer-added" stream event

Change-Id: I72ece72c08ddc6da31c14db35dd84f35d61d39ed
Fix #8: Support the "topic-changed" stream event

Change-Id: I70b9cbea1da20a1434eea39e3d8e85e94357b792
Fix #9: Add a bit more detail in the documentation

- How to install
- Prerequisites (platform, SSH config)
- Link to the Gerrit page
- Link to the example script and license files

Change-Id: I0c24609e1ea89be55a68ebf4a1569c26f23e5a66
Allow example script to continue if errors are received

Add an option to ignore error events and continue receiving.

Connection errors are not ignored and will still result in the
script exiting.

Change-Id: I807fa50700eb6970b7fbabe48c499fe513717c4d
Fix #11: correct handling of `identityfile` in the ssh config

The `identityfile` element of the result returned by SSHConfig.lookup()
is a list, not a string, therefore calling `expanduser` on it results
in a crash.

Change-Id: I8673295d66cac9ca3b522867735b1211f0556d21
Fix initialisation of error event

Change-Id: I19e955c3ca7c84600ec89ff24d5c7458202ff609
Add missing __repr__ methods on ErrorEvent and UnhandledEvent

Also fix a minor coding style issue.

Change-Id: Ib366a816e5cf979eb94c7ce545d1c87c6c3984c8
Completely refactor the stream event handling

Instead of using select.select() to wait for input, use the methods
provided by paramiko's client channel object.

Read from both stdout and stderr, and send ErrorEvent if anything is
received on stderr.

Ref #1
Fix #12

Change-Id: Ic67392cb9d689a1f457f5d02eb17a5432112a0c0
Fix #10: Allow to manually specify ssh username and port

If the username and port are specified when constructing the client,
they will be used instead of attempting to fetch from the ssh config
file.

In this case the full hostname of the server is required, rather
than only the name as listed in the ssh config.

Change-Id: I82b8638d99922c9b40a54a8275ffc085f505696f
Add changelog

Change-Id: Idc086f21125db744a23c8ef829a2dbe54253cda5
Bump version to 0.1.1

Change-Id: Id2a68941ddfbeaee540406e821f1df09408c198f