Fixed lp:1308146 -  charm config options with $ and . in the names now work
Merge pull request #786 from dimitern/lp-1308146-escape-charm-config-in-state

Fixed lp:1308146 -  charm config options with $ and . in the names now work

Since local charms can be uploaded via the API server, this issue was
introduced: charms with config options having "$" and/or "." in their
names caused notOkForStorage error from mongodb when trying to save
the charm config into the charms collection. See http://pad.lv/1308146.

Service settings were already treated properly (escaping $ and . on the
way into mongo and unescaping on the way out), so the fix uses the same
approach.

Tested live with a local environment and added a unit test for it.
Add charm-sync command to help charm developers

charm-sync command will allow bidirectional synchronization
between the contents of a charm in a local repository and the
charm deployed as a unit.
ideally a charm developer can make local changes to the charm
and deploy them and retry runnig hooks, it also makes possible
for the developer to make changes in the unit while using debug
hooks and retrieve them to the local charm.
Fixed main test after ading charm-sync
Applied changes suggested by @davecheney