def simulate_local_repository(): # Identify if we're in a git or hg repo backend = identify_local_vcs() # Simulate the repository in a new project repository = mock.repository(backend=backend, status=RepositoryStatus.active) project = mock.project(repository) plan = mock.plan(project) get_or_create(Snapshot, where={ 'project': project, 'status': SnapshotStatus.active, }) get_or_create(Snapshot, where={ 'project': project, 'status': SnapshotStatus.pending, }) # Create some build data based off commits in the local repository print 'Creating data based on {0} repository in {1}'.format(backend, os.getcwd()) vcs = get_vcs(repository) for lazy_revision in vcs.log(limit=10): revision, created, source = lazy_revision.save(repository) print ' Created revision {0} in {1}'.format(revision.sha, revision.branches) build = add(project, revision, source) print ' Inserted build {0} into {1}'.format(build.id, project.slug)
def simulate_local_repository(): # Identify if we're in a git or hg repo backend = identify_local_vcs() # Simulate the repository in a new project repository = mock.repository(backend=backend, status=RepositoryStatus.active) project = mock.project(repository) plan = mock.plan(project) get_or_create(Snapshot, where={ 'project': project, 'status': SnapshotStatus.active, }) get_or_create(Snapshot, where={ 'project': project, 'status': SnapshotStatus.pending, }) # Create some build data based off commits in the local repository print 'Creating data based on {0} repository in {1}'.format( backend, os.getcwd()) vcs = get_vcs(repository) for lazy_revision in vcs.log(limit=10): revision, created, source = lazy_revision.save(repository) print ' Created revision {0} in {1}'.format(revision.sha, revision.branches) build = add(project, revision, source) print ' Inserted build {0} into {1}'.format(build.id, project.slug)
def loop(): repository = mock.repository() project = mock.project(repository) plan = mock.plan() get_or_create(ProjectPlan, where={"plan": plan, "project": project}) while True: build = gen(project) print "Pushed build {0} on {1}".format(build.id, project.slug) time.sleep(0.1)
def loop(): repository = mock.repository() project = mock.project(repository) plan = mock.plan() get_or_create(ProjectPlan, where={ 'plan': plan, 'project': project, }) while True: build = gen(project) print 'Pushed build {0} on {1}'.format(build.id, project.slug) time.sleep(1)
def loop(): repository = mock.repository() project = mock.project(repository) plan = mock.plan(project) get_or_create(Snapshot, where={ 'project': project, 'status': SnapshotStatus.active, }) get_or_create(Snapshot, where={ 'project': project, 'status': SnapshotStatus.pending, }) print('Looping indefinitely, creating data for', project.slug) while True: build = gen(project) print ' Pushed build {0} on {1}'.format(build.id, project.slug) time.sleep(0.1)
def simulate_local_repository(): # Identify if we're in a git or hg repo backend = identify_local_vcs() # Simulate the repository in a new project repository = mock.repository( backend=backend, status=RepositoryStatus.active, url=os.getcwd(), ) print 'Created repository for {0} repository in {1} ({2})'.format( repository.backend, repository.url, repository.id) project = mock.project(repository) plan = mock.plan(project) get_or_create(Snapshot, where={ 'project': project, 'status': SnapshotStatus.active, }) get_or_create(Snapshot, where={ 'project': project, 'status': SnapshotStatus.pending, }) # make sure we clone the repo vcs = repository.get_vcs() if vcs.exists(): vcs.update() else: vcs.clone() # Create some build data based off commits in the local repository for lazy_revision in vcs.log(limit=10): revision, created, source = lazy_revision.save(repository) print ' Created revision {0} in {1}'.format(revision.sha, revision.branches) build = add(project, revision, source) print ' Inserted build {0} into {1}'.format(build.id, project.slug) return repository
def loop(): repository = mock.repository() project = mock.project(repository) plan = mock.plan() get_or_create(ProjectPlan, where={ 'plan': plan, 'project': project, }) get_or_create(Snapshot, where={ 'project': project, 'status': SnapshotStatus.active, }) get_or_create(Snapshot, where={ 'project': project, 'status': SnapshotStatus.pending, }) while True: build = gen(project) print 'Pushed build {0} on {1}'.format(build.id, project.slug) time.sleep(0.1)