示例#1
0
def load(request):
    """
    版本列表
    :param request:
    :return:
    """
    client = pysvn.Client()
    logger.info("load svn")

    for program in ALL_SVN_LIST:
        dir = getLocalDir(program)
        url = client.info(dir).data['url']
        logger.info("program:[%s],url:[%s]" % (program, url))
        # trunk
        info = None
        try:
            info = BranchInfo.objects().get(programName=program,
                                            branchTag="trunk")
        except:
            pass
        if info is None:
            info = BranchInfo()
            info.programName = program
            info.branchTag = "trunk"
            info.createDate = "999999"
            info.save()

        branches = []
        branches.extend(getBranches(client, url, "branches"))
        try:
            branches.extend(getBranches(client, url, "tags"))
        except Exception as e:
            pass
        for x in branches:
            info = None
            try:
                info = BranchInfo.objects().get(programName=program,
                                                branchTag=x)
            except:
                pass
            if info is None:
                info = BranchInfo()
                info.programName = program
                info.branchTag = x
                customerTag = getCustomerTag(x)
                customer = Customer.objects(tag=customerTag)
                if len(customer) > 0:
                    info.customerTag = customerTag
                info.createDate = getCreateDate(x)
                info.save()
    return redirect("/programBranch/list/", locals())
示例#2
0
def load(request):
    """
    版本列表
    :param request:
    :return:
    """
    client = pysvn.Client()
    logger.info("load svn")

    for program in ALL_SVN_LIST:
        dir = getLocalDir(program)
        url = client.info(dir).data['url']
        logger.info("program:[%s],url:[%s]" % (program, url))
        # trunk
        info = None
        try:
            info = BranchInfo.objects().get(programName=program, branchTag="trunk")
        except:
            pass
        if info is None:
            info = BranchInfo()
            info.programName = program
            info.branchTag = "trunk"
            info.createDate = "999999"
            info.save()

        branches = []
        branches.extend(getBranches(client, url, "branches"))
        try:
            branches.extend(getBranches(client, url, "tags"))
        except Exception as e:
            pass
        for x in branches:
            info = None
            try:
                info = BranchInfo.objects().get(programName=program, branchTag=x)
            except:
                pass
            if info is None:
                info = BranchInfo()
                info.programName = program
                info.branchTag = x
                customerTag = getCustomerTag(x)
                customer = Customer.objects(tag=customerTag)
                if len(customer) > 0:
                    info.customerTag = customerTag
                info.createDate = getCreateDate(x)
                info.save()
    return redirect("/programBranch/list/", locals())