Exemple #1
0
def manifest(request, release_id):
    release = Release.objects.get(id=release_id)
    release.release_notes = release.release_notes.replace('\n', '<br/>')
    manifest = []
    branch = Branch()

    if request.GET.__contains__('branch'):

        branch = Branch.objects.get(id=request.GET.get('branch'))
        for story in release.stories.all():
            deployables = DeployableObject.objects.filter(
                pending_stories=story, branch=branch)
            dep_objects = DeployableObject.objects.filter(
                released_stories=story, branch=branch)
            deployables.select_related()
            dep_objects.select_related()
            manifest += list(deployables)
            manifest += list(dep_objects)

    manifest.sort(key=lambda object: object.type + object.filename)
    branches = Branch.objects.filter(enabled__exact=True)

    data = {
        'release': release,
        'manifest': manifest,
        'branches': branches,
        'branch': branch
    }
    return render_to_response('release_manifest.html',
                              data,
                              context_instance=RequestContext(request))
def newbranch(request):
    if request.method == 'POST':
        form = BranchForm(request.POST)
        
        if form.is_valid():
            # Process the data in form.cleaned_data
            row = Branch()
            cleaned_data = form.cleaned_data
            row.repo = cleaned_data.get('repo')
            row.name = cleaned_data.get('name')
            row.api_env = cleaned_data.get('api_env')
            row.api_user = cleaned_data.get('api_user')
            row.api_pass = cleaned_data.get('api_pass')
            row.api_auth = cleaned_data.get('api_auth')
            row.api_store = cleaned_data.get('api_store')
            row.api_pod = cleaned_data.get('api_pod')
#            row.api_ver = cleaned_data.get('api_ver')
            row.api_assets = ','.join(cleaned_data.get('api_assets'))
            row.save()
            createCrontab(row)
            createCGitEntry(row)
            return adminMenu(request)
    else:
        form = BranchForm()
    return render_to_response('editbranch.html', {'form':form, 'type':'New', 'action':'newbranch/'}, context_instance=RequestContext(request))
Exemple #3
0
def newbranch(request):
    if request.method == 'POST':
        form = BranchForm(request.POST)
        
        if form.is_valid():
            # Process the data in form.cleaned_data
            row = Branch()
            cleaned_data = form.cleaned_data
            row.repo = cleaned_data.get('repo')
            row.name = cleaned_data.get('name')
            row.api_env = cleaned_data.get('api_env')
            row.api_user = cleaned_data.get('api_user')
            row.api_pass = cleaned_data.get('api_pass')
            row.api_auth = cleaned_data.get('api_auth')
            row.api_store = cleaned_data.get('api_store')
            row.api_pod = cleaned_data.get('api_pod')
#            row.api_ver = cleaned_data.get('api_ver')
            row.api_assets = ','.join(cleaned_data.get('api_assets'))
            row.save()
            createCrontab(row)
            createCGitEntry(row)
            return adminMenu(request)
    else:
        form = BranchForm()
    return render_to_response('editbranch.html', {'form':form, 'type':'New', 'action':'newbranch/'}, context_instance=RequestContext(request))
def newbranch(request):
    if request.method == "POST":
        form = BranchForm(request.POST)

        if form.is_valid():
            # Process the data in form.cleaned_data
            row = Branch()
            cleaned_data = form.cleaned_data
            row.repo = cleaned_data.get("repo")
            row.name = cleaned_data.get("name")
            row.api_env = cleaned_data.get("api_env")
            row.api_user = cleaned_data.get("api_user")
            row.api_pass = cleaned_data.get("api_pass")
            row.api_auth = cleaned_data.get("api_auth")
            row.api_store = cleaned_data.get("api_store")
            row.api_pod = cleaned_data.get("api_pod")
            #            row.api_ver = cleaned_data.get('api_ver')
            row.api_assets = ",".join(cleaned_data.get("api_assets"))
            row.save()
            createCrontab(row)
            createCGitEntry(row)
            return adminMenu(request)
    else:
        form = BranchForm()
    return render_to_response(
        "editbranch.html",
        {"form": form, "type": "New", "action": "newbranch/"},
        context_instance=RequestContext(request),
    )
Exemple #5
0
    def test_large_diff(self):
        map = difflist()

        ##
        # load all changed files from each hash into a map for performance
        ##
        lFileCache = createFileCache('sfdiff/testfiles/ltest', map)
        rFileCache = createFileCache('sfdiff/testfiles/rtest', map)

        repo = Repo()
        repo.location = '/tmp'
        repo.save()

        branch = Branch()
        branch.name = 'test'
        branch.repo = repo
        branch.save()

        rel = Release()
        rel.isdefault = True
        rel.name = 'test'
        rel.branch = branch
        rel.save()

        commit = Commit()
        commit.branch = branch
        commit.hash = 'test'
        commit.status = 'p'
        commit.save()

        for type,list in map.items():
            if type == 'objects':
                analyzeObjectChanges(list, lFileCache, rFileCache, 'fields', commit)
                analyzeObjectChanges(list, lFileCache, rFileCache, 'validationRules', commit)
                analyzeObjectChanges(list, lFileCache, rFileCache, 'webLinks', commit)
                analyzeRecordTypeChanges(list, lFileCache, rFileCache, commit)
                analyzeObjectChanges(list, lFileCache, rFileCache, 'namedFilters', commit)

            elif type == 'translations':
                analyzeTranslationChanges(list, lFileCache, rFileCache, commit)

            elif type == 'labels':
                analyzeLabelChanges(list, lFileCache, rFileCache, 'labels', commit)

            else:
                for listitem in list:
                    delta_type = None
                    if lFileCache.has_key(listitem) and rFileCache.has_key(listitem) == False:
                        delta_type = 'd'
                    elif lFileCache.has_key(listitem) == False:
                        delta_type = 'a'
                    else:
                        delta_type = 'u'

                    delta = Delta()
                    delta.object = getDeployable(branch, listitem, type, None, None, None)
                    delta.commit = commit
                    delta.delta_type = delta_type
                    delta.save()

        output = file('/tmp/deltas.json', 'w')
        output.write(serializers.serialize('json', Delta.objects.all(), indent=2))
        output.close()
        output = file('/tmp/deployables.json', 'w')
        output.write(serializers.serialize('json', DeployableObject.objects.all(), indent=2))
        output.close()

        self.assertTrue(filecmp.cmp('/tmp/deltas.json', 'sfdiff/testfiles/results/deltas.json', False), 'delta mismatch')
        self.assertTrue(filecmp.cmp('/tmp/deployables.json', 'sfdiff/testfiles/results/deployables.json', False), 'deployable mismatch')