Refactored CouchChangeTracker.

Change-Id: I39a7c4da61c9990ded6059650b73a32b37a6835e
Some random fixes/improvements

* Added -[CouchServer checkActiveTasks].
* Optimization and leak-fix for CouchQuery.
* Fix for CouchReplication

Change-Id: I2e1b1a4aa1d56fafb9ed08c2affcc43fb085a07f
Get new doc ID from 'id' field of response

After POSTing to a database, get the new document's ID from the 'id'
field of the response body, not just from the "Location:" header.

Change-Id: I15002af869e00065b6ddd3c1e9bca43fe42250a8
Added CouchTouchDBServer

This is a convenience for working with TouchDB, much like CouchEmbeddedServer is for the existing Couchbase Mobile.

Change-Id: I24f7dc34d362e5cbfc585a72abbf136276ce6dca
Don't build CouchEmbeddedServer in the iOS framework

It will cause a link error if the app doesn't use Couchbase.framework (i.e. uses TouchDB)
and links with the -objc flag, which prevents dead-stripping of classes.
This is going to make it difficult to have a single CouchCocoa binary that supports both
Couchbase.framework and TouchDB :-(

Change-Id: I5b1252dc49809d6bf4b103912b3945609636d799
Switch Mac framework to use latest SDK

And fixed a compiler issue with RESTBody using the 10.7 SDK.

Change-Id: Id22c4d7cada0e6f6911771b94f4dc1d2465018f5
Keep CouchChangeTracker from warning in an apparently legal edge case

Change-Id: I83fff237fd4e044a095dd990b20e5920e9574b8d
Avoid polling /_activity in CouchTouchDBServer

Instead it can listen for notifications from TouchReplication.

Change-Id: If0749434ac6fa8aa0c8e6cdfdc6fba41cd22a6c5
Re-implemented CouchDesignDocument_Embedded to use TouchDB

Change-Id: Ib49c5309f8675c0338241955ba66b671aec0e555
Don't stop a replication when its CouchReplication is dealloced

Change-Id: I6f74582d24412a22ecc9bc71cf8344aea8fd1a89
URL query params containing an "&" weren't properly escaped.

Change-Id: I752c4ae2b4a540fe44dc1a41b2d4a863a5c67cdb
Bug-fix for a race condition in CouchReplication.

Change-Id: I557a7e31053ae149339f778ac26f05e684de4b2d

Conflicts:

	Couch/CouchReplication.m
Added doc-comment about auth (401) problems with CouchDB.

I don't know of a good solution that CouchCocoa can implement, so I'm recommending changing CouchDB's config to send the proper auth header.
Fixed some #imports.

Change-Id: I6e39cc5a819ab2ea61e920f870da45401fe9ea85
Updated framework build scripts to work inside TouchDB workspace

The build-fat-iOS-library script had some problems when two targets in the same workspace were using it, due to a collision in the naming of a temporary directory.
Fixed a leak and a build error

* Added a necessary -dealloc method in CouchQueryRow.
* Changed debug symbol style to avoid an annoying error the 2nd time building the iOS framework.

Change-Id: Iff9ebc2e6384a5a444d36c1c0a5df1a0b9394c07
Prevent models from being dealloced while they have KVO observers

Observing an object doesn't retain it. But CouchModels have only weak references from the database, so they can get dealloced if not used. That leads to dangling KVO references, which leads to crashes. Worked around this by overriding add/removeObserver to retain/release the receiver.

Change-Id: I66e44e30e783e6af9a8dfdac475828e6a713c66b
+[CouchModel modelForDocument:] now uses the CouchModelFactory

but only if called on CouchModel itself; if the receiver is a subclass it still always instantiates that subclass.
Also added CouchModelFactory to public headers.

Change-Id: I629db515a0bfdfb797e495a0f42f810c976b3f75
CouchReplication now supports filters

Also changed the CouchDatabase API for creating it -- the options are no longer passed in; instead you set them as properties afterwards.
To make this work I had to delay the call to -start so that the caller would have a chance to make these changes first.

Change-Id: I54ee42e6224607fb1be912dd4b18297d4ddb4aaf
Detect errors in TouchDB replications

* Check nonstandard "error" property in _active_tasks entry to get replication error from TouchDB.
* Listen for TouchDB replication-stopped notification and re-poll _active_tasks in response.

Change-Id: I8dfbf8980cb3d1f6596dbd02f34d77cd418ed865