Fix a crash when TDSocketChangeTracker gets an error

During the -errorOccurred: method's call to [self stop], the delegate would end up releasing the tracker,
causing it to be dealloced prematurely. Moved the stop call to the end, and for safety's sake added a
temporary retain during the entire stream:handleEvent: call.
(Bug reported by Joerg Birkhold.)
Added optional JavaScript map/reduce capability.

TDJSViewCompiler is a plugin that allows TouchDB to run JavaScript
map/reduce functions. It requires JavaScriptCore, which on iOS you'll
need to build and link into your app.

This class is included as source code but not built into TouchDB.
If you want to use it, compile it into your app.
Bump version to 1.004
Allow multiple replications with the same (source, target) dbs

It can be useful to have multiple replications with the same source and target,
if their filters are different.
Oops, broke TouchServ with last commit. Fixed.
BrowserID support for replicator (untested)

To use it with non persistent replications, set a TDBrowserIDAuthorizer.

With persistent replications, add a "auth" sub-object of the "source"
or "target" object (just as for OAuth) and in it put a "browserid"
object with an "assertion" property whose value is the BrowserID
assertion.

This obviously requires that the remote server have BrowserID support.
There is a CouchDB-BrowserID plugin, and IrisCouch's servers have it.
Support for BigCouch array-format sequence IDs

BigCouch is now using arrays as sequence IDs; TouchDB didn't format these properly.
Fixes #218.
Merge branch 'stable'

1.0.1 release

Conflicts:
	TouchDB.xcodeproj/project.pbxproj
More replicator improvements

* Created a TD_DatabaseManager method to create replicators

Conflicts:
	Source/TDReplicatorManager.m
	Source/TD_DatabaseManager.m
Dumb bug fixes (TDReplication, TDBrowserIDAuthorizer)

Conflicts:
	Source/API/TDReplication.m
Change tracker needs to send cookies in its request

TDSocketChangeTracker uses CFHTTPMessageCreateRequest, which is too low-level to use the shared
cookie store, so it doesn't send any cookies. This breaks BrowserID auth, which is session-based.
Fixed this by explicitly getting the cookies from the NSHTTPCookieStore and adding their headers.
More BrowserID work (don't store assertion in database)

BrowserID assertions are extremely short-lived, so it doesn't make sense
to store them in a persistent replication's document. Instead, store the
email address only. The assertion is registered with the authorizer
before starting replication.

Conflicts:
	Source/API/TDReplication.h
	Source/API/TDReplication.m
	TouchDB.xcodeproj/project.pbxproj
Oops, I broke replication with that last commit

Fixes #219
BrowserID improvements

* Parse email address out of assertion rather than requiring it to be provided separately.
* Also get the expiration date, and don't return assertions that have expired.

Conflicts:
	Source/API/TDReplication.h
	Source/API/TDReplication.m
Fix a path-escaping bug with replication

Regression from the initial BrowserID patch (649d14f)
Fix crash in TDJSViewCompiler

The compiled function objects were getting GC'd, after which calling them would crash.
Don't do reachability checks on replication to a local touchdb: URL.

Fixes #228
Make sure views compiled from JS get rebuilt if the map/reduce fn changes

…Although currently this only takes effect next time the app is launched, i.e.
it isn't watching for edits of the design docs while running.

Also moved the code that triggers the compilation out of TDRouter and into
TD_View and TD_Database.
Fixed compile errors reported by Xcode 4.6

Make sure to run "git submodule sync" after pulling this commit.
Don't stop a push replication if the _revs_diff call gets an error

Took out the -stop call. The remaining call to -revisionFailed will ensure that the
pull is retried later. And in the case being reported, where the call fails due to being
canceled when going offline, the replication will continue when it goes back online.
Fixes #233.