Example #1
0
def createrelease(request):
    results = {"success": False}

    if request.method == u"GET":
        try:
            release = Release()
            release.name = request.GET["name"]
            reldate = datetime.strptime(request.GET["estRelDate"] + "T09:09:09", "%b. %d, %YT%H:%M:%S")
            release.est_release_date = reldate
            release.save()
            results = {"success": True}

            calendar.addCalendarReleaseEvent(release.id, release.name, reldate)

        except Exception as ex:
            results = {"success": False, "error": ex}

    json = simplejson.dumps(results)
    return HttpResponse(json, mimetype="application/json")
Example #2
0
def createrelease(request):
    results = {'success':False}
    
    if request.method == u'GET':
        try:
            release = Release()
            release.name = request.GET['name']
            reldate = datetime.strptime(request.GET['estRelDate'] + 'T09:09:09', '%b. %d, %YT%H:%M:%S')
            release.est_release_date = reldate
            release.save()
            results = {'success':True}

            calendar.addCalendarReleaseEvent(release.id, release.name, reldate)

        except Exception as ex:
            results = {'success':False, 'error':ex}


    json = simplejson.dumps(results)
    return HttpResponse(json, mimetype='application/json')
Example #3
0
def createrelease(request):
    results = {'success': False}

    if request.method == u'GET':
        try:
            release = Release()
            release.name = request.GET['name']
            release.branch = Branch.objects.get(name=request.GET['branch'])
            release.est_release_date = request.GET['estRelDate']
            release.save()
            results = {'success': True}
        except Exception as ex:
            results = {'success': False, 'error': ex}

    json = simplejson.dumps(results)
    return HttpResponse(json, mimetype='application/json')
Example #4
0
def createrelease(request):
    results = {'success':False}
    
    if request.method == u'GET':
        try:
            release = Release()
            release.name = request.GET['name']
            release.branch = Branch.objects.get(name=request.GET['branch'])
            release.est_release_date = request.GET['estRelDate']
            release.save()
            results = {'success':True}
        except Exception as ex:
            results = {'success':False, 'error':ex}

    json = simplejson.dumps(results)
    return HttpResponse(json, mimetype='application/json')
Example #5
0
def createrelease(request):
    results = {'success':False}
    
    if request.method == u'GET':
        try:
            release = Release()
            release.name = request.GET['name']
            reldate = datetime.strptime(request.GET['estRelDate'] + 'T09:09:09', '%b. %d, %YT%H:%M:%S')
            release.est_release_date = reldate
            release.save()
            results = {'success':True}

            calendar.addCalendarReleaseEvent(release.id, release.name, reldate)

        except Exception as ex:
            results = {'success':False, 'error':ex}


    json = simplejson.dumps(results)
    return HttpResponse(json, mimetype='application/json')
Example #6
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')