tag: factor out contains traversal

Other "--contains" traversals can benefit from the same
speedups that "tag --contains" has received. This code was
not originally made generically available because it has
some gross corners that make it easy to use it in a wrong or
unsafe way. This patch moves the code to commit.[ch] and
attempts to clean up those corners. Specifically:

  1. The "contains" function is renamed to "commit_contains",
     to more clearly indicate what it does.

  2. The original calling convention was to simply call
     "contains", which would magically cache intermediate
     results in the object flag bits. Now we have a context
     struct and an init/release pair, which makes it more
     clear that calls with the same context are related.

  3. From a modularity standpoint, the traversal would
     ideally operate purely on the commit_contains_context.
     But like most traversals, we keep our state in the
     global commit object flags, which means we can only run
     one "contains" traversal at a time.  Therefore, the
     init function will notice and abort when a second
     simultaneous traversal is begun.

  4. The cached state reflects the results for a particular
     set of "want" commits. With the original interface,
     there was nothing to prevent calling "contains" with a
     new set of "want" commits, which would produce
     incoherent results. Now, the contained commits are
     provided once by the init function (which, as noted
     above, will die if invoked twice without an intervening
     finish).

  5. The original implementation abused UNINTERESTING and
     TMP_MARK. Instead, we define new flags to avoid
     conflict with existing revision flags.

  6. The original implementation just left the global object
     flags smudged. This is OK for "tag --contains", but not
     for general use. The release function now clears our
     object flags after use.
wip