refresh environment
dont serialize messagebody.
[SCHEMA] Allow contact sync from arbitrary remotes.

Summary:
 * Rename g_id to the more generic uid.
 * Add a 'provider_name' column to the Contact table. This allows us to sync
   contacts from multiple backends for the same account without needing to
   worry about uid collisions between those backends.

Test Plan: Unit test added; Google contact sync manually tested to work.

Reviewers: spang

Reviewed By: spang

Differential Revision: https://review.inboxapp.com/D72
Fix a g_id -> uid renaming that escaped D72.
Fix to 'Un-stamped database!' bug

Summary:
Attempting an ./inbox start (for example) after running ./tools/clear-db results in an 'Un-stamped database error';
clearing the db drops the alembic_version table, hence the check for it in inbox:283 fails.

This commit fixes the problem by always including the alembic_version table in the tables kept i.e. not dropped

Test Plan: All scripts work as before.

Reviewers: spang

Reviewed By: spang

Differential Revision: https://review.inboxapp.com/D82
Set uid for locally added contacts.

uid is no longer a nullable column for contacts.
Test code restructured.

Summary:
To allow different providers to be tested independantly:
tests/general: provider agnostic tests
tests/imap: Imap tests
tests/data, tests/util: data + utility needed for tests.

Note: EAS tests live in the corresponding tests/eas directory in the inbox-eas repo.

Test Plan:
./runtests passes all as expected (i.e. depending on the value of the EASTEST flag)

Reviewers:
spang, emfree

CC:
emfree

Differential Revision: https://review.inboxapp.com/D63
Add pytest engine for Arcanist.

Summary:
You'll need to do `pip install coverage` in your VM.
Tests can be disabled by running `arc diff --nounit`.

Test Plan: Run arc diff --preview on some test commit.

Reviewers: spang

Reviewed By: spang

CC: kav-ya, mg

Differential Revision: https://review.inboxapp.com/D84
Minor updates to general contacts sync.

Summary:
Add contact UID type assertion.
It's easy to accidentally pass an int rather than a string, but doing so is Bad
News.

In Contact.copy_from, copy fields whether or not they're None.
This is needed to properly sync individual deleted attributes of EAS contact
objects.

Test Plan: ./runtests

Reviewers: kav-ya

Reviewed By: kav-ya

Differential Revision: https://review.inboxapp.com/D86
Ensure only one inbox server process is running at a time.

Summary:
While it's possible that at some time in the future, we may want to run
multiple server processes, enforcing only one top-level launcher
prevents confusing errors when we try to spawn zerorpc servers that use
the same socket. Later we can add multi-process support within the
launcher.

Test Plan:
./runtests, tried suspending an inbox instance and starting a new one.

This isn't quite perfect yet since it does this on a double ./inbox debug (but
not for the 'start' command), still better than the status quo though since
you can just ctrl-c that hanging process, as opposed to previously when it
would throw a bunch of confusing zerorpc errors:

inbox.server.general [I 2014-04-14 20:40:42,012 inbox   :305 ] [OK] Database scheme matches latest
Inbox server is already running! (pid 3028)
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/gevent/greenlet.py", line 390, in run
    result = self._run(*self.args, **self.kwargs)
  File "./inbox", line 41, in start
    with PidFile(config['PIDDIR'], 'inbox'):
  File "/vagrant/src/inbox/util/misc.py", line 133, in __enter__
    sys.exit()
SystemExit
<Greenlet at 0x3270a68: start> failed with SystemExit

Reviewers: mg

Differential Revision: https://review.inboxapp.com/D91
restore original handler (doesn't help)