@patch('changes.models.Repository.get_vcs')
    def test_ensure_match_patch_want_commit(self, get_vcs):
        get_vcs.return_value = self.get_fake_vcs()
        revision = self.create_revision(
            repository=self.project.repository,
            sha='a' * 40
        )
        patch = Patch(
            repository=self.project.repository,
            parent_revision_sha=revision.sha,
            diff=SAMPLE_DIFF,
        )
        source = self.create_source(self.project, revision=revision)
        bad_source = self.create_source(self.project, revision=revision, patch=patch)
        build = self.create_build(self.project, source=source)

        # if diff builds weren't handled properly, this build would be older
        # and would be returned
        self.create_build(self.project, source=bad_source)
        resp = self.client.post(self.path, data={
            'sha': 'a' * 40,
            'project': self.project.slug,
            'apply_project_files_trigger': '1',
            'ensure_only': '1',
        })
        assert resp.status_code == 200
        data = self.unserialize(resp)
        assert len(data) == 1
        assert data[0]['id'] == build.id.hex
A bare select_subclasses() should achieve the same results as doing
dataset/ETHPy150Open dropbox/changes/tests/changes/api/test_build_index.py/BuildCreateTest.test_ensure_match_patch_want_commit--crossover with--dataset/ETHPy150Open carljm/django-model-utils/model_utils/tests/tests.py/InheritanceManagerUsingModelsTests.test_selecting_all_subclasses_specifically_grandchildren