• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.commit函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中utils.commit函数的典型用法代码示例。如果您正苦于以下问题:Python commit函数的具体用法?Python commit怎么用?Python commit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了commit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: rev

def rev(source_dir):
  os.chdir(source_dir)
  src_commit = system(["git", "show-ref", "HEAD"])

  for d in dirs:
    print "removing directory %s" % d
    os.chdir(mojo_root_dir)
    try:
      system(["git", "rm", "-r", d])
    except subprocess.CalledProcessError:
      print "Could not remove %s" % d
    print "cloning directory %s" % d
    os.chdir(source_dir)
    files = system(["git", "ls-files", d])
    for f in files.splitlines():
      dest_path = os.path.join(mojo_root_dir, f)
      system(["mkdir", "-p", os.path.dirname(dest_path)])
      system(["cp", os.path.join(source_dir, f), dest_path])
    os.chdir(mojo_root_dir)
    system(["git", "add", d])

  for f in files_to_copy:
    system(["cp", os.path.join(source_dir, f), os.path.join(mojo_root_dir, f)])

  os.chdir(mojo_root_dir)
  system(["git", "add", "."])
  commit("Update from chromium " + src_commit)
开发者ID:esprehn,项目名称:mojo,代码行数:27,代码来源:rev.py


示例2: patch_and_filter

def patch_and_filter(dest_dir):
    os.chdir(dest_dir)

    utils.filter_file("build/landmines.py", lambda line: not "gyp_environment" in line)
    utils.commit("filter gyp_environment out of build/landmines.py")

    patch(dest_dir)
开发者ID:jimsimon,项目名称:sky_engine,代码行数:7,代码来源:patch.py


示例3: test_host_in_two_clusters

def test_host_in_two_clusters():
    """
        create 2 new clusters and add a host to both. check Host.cluster.
    """
    per = sess.query(Personality).select_from(
            join(Archetype, Personality)).filter(
            and_(Archetype.name=='windows', Personality.name=='generic')).one()

    for i in xrange(3):
        ec = EsxCluster(name='%s%s'% (CLUSTER_NAME, i), personality=per)
        add(sess, ec)
    commit(sess)

    c1 = sess.query(EsxCluster).filter_by(name='%s1' % (CLUSTER_NAME)).one()
    c2 = sess.query(EsxCluster).filter_by(name='%s2' % (CLUSTER_NAME)).one()

    assert c1
    assert c2
    print 'clusters in host in 2 cluster test are %s and %s'% (c1, c2)

    host = h_factory.next()


    sess.autoflush = False
    hcm1 = HostClusterMember(host=host, cluster=c1)
    create(sess, hcm1)
    assert host in c1.hosts
    print 'c1 hosts are %s'% (c1.hosts)

    c2.hosts.append(host)
    sess.autoflush = True
    commit(sess)
开发者ID:jrha,项目名称:aquilon,代码行数:32,代码来源:test_cluster.py


示例4: test_create_hosts

def test_create_hosts():
    br = Branch.get_unique(sess, 'ny-prod', compel=True)
    dns_dmn = DnsDomain.get_unique(sess, 'one-nyp.ms.com', compel=True)
    stat = Status.get_unique(sess, 'build', compel=True)
    os = sess.query(OperatingSystem).filter(Archetype.name == 'vmhost').first()
    assert os, 'No OS in %s' % func_name()

    pers = sess.query(Personality).select_from(
        join(Personality, Archetype)).filter(
        and_(Archetype.name=='vmhost', Personality.name=='generic')).one()

    sess.autoflush=False

    for i in xrange(NUM_HOSTS):
        machine = m_factory.next()
        vm_host = Host(machine=machine, name='%s%s' % (HOST_NAME, i),
                       dns_domain=dns_dmn, branch=br, personality=pers,
                       status=stat, operating_system=os)
        add(sess, vm_host)

    sess.autoflush=True

    commit(sess)

    hosts = sess.query(Host).filter(
        Host.name.like(HOST_NAME+'%')).all()
    assert len(hosts) is NUM_HOSTS
    print 'created %s hosts'% len(hosts)
开发者ID:jrha,项目名称:aquilon,代码行数:28,代码来源:test_cluster.py


示例5: del_clusters

def del_clusters():
    clist = sess.query(Cluster).all()
    if len(clist) > 0:
        for c in clist:
            sess.delete(c)
        commit(sess)
        print 'deleted %s cluster(s)' % len(clist)
开发者ID:jrha,项目名称:aquilon,代码行数:7,代码来源:test_cluster.py


示例6: test_create_host_simple

def test_create_host_simple():
    for i in xrange(NUM_MACHINES):
        machine = MACHINE_FACTORY.next()
        #create an a_record for the primary name
        name = '%s%s' % (SHORT_NAME_PREFIX, i)

        #convert ip to ipaddr to int, add 1 (router) + i,
        #convert back to ip, then back to string
        #convoluted indeed (FIXME?)
        ip = str(IPAddr(int(IPAddr(NETWORK.ip)) + i +1 ))
        a_rec = FutureARecord.get_or_create(session=sess,
                                      fqdn='%s.ms.com' % name,
                                      ip=ip)

        BRANCH = sess.query(Branch).first()

        # make sure to delete them after (Or put in commit block?)
        sess.refresh(machine)
        host = Host(machine=machine, #primary_name_id=a_rec.id,
                    personality=PRSNLTY, status=STATUS, operating_system=OS,
                    branch=BRANCH)

        add(sess, host)

        pna = PrimaryNameAssociation(a_record_id=a_rec.id,
                                     hardware_entity_id=machine.machine_id)

        add(sess, pna)
        commit(sess)

    hosts = sess.query(Host).all()
    eq_(len(hosts), NUM_MACHINES)
    print 'created %s hosts'% len(hosts)
开发者ID:jrha,项目名称:aquilon,代码行数:33,代码来源:test_host.py


示例7: rev

def rev(source_dir, chromium_dir):
  src_commit = system(["git", "show-ref", "HEAD", "-s"], cwd=source_dir).strip()

  for input_dir, dest_dir in dirs_to_clone.iteritems():
    if os.path.exists(os.path.join(chromium_dir, dest_dir)):
      print "removing directory %s" % dest_dir
      system(["git", "rm", "-r", dest_dir], cwd=chromium_dir)
    print "cloning directory %s into %s" % (input_dir, dest_dir)
    files = system(["git", "ls-files", input_dir], cwd=source_dir)
    for f in files.splitlines():
      # Don't copy presubmit files over since the code is read-only on the
      # chromium side.
      if os.path.basename(f) == "PRESUBMIT.py":
        continue

      # Clone |f| into Chromium under |dest_dir| at its location relative to
      # |input_dir|.
      f_relpath = os.path.relpath(f, input_dir)
      dest_path = os.path.join(chromium_dir, dest_dir, f_relpath)
      system(["mkdir", "-p", os.path.dirname(dest_path)])
      system(["cp", os.path.join(source_dir, f), dest_path])
    os.chdir(chromium_dir)
    system(["git", "add", dest_dir], cwd=chromium_dir)

  mojo_public_dest_dir = os.path.join(sdk_prefix_in_chromium, "mojo/public")
  version_filename = os.path.join(mojo_public_dest_dir, "VERSION")
  with open(version_filename, "w") as version_file:
    version_file.write(src_commit)
  system(["git", "add", version_filename], cwd=chromium_dir)
  commit("Update mojo sdk to rev " + src_commit, cwd=chromium_dir)
开发者ID:rafaelw,项目名称:mojo,代码行数:30,代码来源:rev_sdk.py


示例8: del_service

def del_service(name):
    """ reusable service delete for other tests """
    svc = sess.query(Service).filter_by(name=name).first()
    if svc:
        count = sess.query(Service).filter_by(name=name).delete()
        commit(sess)
        print "session.delete(%s) deleted %s rows" % (name, count)
开发者ID:stdweird,项目名称:aquilon,代码行数:7,代码来源:test_service.py


示例9: install_package_cached

    def install_package_cached(self, repo, pkgname, version, package_cache_path):
        local_packages_path = path.join(path.join(USER_CURRENT_DIR, self._package_folder))

        # download
        url = self.get_download_url(name=pkgname, version=version)
        filename = '{0}@{1}.{2}'.format(pkgname, version, self._file_extension)
        dest = path.join(APP_ARCHIVE_DIR, pkgname, version + ".tgz")

        # Check package archived is downloaded
        # if no download
        # if yes, skip downloading
        if (path.isfile(dest)):
            print 'Locate {0}'.format(filename)
        else:
            print 'Download {0}'.format(filename)
            self.download(url=url, dest=dest)

        # Extract file
        path_to_package = path.join(local_packages_path, pkgname)
        tar = tarfile.open(dest)
        tar.extractall(path=path_to_package)
        tar.close()

        # tmp_package_path = path.join(path_to_package, self._tmp_package_folder)
        # for f in os.listdir(tmp_package_path):
        #     shutil.move(path.join(tmp_package_path, f), path_to_package)

        tmp_package_path = path.join(path_to_package, self._tmp_package_folder)
        for f in os.listdir(tmp_package_path):
            shutil.move(path.join(tmp_package_path, f), path.join(package_cache_path, f))

        try:
            utils.commit(repo, message=version)
        except Exception as e:
            print e
开发者ID:nghiattran,项目名称:pm,代码行数:35,代码来源:node.py


示例10: del_hosts

def del_hosts():
    hosts = sess.query(Host).filter(Host.name.like(HOST_NAME+'%')).all()
    if hosts:
        for host in hosts:
            sess.delete(host)
        commit(sess)
        print 'deleted %s hosts' % len(hosts)
开发者ID:jrha,项目名称:aquilon,代码行数:7,代码来源:test_cluster.py


示例11: teardown

def teardown():
    sess.close()
    (ms, intrnl) = get_reqs()

    #TODO: move this general approach to test_dns???
    # generalize the entire approach and take a count on the way in and out
    qry = sess.query(ARecord).filter(
        ARecord.name.like(AREC_PREFIX + '%'))
    qry = qry.filter_by(dns_environment=intrnl)
    if qry.count() == 0:
        log.info('successful cascaded deletion of ARecords')
    else:
        log.error('ARecords left intact when they should be delete cascaded')
    for rec in qry.filter_by(dns_domain=ms).all():
        sess.delete(rec)
        commit(sess)
        log.debug('deleted ARecord %s' % rec.fqdn)

    dns_count_after = sess.query(DnsRecord).count()

    if dns_count_after != dns_count_b4:
        log.warning('%s record(s) left after teardown in %s, should be %s' % (
            dns_count_after, func_name(), dns_count_b4))

    del_machines(sess, MCHN_PREFIX)

    mchn_count_after = sess.query(Machine).count()
    if mchn_count_b4 != mchn_count_after:
        log.warning('%s machines left after %s, should be %s'%(
            mchn_count_after, func_name(), mchn_count_b4))
开发者ID:jrha,项目名称:aquilon,代码行数:30,代码来源:test_primary_name.py


示例12: rev

def rev(source_dir, dest_dir, dirs_to_rev, name):
    for dir_to_rev in dirs_to_rev:
      if type(dir_to_rev) is tuple:
          d, file_subset = dir_to_rev
      else:
          d = dir_to_rev
          file_subset = None
      print "removing directory %s" % d
      try:
          system(["git", "rm", "-r", d], cwd=dest_dir)
      except subprocess.CalledProcessError:
          print "Could not remove %s" % d
      print "cloning directory %s" % d

      if file_subset is None:
          files = system(["git", "ls-files", d], cwd=source_dir).splitlines()
      else:
          files = [os.path.join(d, f) for f in file_subset]

      for f in files:
          source_path = os.path.join(source_dir, f)
          if not os.path.isfile(source_path):
              continue
          dest_path = os.path.join(dest_dir, f)
          system(["mkdir", "-p", os.path.dirname(dest_path)], cwd=source_dir)
          system(["cp", source_path, dest_path], cwd=source_dir)
      system(["git", "add", d], cwd=dest_dir)

    for f in files_not_to_roll:
        system(["git", "checkout", "HEAD", f], cwd=dest_dir)

    system(["git", "add", "."], cwd=dest_dir)
    src_commit = system(["git", "rev-parse", "HEAD"], cwd=source_dir).strip()
    commit("Update to %s %s" % (name, src_commit), cwd=dest_dir)
开发者ID:eukreign,项目名称:engine,代码行数:34,代码来源:roll.py


示例13: test_whitespace_padding

def test_whitespace_padding():
    a=StringTbl(name='  some eXTRa space     ')
    add(s, a)
    commit(s)

    p = StringTbl.__table__.select().execute().fetchall()[1]
    assert p['name'].startswith('s'), 'Whitespace not stripped in AqStr'
    print a
开发者ID:jrha,项目名称:aquilon,代码行数:8,代码来源:test_column_types.py


示例14: del_metas

def del_metas():
    mlist = sess.query(MetaCluster).all()
    if len(mlist) > 0:
        print '%s clusters before deleting metas' % (sess.query(Cluster).count())
        for m in mlist:
            sess.delete(m)
        commit(sess)
        print 'deleted %s metaclusters' % (len(mlist))
        print '%s clusters left after deleting metas' % (sess.query(Cluster).count())
开发者ID:jrha,项目名称:aquilon,代码行数:9,代码来源:test_metacluster.py


示例15: test_valid_aqstr

def test_valid_aqstr():
    a = StringTbl(name='Hi there')
    add(s, a)
    commit(s)

    s.expunge_all()
    rec = s.query(StringTbl).first()
    print rec.name
    assert rec.name == 'hi there', 'String not lowercase in AqStr'
开发者ID:jrha,项目名称:aquilon,代码行数:9,代码来源:test_column_types.py


示例16: test_del_machine

def test_del_machine():
    mchn = sess.query(Machine).filter_by(label=NAME).first()
    if mchn:
        sess.delete(mchn)
        commit(sess)

        t = sess.query(Machine).filter_by(label=NAME).first()
        assert t is None
        log.info("deleted machine")
开发者ID:stdweird,项目名称:aquilon,代码行数:9,代码来源:test_machine.py


示例17: test_vm_append

def test_vm_append():
    machines = sess.query(Machine).filter(Machine.label.like(VM_NAME+'%')).all()
    ec = EsxCluster.get_unique(sess, CLUSTER_NAME)
    assert ec

    ec.machines.append(machines[12])
    commit(sess)
    assert len(ec.machines) is 11
    print 'now, there are %s machines in the cluster: %s'% (len(ec.machines),
                                                            ec.machines)
开发者ID:jrha,项目名称:aquilon,代码行数:10,代码来源:test_cluster.py


示例18: del_machines

def del_machines(sess=sess, prefix=NAME):
    """ deletes all machines with names like prefix% """
    machines = sess.query(Machine).filter(Machine.label.like(prefix + "%")).all()

    if machines:
        log.debug("attempting to delete %s machines" % len(machines))
        for machine in machines:
            log.info("deleting %s" % machine)
            sess.delete(machine)
            commit(sess)
开发者ID:stdweird,项目名称:aquilon,代码行数:10,代码来源:test_machine.py


示例19: teardown

def teardown():
    machines = sess.query(Machine).filter(
        Machine.label.like(MACHINE_NAME_PREFIX + '%')).all()

    for machine in machines:
        if machine.interfaces:
            for iface in machine.interfaces:
                sess.delete(iface)
        sess.delete(machine)
    commit(sess)
    log.debug('deleted %s machines' % len(machines))
开发者ID:jrha,项目名称:aquilon,代码行数:11,代码来源:test_interface.py


示例20: clean_up

def clean_up():
    del_machines(sess, MACHINE_NAME)
    disk_ids = sess.query(Disk.id).all()
    if disk_ids:
        for id in disk_ids:
            if id in disk_id_cache:
                print 'disk with id %s not deleted'% (id)
                s.query(Disk).filter_by(id=id).delete()
            commit(sess)
    del_service_instance(SHARE_NAME)
    del_service(NAS_SVC)
开发者ID:jrha,项目名称:aquilon,代码行数:11,代码来源:test_disk.py



注:本文中的utils.commit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.compare函数代码示例发布时间:2022-05-26
下一篇:
Python utils.combo_get_value函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap