first we should check if the common ancestor is right
8469
function (commitItems) {
            var msg = 'Squashing commits ' + fromCommit + ' -> ' + toCommit + '\n',
                i;

            for (i = 0; i < commitItems.length; i += 1) {
                msg += '\n' + commitItems[i][CONSTANTS.MONGO_ID] + ':\n';
                msg += commitItems[i].message;
            }

            return msg;
        }
644568
public static boolean isAncestor( File ancestorCandidate, File file ) {

		String path = ancestorCandidate.getAbsolutePath();
		if( ! path.endsWith( "/" ))
			path += "/";

		return file.getAbsolutePath().startsWith( path );
	}
1134038
public boolean shouldStopBefore(InternalKey internalKey)
    {
        // Scan to find earliest grandparent file that contains key.
        InternalKeyComparator internalKeyComparator = inputVersion.getInternalKeyComparator();
        while (grandparentIndex < grandparents.size() && internalKeyComparator.compare(internalKey, grandparents.get(grandparentIndex).getLargest()) > 0) {
            if (seenKey) {
                overlappedBytes += grandparents.get(grandparentIndex).getFileSize();
            }
            grandparentIndex++;
        }
        seenKey = true;

        if (overlappedBytes > MAX_GRAND_PARENT_OVERLAP_BYTES) {
            // Too much overlap for current output; start new output
            overlappedBytes = 0;
            return true;
        }
        else {
            return false;
        }
    }
350904
def common_ancestor(c):
    
    span1 = _to_span(c[0])
    span2 = _to_span(c[1])
    ancestor1 = np.array(span1.sentence.xpath.split("/"))
    ancestor2 = np.array(span2.sentence.xpath.split("/"))
    min_len = min(ancestor1.size, ancestor2.size)
    return list(ancestor1[: np.argmin(ancestor1[:min_len] == ancestor2[:min_len])])
374164
def _has_population_germline(rec):
    
    for k in population_keys:
        if k in rec.header.info:
            return True
    return False
1374730
def is_correct(self):
        
        state = True

        # Internal checks before executing inherited function...
        loop = self.no_loop_in_parents("host_name", "dependent_host_name")
        if loop:
            msg = "Loop detected while checking host dependencies"
            self.add_error(msg)
            state = False
            for item in self:
                for elem in loop:
                    if elem == item.host_name:
                        msg = "Host %s is parent host_name in dependency defined in %s" % (
                            item.host_name_string, item.imported_from
                        )
                        self.add_error(msg)
                    elif elem == item.dependent_host_name:
                        msg = "Host %s is child host_name in dependency defined in %s" % (
                            item.dependent_host_name_string, item.imported_from
                        )
                        self.add_error(msg)

        return super(Hostdependencies, self).is_correct() and state
1318401
function isAttachedToRoot() {
         if (this.root === true) {
           return true;
         } else {
           var ancestor = this.ancestor;

           while (ancestor) {
             if (ancestor.root === true) {
               return true;
             }

             ancestor = ancestor.ancestor;
           }

           return false;
         }
       }
1359446
function isLeftEdgeOf(node, ancestor) {
  while (node && node !== ancestor) {
    if (position(node) !== 0) {
      return false;
    }
    node = node.parentNode;
  }

  return true;
}
687214
def lowest_common_ancestor(root, p, q):
    
    while root:
        if p.val > root.val < q.val:
            root = root.right
        elif p.val < root.val > q.val:
            root = root.left
        else:
            return root
1100103
function sibling(node, selector, ancestry) {
            var parent = ancestry[0], listProp, keys, i, l, k, m;
            if (!parent) { return false; }
            keys = estraverse.VisitorKeys[parent.type];
            for (i = 0, l = keys.length; i < l; ++i) {
                listProp = parent[keys[i]];
                if (isArray(listProp)) {
                    for (k = 0, m = listProp.length; k < m; ++k) {
                        if (listProp[k] !== node && matches(listProp[k], selector, ancestry)) {
                            return true;
                        }
                    }
                }
            }
            return false;
        }
287989
private boolean isDescendant(DependencyInfo ancestor, DependencyInfo descendant){
        for (DependencyInfo child : ancestor.getChildren()){
            if (child.equals(descendant)){
                return true;
            }
            if (isDescendant(child, descendant)){
                return true;
            }
        }
        return false;
    }
676665
def ancestors
        a = Array.new
        self.parent._ancestors(a) unless self.parent.nil?
        return a
    end
300108
function isAncestorIDOf(ancestorID, descendantID) {
  return (
    descendantID.indexOf(ancestorID) === 0 &&
    isBoundary(descendantID, ancestorID.length)
  );
}
650916
long lastCEWithPrimaryBefore(long p) {
        if(p == 0) { return 0; }
        assert(p > elements[(int)elements[IX_FIRST_PRIMARY_INDEX]]);
        int index = findP(p);
        long q = elements[index];
        long secTer;
        if(p == (q & 0xffffff00L)) {
            // p == elements[index] is a root primary. Find the CE before it.
            // We must not be in a primary range.
            assert((q & PRIMARY_STEP_MASK) == 0);
            secTer = elements[index - 1];
            if((secTer & SEC_TER_DELTA_FLAG) == 0) {
                // Primary CE just before p.
                p = secTer & 0xffffff00L;
                secTer = Collation.COMMON_SEC_AND_TER_CE;
            } else {
                // secTer = last secondary & tertiary for the previous primary
                index -= 2;
                for(;;) {
                    p = elements[index];
                    if((p & SEC_TER_DELTA_FLAG) == 0) {
                        p &= 0xffffff00L;
                        break;
                    }
                    --index;
                }
            }
        } else {
            // p > elements[index] which is the previous primary.
            // Find the last secondary & tertiary weights for it.
            p = q & 0xffffff00L;
            secTer = Collation.COMMON_SEC_AND_TER_CE;
            for(;;) {
                q = elements[++index];
                if((q & SEC_TER_DELTA_FLAG) == 0) {
                    // We must not be in a primary range.
                    assert((q & PRIMARY_STEP_MASK) == 0);
                    break;
                }
                secTer = q;
            }
        }
        return (p << 32) | (secTer & ~SEC_TER_DELTA_FLAG);
    }
1363120
def is_descendant_of(self, node):
        
        return self.path.startswith(node.path) and self.depth > node.depth
149747
private boolean shouldIgnore(CmsElementView view, Map<CmsUUID, CmsElementView> views, String myPath) {

        if (isSelectParent()) {
            for (CmsElementView otherView : views.values()) {
                CmsUUID parentViewId = otherView.getParentViewId();
                if (parentViewId != null) {
                    CmsElementView parentOfOther = views.get(parentViewId);
                    if ((parentOfOther != null)
                        && (parentOfOther.getResource() != null)
                        && parentOfOther.getResource().getRootPath().equals(myPath)) {
                        // can't have "grandparents"
                        return true;
                    }
                }
            }
            boolean isStandardView = (view.getResource() != null) || view.getId().isNullUUID();
            if ((view.getParentViewId() != null) || !isStandardView) {
                // synthetic view, or already a sub-view of something else
                return true;
            }
            if ((view.getResource() != null) && view.getResource().getRootPath().equals(myPath)) {
                // can't make a view its own parent
                return true;
            }
        }
        return false;
    }
1135784
def _check_consistency(self):
        ''''''
        type_count = defaultdict(int)
        for _, section in sorted(self.sections.items()):
            type_count[section.section_type] += 1

        if type_count[POINT_TYPE.SOMA] != 1:
            L.info('Have %d somas, expected 1', type_count[POINT_TYPE.SOMA])