You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by ke...@apache.org on 2020/11/12 15:49:21 UTC

[allura] branch master updated (3124cec -> 9fbddbd)

This is an automated email from the ASF dual-hosted git repository.

kentontaylor pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git.


    from 3124cec  pep8/pycodestyle cleanup
     new 6ebb54f  [#8379] remove old adhoc scm script
     new f26a7d6  [#8379] preserve same pickle format as used on py2 for db consistency and interoperability if py2 procs (taskd) in use during a transition
     new 58af26e  [#8379] fix akismet tests
     new 9fbddbd  [#8379] use unicode for tarball_url building

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Allura/allura/controllers/repository.py       |   4 +-
 Allura/allura/model/index.py                  |   2 +-
 Allura/allura/model/repo_refresh.py           |   2 +-
 Allura/allura/tests/unit/spam/test_akismet.py |  44 +++----
 scripts/perf/benchmark-scm.py                 | 161 --------------------------
 5 files changed, 26 insertions(+), 187 deletions(-)
 delete mode 100755 scripts/perf/benchmark-scm.py


[allura] 02/04: [#8379] preserve same pickle format as used on py2 for db consistency and interoperability if py2 procs (taskd) in use during a transition

Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit f26a7d62ef8f8189a8222aeb8793c39f8937e828
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Thu Nov 5 10:29:16 2020 -0500

    [#8379] preserve same pickle format as used on py2 for db consistency and interoperability if py2 procs (taskd) in use during a transition
---
 Allura/allura/model/index.py        | 2 +-
 Allura/allura/model/repo_refresh.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Allura/allura/model/index.py b/Allura/allura/model/index.py
index 0b8a3a4..790667a 100644
--- a/Allura/allura/model/index.py
+++ b/Allura/allura/model/index.py
@@ -84,7 +84,7 @@ class ArtifactReference(object):
             obj = cls(
                 _id=artifact.index_id(),
                 artifact_reference=dict(
-                    cls=bson.Binary(dumps(artifact.__class__)),
+                    cls=bson.Binary(dumps(artifact.__class__, protocol=2)),
                     project_id=artifact.app_config.project_id,
                     app_config_id=artifact.app_config._id,
                     artifact_id=artifact._id))
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index 8eb6b32..fa4a9d7 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -137,7 +137,7 @@ def refresh_commit_repos(all_commit_ids, repo):
             ref = ArtifactReferenceDoc(dict(
                 _id=index_id,
                 artifact_reference=dict(
-                    cls=bson.Binary(dumps(Commit)),
+                    cls=bson.Binary(dumps(Commit, protocol=2)),
                     project_id=repo.app.config.project_id,
                     app_config_id=repo.app.config._id,
                     artifact_id=oid),


[allura] 04/04: [#8379] use unicode for tarball_url building

Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 9fbddbd5f46ba8f4bc8b02e41cfaf654913caeb2
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Thu Nov 5 17:08:35 2020 -0500

    [#8379] use unicode for tarball_url building
---
 Allura/allura/controllers/repository.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index e8f7bcf..96c7294 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -781,10 +781,10 @@ class TreeBrowser(BaseController, DispatchIndex):
         tool_subscribed = M.Mailbox.subscribed()
         tarball_url = None
         if asbool(tg.config.get('scm.repos.tarball.enable', False)):
-            cutout = len(b'tree' + self._path.encode('utf8'))
+            cutout = len('tree' + self._path)
             if request.path.endswith('/') and not self._path.endswith('/'):
                 cutout += 1
-            tarball_url = h.urlquote('%starball' % unquote(request.path)[:-cutout])
+            tarball_url = h.urlquote(request.path_info[:-cutout] + 'tarball')
         return dict(
             repo=c.app.repo,
             commit=self._commit,


[allura] 03/04: [#8379] fix akismet tests

Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 58af26e6cc142dd529bc5ada79372396bd7020d1
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Thu Nov 5 16:04:18 2020 -0500

    [#8379] fix akismet tests
---
 Allura/allura/tests/unit/spam/test_akismet.py | 44 +++++++++++++--------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/Allura/allura/tests/unit/spam/test_akismet.py b/Allura/allura/tests/unit/spam/test_akismet.py
index fbc4cf3..b2bd234 100644
--- a/Allura/allura/tests/unit/spam/test_akismet.py
+++ b/Allura/allura/tests/unit/spam/test_akismet.py
@@ -69,10 +69,10 @@ class TestAkismet(unittest.TestCase):
         self.content = 'spåm text'
         self.expected_data = dict(
             comment_content=self.content.encode('utf8'),
-            comment_type='comment',
-            user_ip='some ip',
-            user_agent='some browser',
-            referrer='some url')
+            comment_type=b'comment',
+            user_ip=b'some ip',
+            user_agent=b'some browser',
+            referrer=b'some url')
 
     @mock.patch('allura.lib.spam.akismetfilter.c')
     @mock.patch('allura.lib.spam.akismetfilter.request')
@@ -91,7 +91,7 @@ class TestAkismet(unittest.TestCase):
         request.remote_addr = 'some ip'
         c.user = None
         self.akismet.check(self.content, content_type='some content type')
-        self.expected_data['comment_type'] = 'some content type'
+        self.expected_data['comment_type'] = b'some content type'
         self.akismet.service.comment_check.assert_called_once_with(**self.expected_data)
 
     @mock.patch('allura.lib.spam.akismetfilter.c')
@@ -102,9 +102,9 @@ class TestAkismet(unittest.TestCase):
         c.user = None
         self.akismet.check(self.content, artifact=self.fake_artifact)
         expected_data = self.expected_data
-        expected_data['permalink'] = 'http://localhost/artifact-url'
-        expected_data['comment_date_gmt'] = '2019-05-17T00:00:00'
-        expected_data['comment_post_modified_gmt'] = '2019-05-17T00:05:01'
+        expected_data['permalink'] = b'http://localhost/artifact-url'
+        expected_data['comment_date_gmt'] = b'2019-05-17T00:00:00'
+        expected_data['comment_post_modified_gmt'] = b'2019-05-17T00:05:01'
         self.akismet.service.comment_check.assert_called_once_with(**expected_data)
 
     @mock.patch('allura.lib.spam.akismetfilter.c')
@@ -116,7 +116,7 @@ class TestAkismet(unittest.TestCase):
         self.akismet.check(self.content, user=self.fake_user)
         expected_data = self.expected_data
         expected_data.update(comment_author='Søme User'.encode('utf8'),
-                             comment_author_email='user@domain')
+                             comment_author_email=b'user@domain')
         self.akismet.service.comment_check.assert_called_once_with(**expected_data)
 
     @mock.patch('allura.lib.spam.akismetfilter.c')
@@ -128,7 +128,7 @@ class TestAkismet(unittest.TestCase):
         self.akismet.check(self.content)
         expected_data = self.expected_data
         expected_data.update(comment_author='Søme User'.encode('utf8'),
-                             comment_author_email='user@domain')
+                             comment_author_email=b'user@domain')
         self.akismet.service.comment_check.assert_called_once_with(**expected_data)
 
     @mock.patch('allura.lib.spam.akismetfilter.c')
@@ -139,9 +139,9 @@ class TestAkismet(unittest.TestCase):
 
         # no IP addr, UA, etc, since this isn't the original request
         expected_data = dict(comment_content='spåm text'.encode('utf8'),
-                             comment_type='comment',
-                             user_ip='',
-                             user_agent='',
+                             comment_type=b'comment',
+                             user_ip=b'',
+                             user_agent=b'',
                              )
         self.akismet.service.submit_spam.assert_called_once_with(**expected_data)
 
@@ -153,9 +153,9 @@ class TestAkismet(unittest.TestCase):
 
         # no IP addr, UA, etc, since this isn't the original request
         expected_data = dict(comment_content='spåm text'.encode('utf8'),
-                             comment_type='comment',
-                             user_ip='',
-                             user_agent='',
+                             comment_type=b'comment',
+                             user_ip=b'',
+                             user_agent=b'',
                              )
         self.akismet.service.submit_ham.assert_called_once_with(**expected_data)
 
@@ -166,11 +166,11 @@ class TestAkismet(unittest.TestCase):
         self.akismet.submit_ham(self.content, artifact=self.fake_artifact)
 
         expected_data = dict(comment_content='spåm text'.encode('utf8'),
-                             comment_type='comment',
-                             user_ip='33.4.5.66',
-                             user_agent='',
-                             permalink='http://localhost/artifact-url',
-                             comment_date_gmt='2019-05-17T00:00:00',
-                             comment_post_modified_gmt='2019-05-17T00:05:01',
+                             comment_type=b'comment',
+                             user_ip=b'33.4.5.66',
+                             user_agent=b'',
+                             permalink=b'http://localhost/artifact-url',
+                             comment_date_gmt=b'2019-05-17T00:00:00',
+                             comment_post_modified_gmt=b'2019-05-17T00:05:01',
                              )
         self.akismet.service.submit_ham.assert_called_once_with(**expected_data)


[allura] 01/04: [#8379] remove old adhoc scm script

Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 6ebb54f9140ae58a737dd2f83e2ee5e2f8ff08ee
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Thu Nov 5 09:53:51 2020 -0500

    [#8379] remove old adhoc scm script
---
 scripts/perf/benchmark-scm.py | 161 ------------------------------------------
 1 file changed, 161 deletions(-)

diff --git a/scripts/perf/benchmark-scm.py b/scripts/perf/benchmark-scm.py
deleted file mode 100755
index 1e23cb9..0000000
--- a/scripts/perf/benchmark-scm.py
+++ /dev/null
@@ -1,161 +0,0 @@
-#!/bin/env python
-
-#       Licensed to the Apache Software Foundation (ASF) under one
-#       or more contributor license agreements.  See the NOTICE file
-#       distributed with this work for additional information
-#       regarding copyright ownership.  The ASF licenses this file
-#       to you under the Apache License, Version 2.0 (the
-#       "License"); you may not use this file except in compliance
-#       with the License.  You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#       Unless required by applicable law or agreed to in writing,
-#       software distributed under the License is distributed on an
-#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#       KIND, either express or implied.  See the License for the
-#       specific language governing permissions and limitations
-#       under the License.
-
-
-from __future__ import unicode_literals
-from __future__ import print_function
-from __future__ import absolute_import
-import os
-import sys
-import argparse
-from datetime import datetime
-
-import git
-import pysvn
-from mercurial import ui, hg, cmdutil
-import six
-from six.moves import range
-
-
-def main(opts):
-    if opts.type == 'git':
-        repo = git.Repo(opts.repo_path, odbt=git.GitCmdObjectDB)
-        cid = opts.cid
-        path = opts.path.strip('/')
-        tree = repo.commit(opts.cid).tree
-        if path:
-            tree = tree[path]
-        names = [n.name for n in tree]
-        impl = impl_git_tree if opts.full_tree else impl_git_node
-    elif opts.type == 'hg':
-        repo = hg.repository(HgUI(), six.ensure_str(opts.repo_path))
-        cid = None if opts.cid == 'HEAD' else ['%s:0' % opts.cid]
-        path = opts.path.strip('/')
-        filenames = list(repo[
-            'tip' if opts.cid == 'HEAD' else opts.cid].manifest().keys())
-        filenames = [
-            name for name in filenames if name.startswith(('%s/' % path).lstrip('/'))]
-        names = set()
-        for name in filenames:
-            names.add(name.split('/')[0])
-        names = list(names)
-        impl = impl_hg_tree if opts.full_tree else impl_hg_node
-    elif opts.type == 'svn':
-        repo = pysvn.Client()
-        if opts.cid == 'HEAD':
-            cid = pysvn.Revision(pysvn.opt_revision_kind.head)
-        else:
-            cid = pysvn.Revision(pysvn.opt_revision_kind.number, opts.cid)
-        path = opts.path.strip('/')
-        names = []
-        impl = impl_svn_tree if opts.full_tree else impl_svn_node
-
-    sys.stdout.write('Timing %s' % ('full tree' if opts.full_tree else 'node'))
-    sys.stdout.flush()
-    total = 0.0
-    for i in range(opts.count):
-        sys.stdout.write('.')
-        sys.stdout.flush()
-        start = datetime.now()
-        impl(repo, cid, path, names, opts.repo_path)
-        end = datetime.now()
-        total += (end - start).total_seconds()
-    print()
-    print('Total time:           %s' % total)
-    print('Average time per run: %s' % (total / opts.count))
-
-
-def impl_git_tree(repo, cid, path, names, *args):
-    data = {}
-    for name in names:
-        #data[name] = repo.git.rev_list(cid, '--', os.path.join(path, name), max_count=1)
-        data[name] = git.Commit.iter_items(
-            repo, cid, os.path.join(path, name), max_count=1).next().hexsha
-    return data
-
-
-def impl_git_node(repo, cid, path, *args):
-    # return repo.git.rev_list(cid, '--', path, max_count=1)
-    return git.Commit.iter_items(repo, cid, path, max_count=1).next().hexsha
-
-
-def impl_hg_tree(repo, cid, path, names, *args):
-    m = cmdutil.match(repo, pats=[path], default=path)
-    data = {}
-    for name in names:
-        rev_iter = cmdutil.walkchangerevs(
-            repo, m, {'rev': cid}, lambda c, f: None)
-        data[name] = rev_iter.next().hex()
-    return data
-
-
-def impl_hg_node(repo, cid, path, *args):
-    m = cmdutil.match(repo, pats=[path], default=path)
-    rev_iter = cmdutil.walkchangerevs(repo, m, {'rev': cid}, lambda c, f: None)
-    return rev_iter.next().hex()
-
-
-def impl_svn_tree(repo, cid, path, names, repo_path, *args):
-    infos = repo.info2(
-        'file://%s/%s' % (repo_path, path),
-        revision=cid,
-        depth=pysvn.depth.immediates)
-    data = {}
-    for name, info in infos[1:]:
-        data[name] = info.last_changed_rev
-    return data
-
-
-def impl_svn_node(repo, cid, path, names, repo_path, *args):
-    logs = repo.log(
-        'file://%s/%s' % (repo_path, path),
-        revision_start=cid,
-        limit=1)
-    return logs[0].revision.number
-
-
-class HgUI(ui.ui):
-
-    '''Hg UI subclass that suppresses reporting of untrusted hgrc files.'''
-
-    def __init__(self, *args, **kwargs):
-        super(HgUI, self).__init__(*args, **kwargs)
-        self._reportuntrusted = False
-
-
-def parse_opts():
-    parser = argparse.ArgumentParser(
-        description='Benchmark getting LCD from repo tool')
-    parser.add_argument('--type', default='git', dest='type',
-                        help='Type of repository being tested.')
-    parser.add_argument('--repo-path', dest='repo_path', required=True,
-                        help='Path to the repository to test against')
-    parser.add_argument('--commit', default='HEAD', dest='cid',
-                        help='Commit ID or revision number to test against')
-    parser.add_argument('--path', default='', dest='path',
-                        help='Path within the repository to test against')
-    parser.add_argument('--count', type=int, default=100, dest='count',
-                        help='Number of times to execute')
-    parser.add_argument(
-        '--full-tree', action='store_true', default=False, dest='full_tree',
-        help='Time full tree listing instead of just the single node')
-    return parser.parse_args()
-
-if __name__ == '__main__':
-    main(parse_opts())