code: private static int findCommonAncestor(RevisionInternal rev, List<String> possibleRevIDs) {
          if (possibleRevIDs == null || possibleRevIDs.size() == 0) {
              return 0;
          }
          List<String> history = Database.parseCouchDBRevisionHistory(rev.getProperties());
  
          //rev is missing _revisions property
          assert (history != null);
  
          boolean changed = history.retainAll(possibleRevIDs);
          String ancestorID = history.size() == 0 ? null : history.get(0);
  
          if (ancestorID == null) {
              return 0;
          }
  
          int generation = RevisionUtils.parseRevIDNumber(ancestorID);
  
          return generation;
      }
docs: Given a revision and an array of revIDs, finds the latest common ancestor revID
  and returns its generation #. If there is none, returns 0.
  <p/>
  int CBLFindCommonAncestor(CBL_Revision* rev, NSArray* possibleRevIDs) in CBLRestPusher.m