Better error if a pushed document fails to be saved

If remote _bulk_docs indicates an error saving a document,
(a) Map "unauthorized" message to 401 status (instead of default 502)
(b) Put the document's URL in the NSError object's userInfo.
Allow client to reset replication state

Setting the "reset" property in a replication request will cause the local checkpoint to be erased, meaning the next replication will start over from scratch (sequence 0).
The Mac demo app now has a menu item that exercises this.
Fixes #186.
Updated MYUtilities
Fix crash after resuming pull due to location change

Shouldn't create a new _pendingChanges when resuming activity, or it'll be out of sync with the _batcher.
(Found by @tleyden; see his patch in #190.)
Fixes #188.
Improve _compact to clear out SQLite WAL file

_compact wasn't really freeing space (at least not immediately) because the changes got appended to the SQLite write-ahead log file. So I extended the -compact method by having it issue a SQL pragma to flush the WAL, and then close and re-open the database. This resets the "___.touchdb-wal" file to zero length.
Fixes #189.
-[TD_Server close] should be synchronous

Closing the server at app quit time is currently a race condition because the -close call returns before the server thread has finished closing stuff, so the process might exit before it finishes. Fixed this by making the -close call synchronous. (Related to #189.)
Avoid race condition registering filters on startup

It was possible for a persistent push replication to start running on  startup before the app had a chance to install filter blocks.
This meant the replication would ignore the filter and send all documents, which is pretty bad.

* Changed TDPusher to make a missing filter function an error.
* Changed TD_Server to wait till the next runloop iteration to start the replicator, giving the caller time to set up filters and validations.
Fixes #193.
Bump project version # to 1.001
Make direct PUT to attachment URL work with streamed request body

This case was accidentally not fixed back in commit 7f24896.
Fixes #198.
Better retry behavior on failure to get password from keychain

For some reason TDSocketChangeTracker sometimes fails to get the password of the credential it's just looked up.
Added some fallback code to make a second attempt to reload the credential.
Also, if it fails to get the password it will clear the busted credential so that it can try to look it up again when it gets
the 401 response.
Fixes #195 ... I hope?
Fix unnecessary 401 challenges

MYURLUtils' method -my_credentialForRealm: is returning a credential with no persistence
when the URL has a baked-in username and password. This turns out to prevent NSURLConnection
from proactively sending the same credential on the next connection to the host, with the bad
effect that every connection initially gets a 401 and only then gets the credential and retries. This
slows down performance.
Fixed this by changing the persistence to NSURLCredentialPersistenceForSession.
I believe this fixes #197 in TouchDB.
Oops, wrong submodule commit ID for MYUtilities.
Fix an assertion failure in TDSocketChangeTracker

-start should just return NO if called when tracker is already running.
Fixes #196.
Bump version to 1.002 (1.0.1 candidate 2)
Replicator now proactively sends auth credentials on every request.

I think this will fix the remaining Cloudant errors (timeout / socket-closed errors pushing large docs).
Speculatively fixes #185.
Properly handle identical re-creation of deleted document

If a document is deleted and then re-created with the same contents as its former first revision,
the new revision's revID is the same as the former one, causing a SQLite table constraint violation.
Fixed this by re-using the old row and setting its 'current' back to 1.
Fixes #205.
Updated FMDB
Better error handling in _bulk_docs

Fixes #200.
Merge branch 'master' of /Couchbase/TouchDB into public-api

Conflicts:
	Source/TDPusher.m
	Source/TDReplicatorManager.m
	Source/TD_Database.m
	Source/TD_Server.h
	Source/TD_Server.m
	TouchDB.xcodeproj/project.pbxproj
Fixed an unused-result static analyzer warning