You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/09/05 20:20:26 UTC
[01/50] git commit: [#6284] move commit id to beginning of line so
that they all line up and are easier to visually scan
Updated Branches:
refs/heads/cj/6596 7b595e1b4 -> 2d667a8ea (forced update)
[#6284] move commit id to beginning of line so that they all line up and are easier to visually scan
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/40b0823b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/40b0823b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/40b0823b
Branch: refs/heads/cj/6596
Commit: 40b0823b815cb58dde7529f64ed834cdd8f48d7d
Parents: 55d3d3f
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Mon Aug 26 23:02:06 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Aug 26 23:02:06 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/widgets/resources/js/commit_browser.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/40b0823b/Allura/allura/lib/widgets/resources/js/commit_browser.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/commit_browser.js b/Allura/allura/lib/widgets/resources/js/commit_browser.js
index 4375529..37c4408 100644
--- a/Allura/allura/lib/widgets/resources/js/commit_browser.js
+++ b/Allura/allura/lib/widgets/resources/js/commit_browser.js
@@ -210,7 +210,7 @@ if($('#commit_graph')){
canvas_ctx.fill();
canvas_ctx.stroke();
canvas_ctx.fillStyle = "#000";
- canvas_ctx.fillText(commit.message + " " + commit.short_id, (1+next_column) * x_space, y_pos);
+ canvas_ctx.fillText(commit.short_id + " " + commit.message, (1+next_column) * x_space, y_pos);
}
}
[41/50] git commit: [#4595] ticket:421 Use utcnow() instead of now()
Posted by jo...@apache.org.
[#4595] ticket:421 Use utcnow() instead of now()
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/91c7a3aa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/91c7a3aa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/91c7a3aa
Branch: refs/heads/cj/6596
Commit: 91c7a3aa891c0ee60a83d5870131abc03a360385
Parents: 815940c
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Sep 2 13:08:32 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:55 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/site_admin.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/91c7a3aa/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index eacf105..b5fa97a 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -192,7 +192,7 @@ class SiteAdminController(object):
end_dt = datetime.strptime(end_dt, '%Y/%m/%d %H:%M:%S')
except ValueError:
end_dt = None
- start_dt = datetime.now() if not start_dt else start_dt
+ start_dt = datetime.utcnow() if not start_dt else start_dt
end_dt = start_dt - timedelta(days=3) if not end_dt else end_dt
start = bson.ObjectId.from_datetime(start_dt)
end = bson.ObjectId.from_datetime(end_dt)
[28/50] git commit: [#6457] Save result of mount_point validation
Posted by jo...@apache.org.
[#6457] Save result of mount_point validation
- Allows validator to return an alternate mount_point if the one
passed in is already in use.
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/faa5a9e8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/faa5a9e8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/faa5a9e8
Branch: refs/heads/cj/6596
Commit: faa5a9e8af6ef73fcee30f9735f5c695c9943265
Parents: 9a4a8dd
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Aug 28 16:56:26 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Sep 3 17:05:08 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/google/code.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/faa5a9e8/ForgeImporters/forgeimporters/google/code.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/code.py b/ForgeImporters/forgeimporters/google/code.py
index 60a0158..ed2519f 100644
--- a/ForgeImporters/forgeimporters/google/code.py
+++ b/ForgeImporters/forgeimporters/google/code.py
@@ -109,7 +109,7 @@ class GoogleRepoImportForm(fe.schema.Schema):
raise
tool_class = REPO_APPS[repo_type]
try:
- v.MountPointValidator(tool_class).to_python(mount_point)
+ value['mount_point'] = v.MountPointValidator(tool_class).to_python(mount_point)
except fe.Invalid as e:
raise fe.Invalid('mount_point:' + str(e), value, state)
return value
[19/50] git commit: [#5775] ticket:404 fixed typo
Posted by jo...@apache.org.
[#5775] ticket:404 fixed typo
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/a6dccae5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/a6dccae5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/a6dccae5
Branch: refs/heads/cj/6596
Commit: a6dccae59299615a3f7944a3b6cbcd6fe26ecede
Parents: cee6005
Author: Anton Kasyanov <mi...@gmail.com>
Authored: Thu Aug 1 18:12:23 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Aug 29 19:00:44 2013 +0000
----------------------------------------------------------------------
ForgeGit/forgegit/tests/model/test_repository.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a6dccae5/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 15527f7..d116a10 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -565,7 +565,7 @@ class TestGitRename(unittest.TestCase):
ThreadLocalORMSession.flush_all()
ThreadLocalORMSession.close_all()
- def test_file_commits(self):
+ def test_renamed_file(self):
# There was a file f.txt, then it was renamed to f2.txt.
commits = list(self.repo.log(id_only=False, path='/f2.txt'))
self.assertEqual(len(commits), 2)
@@ -574,4 +574,4 @@ class TestGitRename(unittest.TestCase):
self.assertEqual(
rename_commit['renamed_from']['commit_url'],
self.repo.url_for_commit(rename_commit['id'])
- )
\ No newline at end of file
+ )
[36/50] git commit: [#4595] ticket:421 Show only usernames in admins
column
Posted by jo...@apache.org.
[#4595] ticket:421 Show only usernames in admins column
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/22f7c861
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/22f7c861
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/22f7c861
Branch: refs/heads/cj/6596
Commit: 22f7c861f8098d1ad4bd83f3a60c2689dcdbd489
Parents: f59fcc2
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Sep 2 10:49:40 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:54 2013 +0000
----------------------------------------------------------------------
Allura/allura/templates/site_admin_new_projects.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/22f7c861/Allura/allura/templates/site_admin_new_projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_new_projects.html b/Allura/allura/templates/site_admin_new_projects.html
index bd97dc1..213ab43 100644
--- a/Allura/allura/templates/site_admin_new_projects.html
+++ b/Allura/allura/templates/site_admin_new_projects.html
@@ -47,7 +47,7 @@
<td><small>{{ p.short_description }}</small></td>
<td><small>{{ p.summary }}</small></td>
<td><small>{{ p.external_homepage|urlize(22) }}</small></td>
- <td><small>{{ p.admins()|join(' ') }}</small></td>
+ <td>{% for a in p.admins() %}<small><a href="{{ a.url() }}">{{ a.username }}</a></small> {% endfor %}</td>
</tr>
{% endfor %}
</table>
[23/50] git commit: [#5775] ticket:405 adding rename detection to svn
Posted by jo...@apache.org.
[#5775] ticket:405 adding rename detection to svn
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/de91d9d7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/de91d9d7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/de91d9d7
Branch: refs/heads/cj/6596
Commit: de91d9d74f1c0702f7e798c321d8b437bae86d84
Parents: 9a5ec88
Author: Anton Kasyanov <mi...@gmail.com>
Authored: Thu Aug 8 17:05:20 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Aug 29 19:00:45 2013 +0000
----------------------------------------------------------------------
ForgeSVN/forgesvn/model/svn.py | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/de91d9d7/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index 9074946..3e6ea25 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -533,28 +533,39 @@ class SVNImplementation(M.RepositoryImplementation):
while revno > exclude:
rev = pysvn.Revision(pysvn.opt_revision_kind.number, revno)
try:
- logs = self._svn.log(url, revision_start=rev, limit=page_size)
+ logs = self._svn.log(url, revision_start=rev, limit=page_size,
+ discover_changed_paths=True)
except pysvn.ClientError as e:
if 'Unable to connect' in e.message:
raise # repo error
return # no (more) history for this path
for ci in logs:
+
if ci.revision.number <= exclude:
return
if id_only:
yield ci.revision.number
else:
- yield self._map_log(ci, url)
+ yield self._map_log(ci, url, path)
if len(logs) < page_size:
return # we didn't get a full page, don't bother calling SVN again
revno = ci.revision.number - 1
- def _map_log(self, ci, url):
+ def _map_log(self, ci, url, path=None):
revno = ci.revision.number
try:
size = int(self._svn.list(url)[0][0].size)
- except pysvn.ClientError as e:
+ except pysvn.ClientError:
size = None
+ rename_details = {}
+ changed_paths = ci.get('changed_paths', [])
+ for changed_path in changed_paths:
+ if changed_path['copyfrom_path'] and changed_path['path'] == path and changed_path['action'] == 'A':
+ rename_details['path'] = changed_path['copyfrom_path']
+ rename_details['commit_url'] = self._repo.url_for_commit(
+ changed_path['copyfrom_revision'].number
+ )
+ break
return {
'id': revno,
'message': h.really_unicode(ci.get('message', '--none--')),
@@ -571,6 +582,7 @@ class SVNImplementation(M.RepositoryImplementation):
'refs': ['HEAD'] if revno == self.head else [],
'parents': [revno-1] if revno > 1 else [],
'size': size,
+ 'rename_details': rename_details,
}
def open_blob(self, blob):
[44/50] git commit: [#6530] Add error handling to individual tool
importers
Posted by jo...@apache.org.
[#6530] Add error handling to individual tool importers
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/1794af54
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/1794af54
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/1794af54
Branch: refs/heads/cj/6596
Commit: 1794af54ad7e92714cb27679fb50df38602fe6b4
Parents: 43f56c2
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Fri Aug 30 16:49:24 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Sep 4 14:30:57 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/base.py | 7 +++---
ForgeImporters/forgeimporters/google/code.py | 13 +++++++++-
ForgeImporters/forgeimporters/google/tracker.py | 13 +++++++++-
.../forgeimporters/tests/test_base.py | 26 ++++++++++++--------
ForgeImporters/forgeimporters/trac/tickets.py | 13 +++++++++-
5 files changed, 55 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1794af54/ForgeImporters/forgeimporters/base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index 69db8d6..54f006b 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -76,11 +76,10 @@ def import_tool(importer_name, project_name=None, mount_point=None, mount_label=
g.post_event('import_tool_task_failed',
error=str(e),
traceback=traceback.format_exc(),
- importer_name=importer_name,
+ importer_source=importer.source,
+ importer_tool_label=importer.tool_label,
project_name=project_name,
- mount_point=mount_point,
- mount_label=mount_label,
- **kw)
+ )
class ProjectExtractor(object):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1794af54/ForgeImporters/forgeimporters/google/code.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/code.py b/ForgeImporters/forgeimporters/google/code.py
index ed2519f..c270ee0 100644
--- a/ForgeImporters/forgeimporters/google/code.py
+++ b/ForgeImporters/forgeimporters/google/code.py
@@ -16,6 +16,7 @@
# under the License.
import urllib2
+import traceback
import formencode as fe
from formencode import validators as fev
@@ -83,7 +84,17 @@ def get_repo_class(type_):
@task(notifications_disabled=True)
def import_tool(**kw):
- GoogleRepoImporter().import_tool(c.project, c.user, **kw)
+ try:
+ importer = GoogleRepoImporter()
+ importer.import_tool(c.project, c.user, **kw)
+ except Exception as e:
+ g.post_event('import_tool_task_failed',
+ error=str(e),
+ traceback=traceback.format_exc(),
+ importer_source=importer.source,
+ importer_tool_label=importer.tool_label,
+ project_name=kw.get('project_name'),
+ )
class GoogleRepoImportForm(fe.schema.Schema):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1794af54/ForgeImporters/forgeimporters/google/tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/tracker.py b/ForgeImporters/forgeimporters/google/tracker.py
index eb97c07..e5c8dc3 100644
--- a/ForgeImporters/forgeimporters/google/tracker.py
+++ b/ForgeImporters/forgeimporters/google/tracker.py
@@ -17,6 +17,7 @@
from collections import defaultdict
from datetime import datetime
+import traceback
from formencode import validators as fev
@@ -53,7 +54,17 @@ from forgeimporters.base import (
@task(notifications_disabled=True)
def import_tool(**kw):
- GoogleCodeTrackerImporter().import_tool(c.project, c.user, **kw)
+ try:
+ importer = GoogleCodeTrackerImporter()
+ importer.import_tool(c.project, c.user, **kw)
+ except Exception as e:
+ g.post_event('import_tool_task_failed',
+ error=str(e),
+ traceback=traceback.format_exc(),
+ importer_source=importer.source,
+ importer_tool_label=importer.tool_label,
+ project_name=kw.get('project_name'),
+ )
class GoogleCodeTrackerImportForm(ToolImportForm):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1794af54/ForgeImporters/forgeimporters/tests/test_base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/test_base.py b/ForgeImporters/forgeimporters/tests/test_base.py
index a61ecda..f6d443f 100644
--- a/ForgeImporters/forgeimporters/tests/test_base.py
+++ b/ForgeImporters/forgeimporters/tests/test_base.py
@@ -54,20 +54,26 @@ def test_import_tool(g, c, by_name):
mount_label='mount_label')
assert not g.post_event.called
-@mock.patch.object(base.ToolImporter, 'by_name')
+
+@mock.patch.object(base.traceback, 'format_exc')
+@mock.patch.object(base, 'ToolImporter')
@mock.patch.object(base, 'g')
-def test_import_tool_failed(g, by_name):
- by_name.side_effect = RuntimeError('my error')
- base.import_tool('importer_name', project_name='project_name',
- mount_point='mount_point', mount_label='mount_label', other='other')
+def test_import_tool_failed(g, ToolImporter, format_exc):
+ format_exc.return_value = 'my traceback'
+
+ importer = mock.Mock(source='importer_source',
+ tool_label='importer_tool_label')
+ importer.import_tool.side_effect = RuntimeError('my error')
+ ToolImporter.by_name.return_value = importer
+
+ base.import_tool('importer_name', project_name='project_name')
g.post_event.assert_called_once_with(
'import_tool_task_failed',
- error=by_name.side_effect,
- importer_name='importer_name',
+ error=str(importer.import_tool.side_effect),
+ traceback='my traceback',
+ importer_source='importer_source',
+ importer_tool_label='importer_tool_label',
project_name='project_name',
- mount_point='mount_point',
- mount_label='mount_label',
- other='other',
)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1794af54/ForgeImporters/forgeimporters/trac/tickets.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/trac/tickets.py b/ForgeImporters/forgeimporters/trac/tickets.py
index 941ff32..7876b44 100644
--- a/ForgeImporters/forgeimporters/trac/tickets.py
+++ b/ForgeImporters/forgeimporters/trac/tickets.py
@@ -20,6 +20,7 @@ from datetime import (
timedelta,
)
import json
+import traceback
from formencode import validators as fev
@@ -59,7 +60,17 @@ from forgetracker.scripts.import_tracker import import_tracker
@task(notifications_disabled=True)
def import_tool(**kw):
- TracTicketImporter().import_tool(c.project, c.user, **kw)
+ try:
+ importer = TracTicketImporter()
+ importer.import_tool(c.project, c.user, **kw)
+ except Exception as e:
+ g.post_event('import_tool_task_failed',
+ error=str(e),
+ traceback=traceback.format_exc(),
+ importer_source=importer.source,
+ importer_tool_label=importer.tool_label,
+ project_name=kw.get('trac_url'),
+ )
class TracTicketImportForm(ToolImportForm):
[17/50] git commit: [#6595] Make 'tarball' controller handle GET and
POST
Posted by jo...@apache.org.
[#6595] Make 'tarball' controller handle GET and POST
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f9679555
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f9679555
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f9679555
Branch: refs/heads/cj/6596
Commit: f9679555198e5246fbbcf003e44d39d9f94e13f9
Parents: 6769dc2
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Mon Aug 26 14:00:08 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Aug 28 19:40:32 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/repository.py | 12 ++---
Allura/allura/templates/repo/tarball.html | 13 ++++--
.../tests/functional/test_controllers.py | 10 +++-
.../tests/functional/test_controllers.py | 49 ++++++++++----------
4 files changed, 46 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f9679555/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index f984a91..14ce77a 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -20,7 +20,7 @@ import json
import logging
import re
import difflib
-from urllib import quote, unquote
+from urllib import quote, unquote, quote_plus
from collections import defaultdict
from itertools import islice
@@ -459,24 +459,24 @@ class CommitBrowser(BaseController):
result.update(self._commit.context())
return result
- @require_post()
@expose('jinja:allura:templates/repo/tarball.html')
def tarball(self, **kw):
- path = kw.pop('path', None)
+ path = request.params.get('path')
if not asbool(tg.config.get('scm.repos.tarball.enable', False)):
raise exc.HTTPNotFound()
rev = self._commit.url().split('/')[-2]
status = c.app.repo.get_tarball_status(rev, path)
- if status is None:
+ if status is None and request.method == 'POST':
allura.tasks.repo_tasks.tarball.post(revision=rev, path=path)
- return dict(commit=self._commit, revision=rev, status=status)
+ redirect('tarball' + '?path={0}'.format(path) if path else '')
+ return dict(commit=self._commit, revision=rev, status=status or 'na')
@expose('json:')
def tarball_status(self, path=None, **kw):
if not asbool(tg.config.get('scm.repos.tarball.enable', False)):
raise exc.HTTPNotFound()
rev = self._commit.url().split('/')[-2]
- return dict(status=c.app.repo.get_tarball_status(rev, path))
+ return dict(status=c.app.repo.get_tarball_status(rev, path) or 'na')
@expose('jinja:allura:templates/repo/log.html')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f9679555/Allura/allura/templates/repo/tarball.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/tarball.html b/Allura/allura/templates/repo/tarball.html
index e4a9cad..805293c 100644
--- a/Allura/allura/templates/repo/tarball.html
+++ b/Allura/allura/templates/repo/tarball.html
@@ -53,13 +53,14 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
left: 10 // Left position relative to parent in px
};
var spinner = new Spinner(opts).spin($('#snapshot_status')[0]);
- var delay = 5000;
+ var delay = 500;
// Check tarball status every 5 seconds
function check_status() {
$.get('{{commit.url()}}tarball_status?path={{path}}', function(data) {
- if (data.status === 'ready') {
+ if (data.status !== 'na') {
spinner.stop();
- $('#snapshot_status h2').toggle();
+ $('#snapshot_status h2').hide();
+ $('#snapshot_status h2.' + data.status).show();
{% if 'no-redirect' not in request.params %}
window.location.href = '{{c.app.repo.tarball_url(revision, path)}}';
{% endif %}
@@ -82,6 +83,7 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
<div id='snapshot_status'>
<h2 class="busy">Generating snapshot...</h2>
<h2 class="ready">Your download will begin shortly, or use this <a href="{{c.app.repo.tarball_url(revision, path)}}">direct link</a>.</h2>
+ <h2 class="na">Checking snapshot status...</h2>
</div>
{% endblock %}
@@ -89,9 +91,10 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
<style type="text/css">
#snapshot_status h2 {
padding-left: 33px;
- }
- #snapshot_status .{{ 'busy' if status == 'ready' else 'ready' }} {
display: none;
}
+ #snapshot_status .{{ status }} {
+ display: block;
+ }
</style>
{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f9679555/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 1222429..c05ef94 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -53,6 +53,8 @@ class _TestCase(TestController):
# ThreadLocalORMSession.close_all()
h.set_context('test', 'src-git', neighborhood='Projects')
c.app.repo.refresh()
+ if os.path.isdir(c.app.repo.tarball_path):
+ shutil.rmtree(c.app.repo.tarball_path)
ThreadLocalORMSession.flush_all()
# ThreadLocalORMSession.close_all()
@@ -343,14 +345,18 @@ class TestRootController(_TestCase):
r = self.app.get(ci + 'tree/')
assert '/p/test/src-git/ci/master/tarball' in r
assert 'Download Snapshot' in r
- r = self.app.post('/p/test/src-git/ci/master/tarball')
- assert 'Generating snapshot...' in r
+ r = self.app.post('/p/test/src-git/ci/master/tarball').follow()
+ assert 'Checking snapshot status...' in r
+ r = self.app.get('/p/test/src-git/ci/master/tarball')
+ assert 'Checking snapshot status...' in r
M.MonQTask.run_ready()
ThreadLocalORMSession.flush_all()
r = self.app.get(ci + 'tarball_status')
assert '{"status": "ready"}' in r
r = self.app.get('/p/test/src-git/ci/master/tarball_status')
assert '{"status": "ready"}' in r
+ r = self.app.get('/p/test/src-git/ci/master/tarball')
+ assert 'Your download will begin shortly' in r
def test_tarball_link_in_subdirs(self):
'''Go to repo subdir and check 'Download Snapshot' link'''
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f9679555/ForgeSVN/forgesvn/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/functional/test_controllers.py b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
index cc37545..16fd989 100644
--- a/ForgeSVN/forgesvn/tests/functional/test_controllers.py
+++ b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
@@ -38,29 +38,24 @@ class SVNTestController(TestController):
TestController.setUp(self)
self.setup_with_tools()
- @with_svn
- @with_tool('test', 'SVN', 'svn-tags', 'SVN with tags')
- def setup_with_tools(self):
- h.set_context('test', 'src', neighborhood='Projects')
+ def _make_app(self, mount_point, name):
+ h.set_context('test', mount_point, neighborhood='Projects')
repo_dir = pkg_resources.resource_filename(
'forgesvn', 'tests/data/')
c.app.repo.fs_path = repo_dir
c.app.repo.status = 'ready'
- c.app.repo.name = 'testsvn'
- ThreadLocalORMSession.flush_all()
- ThreadLocalORMSession.close_all()
- h.set_context('test', 'src', neighborhood='Projects')
- c.app.repo.refresh()
- ThreadLocalORMSession.flush_all()
- ThreadLocalORMSession.close_all()
- h.set_context('test', 'svn-tags', neighborhood='Projects')
- c.app.repo.fs_path = repo_dir
- c.app.repo.status = 'ready'
- c.app.repo.name = 'testsvn-trunk-tags-branches'
+ c.app.repo.name = name
c.app.repo.refresh()
+ if os.path.isdir(c.app.repo.tarball_path):
+ shutil.rmtree(c.app.repo.tarball_path)
ThreadLocalORMSession.flush_all()
ThreadLocalORMSession.close_all()
- h.set_context('test', 'src', neighborhood='Projects')
+
+ @with_svn
+ @with_tool('test', 'SVN', 'svn-tags', 'SVN with tags')
+ def setup_with_tools(self):
+ self._make_app('svn-tags', 'testsvn-trunk-tags-branches')
+ self._make_app('src', 'testsvn')
class TestRootController(SVNTestController):
@@ -194,12 +189,16 @@ class TestRootController(SVNTestController):
def test_tarball(self):
r = self.app.get('/src/3/tree/')
assert 'Download Snapshot' in r
- r = self.app.post('/src/3/tarball')
- assert 'Generating snapshot...' in r
+ r = self.app.post('/src/3/tarball').follow()
+ assert 'Checking snapshot status...' in r
+ r = self.app.get('/src/3/tarball')
+ assert 'Checking snapshot status...' in r
M.MonQTask.run_ready()
ThreadLocalORMSession.flush_all()
r = self.app.get('/src/3/tarball_status')
assert '{"status": "ready"}' in r
+ r = self.app.get('/src/3/tarball')
+ assert 'Your download will begin shortly' in r
@onlyif(os.path.exists(tg.config.get('scm.repos.tarball.zip_binary', '/usr/bin/zip')), 'zip binary is missing')
def test_tarball_tags_aware(self):
@@ -217,23 +216,23 @@ class TestRootController(SVNTestController):
assert_equal(form.find('input', attrs=dict(name='path')).get('value'), '/tags/tag-1.0')
r = self.app.get('/p/test/svn-tags/19/tarball_status?path=/tags/tag-1.0')
- assert_equal(r.json['status'], None)
- r = self.app.post('/p/test/svn-tags/19/tarball', dict(path='/tags/tag-1.0'))
- assert 'Generating snapshot...' in r
+ assert_equal(r.json['status'], 'na')
+ r = self.app.post('/p/test/svn-tags/19/tarball', dict(path='/tags/tag-1.0')).follow()
+ assert 'Checking snapshot status...' in r
M.MonQTask.run_ready()
r = self.app.get('/p/test/svn-tags/19/tarball_status?path=/tags/tag-1.0')
assert_equal(r.json['status'], 'ready')
r = self.app.get('/p/test/svn-tags/19/tarball_status?path=/trunk')
- assert_equal(r.json['status'], None)
- r = self.app.post('/p/test/svn-tags/19/tarball', dict(path='/trunk/'))
- assert 'Generating snapshot...' in r
+ assert_equal(r.json['status'], 'na')
+ r = self.app.post('/p/test/svn-tags/19/tarball', dict(path='/trunk/')).follow()
+ assert 'Checking snapshot status...' in r
M.MonQTask.run_ready()
r = self.app.get('/p/test/svn-tags/19/tarball_status?path=/trunk')
assert_equal(r.json['status'], 'ready')
r = self.app.get('/p/test/svn-tags/19/tarball_status?path=/branches/aaa/')
- assert_equal(r.json['status'], None)
+ assert_equal(r.json['status'], 'na')
# All of the following also should be ready because...
# ...this is essentially the same as trunk snapshot
[24/50] git commit: [#5775] ticket:404 looking for renames in git log
Posted by jo...@apache.org.
[#5775] ticket:404 looking for renames in git log
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/24093750
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/24093750
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/24093750
Branch: refs/heads/cj/6596
Commit: 240937501856ba885850bad591fefcae0f6cb124
Parents: 2d81595
Author: Anton Kasyanov <mi...@gmail.com>
Authored: Tue Aug 6 13:50:24 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Aug 29 19:00:45 2013 +0000
----------------------------------------------------------------------
ForgeGit/forgegit/model/git_repo.py | 49 ++++++++++++++++++--------------
1 file changed, 27 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/24093750/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index ade299e..1599fd2 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -301,28 +301,22 @@ class GitImplementation(M.RepositoryImplementation):
path = path.strip('/') if path else None
if exclude is not None:
revs.extend(['^%s' % e for e in exclude])
- for ci, refs in self._iter_commits_with_refs([revs, '--', path]):
+ args = ['--name-status', revs, '--', path]
+ if path:
+ args = ['--follow'] + args
+ for ci, refs, renamed in self._iter_commits_with_refs(*args):
if id_only:
yield ci.hexsha
else:
size = None
- renamed_from = {}
+ rename_details = {}
if path:
- # checking for renaming in this commit
- if ci.parents:
- # without create_path=True, renames are not detected
- # see diff() doc from git/diff.py
- diff_with_parent = ci.diff(
- ci.parents[0],
- create_patch=True
- )[0]
- # since we do diff with previous commit (not next)
- # rename_from and rename_to are interchanged
- if diff_with_parent.renamed and diff_with_parent.rename_from == path:
- renamed_from['path'] = '/' + diff_with_parent.rename_to
- renamed_from['commit_url'] = self._repo.url_for_commit(
- ci.hexsha
- )
+ if renamed and renamed['to'] == path:
+ rename_details['path'] = '/' + renamed['from']
+ rename_details['commit_url'] = self._repo.url_for_commit(
+ ci.hexsha
+ )
+
try:
node = ci.tree/path
size = node.size if node.type == 'blob' else None
@@ -344,8 +338,11 @@ class GitImplementation(M.RepositoryImplementation):
'refs': refs,
'parents': [pci.hexsha for pci in ci.parents],
'size': size,
- 'renamed_from': renamed_from,
+ 'renamed_from': rename_details,
}
+ if rename_details:
+ # we do not need to show commits before rename
+ break
def _iter_commits_with_refs(self, *args, **kwargs):
"""
@@ -369,12 +366,20 @@ class GitImplementation(M.RepositoryImplementation):
proc = self._git.git.log(*args, format='%H%x00%d', as_process=True, **kwargs)
stream = proc.stdout
while True:
- line = stream.readline()
- if not line:
+ commit_lines = [stream.readline() for _ in xrange(3)]
+ commit_line = '\x00'.join(
+ [line.strip('\n ').replace('\t', ' ') for line in commit_lines if line.strip('\n\t ')]
+ )
+ if not commit_line:
break
- hexsha, decoration = line.strip().split('\x00')
+ hexsha, decoration, name_stat = commit_line.strip().split('\x00')
refs = decoration.strip(' ()').split(', ') if decoration else []
- yield (git.Commit(self._git, gitdb.util.hex_to_bin(hexsha)), refs)
+ name_stat_parts = name_stat.split(' ')
+ renamed = {}
+ if name_stat_parts[0] == 'R100':
+ renamed['from'] = name_stat_parts[1]
+ renamed['to'] = name_stat_parts[2]
+ yield (git.Commit(self._git, gitdb.util.hex_to_bin(hexsha)), refs, renamed)
def open_blob(self, blob):
return _OpenedGitBlob(
[16/50] git commit: [#6595] Show resubmit option if snapshot not found
Posted by jo...@apache.org.
[#6595] Show resubmit option if snapshot not found
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/839e624e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/839e624e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/839e624e
Branch: refs/heads/cj/6596
Commit: 839e624ea2610a0494865e0844b706e2f8754ab4
Parents: f967955
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Aug 28 17:24:58 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Aug 28 19:40:32 2013 +0000
----------------------------------------------------------------------
Allura/allura/templates/repo/tarball.html | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/839e624e/Allura/allura/templates/repo/tarball.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/tarball.html b/Allura/allura/templates/repo/tarball.html
index 805293c..f929433 100644
--- a/Allura/allura/templates/repo/tarball.html
+++ b/Allura/allura/templates/repo/tarball.html
@@ -54,7 +54,6 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
};
var spinner = new Spinner(opts).spin($('#snapshot_status')[0]);
var delay = 500;
- // Check tarball status every 5 seconds
function check_status() {
$.get('{{commit.url()}}tarball_status?path={{path}}', function(data) {
if (data.status !== 'na') {
@@ -65,8 +64,12 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
window.location.href = '{{c.app.repo.tarball_url(revision, path)}}';
{% endif %}
} else {
- if (delay < 600000){
- delay = delay * 2
+ if (delay < 60000){
+ delay = delay * 2;
+ }
+ if (delay >= 16000) {
+ // we've been waiting at least 15 seconds
+ $('#snapshot_status form').show();
}
window.setTimeout(check_status, delay);
}
@@ -84,6 +87,11 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
<h2 class="busy">Generating snapshot...</h2>
<h2 class="ready">Your download will begin shortly, or use this <a href="{{c.app.repo.tarball_url(revision, path)}}">direct link</a>.</h2>
<h2 class="na">Checking snapshot status...</h2>
+ <form action="tarball" method="post">
+ <p>We're having trouble finding that snapshot. Would you like to resubmit?</p>
+ <input type="hidden" name="path" value="{{path}}" />
+ <input type="submit" value="Resubmit Snapshot Request" />
+ </form>
</div>
{% endblock %}
@@ -96,5 +104,12 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
#snapshot_status .{{ status }} {
display: block;
}
+ #snapshot_status form {
+ display: none;
+ margin-left: 20px;
+ }
+ #snapshot_status form p {
+ padding-left: 0;
+ }
</style>
{% endblock %}
[07/50] git commit: [#6482] add a test for the importer admin page
Posted by jo...@apache.org.
[#6482] add a test for the importer admin page
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/7f179dca
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/7f179dca
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/7f179dca
Branch: refs/heads/cj/6596
Commit: 7f179dca16b4a37936a1d3427aa18db130a3292a
Parents: b7fb5f2
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Aug 13 20:38:30 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Aug 27 17:24:58 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/base.py | 4 +-
.../forgeimporters/tests/test_base.py | 74 ++++++++++++++------
2 files changed, 56 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7f179dca/ForgeImporters/forgeimporters/base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index c6cdf4a..e957b1a 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -404,5 +404,5 @@ class ImportAdminExtension(AdminExtension):
def update_project_sidebar_menu(self, sidebar_links):
base_url = c.project.url() + 'admin/ext/'
- link = SitemapEntry('Import', base_url+'import')
- sidebar_links.append(link)
+ link = SitemapEntry('Import', base_url+'import/')
+ sidebar_links.append(link)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7f179dca/ForgeImporters/forgeimporters/tests/test_base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/test_base.py b/ForgeImporters/forgeimporters/tests/test_base.py
index 57ed227..f1c93ad 100644
--- a/ForgeImporters/forgeimporters/tests/test_base.py
+++ b/ForgeImporters/forgeimporters/tests/test_base.py
@@ -19,6 +19,10 @@ from unittest import TestCase
from formencode import Invalid
import mock
+from tg import expose
+from nose.tools import assert_equal
+
+from alluratest.controller import TestController
from .. import base
@@ -76,17 +80,25 @@ TA1 = mock.Mock(tool_label='foo', tool_description='foo_desc')
TA2 = mock.Mock(tool_label='qux', tool_description='qux_desc')
TA3 = mock.Mock(tool_label='baz', tool_description='baz_desc')
-class TestToolImporter(TestCase):
- class TI1(base.ToolImporter):
- target_app = TA1
+class TI1Controller(object):
+ @expose()
+ def index(self, *a, **kw):
+ return 'test importer 1 controller webpage'
+
+class TI1(base.ToolImporter):
+ target_app = TA1
+ controller = TI1Controller
+
+class TI2(base.ToolImporter):
+ target_app = TA2
+ tool_label = 'bar'
+ tool_description = 'bar_desc'
+
+class TI3(base.ToolImporter):
+ target_app = [TA2, TA2]
- class TI2(base.ToolImporter):
- target_app = TA2
- tool_label = 'bar'
- tool_description = 'bar_desc'
+class TestToolImporter(TestCase):
- class TI3(base.ToolImporter):
- target_app = [TA2, TA2]
@mock.patch.object(base, 'iter_entry_points')
def test_by_name(self, iep):
@@ -104,27 +116,27 @@ class TestToolImporter(TestCase):
@mock.patch.object(base, 'iter_entry_points')
def test_by_app(self, iep):
eps = iep.return_value = [
- ep('importer1', importer=self.TI1),
- ep('importer2', importer=self.TI2),
- ep('importer3', importer=self.TI3),
+ ep('importer1', importer=TI1),
+ ep('importer2', importer=TI2),
+ ep('importer3', importer=TI3),
]
importers = base.ToolImporter.by_app(TA2)
self.assertEqual(set(importers.keys()), set([
'importer2',
'importer3',
]))
- self.assertIsInstance(importers['importer2'], self.TI2)
- self.assertIsInstance(importers['importer3'], self.TI3)
+ self.assertIsInstance(importers['importer2'], TI2)
+ self.assertIsInstance(importers['importer3'], TI3)
def test_tool_label(self):
- self.assertEqual(self.TI1().tool_label, 'foo')
- self.assertEqual(self.TI2().tool_label, 'bar')
- self.assertEqual(self.TI3().tool_label, 'qux')
+ self.assertEqual(TI1().tool_label, 'foo')
+ self.assertEqual(TI2().tool_label, 'bar')
+ self.assertEqual(TI3().tool_label, 'qux')
def test_tool_description(self):
- self.assertEqual(self.TI1().tool_description, 'foo_desc')
- self.assertEqual(self.TI2().tool_description, 'bar_desc')
- self.assertEqual(self.TI3().tool_description, 'qux_desc')
+ self.assertEqual(TI1().tool_description, 'foo_desc')
+ self.assertEqual(TI2().tool_description, 'bar_desc')
+ self.assertEqual(TI3().tool_description, 'qux_desc')
class TestToolsValidator(TestCase):
@@ -172,3 +184,25 @@ class TestToolsValidator(TestCase):
mock.call('value1'),
mock.call('value2'),
])
+
+
+class TestProjectToolsImportController(TestController):
+
+ def test_pages(self):
+ admin_page = self.app.get('/admin/')
+ with mock.patch.object(base, 'iter_entry_points') as iep:
+ iep.return_value = [
+ ep('importer1', importer=TI1),
+ ep('importer2', importer=TI2),
+ ep('importer3', importer=TI3),
+ ]
+ import_main_page = admin_page.click('Import')
+ url = import_main_page.environ['PATH_INFO']
+ assert url.endswith('/admin/ext/import/'), url
+
+ with mock.patch.object(base.ToolImporter, 'by_name') as by_name:
+ by_name.return_value = TI1
+ import1_page = import_main_page.click('Import', href=r'importer1$')
+ url = import1_page.environ['PATH_INFO']
+ assert url.endswith('/admin/ext/import/importer1'), url
+ assert_equal(import1_page.body, 'test importer 1 controller webpage')
[40/50] git commit: [#4595] ticket:421 Filter projects by date range
Posted by jo...@apache.org.
[#4595] ticket:421 Filter projects by date range
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f865ddfd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f865ddfd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f865ddfd
Branch: refs/heads/cj/6596
Commit: f865ddfdc5390753cfb268a67d9835b34a439add
Parents: 01194e0
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Sep 2 12:26:09 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:55 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/site_admin.py | 8 +++++---
Allura/allura/tests/functional/test_site_admin.py | 14 ++++++++++++++
2 files changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f865ddfd/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index be8415b..818016f 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -192,14 +192,16 @@ class SiteAdminController(object):
end_dt = datetime.strptime(end_dt, '%Y/%m/%d %H:%M:%S')
except ValueError:
end_dt = None
+ start_dt = datetime.now() if not start_dt else start_dt
+ end_dt = start_dt - timedelta(days=15) if not end_dt else end_dt
+ start = bson.ObjectId.from_datetime(start_dt)
+ end = bson.ObjectId.from_datetime(end_dt)
nb = M.Neighborhood.query.get(name='Users')
projects = (M.Project.query.find({
'neighborhood_id': {'$ne': nb._id},
'deleted': False,
+ '_id': {'$lt': start, '$gt': end},
}).sort('_id', -1))
- #projects = projects.skip(start).limit(limit)
- start_dt = datetime.now() if not start_dt else start_dt
- end_dt = start_dt - timedelta(days=15) if not end_dt else end_dt
return {
'projects': projects,
'window_start': start_dt,
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f865ddfd/Allura/allura/tests/functional/test_site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_site_admin.py b/Allura/allura/tests/functional/test_site_admin.py
index e339ff7..e0ba8fd 100644
--- a/Allura/allura/tests/functional/test_site_admin.py
+++ b/Allura/allura/tests/functional/test_site_admin.py
@@ -16,6 +16,7 @@
# under the License.
import json
+from datetime import timedelta
from nose.tools import assert_equal
from ming.odm import ThreadLocalORMSession
@@ -78,6 +79,19 @@ class TestSiteAdmin(TestController):
username='root'))
assert_equal(len(r.html.find('table').findAll('tr')), count - 1)
+ def test_new_projects_daterange_filtering(self):
+ r = self.app.get('/nf/admin/new_projects', extra_environ=dict(
+ username='root'))
+ count = len(r.html.find('table').findAll('tr'))
+ assert_equal(count, 7)
+
+ filtr = r.forms[0]
+ filtr['start-dt'] = '2000/01/01 10:10:10'
+ filtr['end-dt'] = '2000/01/01 09:09:09'
+ r = filtr.submit()
+ count = len(r.html.find('table').findAll('tr'))
+ assert_equal(count, 1) # only row with headers - no results
+
def test_reclone_repo_access(self):
r = self.app.get('/nf/admin/reclone_repo', extra_environ=dict(
username='*anonymous'), status=302).follow()
[45/50] git commit: [#6530] Refactor error handling into context
manager
Posted by jo...@apache.org.
[#6530] Refactor error handling into context manager
- Also allows exc to propagate up so task will end in error state
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/153078bb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/153078bb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/153078bb
Branch: refs/heads/cj/6596
Commit: 153078bbc7cf0f76c2bd13b155e7a3c09024d9eb
Parents: 1794af5
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue Sep 3 20:15:27 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Sep 4 14:30:57 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/base.py | 31 +++++++++++++-------
ForgeImporters/forgeimporters/google/code.py | 18 ++++--------
ForgeImporters/forgeimporters/google/tracker.py | 14 ++-------
.../forgeimporters/tests/test_base.py | 5 ++--
ForgeImporters/forgeimporters/trac/tickets.py | 14 ++-------
5 files changed, 36 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/153078bb/ForgeImporters/forgeimporters/base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index 54f006b..e0e9d6f 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -66,20 +66,31 @@ class ToolImportForm(schema.Schema):
mount_label = fev.UnicodeString()
+class ImportErrorHandler(object):
+ def __init__(self, importer, project_name):
+ self.importer = importer
+ self.project_name = project_name
+
+ def __enter__(self):
+ pass
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ if exc_type:
+ g.post_event('import_tool_task_failed',
+ error=str(exc_val),
+ traceback=traceback.format_exc(),
+ importer_source=self.importer.source,
+ importer_tool_label=self.importer.tool_label,
+ project_name=self.project_name,
+ )
+
+
@task(notifications_disabled=True)
def import_tool(importer_name, project_name=None, mount_point=None, mount_label=None, **kw):
- try:
- importer = ToolImporter.by_name(importer_name)
+ importer = ToolImporter.by_name(importer_name)
+ with ImportErrorHandler(importer, project_name):
importer.import_tool(c.project, c.user, project_name=project_name,
mount_point=mount_point, mount_label=mount_label, **kw)
- except Exception as e:
- g.post_event('import_tool_task_failed',
- error=str(e),
- traceback=traceback.format_exc(),
- importer_source=importer.source,
- importer_tool_label=importer.tool_label,
- project_name=project_name,
- )
class ProjectExtractor(object):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/153078bb/ForgeImporters/forgeimporters/google/code.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/code.py b/ForgeImporters/forgeimporters/google/code.py
index c270ee0..4cf752d 100644
--- a/ForgeImporters/forgeimporters/google/code.py
+++ b/ForgeImporters/forgeimporters/google/code.py
@@ -16,7 +16,6 @@
# under the License.
import urllib2
-import traceback
import formencode as fe
from formencode import validators as fev
@@ -38,7 +37,10 @@ from allura.controllers import BaseController
from allura.lib import validators as v
from allura.lib.decorators import require_post, task
-from forgeimporters.base import ToolImporter
+from forgeimporters.base import (
+ ToolImporter,
+ ImportErrorHandler,
+ )
from forgeimporters.google import GoogleCodeProjectExtractor
REPO_APPS = {}
@@ -84,17 +86,9 @@ def get_repo_class(type_):
@task(notifications_disabled=True)
def import_tool(**kw):
- try:
- importer = GoogleRepoImporter()
+ importer = GoogleRepoImporter()
+ with ImportErrorHandler(importer, kw.get('project_name')):
importer.import_tool(c.project, c.user, **kw)
- except Exception as e:
- g.post_event('import_tool_task_failed',
- error=str(e),
- traceback=traceback.format_exc(),
- importer_source=importer.source,
- importer_tool_label=importer.tool_label,
- project_name=kw.get('project_name'),
- )
class GoogleRepoImportForm(fe.schema.Schema):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/153078bb/ForgeImporters/forgeimporters/google/tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/tracker.py b/ForgeImporters/forgeimporters/google/tracker.py
index e5c8dc3..1535531 100644
--- a/ForgeImporters/forgeimporters/google/tracker.py
+++ b/ForgeImporters/forgeimporters/google/tracker.py
@@ -17,7 +17,6 @@
from collections import defaultdict
from datetime import datetime
-import traceback
from formencode import validators as fev
@@ -49,22 +48,15 @@ from . import GoogleCodeProjectExtractor
from forgeimporters.base import (
ToolImporter,
ToolImportForm,
+ ImportErrorHandler,
)
@task(notifications_disabled=True)
def import_tool(**kw):
- try:
- importer = GoogleCodeTrackerImporter()
+ importer = GoogleCodeTrackerImporter()
+ with ImportErrorHandler(importer, kw.get('project_name')):
importer.import_tool(c.project, c.user, **kw)
- except Exception as e:
- g.post_event('import_tool_task_failed',
- error=str(e),
- traceback=traceback.format_exc(),
- importer_source=importer.source,
- importer_tool_label=importer.tool_label,
- project_name=kw.get('project_name'),
- )
class GoogleCodeTrackerImportForm(ToolImportForm):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/153078bb/ForgeImporters/forgeimporters/tests/test_base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/test_base.py b/ForgeImporters/forgeimporters/tests/test_base.py
index f6d443f..7de0625 100644
--- a/ForgeImporters/forgeimporters/tests/test_base.py
+++ b/ForgeImporters/forgeimporters/tests/test_base.py
@@ -20,7 +20,7 @@ from unittest import TestCase
from formencode import Invalid
import mock
from tg import expose
-from nose.tools import assert_equal
+from nose.tools import assert_equal, assert_raises
from alluratest.controller import TestController
@@ -66,7 +66,8 @@ def test_import_tool_failed(g, ToolImporter, format_exc):
importer.import_tool.side_effect = RuntimeError('my error')
ToolImporter.by_name.return_value = importer
- base.import_tool('importer_name', project_name='project_name')
+ assert_raises(RuntimeError, base.import_tool, 'importer_name',
+ project_name='project_name')
g.post_event.assert_called_once_with(
'import_tool_task_failed',
error=str(importer.import_tool.side_effect),
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/153078bb/ForgeImporters/forgeimporters/trac/tickets.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/trac/tickets.py b/ForgeImporters/forgeimporters/trac/tickets.py
index 7876b44..3063d71 100644
--- a/ForgeImporters/forgeimporters/trac/tickets.py
+++ b/ForgeImporters/forgeimporters/trac/tickets.py
@@ -20,7 +20,6 @@ from datetime import (
timedelta,
)
import json
-import traceback
from formencode import validators as fev
@@ -53,6 +52,7 @@ from allura.scripts.trac_export import (
from forgeimporters.base import (
ToolImporter,
ToolImportForm,
+ ImportErrorHandler,
)
from forgetracker.tracker_main import ForgeTrackerApp
from forgetracker.scripts.import_tracker import import_tracker
@@ -60,17 +60,9 @@ from forgetracker.scripts.import_tracker import import_tracker
@task(notifications_disabled=True)
def import_tool(**kw):
- try:
- importer = TracTicketImporter()
+ importer = TracTicketImporter()
+ with ImportErrorHandler(importer, kw.get('trac_url')):
importer.import_tool(c.project, c.user, **kw)
- except Exception as e:
- g.post_event('import_tool_task_failed',
- error=str(e),
- traceback=traceback.format_exc(),
- importer_source=importer.source,
- importer_tool_label=importer.tool_label,
- project_name=kw.get('trac_url'),
- )
class TracTicketImportForm(ToolImportForm):
[33/50] git commit: [#6619] backwards compatibility for old tickets
Posted by jo...@apache.org.
[#6619] backwards compatibility for old tickets
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/208f608f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/208f608f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/208f608f
Branch: refs/heads/cj/6596
Commit: 208f608f3bd9dd22b700fb9175e5e2a259009da4
Parents: 7a51d42
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Aug 29 17:25:43 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Sep 3 21:01:57 2013 +0000
----------------------------------------------------------------------
ForgeTracker/forgetracker/tracker_main.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/208f608f/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index c8e728c..8aa29f6 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -412,7 +412,8 @@ class ForgeTrackerApp(Application):
f.write('{"tickets": [')
tickets = TM.Ticket.query.find(dict(
app_config_id=self.config._id,
- deleted=False))
+ deleted={'$ne': True}, # backwards compat for old tickets that don't have it set
+ ))
for i, ticket in enumerate(tickets):
if i > 0:
f.write(',')
[38/50] git commit: [#4595] ticket:421 Pagination by date range
Posted by jo...@apache.org.
[#4595] ticket:421 Pagination by date range
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/815940cc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/815940cc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/815940cc
Branch: refs/heads/cj/6596
Commit: 815940cca6165e0ae414bd96d8f3032fee2250d7
Parents: f865ddf
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Sep 2 12:43:39 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:55 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/site_admin.py | 12 ++++++++++-
.../templates/site_admin_new_projects.html | 21 ++++++++++++++++++++
2 files changed, 32 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/815940cc/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index 818016f..eacf105 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -193,7 +193,7 @@ class SiteAdminController(object):
except ValueError:
end_dt = None
start_dt = datetime.now() if not start_dt else start_dt
- end_dt = start_dt - timedelta(days=15) if not end_dt else end_dt
+ end_dt = start_dt - timedelta(days=3) if not end_dt else end_dt
start = bson.ObjectId.from_datetime(start_dt)
end = bson.ObjectId.from_datetime(end_dt)
nb = M.Neighborhood.query.get(name='Users')
@@ -202,8 +202,18 @@ class SiteAdminController(object):
'deleted': False,
'_id': {'$lt': start, '$gt': end},
}).sort('_id', -1))
+ step = start_dt - end_dt
+ params = request.params.copy()
+ params['start-dt'] = (start_dt + step).strftime('%Y/%m/%d %H:%M:%S')
+ params['end-dt'] = (end_dt + step).strftime('%Y/%m/%d %H:%M:%S')
+ newer_url = tg.url(params=params).lstrip('/')
+ params['start-dt'] = (start_dt - step).strftime('%Y/%m/%d %H:%M:%S')
+ params['end-dt'] = (end_dt - step).strftime('%Y/%m/%d %H:%M:%S')
+ older_url = tg.url(params=params).lstrip('/')
return {
'projects': projects,
+ 'newer_url': newer_url,
+ 'older_url': older_url,
'window_start': start_dt,
'window_end': end_dt,
}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/815940cc/Allura/allura/templates/site_admin_new_projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_new_projects.html b/Allura/allura/templates/site_admin_new_projects.html
index a3c0b76..b49bf1f 100644
--- a/Allura/allura/templates/site_admin_new_projects.html
+++ b/Allura/allura/templates/site_admin_new_projects.html
@@ -19,6 +19,13 @@
{% set page="new_projects" %}
{% extends 'allura:templates/site_admin.html' %}
+{% macro _paging() %}
+<div class="paging">
+ <a class="newer" title="Newer" href="{{ newer_url }}"><</a> …
+ <a class="newer" title="Older" href="{{ older_url }}">></a>
+</div>
+{% endmacro %}
+
{% block content %}
<div class="grid-24">
<form method="GET">
@@ -29,6 +36,7 @@
<div class="grid-2"><input type="submit" value="Filter"></div>
</form>
</div>
+ {{ _paging() }}
<table>
<thead>
<tr>
@@ -59,9 +67,22 @@
</tr>
{% endfor %}
</table>
+ {{ _paging() }}
<div id="selected-projects"></div>
{% endblock %}
+{% block extra_css %}
+<style type="text/css">
+ .paging {
+ float: right;
+ margin: 1em;
+ }
+ .pad table {
+ width: 915px;
+ }
+</style>
+{% endblock %}
+
{% block extra_js %}
<script type="text/javascript" src="{{g.forge_static('js/site_admin_new_projects.js')}}"></script>
{% endblock %}
[20/50] git commit: [5775] ticket:404 fixed old tests
Posted by jo...@apache.org.
[5775] ticket:404 fixed old tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/385611c4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/385611c4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/385611c4
Branch: refs/heads/cj/6596
Commit: 385611c4d50986bfce39cd36d6e1250d0b9df98e
Parents: dd57c98
Author: Anton Kasyanov <mi...@gmail.com>
Authored: Thu Aug 1 14:50:13 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Aug 29 19:00:44 2013 +0000
----------------------------------------------------------------------
ForgeGit/forgegit/model/git_repo.py | 55 +++++++++++---------
.../forgegit/tests/model/test_repository.py | 18 ++++---
2 files changed, 41 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/385611c4/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index f400d56..cee505f 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -301,8 +301,10 @@ class GitImplementation(M.RepositoryImplementation):
path = path.strip('/') if path else None
if exclude is not None:
revs.extend(['^%s' % e for e in exclude])
-
- for ci, refs in self._iter_commits_with_refs(revs, '--follow', '--', path):
+ args = [revs, '--', path]
+ if path:
+ args.append('--follow')
+ for ci, refs in self._iter_commits_with_refs(*args):
if id_only:
yield ci.hexsha
else:
@@ -312,30 +314,31 @@ class GitImplementation(M.RepositoryImplementation):
# checking for renaming in this commit
# log is called with follow, so there should be all commits
# even before renaming
- diffs_with_parent = ci.diff(ci.parents[0])
- deleted_file_diffs = []
- renamed = False
- for diff in diffs_with_parent:
- if not diff.b_mode and not diff.b_blob:
- #new file was created
- if diff.a_blob.name == os.path.basename(path):
- renamed = True
- if not diff.a_mode and not diff.a_blob:
- #file was deleted
- deleted_file_diffs.append(diff)
- if renamed:
- if len(deleted_file_diffs) > 1:
- log.info('Couldn\'t find if file was renamed: too many deletions')
- elif len(deleted_file_diffs) == 1:
- deleted_diff = deleted_file_diffs[0]
- renamed_from['path'] = '{}/{}'.format(
- os.path.dirname(path),
- deleted_diff.b_blob.name,
- )
- renamed_from['commit_id'] = ci.hexsha
- renamed_from['commit_url'] = self._repo.url_for_commit(
- ci.hexsha
- )
+ if ci.parents:
+ diffs_with_parent = ci.diff(ci.parents[0])
+ deleted_file_diffs = []
+ renamed = False
+ for diff in diffs_with_parent:
+ if not diff.b_mode and not diff.b_blob:
+ #new file was created
+ if diff.a_blob.name == os.path.basename(path):
+ renamed = True
+ if not diff.a_mode and not diff.a_blob:
+ #file was deleted
+ deleted_file_diffs.append(diff)
+ if renamed:
+ if len(deleted_file_diffs) > 1:
+ log.info('Couldn\'t find if file was renamed: too many deletions')
+ elif len(deleted_file_diffs) == 1:
+ deleted_diff = deleted_file_diffs[0]
+ renamed_from['path'] = '{}/{}'.format(
+ os.path.dirname(path),
+ deleted_diff.b_blob.name,
+ )
+ renamed_from['commit_id'] = ci.hexsha
+ renamed_from['commit_url'] = self._repo.url_for_commit(
+ ci.hexsha
+ )
try:
node = ci.tree/path
size = node.size if node.type == 'blob' else None
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/385611c4/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 85777e2..7d7f69b 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -240,7 +240,8 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
'message': u'Change README\n',
'parents': ['df30427c488aeab84b2352bdf88a3b19223f9d7a'],
'refs': ['HEAD', 'foo', 'master'],
- 'size': None},
+ 'size': None,
+ 'renamed_from': {}},
{'authored': {'date': datetime.datetime(2010, 10, 7, 18, 44, 1),
'email': u'rcopeland@geek.net',
'name': u'Rick Copeland'},
@@ -251,7 +252,8 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
'message': u'Add README\n',
'parents': ['6a45885ae7347f1cac5103b0050cc1be6a1496c8'],
'refs': [],
- 'size': None},
+ 'size': None,
+ 'renamed_from': {}},
{'authored': {'date': datetime.datetime(2010, 10, 7, 18, 43, 26),
'email': u'rcopeland@geek.net',
'name': u'Rick Copeland'},
@@ -262,7 +264,8 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
'message': u'Remove file\n',
'parents': ['9a7df788cf800241e3bb5a849c8870f2f8259d98'],
'refs': [],
- 'size': None},
+ 'size': None,
+ 'renamed_from': {}},
{'authored': {'date': datetime.datetime(2010, 10, 7, 18, 42, 54),
'email': u'rcopeland@geek.net',
'name': u'Rick Copeland'},
@@ -273,7 +276,8 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
'message': u'Initial commit\n',
'parents': [],
'refs': [],
- 'size': None},
+ 'size': None,
+ 'renamed_from': {}},
])
def test_log_file(self):
@@ -289,7 +293,8 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
'message': u'Change README\n',
'parents': ['df30427c488aeab84b2352bdf88a3b19223f9d7a'],
'refs': ['HEAD', 'foo', 'master'],
- 'size': 28},
+ 'size': 28,
+ 'renamed_from': {}},
{'authored': {'date': datetime.datetime(2010, 10, 7, 18, 44, 1),
'email': u'rcopeland@geek.net',
'name': u'Rick Copeland'},
@@ -300,7 +305,8 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
'message': u'Add README\n',
'parents': ['6a45885ae7347f1cac5103b0050cc1be6a1496c8'],
'refs': [],
- 'size': 15},
+ 'size': 15,
+ 'renamed_from': {}},
])
def test_commit(self):
[29/50] git commit: [#6457] Make way for extending tmpl to hide mount
fields
Posted by jo...@apache.org.
[#6457] Make way for extending tmpl to hide mount fields
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/9a4a8dd5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/9a4a8dd5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/9a4a8dd5
Branch: refs/heads/cj/6596
Commit: 9a4a8dd53d9aaa1c91a6bd903b1a49c644cb3278
Parents: ddac2b6
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Aug 28 16:54:52 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Sep 3 17:05:08 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/templates/importer_base.html | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9a4a8dd5/ForgeImporters/forgeimporters/templates/importer_base.html
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/templates/importer_base.html b/ForgeImporters/forgeimporters/templates/importer_base.html
index 7a25543..b97eedf 100644
--- a/ForgeImporters/forgeimporters/templates/importer_base.html
+++ b/ForgeImporters/forgeimporters/templates/importer_base.html
@@ -64,6 +64,7 @@
<form action="create" method="post" enctype="multipart/form-data">
{% block importer_fields %}
{% endblock %}
+ {% if not show_mount_fields is defined or show_mount_fields %}
<div>
<label for="mount_label">Label</label>
<input name="mount_label" value="{{ c.form_values['mount_label'] or target_app.default_mount_label }}" />
@@ -74,7 +75,7 @@
<input name="mount_point" value="{{ c.form_values['mount_point'] or target_app.default_mount_point }}" />
{{ error('mount_point') }}
</div>
-
+ {% endif %}
<input type="submit" value="Import"/>
</form>
{% endblock %}
[02/50] git commit: Revert "[#6284] ticket:418 commit revision number
in svn commit browser"
Posted by jo...@apache.org.
Revert "[#6284] ticket:418 commit revision number in svn commit browser"
This was also showing up on the individual commit page, which was
unnecessary since the info was already on that page. If we wanted something
just for the view within commit_browser, we could use Allura/allura/templates/repo/commit_basic.html
but it seemed out of place and not too necessary there also.
This reverts commit 67593942258eaff592128d1997b244e192c355be.
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/09f02903
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/09f02903
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/09f02903
Branch: refs/heads/cj/6596
Commit: 09f02903f14f320c8235bc9e29d187c3bb708d46
Parents: 40b0823
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Mon Aug 26 23:02:15 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Aug 26 23:02:15 2013 +0000
----------------------------------------------------------------------
Allura/allura/templates/widgets/repo/revision.html | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/09f02903/Allura/allura/templates/widgets/repo/revision.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/repo/revision.html b/Allura/allura/templates/widgets/repo/revision.html
index f5c186d..48df9c1 100644
--- a/Allura/allura/templates/widgets/repo/revision.html
+++ b/Allura/allura/templates/widgets/repo/revision.html
@@ -18,8 +18,6 @@
-#}
{% from 'allura:templates/jinja_master/lib.html' import email_gravatar, abbr_date with context %}
<div class="commit-details">
- <a href="{{value.url()}}">{{value.shorthand_id()}}</a>
- Commit message:
<div class="commit-message">
<div class="first-line">{{g.markdown.convert(h.really_unicode(value.message.split('\n')[0]))}}</div>
{{g.markdown.convert(h.really_unicode('\n'.join(value.message.split('\n')[1:])))}}
[37/50] git commit: [#4595] ticket:421 Simple UI for date range
filtering
Posted by jo...@apache.org.
[#4595] ticket:421 Simple UI for date range filtering
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/01194e08
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/01194e08
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/01194e08
Branch: refs/heads/cj/6596
Commit: 01194e08c85a00ccd43f903cc546d331cf837930
Parents: 16f3bec
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Sep 2 11:51:00 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:54 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/site_admin.py | 28 +++++++++++---------
.../templates/site_admin_new_projects.html | 11 ++++++--
2 files changed, 25 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/01194e08/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index 7595d66..be8415b 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -181,25 +181,29 @@ class SiteAdminController(object):
@expose('jinja:allura:templates/site_admin_new_projects.html')
@without_trailing_slash
- @validate(dict(page=validators.Int(if_empty=0),
- limit=validators.Int(if_empty=100)))
- def new_projects(self, page=0, limit=100, **kwargs):
- c.page_list = W.page_list
- c.page_size = W.page_size
- limit, pagenum, start = g.handle_paging(limit, page, default=100)
- count = 0
+ def new_projects(self, **kwargs):
+ start_dt = kwargs.pop('start-dt', '')
+ end_dt = kwargs.pop('end-dt', '')
+ try:
+ start_dt = datetime.strptime(start_dt, '%Y/%m/%d %H:%M:%S')
+ except ValueError:
+ start_dt = None
+ try:
+ end_dt = datetime.strptime(end_dt, '%Y/%m/%d %H:%M:%S')
+ except ValueError:
+ end_dt = None
nb = M.Neighborhood.query.get(name='Users')
projects = (M.Project.query.find({
'neighborhood_id': {'$ne': nb._id},
'deleted': False,
}).sort('_id', -1))
- count = projects.count()
- projects = projects.skip(start).limit(limit)
+ #projects = projects.skip(start).limit(limit)
+ start_dt = datetime.now() if not start_dt else start_dt
+ end_dt = start_dt - timedelta(days=15) if not end_dt else end_dt
return {
'projects': projects,
- 'limit': limit,
- 'pagenum': pagenum,
- 'count': count
+ 'window_start': start_dt,
+ 'window_end': end_dt,
}
@expose('jinja:allura:templates/site_admin_reclone_repo.html')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/01194e08/Allura/allura/templates/site_admin_new_projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_new_projects.html b/Allura/allura/templates/site_admin_new_projects.html
index 213ab43..a3c0b76 100644
--- a/Allura/allura/templates/site_admin_new_projects.html
+++ b/Allura/allura/templates/site_admin_new_projects.html
@@ -20,7 +20,15 @@
{% extends 'allura:templates/site_admin.html' %}
{% block content %}
- {{ c.page_size.display(limit=limit, count=count, page=pagenum) }}
+ <div class="grid-24">
+ <form method="GET">
+ <div class="grid-13">
+ <label for="start-dt">From: </label><input type="text" name="start-dt" id="start-dt" value="{{ window_start.strftime('%Y/%m/%d %H:%M:%S') }}">
+ <label for="end-dt">To: </label><input type="text" name="end-dt" id="end-dt" value="{{ window_end.strftime('%Y/%m/%d %H:%M:%S') }}">
+ </div>
+ <div class="grid-2"><input type="submit" value="Filter"></div>
+ </form>
+ </div>
<table>
<thead>
<tr>
@@ -51,7 +59,6 @@
</tr>
{% endfor %}
</table>
- {{ c.page_list.display(limit=limit, count=count, page=pagenum) }}
<div id="selected-projects"></div>
{% endblock %}
[11/50] git commit: [#6526] Handle c not having 'project' attr
Posted by jo...@apache.org.
[#6526] Handle c not having 'project' attr
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/9704ca5c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/9704ca5c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/9704ca5c
Branch: refs/heads/cj/6596
Commit: 9704ca5cfc8e6e17622e60094bf48322effc55ea
Parents: 9065167
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Aug 28 15:48:14 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Aug 28 15:48:14 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/validators.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9704ca5c/Allura/allura/lib/validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/validators.py b/Allura/allura/lib/validators.py
index 3295bb0..9d15429 100644
--- a/Allura/allura/lib/validators.py
+++ b/Allura/allura/lib/validators.py
@@ -90,7 +90,8 @@ class MountPointValidator(fev.UnicodeString):
if mount_point in self.reserved_mount_points:
raise fe.Invalid('Mount point "%s" is reserved' % mount_point,
value, state)
- if c.project and c.project.app_instance(mount_point) is not None:
+ if (getattr(c, 'project', None) and
+ c.project.app_instance(mount_point) is not None):
raise fe.Invalid('Mount point "%s" is already in use' % mount_point,
value, state)
return mount_point
@@ -99,7 +100,8 @@ class MountPointValidator(fev.UnicodeString):
base_mount_point = mount_point = self.app_class.default_mount_point
i = 0
while True:
- if not c.project or c.project.app_instance(mount_point) is None:
+ if (not getattr(c, 'project', None) or
+ c.project.app_instance(mount_point) is None):
return mount_point
mount_point = base_mount_point + '-%d' % i
i += 1
[05/50] git commit: [#6526] Clean up individual tool importers
Posted by jo...@apache.org.
[#6526] Clean up individual tool importers
- Make forms look (slightly) better
- Add validation
- Kick off import as task
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/8378ac03
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/8378ac03
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/8378ac03
Branch: refs/heads/cj/6596
Commit: 8378ac032f3d92ea77d2756336641f45a9c71931
Parents: ec9c7cf
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Aug 21 20:53:33 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Aug 27 17:24:58 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/validators.py | 29 +++++++
Allura/allura/model/project.py | 23 ++----
ForgeImporters/forgeimporters/base.py | 10 ++-
.../forgeimporters/google/__init__.py | 2 +-
ForgeImporters/forgeimporters/google/code.py | 62 +++++++++++++--
.../google/templates/code/index.html | 25 ++----
.../google/templates/tracker/index.html | 27 +++++++
.../forgeimporters/google/tests/test_code.py | 17 ++---
ForgeImporters/forgeimporters/google/tracker.py | 62 ++++++++++++++-
.../forgeimporters/templates/importer_base.html | 80 ++++++++++++++++++++
.../forgeimporters/tests/google/test_tracker.py | 34 ++++++++-
.../trac/templates/tickets/index.html | 41 ++++------
.../forgeimporters/trac/tests/test_tickets.py | 20 ++---
ForgeImporters/forgeimporters/trac/tickets.py | 40 +++++++---
14 files changed, 364 insertions(+), 108 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8378ac03/Allura/allura/lib/validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/validators.py b/Allura/allura/lib/validators.py
index 9b44d53..fa82d32 100644
--- a/Allura/allura/lib/validators.py
+++ b/Allura/allura/lib/validators.py
@@ -72,6 +72,35 @@ class MaxBytesValidator(fev.FancyValidator):
def from_python(self, value, state):
return h.really_unicode(value or '')
+class MountPointValidator(fev.UnicodeString):
+ def __init__(self, app_class,
+ reserved_mount_points=('feed', 'index', 'icon', '_nav.json')):
+ super(self.__class__, self).__init__()
+ self.app_class = app_class
+ self.reserved_mount_points = reserved_mount_points
+
+ def _to_python(self, value, state):
+ from pylons import tmpl_context as c
+ project = state.project if hasattr(state, 'project') else c.project
+ mount_point, App = value, self.app_class
+ if not mount_point:
+ base_mount_point = mount_point = App.default_mount_point
+ for x in range(10):
+ if project.app_instance(mount_point) is None: break
+ mount_point = base_mount_point + '-%d' % x
+ if not App.relaxed_mount_points:
+ mount_point = mount_point.lower()
+ if not App.validate_mount_point(mount_point):
+ raise fe.Invalid('Mount point "%s" is invalid' % mount_point,
+ value, state)
+ if mount_point in self.reserved_mount_points:
+ raise fe.Invalid('Mount point "%s" is reserved' % mount_point,
+ value, state)
+ if project.app_instance(mount_point) is not None:
+ raise fe.Invalid('Mount point "%s" is already in use' % mount_point,
+ value, state)
+ return mount_point
+
class TaskValidator(fev.FancyValidator):
def _to_python(self, value, state):
try:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8378ac03/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index ebccb3d..983ef66 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -26,6 +26,7 @@ from tg import config
from pylons import tmpl_context as c, app_globals as g
from pylons import request
from paste.deploy.converters import asbool
+import formencode as fe
from ming import schema as S
from ming.utils import LazyProperty
@@ -38,6 +39,7 @@ from allura.lib import helpers as h
from allura.lib import plugin
from allura.lib import exceptions
from allura.lib import security
+from allura.lib import validators as v
from allura.lib.security import has_access
from .session import main_orm_session
@@ -598,23 +600,10 @@ class Project(MappedClass, ActivityNode, ActivityObject):
def install_app(self, ep_name, mount_point=None, mount_label=None, ordinal=None, **override_options):
App = g.entry_points['tool'][ep_name]
- if not mount_point:
- base_mount_point = mount_point = App.default_mount_point
- for x in range(10):
- if self.app_instance(mount_point) is None: break
- mount_point = base_mount_point + '-%d' % x
- if not App.relaxed_mount_points:
- mount_point = mount_point.lower()
- if not App.validate_mount_point(mount_point):
- raise exceptions.ToolError, 'Mount point "%s" is invalid' % mount_point
- # HACK: reserved url components
- if mount_point in ('feed', 'index', 'icon', '_nav.json'):
- raise exceptions.ToolError, (
- 'Mount point "%s" is reserved' % mount_point)
- if self.app_instance(mount_point) is not None:
- raise exceptions.ToolError, (
- 'Mount point "%s" is already in use' % mount_point)
- assert self.app_instance(mount_point) is None
+ try:
+ mount_point = v.MountPointValidator(App).to_python(mount_point)
+ except fe.Invalid as e:
+ raise exceptions.ToolError(str(e))
if ordinal is None:
ordinal = int(self.ordered_mounts(include_hidden=True)[-1]['ordinal']) + 1
options = App.default_options()
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8378ac03/ForgeImporters/forgeimporters/base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index e80235e..bdff43b 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -35,6 +35,7 @@ from allura.lib.security import require_access
from allura.lib.plugin import ProjectRegistrationProvider, AdminExtension
from allura.lib import helpers as h
from allura.lib import exceptions
+from allura.lib import validators as v
from allura.app import SitemapEntry
from paste.deploy.converters import aslist
@@ -58,6 +59,13 @@ class ProjectImportForm(schema.Schema):
project_name = fev.UnicodeString(not_empty=True, max=40)
+class ToolImportForm(schema.Schema):
+ def __init__(self, tool_class):
+ super(ToolImportForm, self).__init__()
+ self.add_field('mount_point', v.MountPointValidator(tool_class))
+ mount_label = fev.UnicodeString()
+
+
@task(notifications_disabled=True)
def import_tool(importer_name, project_name=None, mount_point=None, mount_label=None, **kw):
importer = ToolImporter.by_name(importer_name)
@@ -388,4 +396,4 @@ class ImportAdminExtension(AdminExtension):
def update_project_sidebar_menu(self, sidebar_links):
base_url = c.project.url() + 'admin/ext/'
link = SitemapEntry('Import', base_url+'import/')
- sidebar_links.append(link)
\ No newline at end of file
+ sidebar_links.append(link)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8378ac03/ForgeImporters/forgeimporters/google/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/__init__.py b/ForgeImporters/forgeimporters/google/__init__.py
index 849f924..ad5f8e5 100644
--- a/ForgeImporters/forgeimporters/google/__init__.py
+++ b/ForgeImporters/forgeimporters/google/__init__.py
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one
+# LNicensed 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
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8378ac03/ForgeImporters/forgeimporters/google/code.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/code.py b/ForgeImporters/forgeimporters/google/code.py
index 11dd7a6..60a0158 100644
--- a/ForgeImporters/forgeimporters/google/code.py
+++ b/ForgeImporters/forgeimporters/google/code.py
@@ -15,6 +15,8 @@
# specific language governing permissions and limitations
# under the License.
+import urllib2
+
import formencode as fe
from formencode import validators as fev
@@ -22,6 +24,7 @@ from pylons import tmpl_context as c
from pylons import app_globals as g
from tg import (
expose,
+ flash,
redirect,
validate,
)
@@ -31,25 +34,30 @@ from tg.decorators import (
)
from allura.controllers import BaseController
-from allura.lib.decorators import require_post
+from allura.lib import validators as v
+from allura.lib.decorators import require_post, task
from forgeimporters.base import ToolImporter
from forgeimporters.google import GoogleCodeProjectExtractor
+REPO_APPS = {}
TARGET_APPS = []
try:
from forgehg.hg_main import ForgeHgApp
TARGET_APPS.append(ForgeHgApp)
+ REPO_APPS['hg'] = ForgeHgApp
except ImportError:
pass
try:
from forgegit.git_main import ForgeGitApp
TARGET_APPS.append(ForgeGitApp)
+ REPO_APPS['git'] = ForgeGitApp
except ImportError:
pass
try:
from forgesvn.svn_main import ForgeSVNApp
TARGET_APPS.append(ForgeSVNApp)
+ REPO_APPS['svn'] = ForgeSVNApp
except ImportError:
pass
@@ -69,28 +77,70 @@ def get_repo_url(project_name, type_):
return REPO_URLS[type_].format(project_name)
-class GoogleRepoImportSchema(fe.Schema):
+def get_repo_class(type_):
+ return REPO_APPS[type_]
+
+
+@task(notifications_disabled=True)
+def import_tool(**kw):
+ GoogleRepoImporter().import_tool(c.project, c.user, **kw)
+
+
+class GoogleRepoImportForm(fe.schema.Schema):
gc_project_name = fev.UnicodeString(not_empty=True)
mount_point = fev.UnicodeString()
mount_label = fev.UnicodeString()
+ def _to_python(self, value, state):
+ value = super(self.__class__, self)._to_python(value, state)
+
+ gc_project_name = value['gc_project_name']
+ mount_point = value['mount_point']
+ try:
+ repo_type = GoogleCodeProjectExtractor(gc_project_name).get_repo_type()
+ except urllib2.HTTPError as e:
+ if e.code == 404:
+ msg = 'No such project'
+ else:
+ msg = str(e)
+ msg = 'gc_project_name:' + msg
+ raise fe.Invalid(msg, value, state)
+ except Exception:
+ raise
+ tool_class = REPO_APPS[repo_type]
+ try:
+ v.MountPointValidator(tool_class).to_python(mount_point)
+ except fe.Invalid as e:
+ raise fe.Invalid('mount_point:' + str(e), value, state)
+ return value
+
class GoogleRepoImportController(BaseController):
+ def __init__(self):
+ self.importer = GoogleRepoImporter()
+
+ @property
+ def target_app(self):
+ return self.importer.target_app[0]
+
@with_trailing_slash
@expose('jinja:forgeimporters.google:templates/code/index.html')
def index(self, **kw):
- return {}
+ return dict(importer=self.importer,
+ target_app=self.target_app)
@without_trailing_slash
@expose()
@require_post()
- @validate(GoogleRepoImportSchema(), error_handler=index)
+ @validate(GoogleRepoImportForm(), error_handler=index)
def create(self, gc_project_name, mount_point, mount_label, **kw):
- app = GoogleRepoImporter().import_tool(c.project, c.user,
+ import_tool.post(
project_name=gc_project_name,
mount_point=mount_point,
mount_label=mount_label)
- redirect(app.url())
+ flash('Repo import has begun. Your new repo will be available '
+ 'when the import is complete.')
+ redirect(c.project.url() + 'admin/')
class GoogleRepoImporter(ToolImporter):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8378ac03/ForgeImporters/forgeimporters/google/templates/code/index.html
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/templates/code/index.html b/ForgeImporters/forgeimporters/google/templates/code/index.html
index 7bace3a..e2cef0c 100644
--- a/ForgeImporters/forgeimporters/google/templates/code/index.html
+++ b/ForgeImporters/forgeimporters/google/templates/code/index.html
@@ -16,27 +16,16 @@
specific language governing permissions and limitations
under the License.
-#}
-{% extends g.theme.master %}
+{% extends 'forgeimporters:templates/importer_base.html' %}
{% block title %}
-{{c.project.name}} / Import Google Code Repo
+{{c.project.name}} / Import your repo from Google Code
{% endblock %}
-{% block header %}
-Import a Repo from a Google Code project
-{% endblock %}
-
-{% block content %}
-<form action="create" method="post" class="pad">
+{% block importer_fields %}
+<div>
<label for="gc_project_name">Google Code project name (as it appears in a URL)</label>
- <input name="gc_project_name" />
-
- <label for="mount_label">Label</label>
- <input name="mount_label" value="Source" />
-
- <label for="mount_point">Mount Point</label>
- <input name="mount_point" value="source" />
-
- <input type="submit" />
-</form>
+ <input name="gc_project_name" value="{{ c.form_values['gc_project_name'] }}" />
+ {{ error('gc_project_name') }}
+</div>
{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8378ac03/ForgeImporters/forgeimporters/google/templates/tracker/index.html
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/templates/tracker/index.html b/ForgeImporters/forgeimporters/google/templates/tracker/index.html
new file mode 100644
index 0000000..08d0084
--- /dev/null
+++ b/ForgeImporters/forgeimporters/google/templates/tracker/index.html
@@ -0,0 +1,27 @@
+{#-
+ 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.
+-#}
+{% extends 'forgeimporters:templates/importer_base.html' %}
+
+{% block importer_fields %}
+<div>
+ <label for="gc_project_name">Google Code project name (as it appears in a URL)</label>
+ <input name="gc_project_name" value="{{ c.form_values['gc_project_name'] }}" />
+ {{ error('gc_project_name') }}
+</div>
+{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8378ac03/ForgeImporters/forgeimporters/google/tests/test_code.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/tests/test_code.py b/ForgeImporters/forgeimporters/google/tests/test_code.py
index 950246a..c6874ad 100644
--- a/ForgeImporters/forgeimporters/google/tests/test_code.py
+++ b/ForgeImporters/forgeimporters/google/tests/test_code.py
@@ -89,12 +89,8 @@ class TestGoogleRepoImportController(TestController, TestCase):
self.assertIsNotNone(r.html.find(attrs=dict(name="mount_point")))
@with_svn
- @patch('forgeimporters.google.code.GoogleRepoImporter')
- def test_create(self, gri):
- from allura import model as M
- gri = gri.return_value
- gri.import_tool.return_value = Mock()
- gri.import_tool.return_value.url.return_value = '/p/{}/mymount'.format(test_project_with_repo)
+ @patch('forgeimporters.google.code.import_tool')
+ def test_create(self, import_tool):
params = dict(gc_project_name='poop',
mount_label='mylabel',
mount_point='mymount',
@@ -102,8 +98,7 @@ class TestGoogleRepoImportController(TestController, TestCase):
r = self.app.post('/p/{}/admin/src/_importer/create'.format(test_project_with_repo),
params,
status=302)
- project = M.Project.query.get(shortname=test_project_with_repo)
- self.assertEqual(r.location, 'http://localhost/p/{}/mymount'.format(test_project_with_repo))
- self.assertEqual(project._id, gri.import_tool.call_args[0][0]._id)
- self.assertEqual(u'mymount', gri.import_tool.call_args[1]['mount_point'])
- self.assertEqual(u'mylabel', gri.import_tool.call_args[1]['mount_label'])
+ self.assertEqual(r.location, 'http://localhost/p/{}/admin/'.format(test_project_with_repo))
+ self.assertEqual(u'mymount', import_tool.post.call_args[1]['mount_point'])
+ self.assertEqual(u'mylabel', import_tool.post.call_args[1]['mount_label'])
+ self.assertEqual(u'poop', import_tool.post.call_args[1]['project_name'])
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8378ac03/ForgeImporters/forgeimporters/google/tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/tracker.py b/ForgeImporters/forgeimporters/google/tracker.py
index 8b1747f..b7fccbe 100644
--- a/ForgeImporters/forgeimporters/google/tracker.py
+++ b/ForgeImporters/forgeimporters/google/tracker.py
@@ -18,23 +18,81 @@
from collections import defaultdict
from datetime import datetime
+from formencode import validators as fev
+
from pylons import tmpl_context as c
from pylons import app_globals as g
from ming.orm import session, ThreadLocalORMSession
from allura import model as M
+#import gdata
+gdata = None
+from tg import (
+ expose,
+ flash,
+ redirect,
+ validate,
+ )
+from tg.decorators import (
+ with_trailing_slash,
+ without_trailing_slash,
+ )
+
+from allura.controllers import BaseController
from allura.lib import helpers as h
+from allura.lib.decorators import require_post, task
from forgetracker.tracker_main import ForgeTrackerApp
from forgetracker import model as TM
-from ..base import ToolImporter
from . import GoogleCodeProjectExtractor
+from forgeimporters.base import (
+ ToolImporter,
+ ToolImportForm,
+ )
+
+
+@task(notifications_disabled=True)
+def import_tool(**kw):
+ GoogleCodeTrackerImporter().import_tool(c.project, c.user, **kw)
+
+
+class GoogleCodeTrackerImportForm(ToolImportForm):
+ gc_project_name = fev.UnicodeString(not_empty=True)
+
+
+class GoogleCodeTrackerImportController(BaseController):
+ def __init__(self):
+ self.importer = GoogleCodeTrackerImporter()
+
+ @property
+ def target_app(self):
+ return self.importer.target_app
+
+ @with_trailing_slash
+ @expose('jinja:forgeimporters.google:templates/tracker/index.html')
+ def index(self, **kw):
+ return dict(importer=self.importer,
+ target_app=self.target_app)
+
+ @without_trailing_slash
+ @expose()
+ @require_post()
+ @validate(GoogleCodeTrackerImportForm(ForgeTrackerApp), error_handler=index)
+ def create(self, gc_project_name, mount_point, mount_label, **kw):
+ import_tool.post(
+ project_name=gc_project_name,
+ mount_point=mount_point,
+ mount_label=mount_label,
+ )
+ flash('Ticket import has begun. Your new tracker will be available '
+ 'when the import is complete.')
+ redirect(c.project.url() + 'admin/')
class GoogleCodeTrackerImporter(ToolImporter):
source = 'Google Code'
target_app = ForgeTrackerApp
- controller = None
+ controller = GoogleCodeTrackerImportController
tool_label = 'Issues'
field_types = defaultdict(lambda: 'string',
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8378ac03/ForgeImporters/forgeimporters/templates/importer_base.html
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/templates/importer_base.html b/ForgeImporters/forgeimporters/templates/importer_base.html
new file mode 100644
index 0000000..4bdfe0f
--- /dev/null
+++ b/ForgeImporters/forgeimporters/templates/importer_base.html
@@ -0,0 +1,80 @@
+{#-
+ 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.
+-#}
+{% extends g.theme.master %}
+
+{% block title %}
+{{c.project.name}} / {{ importer.tool_description }}
+{% endblock %}
+
+{% block header %}
+{{ importer.tool_description }}
+{% endblock %}
+
+{% block extra_css %}
+ <style type="text/css">
+ form {
+ padding: 0 20px 20px 20px;
+ }
+ form label {
+ display: inline-block;
+ width: 30%;
+ vertical-align: top;
+ }
+ form > div {
+ margin-bottom: 10px;
+ }
+ form > div input {
+ width: 30%;
+ vertical-align: top;
+ }
+ form .error {
+ display: inline-block;
+ color: #f00;
+ background: none;
+ border: none;
+ margin: 0;
+ width: 30%;
+ }
+ </style>
+{% endblock %}
+
+{%- macro error(field_name) %}
+ {% if c.form_errors[field_name] %}
+ <div class="error">{{c.form_errors[field_name]}}</div>
+ {% endif %}
+{%- endmacro %}
+
+{% block content %}
+<form action="create" method="post" enctype="multipart/form-data">
+ {% block importer_fields %}
+ {% endblock %}
+ <div>
+ <label for="mount_label">Label</label>
+ <input name="mount_label" value="{{ c.form_values['mount_label'] or target_app.default_mount_label }}" />
+ {{ error('mount_label') }}
+ </div>
+ <div>
+ <label for="mount_point">Mount Point</label>
+ <input name="mount_point" value="{{ c.form_values['mount_point'] or target_app.default_mount_point }}" />
+ {{ error('mount_point') }}
+ </div>
+
+ <input type="submit" />
+</form>
+{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8378ac03/ForgeImporters/forgeimporters/tests/google/test_tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/google/test_tracker.py b/ForgeImporters/forgeimporters/tests/google/test_tracker.py
index 4a7c28f..3c7f0aa 100644
--- a/ForgeImporters/forgeimporters/tests/google/test_tracker.py
+++ b/ForgeImporters/forgeimporters/tests/google/test_tracker.py
@@ -16,9 +16,12 @@
# under the License.
from datetime import datetime
-from operator import itemgetter
from unittest import TestCase
import mock
+from mock import patch
+
+from allura.tests import TestController
+from allura.tests.decorators import with_tracker
from ...google import tracker
@@ -239,3 +242,32 @@ class TestTrackerImporter(TestCase):
'options': 'foo bar',
},
])
+
+
+class TestGoogleCodeTrackerImportController(TestController, TestCase):
+ def setUp(self):
+ """Mount Google Code importer on the Tracker admin controller"""
+ super(TestGoogleCodeTrackerImportController, self).setUp()
+ from forgetracker.tracker_main import TrackerAdminController
+ TrackerAdminController._importer = tracker.GoogleCodeTrackerImportController()
+
+ @with_tracker
+ def test_index(self):
+ r = self.app.get('/p/test/admin/bugs/_importer/')
+ self.assertIsNotNone(r.html.find(attrs=dict(name="gc_project_name")))
+ self.assertIsNotNone(r.html.find(attrs=dict(name="mount_label")))
+ self.assertIsNotNone(r.html.find(attrs=dict(name="mount_point")))
+
+ @with_tracker
+ @patch('forgeimporters.google.tracker.import_tool')
+ def test_create(self, import_tool):
+ params = dict(gc_project_name='test',
+ mount_label='mylabel',
+ mount_point='mymount',
+ )
+ r = self.app.post('/p/test/admin/bugs/_importer/create', params,
+ status=302)
+ self.assertEqual(r.location, 'http://localhost/p/test/admin/')
+ self.assertEqual(u'mymount', import_tool.post.call_args[1]['mount_point'])
+ self.assertEqual(u'mylabel', import_tool.post.call_args[1]['mount_label'])
+ self.assertEqual(u'test', import_tool.post.call_args[1]['project_name'])
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8378ac03/ForgeImporters/forgeimporters/trac/templates/tickets/index.html
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/trac/templates/tickets/index.html b/ForgeImporters/forgeimporters/trac/templates/tickets/index.html
index 7c278b0..42b8a9f 100644
--- a/ForgeImporters/forgeimporters/trac/templates/tickets/index.html
+++ b/ForgeImporters/forgeimporters/trac/templates/tickets/index.html
@@ -16,30 +16,19 @@
specific language governing permissions and limitations
under the License.
-#}
-{% extends g.theme.master %}
-
-{% block title %}
-{{c.project.name}} / Import Trac Tickets
-{% endblock %}
-
-{% block header %}
-Import tickets from Trac
-{% endblock %}
-
-{% block content %}
-<form action="create" method="post" enctype="multipart/form-data" class="pad">
- <label for="trac_url">URL of the Trac instance</label>
- <input name="trac_url" />
-
- <label for="user_map">JSON file mapping Trac usernames to Allura usernames (optional)</label>
- <input name="user_map" type="file" />
-
- <label for="mount_label">Label</label>
- <input name="mount_label" value="Source" />
-
- <label for="mount_point">Mount Point</label>
- <input name="mount_point" value="source" />
-
- <input type="submit" />
-</form>
+{% extends 'forgeimporters:templates/importer_base.html' %}
+
+{% block importer_fields %}
+ <div>
+ <label for="trac_url">URL of the Trac instance</label>
+ <input name="trac_url" value="{{ c.form_values['trac_url'] }}" />
+ {{ error('trac_url') }}
+ </div>
+ <div>
+ <label for="user_map">User Map (optional)
+ <br><small>JSON file mapping Trac usernames to Allura usernames</small>
+ </label>
+ <input name="user_map" type="file" />
+ {{ error('user_map') }}
+ </div>
{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8378ac03/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/trac/tests/test_tickets.py b/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
index 2a539df..953c6d7 100644
--- a/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
+++ b/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
@@ -84,12 +84,8 @@ class TestTracTicketImportController(TestController, TestCase):
self.assertIsNotNone(r.html.find(attrs=dict(name="mount_point")))
@with_tracker
- @patch('forgeimporters.trac.tickets.TracTicketImporter')
- def test_create(self, importer):
- from allura import model as M
- importer = importer.return_value
- importer.import_tool.return_value = Mock()
- importer.import_tool.return_value.url.return_value = '/p/test/mymount'
+ @patch('forgeimporters.trac.tickets.import_tool')
+ def test_create(self, import_tool):
params = dict(trac_url='http://example.com/trac/url',
mount_label='mylabel',
mount_point='mymount',
@@ -97,10 +93,8 @@ class TestTracTicketImportController(TestController, TestCase):
r = self.app.post('/p/test/admin/bugs/_importer/create', params,
upload_files=[('user_map', 'myfile', '{"orig_user": "new_user"}')],
status=302)
- project = M.Project.query.get(shortname='test')
- self.assertEqual(r.location, 'http://localhost/p/test/mymount')
- self.assertEqual(project._id, importer.import_tool.call_args[0][0]._id)
- self.assertEqual(u'mymount', importer.import_tool.call_args[1]['mount_point'])
- self.assertEqual(u'mylabel', importer.import_tool.call_args[1]['mount_label'])
- self.assertEqual('{"orig_user": "new_user"}', importer.import_tool.call_args[1]['user_map'])
- self.assertEqual(u'http://example.com/trac/url', importer.import_tool.call_args[1]['trac_url'])
+ self.assertEqual(r.location, 'http://localhost/p/test/admin/')
+ self.assertEqual(u'mymount', import_tool.post.call_args[1]['mount_point'])
+ self.assertEqual(u'mylabel', import_tool.post.call_args[1]['mount_label'])
+ self.assertEqual('{"orig_user": "new_user"}', import_tool.post.call_args[1]['user_map'])
+ self.assertEqual(u'http://example.com/trac/url', import_tool.post.call_args[1]['trac_url'])
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8378ac03/ForgeImporters/forgeimporters/trac/tickets.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/trac/tickets.py b/ForgeImporters/forgeimporters/trac/tickets.py
index dfbb2a2..3e0e486 100644
--- a/ForgeImporters/forgeimporters/trac/tickets.py
+++ b/ForgeImporters/forgeimporters/trac/tickets.py
@@ -21,7 +21,6 @@ from datetime import (
)
import json
-import formencode as fe
from formencode import validators as fev
from ming.orm import session
@@ -30,6 +29,7 @@ from pylons import app_globals as g
from tg import (
config,
expose,
+ flash,
redirect,
validate,
)
@@ -39,44 +39,60 @@ from tg.decorators import (
)
from allura.controllers import BaseController
-from allura.lib.decorators import require_post
+from allura.lib.decorators import require_post, task
from allura.lib.import_api import AlluraImportApiClient
-from allura.lib.validators import UserMapJsonFile
+from allura.lib import validators as v
from allura.model import ApiTicket
from allura.scripts.trac_export import (
TracExport,
DateJSONEncoder,
)
-from forgeimporters.base import ToolImporter
+from forgeimporters.base import (
+ ToolImporter,
+ ToolImportForm,
+ )
from forgetracker.tracker_main import ForgeTrackerApp
from forgetracker.scripts.import_tracker import import_tracker
-class TracTicketImportSchema(fe.Schema):
+@task(notifications_disabled=True)
+def import_tool(**kw):
+ TracTicketImporter().import_tool(c.project, c.user, **kw)
+
+
+class TracTicketImportForm(ToolImportForm):
trac_url = fev.URL(not_empty=True)
- user_map = UserMapJsonFile(as_string=True)
- mount_point = fev.UnicodeString()
- mount_label = fev.UnicodeString()
+ user_map = v.UserMapJsonFile(as_string=True)
class TracTicketImportController(BaseController):
+ def __init__(self):
+ self.importer = TracTicketImporter()
+
+ @property
+ def target_app(self):
+ return self.importer.target_app
+
@with_trailing_slash
@expose('jinja:forgeimporters.trac:templates/tickets/index.html')
def index(self, **kw):
- return {}
+ return dict(importer=self.importer,
+ target_app=self.target_app)
@without_trailing_slash
@expose()
@require_post()
- @validate(TracTicketImportSchema(), error_handler=index)
+ @validate(TracTicketImportForm(ForgeTrackerApp), error_handler=index)
def create(self, trac_url, mount_point, mount_label, user_map=None, **kw):
- app = TracTicketImporter().import_tool(c.project, c.user,
+ import_tool.post(
mount_point=mount_point,
mount_label=mount_label,
trac_url=trac_url,
user_map=user_map)
- redirect(app.url())
+ flash('Ticket import has begun. Your new tracker will be available '
+ 'when the import is complete.')
+ redirect(c.project.url() + 'admin/')
class TracTicketImporter(ToolImporter):
[13/50] git commit: [#6526] bump Google Code & Trac Wiki importer
versions for their changes
Posted by jo...@apache.org.
[#6526] bump Google Code & Trac Wiki importer versions for their changes
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/10cb90c7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/10cb90c7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/10cb90c7
Branch: refs/heads/cj/6596
Commit: 10cb90c712a79fb8a64d5f7dbcc0aaa5b7132b04
Parents: eceab84
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Aug 28 17:08:01 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Aug 28 17:08:01 2013 +0000
----------------------------------------------------------------------
requirements-sf.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/10cb90c7/requirements-sf.txt
----------------------------------------------------------------------
diff --git a/requirements-sf.txt b/requirements-sf.txt
index a77c839..4e00d83 100644
--- a/requirements-sf.txt
+++ b/requirements-sf.txt
@@ -6,7 +6,7 @@ kombu==1.0.4
coverage==3.5a1-20110413
ForgeHg==0.1.15
ForgePastebin==0.2.7
-GoogleCodeWikiImporter==0.2.0
+GoogleCodeWikiImporter==0.3.0
mechanize==0.2.4
mercurial==1.4.3
MySQL-python==1.2.3c1
@@ -20,7 +20,7 @@ wsgipreload==1.2
pyzmq==2.1.7
html2text==3.200.3dev-20121112
PyMollom==0.1
-TracWikiImporter==0.1.0
+TracWikiImporter==0.2.0
# use version built from https://github.com/johnsca/GitPython/commits/tv/6000
# for unmerged fixes for [#5411], [#6000], and [#6078]
[42/50] git commit: [#4595] ticket:421 Fix occasionally failing tests
Posted by jo...@apache.org.
[#4595] ticket:421 Fix occasionally failing tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ef8c3397
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ef8c3397
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ef8c3397
Branch: refs/heads/cj/6596
Commit: ef8c33972e8920a1be17a6086bf4f0bff5c42db1
Parents: 91c7a3a
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Sep 2 13:22:51 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:55 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/site_admin.py | 6 ++----
Allura/allura/tests/functional/test_site_admin.py | 1 -
2 files changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ef8c3397/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index b5fa97a..0051a04 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -187,13 +187,11 @@ class SiteAdminController(object):
try:
start_dt = datetime.strptime(start_dt, '%Y/%m/%d %H:%M:%S')
except ValueError:
- start_dt = None
+ start_dt = datetime.utcnow() + timedelta(days=1)
try:
end_dt = datetime.strptime(end_dt, '%Y/%m/%d %H:%M:%S')
except ValueError:
- end_dt = None
- start_dt = datetime.utcnow() if not start_dt else start_dt
- end_dt = start_dt - timedelta(days=3) if not end_dt else end_dt
+ end_dt = start_dt - timedelta(days=3) if not end_dt else end_dt
start = bson.ObjectId.from_datetime(start_dt)
end = bson.ObjectId.from_datetime(end_dt)
nb = M.Neighborhood.query.get(name='Users')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ef8c3397/Allura/allura/tests/functional/test_site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_site_admin.py b/Allura/allura/tests/functional/test_site_admin.py
index e0ba8fd..0f20247 100644
--- a/Allura/allura/tests/functional/test_site_admin.py
+++ b/Allura/allura/tests/functional/test_site_admin.py
@@ -16,7 +16,6 @@
# under the License.
import json
-from datetime import timedelta
from nose.tools import assert_equal
from ming.odm import ThreadLocalORMSession
[39/50] git commit: [#4595] ticket:421 Fix page layout for firefox
Posted by jo...@apache.org.
[#4595] ticket:421 Fix page layout for firefox
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/19070bda
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/19070bda
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/19070bda
Branch: refs/heads/cj/6596
Commit: 19070bda3732ca3097c3e24636f813259e390e7c
Parents: ef8c339
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Sep 3 14:55:41 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:55 2013 +0000
----------------------------------------------------------------------
Allura/allura/templates/site_admin_new_projects.html | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/19070bda/Allura/allura/templates/site_admin_new_projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_new_projects.html b/Allura/allura/templates/site_admin_new_projects.html
index b49bf1f..3b9dab5 100644
--- a/Allura/allura/templates/site_admin_new_projects.html
+++ b/Allura/allura/templates/site_admin_new_projects.html
@@ -33,10 +33,11 @@
<label for="start-dt">From: </label><input type="text" name="start-dt" id="start-dt" value="{{ window_start.strftime('%Y/%m/%d %H:%M:%S') }}">
<label for="end-dt">To: </label><input type="text" name="end-dt" id="end-dt" value="{{ window_end.strftime('%Y/%m/%d %H:%M:%S') }}">
</div>
- <div class="grid-2"><input type="submit" value="Filter"></div>
+ <div class="grid-3"><input type="submit" value="Filter"></div>
</form>
</div>
{{ _paging() }}
+ <div style="clear:both;"></div>
<table>
<thead>
<tr>
[12/50] git commit: [#6526] Set c.project before calling
MountPointValidator
Posted by jo...@apache.org.
[#6526] Set c.project before calling MountPointValidator
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/eceab844
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/eceab844
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/eceab844
Branch: refs/heads/cj/6596
Commit: eceab844fdd664eff62b1a64380bce01a0767d07
Parents: 9704ca5
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Aug 28 16:08:34 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Aug 28 16:08:34 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/validators.py | 6 ++----
Allura/allura/model/project.py | 9 +++++----
2 files changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/eceab844/Allura/allura/lib/validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/validators.py b/Allura/allura/lib/validators.py
index 9d15429..3295bb0 100644
--- a/Allura/allura/lib/validators.py
+++ b/Allura/allura/lib/validators.py
@@ -90,8 +90,7 @@ class MountPointValidator(fev.UnicodeString):
if mount_point in self.reserved_mount_points:
raise fe.Invalid('Mount point "%s" is reserved' % mount_point,
value, state)
- if (getattr(c, 'project', None) and
- c.project.app_instance(mount_point) is not None):
+ if c.project and c.project.app_instance(mount_point) is not None:
raise fe.Invalid('Mount point "%s" is already in use' % mount_point,
value, state)
return mount_point
@@ -100,8 +99,7 @@ class MountPointValidator(fev.UnicodeString):
base_mount_point = mount_point = self.app_class.default_mount_point
i = 0
while True:
- if (not getattr(c, 'project', None) or
- c.project.app_instance(mount_point) is None):
+ if not c.project or c.project.app_instance(mount_point) is None:
return mount_point
mount_point = base_mount_point + '-%d' % i
i += 1
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/eceab844/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 983ef66..ec39157 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -600,10 +600,11 @@ class Project(MappedClass, ActivityNode, ActivityObject):
def install_app(self, ep_name, mount_point=None, mount_label=None, ordinal=None, **override_options):
App = g.entry_points['tool'][ep_name]
- try:
- mount_point = v.MountPointValidator(App).to_python(mount_point)
- except fe.Invalid as e:
- raise exceptions.ToolError(str(e))
+ with h.push_config(c, project=self):
+ try:
+ mount_point = v.MountPointValidator(App).to_python(mount_point)
+ except fe.Invalid as e:
+ raise exceptions.ToolError(str(e))
if ordinal is None:
ordinal = int(self.ordered_mounts(include_hidden=True)[-1]['ordinal']) + 1
options = App.default_options()
[49/50] git commit: [#6629] fix and test for merge commit's lack of
rename output
Posted by jo...@apache.org.
[#6629] fix and test for merge commit's lack of rename output
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/b4eddf92
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b4eddf92
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b4eddf92
Branch: refs/heads/cj/6596
Commit: b4eddf929902f02a3faaf2834a6ec2d867516fc5
Parents: 39b6d20
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Sep 5 15:10:53 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Sep 5 15:10:53 2013 +0000
----------------------------------------------------------------------
ForgeGit/forgegit/model/git_repo.py | 11 ++++++-----
ForgeGit/forgegit/tests/model/test_repository.py | 5 +++++
2 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b4eddf92/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 7262efa..29af6c7 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -384,17 +384,18 @@ class GitImplementation(M.RepositoryImplementation):
# hash line read, need to yield previous commit
# first, cleaning lines a bit
commit_lines = [
- ln.strip('\n\ ').replace('\t', ' ')
+ ln.strip('\n ').replace('\t', ' ')
for ln in commit_lines if ln.strip('\n ')
]
if commit_lines:
hexsha, decoration = commit_lines[0].split('\x00')
refs = decoration.strip(' ()').split(', ') if decoration else []
- name_stat_parts = commit_lines[1].split(' ')
renamed = {}
- if name_stat_parts[0] == 'R100':
- renamed['from'] = name_stat_parts[1]
- renamed['to'] = name_stat_parts[2]
+ if len(commit_lines) > 1: # merge commits don't have any --name-status output
+ name_stat_parts = commit_lines[1].split(' ')
+ if name_stat_parts[0] == 'R100':
+ renamed['from'] = name_stat_parts[1]
+ renamed['to'] = name_stat_parts[2]
yield (git.Commit(self._git, gitdb.util.hex_to_bin(hexsha)), refs, renamed)
if not(len(line)):
# if all lines have been read
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b4eddf92/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index e55fed7..575ccba 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -575,3 +575,8 @@ class TestGitRename(unittest.TestCase):
rename_commit['rename_details']['commit_url'],
self.repo.url_for_commit(rename_commit['id'])
)
+
+ def test_merge_commit(self):
+ merge_sha = '13951944969cf45a701bf90f83647b309815e6d5'
+ commit = self.repo.log(revs=merge_sha, id_only=False).next()
+ self.assertEqual(commit['rename_details'], {})
[46/50] git commit: [#6530] bump wiki importer versions
Posted by jo...@apache.org.
[#6530] bump wiki importer versions
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/94a3b1c2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/94a3b1c2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/94a3b1c2
Branch: refs/heads/cj/6596
Commit: 94a3b1c27171e7d06d91cbd25a0d11978e4ef3f6
Parents: 153078b
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Sep 4 15:29:24 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Sep 4 15:29:24 2013 +0000
----------------------------------------------------------------------
requirements-sf.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/94a3b1c2/requirements-sf.txt
----------------------------------------------------------------------
diff --git a/requirements-sf.txt b/requirements-sf.txt
index 6115291..286c95a 100644
--- a/requirements-sf.txt
+++ b/requirements-sf.txt
@@ -6,7 +6,7 @@ kombu==1.0.4
coverage==3.5a1-20110413
ForgeHg==0.1.16
ForgePastebin==0.2.7
-GoogleCodeWikiImporter==0.3.0
+GoogleCodeWikiImporter==0.3.1
mechanize==0.2.4
mercurial==1.4.3
MySQL-python==1.2.3c1
@@ -20,7 +20,7 @@ wsgipreload==1.2
pyzmq==2.1.7
html2text==3.200.3dev-20121112
PyMollom==0.1
-TracWikiImporter==0.2.0
+TracWikiImporter==0.2.1
# use version built from https://github.com/johnsca/GitPython/commits/tv/6000
# for unmerged fixes for [#5411], [#6000], and [#6078]
[50/50] git commit: [#6596] Removed (deprecated) "votes" field on
Ticket and replaced with calculated property
Posted by jo...@apache.org.
[#6596] Removed (deprecated) "votes" field on Ticket and replaced with calculated property
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/2d667a8e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/2d667a8e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/2d667a8e
Branch: refs/heads/cj/6596
Commit: 2d667a8eab4f3c5d0d22bbb856267f2d0b40e10d
Parents: b4eddf9
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Mon Aug 26 20:04:30 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Sep 5 17:41:27 2013 +0000
----------------------------------------------------------------------
Allura/allura/model/artifact.py | 8 +++++---
ForgeTracker/forgetracker/model/ticket.py | 2 +-
.../templates/tracker_widgets/ticket_search_results.html | 2 +-
3 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2d667a8e/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index 294c3d0..82355cd 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -833,7 +833,7 @@ class VotableArtifact(MappedClass):
session = main_orm_session
name = 'vote'
- votes = FieldProperty(int, if_missing=0)
+ votes = FieldProperty(S.Deprecated)
votes_up = FieldProperty(int, if_missing=0)
votes_down = FieldProperty(int, if_missing=0)
votes_up_users = FieldProperty([str], if_missing=list())
@@ -854,7 +854,6 @@ class VotableArtifact(MappedClass):
else:
self.votes_up_users.append(user.username)
self.votes_up += 1
- self.votes = self.votes_up - self.votes_down
def vote_down(self, user):
voted = self.user_voted(user)
@@ -871,7 +870,6 @@ class VotableArtifact(MappedClass):
else:
self.votes_down_users.append(user.username)
self.votes_down += 1
- self.votes = self.votes_up - self.votes_down
def user_voted(self, user):
"""Check that user voted for this artifact.
@@ -888,6 +886,10 @@ class VotableArtifact(MappedClass):
return 0
@property
+ def votes_up_net(self):
+ return self.votes_up - self.votes_down
+
+ @property
def votes_up_percent(self):
votes_count = self.votes_up + self.votes_down
if votes_count == 0:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2d667a8e/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index d16039e..25e5b6a 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -589,7 +589,7 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
private_b=self.private,
votes_up_i=self.votes_up,
votes_down_i=self.votes_down,
- votes_total_i=(self.votes_up - self.votes_down),
+ votes_total_i=self.votes_up_net,
import_id_s=ImportIdConverter.get().simplify(self.import_id)
)
for k, v in self.custom_fields.iteritems():
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2d667a8e/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html b/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html
index af93d72..975b363 100644
--- a/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html
+++ b/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html
@@ -64,7 +64,7 @@
{%- endfor -%}
</td>
{% elif col['name'] == 'votes' %}
- <td>{{ t.votes }}</td>
+ <td>{{ t.votes_up_net }}</td>
{% else %}
{% set fld = c.app.globals.get_custom_field(col['name']) %}
{% if fld and fld.type == 'user' %}
[26/50] git commit: [#5775] ticket:404 fixed log implementation error
Posted by jo...@apache.org.
[#5775] ticket:404 fixed log implementation error
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/9a5ec88c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/9a5ec88c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/9a5ec88c
Branch: refs/heads/cj/6596
Commit: 9a5ec88c577d05b1cecd40a58e4fb4ce21e9f104
Parents: 2409375
Author: Anton Kasyanov <mi...@gmail.com>
Authored: Tue Aug 6 17:26:42 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Aug 29 19:00:45 2013 +0000
----------------------------------------------------------------------
Allura/allura/templates/widgets/repo/log.html | 6 +--
ForgeGit/forgegit/model/git_repo.py | 52 ++++++++++++++------
.../forgegit/tests/model/test_repository.py | 16 +++---
3 files changed, 48 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9a5ec88c/Allura/allura/templates/widgets/repo/log.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/repo/log.html b/Allura/allura/templates/widgets/repo/log.html
index c3ced6f..ec6b048 100644
--- a/Allura/allura/templates/widgets/repo/log.html
+++ b/Allura/allura/templates/widgets/repo/log.html
@@ -54,11 +54,11 @@
pushed by {{ user_link(commit.committed.email, commit.committed.name) }}
{% endif %}
{{g.markdown.convert(commit.message)}}
- {% if commit.renamed_from %}
+ {% if commit.rename_details %}
<div>
<b>renamed from</b>
- <a href={{commit.renamed_from['commit_url']}}log/?path={{ commit.renamed_from['path'] }}>
- {{ commit.renamed_from['path'] }}
+ <a href={{commit.rename_details['commit_url']}}log/?path={{ commit.rename_details['path'] }}>
+ {{ commit.rename_details['path'] }}
</a>
</div>
{% endif %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9a5ec88c/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 1599fd2..7262efa 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -338,7 +338,7 @@ class GitImplementation(M.RepositoryImplementation):
'refs': refs,
'parents': [pci.hexsha for pci in ci.parents],
'size': size,
- 'renamed_from': rename_details,
+ 'rename_details': rename_details,
}
if rename_details:
# we do not need to show commits before rename
@@ -362,24 +362,46 @@ class GitImplementation(M.RepositoryImplementation):
of lazy-loading the commit data is probably fine. But if this
ends up being a bottleneck, that would be one possibile
optimization.
+
+ Renaming
+ Detection of renaming can be implemented using diff with parent
+ with create_path=True. But taking diffs is slow. That's why
+ --name-status is added to log.
+ Then log returns something like this:
+ <commit hash>x00 <refs>
+ \n # empty line
+ R100 <renamed from path> <renamed to path> # when rename happens
+ A\t<some path> # other cases
+ D\t<some path> # other cases
+ etc
"""
proc = self._git.git.log(*args, format='%H%x00%d', as_process=True, **kwargs)
stream = proc.stdout
+ commit_lines = []
while True:
- commit_lines = [stream.readline() for _ in xrange(3)]
- commit_line = '\x00'.join(
- [line.strip('\n ').replace('\t', ' ') for line in commit_lines if line.strip('\n\t ')]
- )
- if not commit_line:
- break
- hexsha, decoration, name_stat = commit_line.strip().split('\x00')
- refs = decoration.strip(' ()').split(', ') if decoration else []
- name_stat_parts = name_stat.split(' ')
- renamed = {}
- if name_stat_parts[0] == 'R100':
- renamed['from'] = name_stat_parts[1]
- renamed['to'] = name_stat_parts[2]
- yield (git.Commit(self._git, gitdb.util.hex_to_bin(hexsha)), refs, renamed)
+ line = stream.readline()
+ if '\x00' in line or not(len(line)):
+ # hash line read, need to yield previous commit
+ # first, cleaning lines a bit
+ commit_lines = [
+ ln.strip('\n\ ').replace('\t', ' ')
+ for ln in commit_lines if ln.strip('\n ')
+ ]
+ if commit_lines:
+ hexsha, decoration = commit_lines[0].split('\x00')
+ refs = decoration.strip(' ()').split(', ') if decoration else []
+ name_stat_parts = commit_lines[1].split(' ')
+ renamed = {}
+ if name_stat_parts[0] == 'R100':
+ renamed['from'] = name_stat_parts[1]
+ renamed['to'] = name_stat_parts[2]
+ yield (git.Commit(self._git, gitdb.util.hex_to_bin(hexsha)), refs, renamed)
+ if not(len(line)):
+ # if all lines have been read
+ break
+ commit_lines = [line]
+ else:
+ commit_lines.append(line)
def open_blob(self, blob):
return _OpenedGitBlob(
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9a5ec88c/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index d116a10..e55fed7 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -241,7 +241,7 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
'parents': ['df30427c488aeab84b2352bdf88a3b19223f9d7a'],
'refs': ['HEAD', 'foo', 'master'],
'size': None,
- 'renamed_from': {}},
+ 'rename_details': {}},
{'authored': {'date': datetime.datetime(2010, 10, 7, 18, 44, 1),
'email': u'rcopeland@geek.net',
'name': u'Rick Copeland'},
@@ -253,7 +253,7 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
'parents': ['6a45885ae7347f1cac5103b0050cc1be6a1496c8'],
'refs': [],
'size': None,
- 'renamed_from': {}},
+ 'rename_details': {}},
{'authored': {'date': datetime.datetime(2010, 10, 7, 18, 43, 26),
'email': u'rcopeland@geek.net',
'name': u'Rick Copeland'},
@@ -265,7 +265,7 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
'parents': ['9a7df788cf800241e3bb5a849c8870f2f8259d98'],
'refs': [],
'size': None,
- 'renamed_from': {}},
+ 'rename_details': {}},
{'authored': {'date': datetime.datetime(2010, 10, 7, 18, 42, 54),
'email': u'rcopeland@geek.net',
'name': u'Rick Copeland'},
@@ -277,7 +277,7 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
'parents': [],
'refs': [],
'size': None,
- 'renamed_from': {}},
+ 'rename_details': {}},
])
def test_log_file(self):
@@ -294,7 +294,7 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
'parents': ['df30427c488aeab84b2352bdf88a3b19223f9d7a'],
'refs': ['HEAD', 'foo', 'master'],
'size': 28,
- 'renamed_from': {}},
+ 'rename_details': {}},
{'authored': {'date': datetime.datetime(2010, 10, 7, 18, 44, 1),
'email': u'rcopeland@geek.net',
'name': u'Rick Copeland'},
@@ -306,7 +306,7 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
'parents': ['6a45885ae7347f1cac5103b0050cc1be6a1496c8'],
'refs': [],
'size': 15,
- 'renamed_from': {}},
+ 'rename_details': {}},
])
def test_commit(self):
@@ -570,8 +570,8 @@ class TestGitRename(unittest.TestCase):
commits = list(self.repo.log(id_only=False, path='/f2.txt'))
self.assertEqual(len(commits), 2)
rename_commit = commits[1]
- self.assertEqual(rename_commit['renamed_from']['path'], '/f.txt')
+ self.assertEqual(rename_commit['rename_details']['path'], '/f.txt')
self.assertEqual(
- rename_commit['renamed_from']['commit_url'],
+ rename_commit['rename_details']['commit_url'],
self.repo.url_for_commit(rename_commit['id'])
)
[09/50] git commit: [#6526] Fix MountPointValidator to provide
default value
Posted by jo...@apache.org.
[#6526] Fix MountPointValidator to provide default value
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/a4dc01b3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/a4dc01b3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/a4dc01b3
Branch: refs/heads/cj/6596
Commit: a4dc01b395929b0ba05a14f1a37e590ebdf42a6f
Parents: 6ff3125
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Aug 28 14:30:28 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Aug 28 14:30:28 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/validators.py | 23 ++++++-----
Allura/allura/tests/test_validators.py | 61 +++++++++++++++++++++++++++++
2 files changed, 74 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a4dc01b3/Allura/allura/lib/validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/validators.py b/Allura/allura/lib/validators.py
index fa82d32..3295bb0 100644
--- a/Allura/allura/lib/validators.py
+++ b/Allura/allura/lib/validators.py
@@ -19,6 +19,7 @@ import json
from bson import ObjectId
import formencode as fe
from formencode import validators as fev
+from pylons import tmpl_context as c
from . import helpers as h
from datetime import datetime
@@ -74,20 +75,13 @@ class MaxBytesValidator(fev.FancyValidator):
class MountPointValidator(fev.UnicodeString):
def __init__(self, app_class,
- reserved_mount_points=('feed', 'index', 'icon', '_nav.json')):
- super(self.__class__, self).__init__()
+ reserved_mount_points=('feed', 'index', 'icon', '_nav.json'), **kw):
+ super(self.__class__, self).__init__(**kw)
self.app_class = app_class
self.reserved_mount_points = reserved_mount_points
def _to_python(self, value, state):
- from pylons import tmpl_context as c
- project = state.project if hasattr(state, 'project') else c.project
mount_point, App = value, self.app_class
- if not mount_point:
- base_mount_point = mount_point = App.default_mount_point
- for x in range(10):
- if project.app_instance(mount_point) is None: break
- mount_point = base_mount_point + '-%d' % x
if not App.relaxed_mount_points:
mount_point = mount_point.lower()
if not App.validate_mount_point(mount_point):
@@ -96,11 +90,20 @@ class MountPointValidator(fev.UnicodeString):
if mount_point in self.reserved_mount_points:
raise fe.Invalid('Mount point "%s" is reserved' % mount_point,
value, state)
- if project.app_instance(mount_point) is not None:
+ if c.project and c.project.app_instance(mount_point) is not None:
raise fe.Invalid('Mount point "%s" is already in use' % mount_point,
value, state)
return mount_point
+ def empty_value(self, value):
+ base_mount_point = mount_point = self.app_class.default_mount_point
+ i = 0
+ while True:
+ if not c.project or c.project.app_instance(mount_point) is None:
+ return mount_point
+ mount_point = base_mount_point + '-%d' % i
+ i += 1
+
class TaskValidator(fev.FancyValidator):
def _to_python(self, value, state):
try:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a4dc01b3/Allura/allura/tests/test_validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_validators.py b/Allura/allura/tests/test_validators.py
index b0d165c..26779ce 100644
--- a/Allura/allura/tests/test_validators.py
+++ b/Allura/allura/tests/test_validators.py
@@ -17,6 +17,7 @@
import unittest
import formencode as fe
+from mock import Mock, patch
from allura import model as M
from allura.lib import validators as v
@@ -92,6 +93,66 @@ class TestUserValidator(unittest.TestCase):
self.assertEqual(str(cm.exception), "Invalid username")
+class TestMountPointValidator(unittest.TestCase):
+
+ @patch('allura.lib.validators.c')
+ def test_valid(self, c):
+ App = Mock()
+ App.relaxed_mount_points = False
+ App.validate_mount_point.return_value = True
+ c.project.app_instance.return_value = None
+ val = v.MountPointValidator(App)
+ self.assertEqual('mymount', val.to_python('Mymount'))
+
+ @patch('allura.lib.validators.c')
+ def test_invalid(self, c):
+ App = Mock()
+ App.relaxed_mount_points = False
+ App.validate_mount_point.return_value = False
+ c.project.app_instance.return_value = False
+ val = v.MountPointValidator(App)
+ with self.assertRaises(fe.Invalid):
+ val.to_python('mymount')
+
+ @patch('allura.lib.validators.c')
+ def test_relaxed_mount_points(self, c):
+ App = Mock()
+ App.relaxed_mount_points = True
+ App.validate_mount_point.return_value = True
+ c.project.app_instance.return_value = None
+ val = v.MountPointValidator(App)
+ self.assertEqual('Mymount', val.to_python('Mymount'))
+
+ @patch('allura.lib.validators.c')
+ def test_in_use(self, c):
+ App = Mock()
+ App.relaxed_mount_points = False
+ App.validate_mount_point.return_value = True
+ c.project.app_instance.return_value = True
+ val = v.MountPointValidator(App)
+ with self.assertRaises(fe.Invalid):
+ val.to_python('mymount')
+
+ @patch('allura.lib.validators.c')
+ def test_reserved(self, c):
+ App = Mock()
+ App.relaxed_mount_points = False
+ App.validate_mount_point.return_value = True
+ c.project.app_instance.return_value = False
+ val = v.MountPointValidator(App)
+ with self.assertRaises(fe.Invalid):
+ val.to_python('feed')
+
+ @patch('allura.lib.validators.c')
+ def test_empty(self, c):
+ App = Mock()
+ App.default_mount_point = 'wiki'
+ c.project.app_instance.side_effect = lambda mp: None if mp != 'wiki' else True
+ val = v.MountPointValidator(App)
+ self.assertEqual('wiki-0', val.to_python(''))
+ self.assertEqual('wiki-0', val.to_python(None))
+
+
class TestTaskValidator(unittest.TestCase):
val = v.TaskValidator
[15/50] git commit: put middleware back in proper place so error
pages work correctly (bug introduced in 9a1363)
Posted by jo...@apache.org.
put middleware back in proper place so error pages work correctly (bug introduced in 9a1363)
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/6769dc23
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/6769dc23
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/6769dc23
Branch: refs/heads/cj/6596
Commit: 6769dc236d4002e9da51c3cb99439c233fb8a8b2
Parents: 1581f29
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Aug 28 19:02:12 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Aug 28 19:05:47 2013 +0000
----------------------------------------------------------------------
Allura/allura/config/middleware.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6769dc23/Allura/allura/config/middleware.py
----------------------------------------------------------------------
diff --git a/Allura/allura/config/middleware.py b/Allura/allura/config/middleware.py
index 1e9b0c7..7395f93 100644
--- a/Allura/allura/config/middleware.py
+++ b/Allura/allura/config/middleware.py
@@ -161,15 +161,17 @@ def _make_core_app(root, global_conf, full_stack=True, **app_conf):
# streaming=true ensures they won't be cleaned up till
# the WSGI application's iterator is exhausted
app = RegistryManager(app, streaming=True)
- # Make sure that the wsgi.scheme is set appropriately when we
- # have the funky HTTP_X_SFINC_SSL environ var
- if asbool(app_conf.get('auth.method', 'local')=='sfx'):
- app = set_scheme_middleware(app)
# "task" wsgi would get a 2nd request to /error/document if we used this middleware
if config.get('override_root') != 'task':
# Converts exceptions to HTTP errors, shows traceback in debug mode
tg.error.footer_html = '<!-- %s %s -->' # don't use TG footer with extra CSS & images that take time to load
app = tg.error.ErrorHandler(app, global_conf, **config['pylons.errorware'])
+
+ # Make sure that the wsgi.scheme is set appropriately when we
+ # have the funky HTTP_X_SFINC_SSL environ var
+ if asbool(app_conf.get('auth.method', 'local')=='sfx'):
+ app = set_scheme_middleware(app)
+
# Redirect some status codes to /error/document
if asbool(config['debug']):
app = StatusCodeRedirect(app, base_config.handle_status_codes)
[18/50] git commit: [5775] ticket:401 added tests for renaming
Posted by jo...@apache.org.
[5775] ticket:401 added tests for renaming
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/cee60059
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/cee60059
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/cee60059
Branch: refs/heads/cj/6596
Commit: cee60059cbd356722eb06f1742bdf60a0f2cadca
Parents: 385611c
Author: Anton Kasyanov <mi...@gmail.com>
Authored: Thu Aug 1 17:42:51 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Aug 29 19:00:44 2013 +0000
----------------------------------------------------------------------
Allura/allura/templates/widgets/repo/log.html | 2 +-
ForgeGit/forgegit/model/git_repo.py | 1 -
.../data/testrename.git/.SOURCEFORGE-REPOSITORY | 1 +
.../forgegit/tests/data/testrename.git/HEAD | 1 +
.../forgegit/tests/data/testrename.git/config | 7 +
.../tests/data/testrename.git/description | 1 +
.../testrename.git/hooks/applypatch-msg.sample | 15 ++
.../data/testrename.git/hooks/commit-msg.sample | 24 +++
.../data/testrename.git/hooks/post-receive | 9 +
.../testrename.git/hooks/post-update.sample | 8 +
.../testrename.git/hooks/pre-applypatch.sample | 14 ++
.../data/testrename.git/hooks/pre-commit.sample | 50 ++++++
.../data/testrename.git/hooks/pre-rebase.sample | 169 +++++++++++++++++++
.../hooks/prepare-commit-msg.sample | 36 ++++
.../data/testrename.git/hooks/update.sample | 128 ++++++++++++++
.../tests/data/testrename.git/info/exclude | 6 +
.../25/9c77dd6ee0e6091d11e429b56c44ccbf1e64a3 | 2 +
.../25/ac990c253975ab297e9955825e4ef9dc515d82 | Bin 0 -> 35 bytes
.../72/68e74cd78a7c34f1a4a6dfb6ce861e35f571d4 | Bin 0 -> 43 bytes
.../7b/57bd29ea8afbdeb9bac64cf7074f4b531492a8 | Bin 0 -> 26 bytes
.../7c/09182e61af959e4f1fb0e354bab49f14ef810d | Bin 0 -> 133 bytes
.../89/b97e3324e20b57543ae48ced731e31a052548c | Bin 0 -> 49 bytes
.../9a/cb8ca3e5703fa90f1cdc708dd070c17d0c26d8 | Bin 0 -> 50 bytes
.../b1/20505a61225e6c14bee3e5b5862db81628c35c | Bin 0 -> 160 bytes
.../c5/5a64046f8618a4c84c74dc834eb5722dabd58a | Bin 0 -> 51 bytes
.../dd/633a6dd42e52a66b277324fb75d83295d20f98 | Bin 0 -> 50 bytes
.../fb/b0644603bb6ecee3ebb62efe8c86efc9b84ee6 | Bin 0 -> 168 bytes
.../tests/data/testrename.git/refs/heads/master | 1 +
.../tests/functional/test_controllers.py | 24 +++
.../forgegit/tests/model/test_repository.py | 35 ++++
30 files changed, 532 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/Allura/allura/templates/widgets/repo/log.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/repo/log.html b/Allura/allura/templates/widgets/repo/log.html
index b54685f..c3ced6f 100644
--- a/Allura/allura/templates/widgets/repo/log.html
+++ b/Allura/allura/templates/widgets/repo/log.html
@@ -56,7 +56,7 @@
{{g.markdown.convert(commit.message)}}
{% if commit.renamed_from %}
<div>
- <b>renamed from</b> 
+ <b>renamed from</b>
<a href={{commit.renamed_from['commit_url']}}log/?path={{ commit.renamed_from['path'] }}>
{{ commit.renamed_from['path'] }}
</a>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index cee505f..fc7be67 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -335,7 +335,6 @@ class GitImplementation(M.RepositoryImplementation):
os.path.dirname(path),
deleted_diff.b_blob.name,
)
- renamed_from['commit_id'] = ci.hexsha
renamed_from['commit_url'] = self._repo.url_for_commit(
ci.hexsha
)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/.SOURCEFORGE-REPOSITORY
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/.SOURCEFORGE-REPOSITORY b/ForgeGit/forgegit/tests/data/testrename.git/.SOURCEFORGE-REPOSITORY
new file mode 100644
index 0000000..0899c29
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/.SOURCEFORGE-REPOSITORY
@@ -0,0 +1 @@
+git
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/HEAD
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/HEAD b/ForgeGit/forgegit/tests/data/testrename.git/HEAD
new file mode 100644
index 0000000..cb089cd
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/config
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/config b/ForgeGit/forgegit/tests/data/testrename.git/config
new file mode 100644
index 0000000..164a3ce
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/config
@@ -0,0 +1,7 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = true
+ sharedrepository = 2
+[receive]
+ denyNonFastforwards = true
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/description
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/description b/ForgeGit/forgegit/tests/data/testrename.git/description
new file mode 100644
index 0000000..498b267
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/description
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/hooks/applypatch-msg.sample
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/applypatch-msg.sample b/ForgeGit/forgegit/tests/data/testrename.git/hooks/applypatch-msg.sample
new file mode 100755
index 0000000..8b2a2fe
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/hooks/applypatch-msg.sample
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# An example hook script to check the commit log message taken by
+# applypatch from an e-mail message.
+#
+# The hook should exit with non-zero status after issuing an
+# appropriate message if it wants to stop the commit. The hook is
+# allowed to edit the commit message file.
+#
+# To enable this hook, rename this file to "applypatch-msg".
+
+. git-sh-setup
+test -x "$GIT_DIR/hooks/commit-msg" &&
+ exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
+:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/hooks/commit-msg.sample
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/commit-msg.sample b/ForgeGit/forgegit/tests/data/testrename.git/hooks/commit-msg.sample
new file mode 100755
index 0000000..b58d118
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/hooks/commit-msg.sample
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# An example hook script to check the commit log message.
+# Called by "git commit" with one argument, the name of the file
+# that has the commit message. The hook should exit with non-zero
+# status after issuing an appropriate message if it wants to stop the
+# commit. The hook is allowed to edit the commit message file.
+#
+# To enable this hook, rename this file to "commit-msg".
+
+# Uncomment the below to add a Signed-off-by line to the message.
+# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
+# hook is more suited to it.
+#
+# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
+# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
+
+# This example catches duplicate Signed-off-by lines.
+
+test "" = "$(grep '^Signed-off-by: ' "$1" |
+ sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
+ echo >&2 Duplicate Signed-off-by lines.
+ exit 1
+}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/hooks/post-receive
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/post-receive b/ForgeGit/forgegit/tests/data/testrename.git/hooks/post-receive
new file mode 100755
index 0000000..3ab92f5
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/hooks/post-receive
@@ -0,0 +1,9 @@
+#!/bin/bash
+# The following is required for site integration, do not remove/modify.
+# Place user hook code in post-receive-user and it will be called from here.
+curl -s http://localhost:8080/auth/refresh_repo/p/test2/code/
+
+DIR="$(dirname "${BASH_SOURCE[0]}")"
+if [ -x $DIR/post-receive-user ]; then
+ exec $DIR/post-receive-user
+fi
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/hooks/post-update.sample
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/post-update.sample b/ForgeGit/forgegit/tests/data/testrename.git/hooks/post-update.sample
new file mode 100755
index 0000000..ec17ec1
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/hooks/post-update.sample
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# An example hook script to prepare a packed repository for use over
+# dumb transports.
+#
+# To enable this hook, rename this file to "post-update".
+
+exec git update-server-info
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-applypatch.sample
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-applypatch.sample b/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-applypatch.sample
new file mode 100755
index 0000000..b1f187c
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-applypatch.sample
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# An example hook script to verify what is about to be committed
+# by applypatch from an e-mail message.
+#
+# The hook should exit with non-zero status after issuing an
+# appropriate message if it wants to stop the commit.
+#
+# To enable this hook, rename this file to "pre-applypatch".
+
+. git-sh-setup
+test -x "$GIT_DIR/hooks/pre-commit" &&
+ exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
+:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-commit.sample
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-commit.sample b/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-commit.sample
new file mode 100755
index 0000000..18c4829
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-commit.sample
@@ -0,0 +1,50 @@
+#!/bin/sh
+#
+# An example hook script to verify what is about to be committed.
+# Called by "git commit" with no arguments. The hook should
+# exit with non-zero status after issuing an appropriate message if
+# it wants to stop the commit.
+#
+# To enable this hook, rename this file to "pre-commit".
+
+if git rev-parse --verify HEAD >/dev/null 2>&1
+then
+ against=HEAD
+else
+ # Initial commit: diff against an empty tree object
+ against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+fi
+
+# If you want to allow non-ascii filenames set this variable to true.
+allownonascii=$(git config hooks.allownonascii)
+
+# Redirect output to stderr.
+exec 1>&2
+
+# Cross platform projects tend to avoid non-ascii filenames; prevent
+# them from being added to the repository. We exploit the fact that the
+# printable range starts at the space character and ends with tilde.
+if [ "$allownonascii" != "true" ] &&
+ # Note that the use of brackets around a tr range is ok here, (it's
+ # even required, for portability to Solaris 10's /usr/bin/tr), since
+ # the square bracket bytes happen to fall in the designated range.
+ test $(git diff --cached --name-only --diff-filter=A -z $against |
+ LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
+then
+ echo "Error: Attempt to add a non-ascii file name."
+ echo
+ echo "This can cause problems if you want to work"
+ echo "with people on other platforms."
+ echo
+ echo "To be portable it is advisable to rename the file ..."
+ echo
+ echo "If you know what you are doing you can disable this"
+ echo "check using:"
+ echo
+ echo " git config hooks.allownonascii true"
+ echo
+ exit 1
+fi
+
+# If there are whitespace errors, print the offending file names and fail.
+exec git diff-index --check --cached $against --
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-rebase.sample
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-rebase.sample b/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-rebase.sample
new file mode 100755
index 0000000..33730ca
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-rebase.sample
@@ -0,0 +1,169 @@
+#!/bin/sh
+#
+# Copyright (c) 2006, 2008 Junio C Hamano
+#
+# The "pre-rebase" hook is run just before "git rebase" starts doing
+# its job, and can prevent the command from running by exiting with
+# non-zero status.
+#
+# The hook is called with the following parameters:
+#
+# $1 -- the upstream the series was forked from.
+# $2 -- the branch being rebased (or empty when rebasing the current branch).
+#
+# This sample shows how to prevent topic branches that are already
+# merged to 'next' branch from getting rebased, because allowing it
+# would result in rebasing already published history.
+
+publish=next
+basebranch="$1"
+if test "$#" = 2
+then
+ topic="refs/heads/$2"
+else
+ topic=`git symbolic-ref HEAD` ||
+ exit 0 ;# we do not interrupt rebasing detached HEAD
+fi
+
+case "$topic" in
+refs/heads/??/*)
+ ;;
+*)
+ exit 0 ;# we do not interrupt others.
+ ;;
+esac
+
+# Now we are dealing with a topic branch being rebased
+# on top of master. Is it OK to rebase it?
+
+# Does the topic really exist?
+git show-ref -q "$topic" || {
+ echo >&2 "No such branch $topic"
+ exit 1
+}
+
+# Is topic fully merged to master?
+not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
+if test -z "$not_in_master"
+then
+ echo >&2 "$topic is fully merged to master; better remove it."
+ exit 1 ;# we could allow it, but there is no point.
+fi
+
+# Is topic ever merged to next? If so you should not be rebasing it.
+only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
+only_next_2=`git rev-list ^master ${publish} | sort`
+if test "$only_next_1" = "$only_next_2"
+then
+ not_in_topic=`git rev-list "^$topic" master`
+ if test -z "$not_in_topic"
+ then
+ echo >&2 "$topic is already up-to-date with master"
+ exit 1 ;# we could allow it, but there is no point.
+ else
+ exit 0
+ fi
+else
+ not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
+ /usr/bin/perl -e '
+ my $topic = $ARGV[0];
+ my $msg = "* $topic has commits already merged to public branch:\n";
+ my (%not_in_next) = map {
+ /^([0-9a-f]+) /;
+ ($1 => 1);
+ } split(/\n/, $ARGV[1]);
+ for my $elem (map {
+ /^([0-9a-f]+) (.*)$/;
+ [$1 => $2];
+ } split(/\n/, $ARGV[2])) {
+ if (!exists $not_in_next{$elem->[0]}) {
+ if ($msg) {
+ print STDERR $msg;
+ undef $msg;
+ }
+ print STDERR " $elem->[1]\n";
+ }
+ }
+ ' "$topic" "$not_in_next" "$not_in_master"
+ exit 1
+fi
+
+<<\DOC_END
+
+This sample hook safeguards topic branches that have been
+published from being rewound.
+
+The workflow assumed here is:
+
+ * Once a topic branch forks from "master", "master" is never
+ merged into it again (either directly or indirectly).
+
+ * Once a topic branch is fully cooked and merged into "master",
+ it is deleted. If you need to build on top of it to correct
+ earlier mistakes, a new topic branch is created by forking at
+ the tip of the "master". This is not strictly necessary, but
+ it makes it easier to keep your history simple.
+
+ * Whenever you need to test or publish your changes to topic
+ branches, merge them into "next" branch.
+
+The script, being an example, hardcodes the publish branch name
+to be "next", but it is trivial to make it configurable via
+$GIT_DIR/config mechanism.
+
+With this workflow, you would want to know:
+
+(1) ... if a topic branch has ever been merged to "next". Young
+ topic branches can have stupid mistakes you would rather
+ clean up before publishing, and things that have not been
+ merged into other branches can be easily rebased without
+ affecting other people. But once it is published, you would
+ not want to rewind it.
+
+(2) ... if a topic branch has been fully merged to "master".
+ Then you can delete it. More importantly, you should not
+ build on top of it -- other people may already want to
+ change things related to the topic as patches against your
+ "master", so if you need further changes, it is better to
+ fork the topic (perhaps with the same name) afresh from the
+ tip of "master".
+
+Let's look at this example:
+
+ o---o---o---o---o---o---o---o---o---o "next"
+ / / / /
+ / a---a---b A / /
+ / / / /
+ / / c---c---c---c B /
+ / / / \ /
+ / / / b---b C \ /
+ / / / / \ /
+ ---o---o---o---o---o---o---o---o---o---o---o "master"
+
+
+A, B and C are topic branches.
+
+ * A has one fix since it was merged up to "next".
+
+ * B has finished. It has been fully merged up to "master" and "next",
+ and is ready to be deleted.
+
+ * C has not merged to "next" at all.
+
+We would want to allow C to be rebased, refuse A, and encourage
+B to be deleted.
+
+To compute (1):
+
+ git rev-list ^master ^topic next
+ git rev-list ^master next
+
+ if these match, topic has not merged in next at all.
+
+To compute (2):
+
+ git rev-list master..topic
+
+ if this is empty, it is fully merged to "master".
+
+DOC_END
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/hooks/prepare-commit-msg.sample
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/prepare-commit-msg.sample b/ForgeGit/forgegit/tests/data/testrename.git/hooks/prepare-commit-msg.sample
new file mode 100755
index 0000000..f093a02
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/hooks/prepare-commit-msg.sample
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# An example hook script to prepare the commit log message.
+# Called by "git commit" with the name of the file that has the
+# commit message, followed by the description of the commit
+# message's source. The hook's purpose is to edit the commit
+# message file. If the hook fails with a non-zero status,
+# the commit is aborted.
+#
+# To enable this hook, rename this file to "prepare-commit-msg".
+
+# This hook includes three examples. The first comments out the
+# "Conflicts:" part of a merge commit.
+#
+# The second includes the output of "git diff --name-status -r"
+# into the message, just before the "git status" output. It is
+# commented because it doesn't cope with --amend or with squashed
+# commits.
+#
+# The third example adds a Signed-off-by line to the message, that can
+# still be edited. This is rarely a good idea.
+
+case "$2,$3" in
+ merge,)
+ /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
+
+# ,|template,)
+# /usr/bin/perl -i.bak -pe '
+# print "\n" . `git diff --cached --name-status -r`
+# if /^#/ && $first++ == 0' "$1" ;;
+
+ *) ;;
+esac
+
+# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
+# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/hooks/update.sample
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/update.sample b/ForgeGit/forgegit/tests/data/testrename.git/hooks/update.sample
new file mode 100755
index 0000000..71ab04e
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/hooks/update.sample
@@ -0,0 +1,128 @@
+#!/bin/sh
+#
+# An example hook script to blocks unannotated tags from entering.
+# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
+#
+# To enable this hook, rename this file to "update".
+#
+# Config
+# ------
+# hooks.allowunannotated
+# This boolean sets whether unannotated tags will be allowed into the
+# repository. By default they won't be.
+# hooks.allowdeletetag
+# This boolean sets whether deleting tags will be allowed in the
+# repository. By default they won't be.
+# hooks.allowmodifytag
+# This boolean sets whether a tag may be modified after creation. By default
+# it won't be.
+# hooks.allowdeletebranch
+# This boolean sets whether deleting branches will be allowed in the
+# repository. By default they won't be.
+# hooks.denycreatebranch
+# This boolean sets whether remotely creating branches will be denied
+# in the repository. By default this is allowed.
+#
+
+# --- Command line
+refname="$1"
+oldrev="$2"
+newrev="$3"
+
+# --- Safety check
+if [ -z "$GIT_DIR" ]; then
+ echo "Don't run this script from the command line." >&2
+ echo " (if you want, you could supply GIT_DIR then run" >&2
+ echo " $0 <ref> <oldrev> <newrev>)" >&2
+ exit 1
+fi
+
+if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
+ echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
+ exit 1
+fi
+
+# --- Config
+allowunannotated=$(git config --bool hooks.allowunannotated)
+allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
+denycreatebranch=$(git config --bool hooks.denycreatebranch)
+allowdeletetag=$(git config --bool hooks.allowdeletetag)
+allowmodifytag=$(git config --bool hooks.allowmodifytag)
+
+# check for no description
+projectdesc=$(sed -e '1q' "$GIT_DIR/description")
+case "$projectdesc" in
+"Unnamed repository"* | "")
+ echo "*** Project description file hasn't been set" >&2
+ exit 1
+ ;;
+esac
+
+# --- Check types
+# if $newrev is 0000...0000, it's a commit to delete a ref.
+zero="0000000000000000000000000000000000000000"
+if [ "$newrev" = "$zero" ]; then
+ newrev_type=delete
+else
+ newrev_type=$(git cat-file -t $newrev)
+fi
+
+case "$refname","$newrev_type" in
+ refs/tags/*,commit)
+ # un-annotated tag
+ short_refname=${refname##refs/tags/}
+ if [ "$allowunannotated" != "true" ]; then
+ echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
+ echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
+ exit 1
+ fi
+ ;;
+ refs/tags/*,delete)
+ # delete tag
+ if [ "$allowdeletetag" != "true" ]; then
+ echo "*** Deleting a tag is not allowed in this repository" >&2
+ exit 1
+ fi
+ ;;
+ refs/tags/*,tag)
+ # annotated tag
+ if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
+ then
+ echo "*** Tag '$refname' already exists." >&2
+ echo "*** Modifying a tag is not allowed in this repository." >&2
+ exit 1
+ fi
+ ;;
+ refs/heads/*,commit)
+ # branch
+ if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
+ echo "*** Creating a branch is not allowed in this repository" >&2
+ exit 1
+ fi
+ ;;
+ refs/heads/*,delete)
+ # delete branch
+ if [ "$allowdeletebranch" != "true" ]; then
+ echo "*** Deleting a branch is not allowed in this repository" >&2
+ exit 1
+ fi
+ ;;
+ refs/remotes/*,commit)
+ # tracking branch
+ ;;
+ refs/remotes/*,delete)
+ # delete tracking branch
+ if [ "$allowdeletebranch" != "true" ]; then
+ echo "*** Deleting a tracking branch is not allowed in this repository" >&2
+ exit 1
+ fi
+ ;;
+ *)
+ # Anything else (is there anything else?)
+ echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
+ exit 1
+ ;;
+esac
+
+# --- Finished
+exit 0
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/info/exclude
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/info/exclude b/ForgeGit/forgegit/tests/data/testrename.git/info/exclude
new file mode 100644
index 0000000..a5196d1
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/info/exclude
@@ -0,0 +1,6 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/objects/25/9c77dd6ee0e6091d11e429b56c44ccbf1e64a3
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/objects/25/9c77dd6ee0e6091d11e429b56c44ccbf1e64a3 b/ForgeGit/forgegit/tests/data/testrename.git/objects/25/9c77dd6ee0e6091d11e429b56c44ccbf1e64a3
new file mode 100644
index 0000000..c2ab918
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/objects/25/9c77dd6ee0e6091d11e429b56c44ccbf1e64a3
@@ -0,0 +1,2 @@
+x��Kj1��)z���
&�k���j�,)�(���:C����I�u��Ʈ
+��)ژ�q���"�f\�/��
��[��qޣ&q1�Ō�|��' (�ǣ�pm�7���ǭ��R�V\�c���Vޞ�����`H�X���Z3��sR�.�C���ඪy|2K�
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/objects/25/ac990c253975ab297e9955825e4ef9dc515d82
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/objects/25/ac990c253975ab297e9955825e4ef9dc515d82 b/ForgeGit/forgegit/tests/data/testrename.git/objects/25/ac990c253975ab297e9955825e4ef9dc515d82
new file mode 100644
index 0000000..3fabb2c
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/testrename.git/objects/25/ac990c253975ab297e9955825e4ef9dc515d82 differ
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/objects/72/68e74cd78a7c34f1a4a6dfb6ce861e35f571d4
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/objects/72/68e74cd78a7c34f1a4a6dfb6ce861e35f571d4 b/ForgeGit/forgegit/tests/data/testrename.git/objects/72/68e74cd78a7c34f1a4a6dfb6ce861e35f571d4
new file mode 100644
index 0000000..d7cc85e
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/testrename.git/objects/72/68e74cd78a7c34f1a4a6dfb6ce861e35f571d4 differ
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/objects/7b/57bd29ea8afbdeb9bac64cf7074f4b531492a8
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/objects/7b/57bd29ea8afbdeb9bac64cf7074f4b531492a8 b/ForgeGit/forgegit/tests/data/testrename.git/objects/7b/57bd29ea8afbdeb9bac64cf7074f4b531492a8
new file mode 100644
index 0000000..71d6c5a
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/testrename.git/objects/7b/57bd29ea8afbdeb9bac64cf7074f4b531492a8 differ
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/objects/7c/09182e61af959e4f1fb0e354bab49f14ef810d
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/objects/7c/09182e61af959e4f1fb0e354bab49f14ef810d b/ForgeGit/forgegit/tests/data/testrename.git/objects/7c/09182e61af959e4f1fb0e354bab49f14ef810d
new file mode 100644
index 0000000..7d51fe9
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/testrename.git/objects/7c/09182e61af959e4f1fb0e354bab49f14ef810d differ
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/objects/89/b97e3324e20b57543ae48ced731e31a052548c
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/objects/89/b97e3324e20b57543ae48ced731e31a052548c b/ForgeGit/forgegit/tests/data/testrename.git/objects/89/b97e3324e20b57543ae48ced731e31a052548c
new file mode 100644
index 0000000..8c65cdd
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/testrename.git/objects/89/b97e3324e20b57543ae48ced731e31a052548c differ
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/objects/9a/cb8ca3e5703fa90f1cdc708dd070c17d0c26d8
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/objects/9a/cb8ca3e5703fa90f1cdc708dd070c17d0c26d8 b/ForgeGit/forgegit/tests/data/testrename.git/objects/9a/cb8ca3e5703fa90f1cdc708dd070c17d0c26d8
new file mode 100644
index 0000000..c2eeea8
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/testrename.git/objects/9a/cb8ca3e5703fa90f1cdc708dd070c17d0c26d8 differ
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/objects/b1/20505a61225e6c14bee3e5b5862db81628c35c
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/objects/b1/20505a61225e6c14bee3e5b5862db81628c35c b/ForgeGit/forgegit/tests/data/testrename.git/objects/b1/20505a61225e6c14bee3e5b5862db81628c35c
new file mode 100644
index 0000000..c1249a0
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/testrename.git/objects/b1/20505a61225e6c14bee3e5b5862db81628c35c differ
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/objects/c5/5a64046f8618a4c84c74dc834eb5722dabd58a
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/objects/c5/5a64046f8618a4c84c74dc834eb5722dabd58a b/ForgeGit/forgegit/tests/data/testrename.git/objects/c5/5a64046f8618a4c84c74dc834eb5722dabd58a
new file mode 100644
index 0000000..5068b35
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/testrename.git/objects/c5/5a64046f8618a4c84c74dc834eb5722dabd58a differ
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/objects/dd/633a6dd42e52a66b277324fb75d83295d20f98
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/objects/dd/633a6dd42e52a66b277324fb75d83295d20f98 b/ForgeGit/forgegit/tests/data/testrename.git/objects/dd/633a6dd42e52a66b277324fb75d83295d20f98
new file mode 100644
index 0000000..297abfc
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/testrename.git/objects/dd/633a6dd42e52a66b277324fb75d83295d20f98 differ
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/objects/fb/b0644603bb6ecee3ebb62efe8c86efc9b84ee6
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/objects/fb/b0644603bb6ecee3ebb62efe8c86efc9b84ee6 b/ForgeGit/forgegit/tests/data/testrename.git/objects/fb/b0644603bb6ecee3ebb62efe8c86efc9b84ee6
new file mode 100644
index 0000000..4eef534
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/testrename.git/objects/fb/b0644603bb6ecee3ebb62efe8c86efc9b84ee6 differ
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/data/testrename.git/refs/heads/master
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/refs/heads/master b/ForgeGit/forgegit/tests/data/testrename.git/refs/heads/master
new file mode 100644
index 0000000..e83ab53
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/refs/heads/master
@@ -0,0 +1 @@
+259c77dd6ee0e6091d11e429b56c44ccbf1e64a3
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index c05ef94..638fd90 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -566,3 +566,27 @@ class TestDiff(TestController):
r = self.app.get('/src-git/ci/d961abbbf10341ee18a668c975842c35cfc0bef2/tree/1.png?diff=2ce83a24e52c21e8d2146b1a04a20717c0bb08d7')
assert 'alt="2ce83a2..."' in r
assert 'alt="d961abb..."' in r
+
+class TestGitRename(TestController):
+
+ def setUp(self):
+ super(TestGitRename, self).setUp()
+ self.setup_with_tools()
+
+ @with_git
+ def setup_with_tools(self):
+ h.set_context('test', 'src-git', neighborhood='Projects')
+ repo_dir = pkg_resources.resource_filename(
+ 'forgegit', 'tests/data')
+ c.app.repo.fs_path = repo_dir
+ c.app.repo.status = 'ready'
+ c.app.repo.name = 'testrename.git'
+ ThreadLocalORMSession.flush_all()
+ h.set_context('test', 'src-git', neighborhood='Projects')
+ c.app.repo.refresh()
+ ThreadLocalORMSession.flush_all()
+
+ def test_log(self):
+ resp = self.app.get('/src-git/ci/259c77dd6ee0e6091d11e429b56c44ccbf1e64a3/log/?path=/f2.txt')
+ assert '<b>renamed from</b>' in resp
+ assert '/f.txt' in resp
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cee60059/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 7d7f69b..15527f7 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -540,3 +540,38 @@ class TestGitHtmlView(unittest.TestCase):
assert b.has_html_view
b = self.rev.tree.get_blob_by_path('test.spec.in')
assert b.has_html_view
+
+
+class TestGitRename(unittest.TestCase):
+
+ def setUp(self):
+ setup_basic_test()
+ self.setup_with_tools()
+
+ @with_git
+ def setup_with_tools(self):
+ setup_global_objects()
+ h.set_context('test', 'src-git', neighborhood='Projects')
+ repo_dir = pkg_resources.resource_filename(
+ 'forgegit', 'tests/data')
+ self.repo = GM.Repository(
+ name='testrename.git',
+ fs_path=repo_dir,
+ url_path='/test/',
+ tool='git',
+ status='creating')
+ self.repo.refresh()
+ self.rev = self.repo.commit('HEAD')
+ ThreadLocalORMSession.flush_all()
+ ThreadLocalORMSession.close_all()
+
+ def test_file_commits(self):
+ # There was a file f.txt, then it was renamed to f2.txt.
+ commits = list(self.repo.log(id_only=False, path='/f2.txt'))
+ self.assertEqual(len(commits), 2)
+ rename_commit = commits[1]
+ self.assertEqual(rename_commit['renamed_from']['path'], '/f.txt')
+ self.assertEqual(
+ rename_commit['renamed_from']['commit_url'],
+ self.repo.url_for_commit(rename_commit['id'])
+ )
\ No newline at end of file
[25/50] git commit: [#5775] ticket:404 using diff.renamed now
Posted by jo...@apache.org.
[#5775] ticket:404 using diff.renamed now
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/2d81595e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/2d81595e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/2d81595e
Branch: refs/heads/cj/6596
Commit: 2d81595ecc43f7f7ec4398cc79e8d6fa74bdc49e
Parents: a6dccae
Author: Anton Kasyanov <mi...@gmail.com>
Authored: Tue Aug 6 12:40:36 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Aug 29 19:00:45 2013 +0000
----------------------------------------------------------------------
ForgeGit/forgegit/model/git_repo.py | 41 +++++++++-----------------------
1 file changed, 11 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2d81595e/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index fc7be67..ade299e 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -301,10 +301,7 @@ class GitImplementation(M.RepositoryImplementation):
path = path.strip('/') if path else None
if exclude is not None:
revs.extend(['^%s' % e for e in exclude])
- args = [revs, '--', path]
- if path:
- args.append('--follow')
- for ci, refs in self._iter_commits_with_refs(*args):
+ for ci, refs in self._iter_commits_with_refs([revs, '--', path]):
if id_only:
yield ci.hexsha
else:
@@ -312,29 +309,17 @@ class GitImplementation(M.RepositoryImplementation):
renamed_from = {}
if path:
# checking for renaming in this commit
- # log is called with follow, so there should be all commits
- # even before renaming
if ci.parents:
- diffs_with_parent = ci.diff(ci.parents[0])
- deleted_file_diffs = []
- renamed = False
- for diff in diffs_with_parent:
- if not diff.b_mode and not diff.b_blob:
- #new file was created
- if diff.a_blob.name == os.path.basename(path):
- renamed = True
- if not diff.a_mode and not diff.a_blob:
- #file was deleted
- deleted_file_diffs.append(diff)
- if renamed:
- if len(deleted_file_diffs) > 1:
- log.info('Couldn\'t find if file was renamed: too many deletions')
- elif len(deleted_file_diffs) == 1:
- deleted_diff = deleted_file_diffs[0]
- renamed_from['path'] = '{}/{}'.format(
- os.path.dirname(path),
- deleted_diff.b_blob.name,
- )
+ # without create_path=True, renames are not detected
+ # see diff() doc from git/diff.py
+ diff_with_parent = ci.diff(
+ ci.parents[0],
+ create_patch=True
+ )[0]
+ # since we do diff with previous commit (not next)
+ # rename_from and rename_to are interchanged
+ if diff_with_parent.renamed and diff_with_parent.rename_from == path:
+ renamed_from['path'] = '/' + diff_with_parent.rename_to
renamed_from['commit_url'] = self._repo.url_for_commit(
ci.hexsha
)
@@ -361,10 +346,6 @@ class GitImplementation(M.RepositoryImplementation):
'size': size,
'renamed_from': renamed_from,
}
- if renamed_from:
- # if file was renamed, do not yield commits
- # before renaming
- break
def _iter_commits_with_refs(self, *args, **kwargs):
"""
[10/50] git commit: [#6526] Better label on submit button
Posted by jo...@apache.org.
[#6526] Better label on submit button
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/90651671
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/90651671
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/90651671
Branch: refs/heads/cj/6596
Commit: 906516719ecc8b3a6c10c4a253a443d7367c0dbd
Parents: a4dc01b
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Aug 28 14:34:10 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Aug 28 14:34:10 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/templates/importer_base.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/90651671/ForgeImporters/forgeimporters/templates/importer_base.html
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/templates/importer_base.html b/ForgeImporters/forgeimporters/templates/importer_base.html
index 4bdfe0f..7a25543 100644
--- a/ForgeImporters/forgeimporters/templates/importer_base.html
+++ b/ForgeImporters/forgeimporters/templates/importer_base.html
@@ -75,6 +75,6 @@
{{ error('mount_point') }}
</div>
- <input type="submit" />
+ <input type="submit" value="Import"/>
</form>
{% endblock %}
[35/50] git commit: [#4595] ticket:421 Filter out deleted projects
Posted by jo...@apache.org.
[#4595] ticket:421 Filter out deleted projects
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f59fcc24
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f59fcc24
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f59fcc24
Branch: refs/heads/cj/6596
Commit: f59fcc246dedaeae060cf63532507dfdec473840
Parents: 8b15df9
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Aug 30 12:17:20 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:54 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/site_admin.py | 6 ++++--
.../templates/site_admin_new_projects.html | 2 --
.../allura/tests/functional/test_site_admin.py | 20 +++++++++++++++++---
3 files changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f59fcc24/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index 50b0e38..7595d66 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -189,8 +189,10 @@ class SiteAdminController(object):
limit, pagenum, start = g.handle_paging(limit, page, default=100)
count = 0
nb = M.Neighborhood.query.get(name='Users')
- projects = (M.Project.query.find({'neighborhood_id': {'$ne': nb._id}})
- .sort('_id', -1))
+ projects = (M.Project.query.find({
+ 'neighborhood_id': {'$ne': nb._id},
+ 'deleted': False,
+ }).sort('_id', -1))
count = projects.count()
projects = projects.skip(start).limit(limit)
return {
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f59fcc24/Allura/allura/templates/site_admin_new_projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_new_projects.html b/Allura/allura/templates/site_admin_new_projects.html
index aae9e48..bd97dc1 100644
--- a/Allura/allura/templates/site_admin_new_projects.html
+++ b/Allura/allura/templates/site_admin_new_projects.html
@@ -30,7 +30,6 @@
<th>Name</th>
<th>Short description</th>
<th>Summary</th>
- <th>Deleted?</th>
<th>Homepage</th>
<th>Admins</th>
</tr>
@@ -47,7 +46,6 @@
<td><small><a href="{{ p.url() }}">{{ p.name }}</a></small></td>
<td><small>{{ p.short_description }}</small></td>
<td><small>{{ p.summary }}</small></td>
- <td><small>{{ 'Yes' if p.deleted else 'No' }}</small></td>
<td><small>{{ p.external_homepage|urlize(22) }}</small></td>
<td><small>{{ p.admins()|join(' ') }}</small></td>
</tr>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f59fcc24/Allura/allura/tests/functional/test_site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_site_admin.py b/Allura/allura/tests/functional/test_site_admin.py
index dc8f26c..e339ff7 100644
--- a/Allura/allura/tests/functional/test_site_admin.py
+++ b/Allura/allura/tests/functional/test_site_admin.py
@@ -17,6 +17,9 @@
import json
+from nose.tools import assert_equal
+from ming.odm import ThreadLocalORMSession
+
from allura import model as M
from allura.tests import TestController
from allura.lib.decorators import task
@@ -60,9 +63,20 @@ class TestSiteAdmin(TestController):
assert headers[3].contents[0] == 'Name'
assert headers[4].contents[0] == 'Short description'
assert headers[5].contents[0] == 'Summary'
- assert headers[6].contents[0] == 'Deleted?'
- assert headers[7].contents[0] == 'Homepage'
- assert headers[8].contents[0] == 'Admins'
+ assert headers[6].contents[0] == 'Homepage'
+ assert headers[7].contents[0] == 'Admins'
+
+ def test_new_projects_deleted_projects(self):
+ '''Deleted projects should not be visible here'''
+ r = self.app.get('/nf/admin/new_projects', extra_environ=dict(
+ username='root'))
+ count = len(r.html.find('table').findAll('tr'))
+ p = M.Project.query.get(shortname='test')
+ p.deleted = True
+ ThreadLocalORMSession.flush_all()
+ r = self.app.get('/nf/admin/new_projects', extra_environ=dict(
+ username='root'))
+ assert_equal(len(r.html.find('table').findAll('tr')), count - 1)
def test_reclone_repo_access(self):
r = self.app.get('/nf/admin/reclone_repo', extra_environ=dict(
[06/50] git commit: [#6482] simpler logic to build matrix of
importers (thanks Cory)
Posted by jo...@apache.org.
[#6482] simpler logic to build matrix of importers (thanks Cory)
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ec9c7cf0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ec9c7cf0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ec9c7cf0
Branch: refs/heads/cj/6596
Commit: ec9c7cf0004f44b1b042aef9b83d22235d92da40
Parents: 7f179dc
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Aug 13 21:12:37 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Aug 27 17:24:58 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/base.py | 27 ++++----------------
.../forgeimporters/templates/list_all.html | 12 ++++-----
2 files changed, 11 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ec9c7cf0/ForgeImporters/forgeimporters/base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index e957b1a..e80235e 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -360,33 +360,16 @@ class ProjectToolsImportController(object):
@with_trailing_slash
@expose('jinja:forgeimporters:templates/list_all.html')
def index(self, *a, **kw):
- # make dictionaries of both axis
- importers_by_source = defaultdict(dict)
- importers_by_tool = defaultdict(dict)
+ importer_matrix = defaultdict(dict)
+ tools_with_importers = set()
for ep in iter_entry_points('allura.importers'):
importer = ep.load()
- importers_by_source[importer.source][ep.name] = importer
for tool in aslist(importer.target_app):
- importers_by_tool[tool][ep.name] = importer
-
- relevant_tools = sorted(importers_by_tool.keys(), key=lambda t: t.tool_label)
-
- # build a full matrix including empty spots
- importer_matrix = dict() # source -> [importer names]
- for source, src_importers in importers_by_source.iteritems():
- row = list()
- for tool in relevant_tools:
- for ep_name, importer in src_importers.iteritems():
- if tool in aslist(importer.target_app):
- row.append(ep_name)
- break
- else:
- row.append(None)
- importer_matrix[source] = row
-
+ tools_with_importers.add(tool.tool_label)
+ importer_matrix[importer.source][tool.tool_label] = ep.name
return {
- 'tools': relevant_tools,
'importer_matrix': importer_matrix,
+ 'tools': tools_with_importers,
}
@expose()
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ec9c7cf0/ForgeImporters/forgeimporters/templates/list_all.html
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/templates/list_all.html b/ForgeImporters/forgeimporters/templates/list_all.html
index b91e0df..b4c0a06 100644
--- a/ForgeImporters/forgeimporters/templates/list_all.html
+++ b/ForgeImporters/forgeimporters/templates/list_all.html
@@ -31,18 +31,18 @@
<thead>
<tr>
<th></th>
- {% for tool in tools %}
- <th>{{tool.tool_label}}</th>
+ {% for tool in tools|sort %}
+ <th>{{tool}}</th>
{% endfor %}
</tr>
</thead>
- {% for source, importers in importer_matrix|dictsort %}
+ {% for source in importer_matrix.keys()|sort %}
<tr>
<td><strong>{{ source }}</strong></td>
- {% for importer_name in importers %}
+ {% for tool in tools|sort %}
<td>
- {% if importer_name %}
- <a href="{{importer_name}}">Import</a>
+ {% if importer_matrix[source].get(tool) %}
+ <a href="{{ importer_matrix[source][tool] }}">Import</a>
{% endif %}
</td>
{% endfor %}
[04/50] git commit: [#6482] import page for existing projects
Posted by jo...@apache.org.
[#6482] import page for existing projects
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f705a179
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f705a179
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f705a179
Branch: refs/heads/cj/6596
Commit: f705a17907a7ad196b9d19c3086b79bc94221908
Parents: 09f0290
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Fri Aug 9 22:14:07 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Aug 27 17:24:58 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/base.py | 45 ++++++++++++--
.../forgeimporters/templates/list_all.html | 62 ++++++++++++++++++++
ForgeImporters/setup.py | 3 +
3 files changed, 104 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f705a179/ForgeImporters/forgeimporters/base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index 19a3d70..620097e 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -24,15 +24,17 @@ from pkg_resources import iter_entry_points
from BeautifulSoup import BeautifulSoup
from tg import expose, validate, flash, redirect, config
from tg.decorators import with_trailing_slash
-from pylons import tmpl_context as c
+from pylons import tmpl_context as c, app_globals as g
from formencode import validators as fev, schema
+from webob import exc
from allura.lib.decorators import require_post
from allura.lib.decorators import task
from allura.lib.security import require_access
-from allura.lib.plugin import ProjectRegistrationProvider
+from allura.lib.plugin import ProjectRegistrationProvider, AdminExtension
from allura.lib import helpers as h
from allura.lib import exceptions
+from allura.app import SitemapEntry
from paste.deploy.converters import aslist
@@ -273,16 +275,16 @@ class ToolImporter(object):
source = None # string description of source, must match project importer
controller = None
- @classmethod
- def by_name(self, name):
+ @staticmethod
+ def by_name(name):
"""
Return a ToolImporter subclass instance given its entry-point name.
"""
for ep in iter_entry_points('allura.importers', name):
return ep.load()()
- @classmethod
- def by_app(self, app):
+ @staticmethod
+ def by_app(app):
"""
Return a ToolImporter subclass instance given its target_app class.
"""
@@ -350,3 +352,34 @@ class ToolsValidator(fev.Set):
pl = 's' if len(invalid) > 1 else ''
raise fev.Invalid('Invalid tool%s selected: %s' % (pl, ', '.join(invalid)), value, state)
return valid
+
+class ProjectToolsImportController(object):
+ '''List all importers available'''
+
+ @with_trailing_slash
+ @expose('jinja:forgeimporters:templates/list_all.html')
+ def index(self, *a, **kw):
+ importers = {}
+ for app_name, app in g.entry_points['tool'].iteritems():
+ importers[app] = ToolImporter.by_app(app)
+ return {
+ 'importers': importers
+ }
+
+ @expose()
+ def _lookup(self, name, *remainder):
+ import_tool = ToolImporter.by_name(name)
+ if import_tool:
+ return import_tool.controller(), remainder
+ else:
+ raise exc.HTTPNotFound
+
+class ImportAdminExtension(AdminExtension):
+ '''Add import link to project admin sidebar'''
+
+ project_admin_controllers = {'import': ProjectToolsImportController}
+
+ def update_project_sidebar_menu(self, sidebar_links):
+ base_url = c.project.url() + 'admin/ext/'
+ link = SitemapEntry('Import', base_url+'import')
+ sidebar_links.append(link)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f705a179/ForgeImporters/forgeimporters/templates/list_all.html
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/templates/list_all.html b/ForgeImporters/forgeimporters/templates/list_all.html
new file mode 100644
index 0000000..58c9f34
--- /dev/null
+++ b/ForgeImporters/forgeimporters/templates/list_all.html
@@ -0,0 +1,62 @@
+{#-
+ 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.
+-#}
+{% extends g.theme.master %}
+{% import 'allura:templates/jinja_master/lib.html' as lib with context %}
+
+{% block title %}{{c.project.name}} / Import{% endblock %}
+
+{% block header %}Import from external sources{% endblock %}
+
+{% block extra_css %}
+<style type="text/css">
+ .tool {
+ margin-bottom: 3em;
+ }
+ .tool img {
+ float: left;
+ margin: 0 1em;
+ }
+ .importer .descr {
+ margin: 0 2em 1em 2em;
+ }
+</style>
+{% endblock %}
+
+{% block content %}
+ {% for tool, tool_importers in importers.iteritems() %}
+ <div class="tool">
+ {% for importer_name, importer in tool_importers.iteritems() %}
+ {% if loop.first %}
+ <img src="{{ g.theme.app_icon_url(tool, 48) }}" alt="{{ tool.tool_label }} icon">
+ <h2>{{ tool.tool_label }}</h2>
+ {% endif %}
+ <div class="importer">
+ <a href="{{importer_name}}"><h3>
+ {{importer.source}}:
+ {{importer.tool_label}}
+ </h3>
+ </a>
+ <div class="descr">
+ {{importer.tool_description}}
+ </div>
+ </div>
+ {% endfor %}
+ </div>
+ {% endfor %}
+{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f705a179/ForgeImporters/setup.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/setup.py b/ForgeImporters/setup.py
index cec76b4..d070782 100644
--- a/ForgeImporters/setup.py
+++ b/ForgeImporters/setup.py
@@ -42,4 +42,7 @@ setup(name='ForgeImporters',
google-code-tracker = forgeimporters.google.tracker:GoogleCodeTrackerImporter
google-code-repo = forgeimporters.google.code:GoogleRepoImporter
trac-tickets = forgeimporters.trac.tickets:TracTicketImporter
+
+ [allura.admin]
+ importers = forgeimporters.base:ImportAdminExtension
""",)
[03/50] git commit: [#6526] Fix typo
Posted by jo...@apache.org.
[#6526] Fix typo
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/6ff3125c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/6ff3125c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/6ff3125c
Branch: refs/heads/cj/6596
Commit: 6ff3125c01544dffb7fe63a5efd14439e7b6d72d
Parents: 8378ac0
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue Aug 27 13:38:31 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Aug 27 17:24:58 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/google/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6ff3125c/ForgeImporters/forgeimporters/google/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/__init__.py b/ForgeImporters/forgeimporters/google/__init__.py
index ad5f8e5..849f924 100644
--- a/ForgeImporters/forgeimporters/google/__init__.py
+++ b/ForgeImporters/forgeimporters/google/__init__.py
@@ -1,4 +1,4 @@
-# LNicensed to the Apache Software Foundation (ASF) under one
+# 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
[22/50] git commit: [#5775] ticket:405 added tests for renaming in svn
Posted by jo...@apache.org.
[#5775] ticket:405 added tests for renaming in svn
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/d509748e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d509748e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d509748e
Branch: refs/heads/cj/6596
Commit: d509748e8edf0e6e8cf47eef217b150a582c06f3
Parents: de91d9d
Author: Anton Kasyanov <mi...@gmail.com>
Authored: Thu Aug 8 18:05:26 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Aug 29 19:00:45 2013 +0000
----------------------------------------------------------------------
.../data/testsvn-rename/.SOURCEFORGE-REPOSITORY | 1 +
.../tests/data/testsvn-rename/README.txt | 5 ++
.../tests/data/testsvn-rename/conf/authz | 32 +++++++
.../tests/data/testsvn-rename/conf/passwd | 8 ++
.../data/testsvn-rename/conf/svnserve.conf | 47 ++++++++++
.../tests/data/testsvn-rename/db/current | 1 +
.../tests/data/testsvn-rename/db/format | 2 +
.../tests/data/testsvn-rename/db/fs-type | 1 +
.../tests/data/testsvn-rename/db/fsfs.conf | 37 ++++++++
.../data/testsvn-rename/db/min-unpacked-rev | 1 +
.../tests/data/testsvn-rename/db/revprops/0/0 | 5 ++
.../tests/data/testsvn-rename/db/revprops/0/1 | 13 +++
.../tests/data/testsvn-rename/db/revprops/0/2 | 13 +++
.../tests/data/testsvn-rename/db/revprops/0/3 | 13 +++
.../tests/data/testsvn-rename/db/revs/0/0 | 11 +++
.../tests/data/testsvn-rename/db/revs/0/1 | 49 +++++++++++
.../tests/data/testsvn-rename/db/revs/0/2 | Bin 0 -> 716 bytes
.../tests/data/testsvn-rename/db/revs/0/3 | 56 ++++++++++++
.../tests/data/testsvn-rename/db/txn-current | 1 +
.../data/testsvn-rename/db/txn-current-lock | 0
.../forgesvn/tests/data/testsvn-rename/db/uuid | 1 +
.../tests/data/testsvn-rename/db/write-lock | 0
.../forgesvn/tests/data/testsvn-rename/format | 1 +
.../tests/data/testsvn-rename/hooks/post-commit | 8 ++
.../data/testsvn-rename/hooks/post-commit.tmpl | 50 +++++++++++
.../data/testsvn-rename/hooks/post-lock.tmpl | 45 ++++++++++
.../hooks/post-revprop-change.tmpl | 57 +++++++++++++
.../data/testsvn-rename/hooks/post-unlock.tmpl | 43 ++++++++++
.../data/testsvn-rename/hooks/pre-commit.tmpl | 85 +++++++++++++++++++
.../data/testsvn-rename/hooks/pre-lock.tmpl | 71 ++++++++++++++++
.../hooks/pre-revprop-change.tmpl | 66 ++++++++++++++
.../data/testsvn-rename/hooks/pre-unlock.tmpl | 63 ++++++++++++++
.../data/testsvn-rename/hooks/start-commit.tmpl | 68 +++++++++++++++
.../data/testsvn-rename/locks/db-logs.lock | 3 +
.../tests/data/testsvn-rename/locks/db.lock | 3 +
.../tests/functional/test_controllers.py | 27 ++++++
.../forgesvn/tests/model/test_repository.py | 56 ++++++++++--
37 files changed, 935 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/.SOURCEFORGE-REPOSITORY
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/.SOURCEFORGE-REPOSITORY b/ForgeSVN/forgesvn/tests/data/testsvn-rename/.SOURCEFORGE-REPOSITORY
new file mode 100644
index 0000000..f2990b4
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/.SOURCEFORGE-REPOSITORY
@@ -0,0 +1 @@
+svn
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/README.txt
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/README.txt b/ForgeSVN/forgesvn/tests/data/testsvn-rename/README.txt
new file mode 100644
index 0000000..3bf5a57
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/README.txt
@@ -0,0 +1,5 @@
+This is a Subversion repository; use the 'svnadmin' tool to examine
+it. Do not add, delete, or modify files here unless you know how
+to avoid corrupting the repository.
+
+Visit http://subversion.tigris.org/ for more information.
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/conf/authz
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/conf/authz b/ForgeSVN/forgesvn/tests/data/testsvn-rename/conf/authz
new file mode 100644
index 0000000..0b9a410
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/conf/authz
@@ -0,0 +1,32 @@
+### This file is an example authorization file for svnserve.
+### Its format is identical to that of mod_authz_svn authorization
+### files.
+### As shown below each section defines authorizations for the path and
+### (optional) repository specified by the section name.
+### The authorizations follow. An authorization line can refer to:
+### - a single user,
+### - a group of users defined in a special [groups] section,
+### - an alias defined in a special [aliases] section,
+### - all authenticated users, using the '$authenticated' token,
+### - only anonymous users, using the '$anonymous' token,
+### - anyone, using the '*' wildcard.
+###
+### A match can be inverted by prefixing the rule with '~'. Rules can
+### grant read ('r') access, read-write ('rw') access, or no access
+### ('').
+
+[aliases]
+# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
+
+[groups]
+# harry_and_sally = harry,sally
+# harry_sally_and_joe = harry,sally,&joe
+
+# [/foo/bar]
+# harry = rw
+# &joe = r
+# * =
+
+# [repository:/baz/fuz]
+# @harry_and_sally = rw
+# * = r
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/conf/passwd
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/conf/passwd b/ForgeSVN/forgesvn/tests/data/testsvn-rename/conf/passwd
new file mode 100644
index 0000000..ecaa08d
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/conf/passwd
@@ -0,0 +1,8 @@
+### This file is an example password file for svnserve.
+### Its format is similar to that of svnserve.conf. As shown in the
+### example below it contains one section labelled [users].
+### The name and password for each user follow, one account per line.
+
+[users]
+# harry = harryssecret
+# sally = sallyssecret
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/conf/svnserve.conf
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/conf/svnserve.conf b/ForgeSVN/forgesvn/tests/data/testsvn-rename/conf/svnserve.conf
new file mode 100644
index 0000000..e62a01e
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/conf/svnserve.conf
@@ -0,0 +1,47 @@
+### This file controls the configuration of the svnserve daemon, if you
+### use it to allow access to this repository. (If you only allow
+### access through http: and/or file: URLs, then this file is
+### irrelevant.)
+
+### Visit http://subversion.tigris.org/ for more information.
+
+[general]
+### These options control access to the repository for unauthenticated
+### and authenticated users. Valid values are "write", "read",
+### and "none". The sample settings below are the defaults.
+# anon-access = read
+# auth-access = write
+### The password-db option controls the location of the password
+### database file. Unless you specify a path starting with a /,
+### the file's location is relative to the directory containing
+### this configuration file.
+### If SASL is enabled (see below), this file will NOT be used.
+### Uncomment the line below to use the default password file.
+# password-db = passwd
+### The authz-db option controls the location of the authorization
+### rules for path-based access control. Unless you specify a path
+### starting with a /, the file's location is relative to the the
+### directory containing this file. If you don't specify an
+### authz-db, no path-based access control is done.
+### Uncomment the line below to use the default authorization file.
+# authz-db = authz
+### This option specifies the authentication realm of the repository.
+### If two repositories have the same authentication realm, they should
+### have the same password database, and vice versa. The default realm
+### is repository's uuid.
+# realm = My First Repository
+
+[sasl]
+### This option specifies whether you want to use the Cyrus SASL
+### library for authentication. Default is false.
+### This section will be ignored if svnserve is not built with Cyrus
+### SASL support; to check, run 'svnserve --version' and look for a line
+### reading 'Cyrus SASL authentication is available.'
+# use-sasl = true
+### These options specify the desired strength of the security layer
+### that you want SASL to provide. 0 means no encryption, 1 means
+### integrity-checking only, values larger than 1 are correlated
+### to the effective key length for encryption (e.g. 128 means 128-bit
+### encryption). The values below are the defaults.
+# min-encryption = 0
+# max-encryption = 256
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/current
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/current b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/current
new file mode 100644
index 0000000..00750ed
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/current
@@ -0,0 +1 @@
+3
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/format
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/format b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/format
new file mode 100644
index 0000000..db06890
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/format
@@ -0,0 +1,2 @@
+4
+layout sharded 1000
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/fs-type
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/fs-type b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/fs-type
new file mode 100644
index 0000000..4fdd953
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/fs-type
@@ -0,0 +1 @@
+fsfs
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/fsfs.conf
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/fsfs.conf b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/fsfs.conf
new file mode 100644
index 0000000..0a5f1fe
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/fsfs.conf
@@ -0,0 +1,37 @@
+### This file controls the configuration of the FSFS filesystem.
+
+[memcached-servers]
+### These options name memcached servers used to cache internal FSFS
+### data. See http://www.danga.com/memcached/ for more information on
+### memcached. To use memcached with FSFS, run one or more memcached
+### servers, and specify each of them as an option like so:
+# first-server = 127.0.0.1:11211
+# remote-memcached = mymemcached.corp.example.com:11212
+### The option name is ignored; the value is of the form HOST:PORT.
+### memcached servers can be shared between multiple repositories;
+### however, if you do this, you *must* ensure that repositories have
+### distinct UUIDs and paths, or else cached data from one repository
+### might be used by another accidentally. Note also that memcached has
+### no authentication for reads or writes, so you must ensure that your
+### memcached servers are only accessible by trusted users.
+
+[caches]
+### When a cache-related error occurs, normally Subversion ignores it
+### and continues, logging an error if the server is appropriately
+### configured (and ignoring it with file:// access). To make
+### Subversion never ignore cache errors, uncomment this line.
+# fail-stop = true
+
+[rep-sharing]
+### To conserve space, the filesystem can optionally avoid storing
+### duplicate representations. This comes at a slight cost in performace,
+### as maintaining a database of shared representations can increase
+### commit times. The space savings are dependent upon the size of the
+### repository, the number of objects it contains and the amount of
+### duplication between them, usually a function of the branching and
+### merging process.
+###
+### The following parameter enables rep-sharing in the repository. It can
+### be switched on and off at will, but for best space-saving results
+### should be enabled consistently over the life of the repository.
+# enable-rep-sharing = false
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/min-unpacked-rev
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/min-unpacked-rev b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/min-unpacked-rev
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/min-unpacked-rev
@@ -0,0 +1 @@
+0
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revprops/0/0
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revprops/0/0 b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revprops/0/0
new file mode 100644
index 0000000..8d3fd9e
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revprops/0/0
@@ -0,0 +1,5 @@
+K 8
+svn:date
+V 27
+2013-08-08T12:37:19.542781Z
+END
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revprops/0/1
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revprops/0/1 b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revprops/0/1
new file mode 100644
index 0000000..2a381d9
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revprops/0/1
@@ -0,0 +1,13 @@
+K 10
+svn:author
+V 4
+root
+K 8
+svn:date
+V 27
+2013-08-08T12:38:04.489552Z
+K 7
+svn:log
+V 23
+Add initial directories
+END
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revprops/0/2
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revprops/0/2 b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revprops/0/2
new file mode 100644
index 0000000..144e101
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revprops/0/2
@@ -0,0 +1,13 @@
+K 10
+svn:author
+V 4
+root
+K 8
+svn:date
+V 27
+2013-08-08T12:39:43.351248Z
+K 7
+svn:log
+V 11
+file in dir
+END
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revprops/0/3
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revprops/0/3 b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revprops/0/3
new file mode 100644
index 0000000..a3a76ba
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revprops/0/3
@@ -0,0 +1,13 @@
+K 10
+svn:author
+V 4
+root
+K 8
+svn:date
+V 27
+2013-08-08T12:40:01.848949Z
+K 7
+svn:log
+V 6
+rename
+END
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revs/0/0
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revs/0/0 b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revs/0/0
new file mode 100644
index 0000000..10f5c45
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revs/0/0
@@ -0,0 +1,11 @@
+PLAIN
+END
+ENDREP
+id: 0.0.r0/17
+type: dir
+count: 0
+text: 0 0 4 4 2d2977d1c96f487abe4a1e202dd03b4e
+cpath: /
+
+
+17 107
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revs/0/1
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revs/0/1 b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revs/0/1
new file mode 100644
index 0000000..f2ad9f2
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revs/0/1
@@ -0,0 +1,49 @@
+id: 2-1.0.r1/0
+type: dir
+count: 0
+cpath: /tags
+copyroot: 0 /
+
+id: 3-1.0.r1/62
+type: dir
+count: 0
+cpath: /trunk
+copyroot: 0 /
+
+id: 0-1.0.r1/126
+type: dir
+count: 0
+cpath: /branches
+copyroot: 0 /
+
+PLAIN
+K 8
+branches
+V 16
+dir 0-1.0.r1/126
+K 4
+tags
+V 14
+dir 2-1.0.r1/0
+K 5
+trunk
+V 15
+dir 3-1.0.r1/62
+END
+ENDREP
+id: 0.0.r1/306
+type: dir
+pred: 0.0.r0/17
+count: 1
+text: 1 194 99 99 2a9153030baf0be3d36129055b365771
+cpath: /
+copyroot: 0 /
+
+_3.0.t0-0 add-dir false false /trunk
+
+_0.0.t0-0 add-dir false false /branches
+
+_2.0.t0-0 add-dir false false /tags
+
+
+306 431
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revs/0/2
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revs/0/2 b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revs/0/2
new file mode 100644
index 0000000..3621d6e
Binary files /dev/null and b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revs/0/2 differ
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revs/0/3
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revs/0/3 b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revs/0/3
new file mode 100644
index 0000000..dfc2340
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/revs/0/3
@@ -0,0 +1,56 @@
+id: 2-2.0-3.r3/0
+type: file
+pred: 2-2.0.r2/31
+count: 1
+text: 2 0 18 6 58e3b26452d39a3b59fb382c0ba03bac 415b4467aab97d19ad3fd7beb8eeaa42c8330abc 1-1/_4
+cpath: /dir/b.txt
+copyfrom: 2 /dir/a.txt
+
+PLAIN
+K 5
+b.txt
+V 17
+file 2-2.0-3.r3/0
+END
+ENDREP
+id: 0-2.0.r3/243
+type: dir
+pred: 0-2.0.r2/245
+count: 1
+text: 3 193 37 37 1f4ffb88b2b1a84f68f687f7c6234093
+cpath: /dir
+copyroot: 0 /
+
+PLAIN
+K 8
+branches
+V 16
+dir 0-1.0.r1/126
+K 3
+dir
+V 16
+dir 0-2.0.r3/243
+K 4
+tags
+V 14
+dir 2-1.0.r1/0
+K 5
+trunk
+V 15
+dir 3-1.0.r1/62
+END
+ENDREP
+id: 0.0.r3/518
+type: dir
+pred: 0.0.r2/501
+count: 3
+text: 3 376 129 129 a5fed55ce83e9aefbeb6199207438b16
+cpath: /
+copyroot: 0 /
+
+2-2.0.r2/31 delete-file false false /dir/a.txt
+
+2-2._0.t2-2 add-file false false /dir/b.txt
+2 /dir/a.txt
+
+518 646
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/txn-current
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/txn-current b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/txn-current
new file mode 100644
index 0000000..00750ed
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/txn-current
@@ -0,0 +1 @@
+3
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/txn-current-lock
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/txn-current-lock b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/txn-current-lock
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/uuid
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/uuid b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/uuid
new file mode 100644
index 0000000..b82b6b3
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/uuid
@@ -0,0 +1 @@
+7dc01617-2ce1-4b3d-96af-f7038e33c0a2
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/write-lock
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/write-lock b/ForgeSVN/forgesvn/tests/data/testsvn-rename/db/write-lock
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/format
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/format b/ForgeSVN/forgesvn/tests/data/testsvn-rename/format
new file mode 100644
index 0000000..7ed6ff8
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/format
@@ -0,0 +1 @@
+5
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-commit
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-commit b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-commit
new file mode 100755
index 0000000..5c81f51
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-commit
@@ -0,0 +1,8 @@
+#!/bin/bash
+# The following is required for site integration, do not remove/modify.
+# Place user hook code in post-commit-user and it will be called from here.
+curl -s http://localhost:8080/auth/refresh_repo/p/test2/code/
+
+DIR="$(dirname "${BASH_SOURCE[0]}")"
+if [ -x $DIR/post-commit-user ]; then exec $DIR/post-commit-user "$@"
+fi
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-commit.tmpl
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-commit.tmpl b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-commit.tmpl
new file mode 100644
index 0000000..93c92ad
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-commit.tmpl
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# POST-COMMIT HOOK
+#
+# The post-commit hook is invoked after a commit. Subversion runs
+# this hook by invoking a program (script, executable, binary, etc.)
+# named 'post-commit' (for which this file is a template) with the
+# following ordered arguments:
+#
+# [1] REPOS-PATH (the path to this repository)
+# [2] REV (the number of the revision just committed)
+#
+# The default working directory for the invocation is undefined, so
+# the program should set one explicitly if it cares.
+#
+# Because the commit has already completed and cannot be undone,
+# the exit code of the hook program is ignored. The hook program
+# can use the 'svnlook' utility to help it examine the
+# newly-committed tree.
+#
+# On a Unix system, the normal procedure is to have 'post-commit'
+# invoke other programs to do the real work, though it may do the
+# work itself too.
+#
+# Note that 'post-commit' must be executable by the user(s) who will
+# invoke it (typically the user httpd runs as), and that user must
+# have filesystem-level permission to access the repository.
+#
+# On a Windows system, you should name the hook program
+# 'post-commit.bat' or 'post-commit.exe',
+# but the basic idea is the same.
+#
+# The hook program typically does not inherit the environment of
+# its parent process. For example, a common problem is for the
+# PATH environment variable to not be set to its usual value, so
+# that subprograms fail to launch unless invoked via absolute path.
+# If you're having unexpected problems with a hook program, the
+# culprit may be unusual (or missing) environment variables.
+#
+# Here is an example hook script, for a Unix /bin/sh interpreter.
+# For more examples and pre-written hooks, see those in
+# /usr/share/subversion/hook-scripts, and in the repository at
+# http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and
+# http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/
+
+
+REPOS="$1"
+REV="$2"
+
+"$REPOS"/hooks/mailer.py commit "$REPOS" $REV "$REPOS"/mailer.conf
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-lock.tmpl
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-lock.tmpl b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-lock.tmpl
new file mode 100644
index 0000000..beae9d7
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-lock.tmpl
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# POST-LOCK HOOK
+#
+# The post-lock hook is run after a path is locked. Subversion runs
+# this hook by invoking a program (script, executable, binary, etc.)
+# named 'post-lock' (for which this file is a template) with the
+# following ordered arguments:
+#
+# [1] REPOS-PATH (the path to this repository)
+# [2] USER (the user who created the lock)
+#
+# The paths that were just locked are passed to the hook via STDIN (as
+# of Subversion 1.2, only one path is passed per invocation, but the
+# plan is to pass all locked paths at once, so the hook program
+# should be written accordingly).
+#
+# The default working directory for the invocation is undefined, so
+# the program should set one explicitly if it cares.
+#
+# Because the lock has already been created and cannot be undone,
+# the exit code of the hook program is ignored. The hook program
+# can use the 'svnlook' utility to help it examine the
+# newly-created lock.
+#
+# On a Unix system, the normal procedure is to have 'post-lock'
+# invoke other programs to do the real work, though it may do the
+# work itself too.
+#
+# Note that 'post-lock' must be executable by the user(s) who will
+# invoke it (typically the user httpd runs as), and that user must
+# have filesystem-level permission to access the repository.
+#
+# On a Windows system, you should name the hook program
+# 'post-lock.bat' or 'post-lock.exe',
+# but the basic idea is the same.
+#
+# Here is an example hook script, for a Unix /bin/sh interpreter:
+
+REPOS="$1"
+USER="$2"
+
+# Send email to interested parties, let them know a lock was created:
+"$REPOS"/hooks/mailer.py lock \
+ "$REPOS" "$USER" "$REPOS"/hooks/mailer.conf
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-revprop-change.tmpl
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-revprop-change.tmpl b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-revprop-change.tmpl
new file mode 100644
index 0000000..cf7aedd
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-revprop-change.tmpl
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+# POST-REVPROP-CHANGE HOOK
+#
+# The post-revprop-change hook is invoked after a revision property
+# has been added, modified or deleted. Subversion runs this hook by
+# invoking a program (script, executable, binary, etc.) named
+# 'post-revprop-change' (for which this file is a template), with the
+# following ordered arguments:
+#
+# [1] REPOS-PATH (the path to this repository)
+# [2] REV (the revision that was tweaked)
+# [3] USER (the username of the person tweaking the property)
+# [4] PROPNAME (the property that was changed)
+# [5] ACTION (the property was 'A'dded, 'M'odified, or 'D'eleted)
+#
+# [STDIN] PROPVAL ** the old property value is passed via STDIN.
+#
+# Because the propchange has already completed and cannot be undone,
+# the exit code of the hook program is ignored. The hook program
+# can use the 'svnlook' utility to help it examine the
+# new property value.
+#
+# On a Unix system, the normal procedure is to have 'post-revprop-change'
+# invoke other programs to do the real work, though it may do the
+# work itself too.
+#
+# Note that 'post-revprop-change' must be executable by the user(s) who will
+# invoke it (typically the user httpd runs as), and that user must
+# have filesystem-level permission to access the repository.
+#
+# On a Windows system, you should name the hook program
+# 'post-revprop-change.bat' or 'post-revprop-change.exe',
+# but the basic idea is the same.
+#
+# The hook program typically does not inherit the environment of
+# its parent process. For example, a common problem is for the
+# PATH environment variable to not be set to its usual value, so
+# that subprograms fail to launch unless invoked via absolute path.
+# If you're having unexpected problems with a hook program, the
+# culprit may be unusual (or missing) environment variables.
+#
+# Here is an example hook script, for a Unix /bin/sh interpreter.
+# For more examples and pre-written hooks, see those in
+# /usr/share/subversion/hook-scripts, and in the repository at
+# http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and
+# http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/
+
+
+REPOS="$1"
+REV="$2"
+USER="$3"
+PROPNAME="$4"
+ACTION="$5"
+
+"$REPOS"/hooks/mailer.py propchange2 "$REPOS" $REV \
+ "$USER" "$PROPNAME" "$ACTION" "$REPOS"/hooks/mailer.conf
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-unlock.tmpl
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-unlock.tmpl b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-unlock.tmpl
new file mode 100644
index 0000000..277569f
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/post-unlock.tmpl
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+# POST-UNLOCK HOOK
+#
+# The post-unlock hook runs after a path is unlocked. Subversion runs
+# this hook by invoking a program (script, executable, binary, etc.)
+# named 'post-unlock' (for which this file is a template) with the
+# following ordered arguments:
+#
+# [1] REPOS-PATH (the path to this repository)
+# [2] USER (the user who destroyed the lock)
+#
+# The paths that were just unlocked are passed to the hook via STDIN
+# (as of Subversion 1.2, only one path is passed per invocation, but
+# the plan is to pass all unlocked paths at once, so the hook program
+# should be written accordingly).
+#
+# The default working directory for the invocation is undefined, so
+# the program should set one explicitly if it cares.
+#
+# Because the lock has already been destroyed and cannot be undone,
+# the exit code of the hook program is ignored.
+#
+# On a Unix system, the normal procedure is to have 'post-unlock'
+# invoke other programs to do the real work, though it may do the
+# work itself too.
+#
+# Note that 'post-unlock' must be executable by the user(s) who will
+# invoke it (typically the user httpd runs as), and that user must
+# have filesystem-level permission to access the repository.
+#
+# On a Windows system, you should name the hook program
+# 'post-unlock.bat' or 'post-unlock.exe',
+# but the basic idea is the same.
+#
+# Here is an example hook script, for a Unix /bin/sh interpreter:
+
+REPOS="$1"
+USER="$2"
+
+# Send email to interested parties, let them know a lock was removed:
+"$REPOS"/hooks/mailer.py unlock \
+ "$REPOS" "$USER" "$REPOS"/hooks/mailer.conf
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/pre-commit.tmpl
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/pre-commit.tmpl b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/pre-commit.tmpl
new file mode 100644
index 0000000..44c24b9
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/pre-commit.tmpl
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+# PRE-COMMIT HOOK
+#
+# The pre-commit hook is invoked before a Subversion txn is
+# committed. Subversion runs this hook by invoking a program
+# (script, executable, binary, etc.) named 'pre-commit' (for which
+# this file is a template), with the following ordered arguments:
+#
+# [1] REPOS-PATH (the path to this repository)
+# [2] TXN-NAME (the name of the txn about to be committed)
+#
+# [STDIN] LOCK-TOKENS ** the lock tokens are passed via STDIN.
+#
+# If STDIN contains the line "LOCK-TOKENS:\n" (the "\n" denotes a
+# single newline), the lines following it are the lock tokens for
+# this commit. The end of the list is marked by a line containing
+# only a newline character.
+#
+# Each lock token line consists of a URI-escaped path, followed
+# by the separator character '|', followed by the lock token string,
+# followed by a newline.
+#
+# The default working directory for the invocation is undefined, so
+# the program should set one explicitly if it cares.
+#
+# If the hook program exits with success, the txn is committed; but
+# if it exits with failure (non-zero), the txn is aborted, no commit
+# takes place, and STDERR is returned to the client. The hook
+# program can use the 'svnlook' utility to help it examine the txn.
+#
+# On a Unix system, the normal procedure is to have 'pre-commit'
+# invoke other programs to do the real work, though it may do the
+# work itself too.
+#
+# *** NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT ***
+# *** FOR REVISION PROPERTIES (like svn:log or svn:author). ***
+#
+# This is why we recommend using the read-only 'svnlook' utility.
+# In the future, Subversion may enforce the rule that pre-commit
+# hooks should not modify the versioned data in txns, or else come
+# up with a mechanism to make it safe to do so (by informing the
+# committing client of the changes). However, right now neither
+# mechanism is implemented, so hook writers just have to be careful.
+#
+# Note that 'pre-commit' must be executable by the user(s) who will
+# invoke it (typically the user httpd runs as), and that user must
+# have filesystem-level permission to access the repository.
+#
+# On a Windows system, you should name the hook program
+# 'pre-commit.bat' or 'pre-commit.exe',
+# but the basic idea is the same.
+#
+# The hook program typically does not inherit the environment of
+# its parent process. For example, a common problem is for the
+# PATH environment variable to not be set to its usual value, so
+# that subprograms fail to launch unless invoked via absolute path.
+# If you're having unexpected problems with a hook program, the
+# culprit may be unusual (or missing) environment variables.
+#
+# Here is an example hook script, for a Unix /bin/sh interpreter.
+# For more examples and pre-written hooks, see those in
+# /usr/share/subversion/hook-scripts, and in the repository at
+# http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and
+# http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/
+
+
+REPOS="$1"
+TXN="$2"
+
+# Make sure that the log message contains some text.
+SVNLOOK=/usr/bin/svnlook
+$SVNLOOK log -t "$TXN" "$REPOS" | \
+ grep "[a-zA-Z0-9]" > /dev/null || exit 1
+
+# Exit on all errors.
+set -e
+
+# Check that the author of this commit has the rights to perform
+# the commit on the files and directories being modified.
+"$REPOS"/hooks/commit-access-control.pl "$REPOS" $TXN \
+ "$REPOS"/hooks/commit-access-control.cfg
+
+# All checks passed, so allow the commit.
+exit 0
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/pre-lock.tmpl
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/pre-lock.tmpl b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/pre-lock.tmpl
new file mode 100644
index 0000000..13827fb
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/pre-lock.tmpl
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+# PRE-LOCK HOOK
+#
+# The pre-lock hook is invoked before an exclusive lock is
+# created. Subversion runs this hook by invoking a program
+# (script, executable, binary, etc.) named 'pre-lock' (for which
+# this file is a template), with the following ordered arguments:
+#
+# [1] REPOS-PATH (the path to this repository)
+# [2] PATH (the path in the repository about to be locked)
+# [3] USER (the user creating the lock)
+# [4] COMMENT (the comment of the lock)
+# [5] STEAL-LOCK (1 if the user is trying to steal the lock, else 0)
+#
+# If the hook program outputs anything on stdout, the output string will
+# be used as the lock token for this lock operation. If you choose to use
+# this feature, you must guarantee the tokens generated are unique across
+# the repository each time.
+#
+# The default working directory for the invocation is undefined, so
+# the program should set one explicitly if it cares.
+#
+# If the hook program exits with success, the lock is created; but
+# if it exits with failure (non-zero), the lock action is aborted
+# and STDERR is returned to the client.
+
+# On a Unix system, the normal procedure is to have 'pre-lock'
+# invoke other programs to do the real work, though it may do the
+# work itself too.
+#
+# Note that 'pre-lock' must be executable by the user(s) who will
+# invoke it (typically the user httpd runs as), and that user must
+# have filesystem-level permission to access the repository.
+#
+# On a Windows system, you should name the hook program
+# 'pre-lock.bat' or 'pre-lock.exe',
+# but the basic idea is the same.
+#
+# Here is an example hook script, for a Unix /bin/sh interpreter:
+
+REPOS="$1"
+PATH="$2"
+USER="$3"
+
+# If a lock exists and is owned by a different person, don't allow it
+# to be stolen (e.g., with 'svn lock --force ...').
+
+# (Maybe this script could send email to the lock owner?)
+SVNLOOK=/usr/bin/svnlook
+GREP=/bin/grep
+SED=/bin/sed
+
+LOCK_OWNER=`$SVNLOOK lock "$REPOS" "$PATH" | \
+ $GREP '^Owner: ' | $SED 's/Owner: //'`
+
+# If we get no result from svnlook, there's no lock, allow the lock to
+# happen:
+if [ "$LOCK_OWNER" = "" ]; then
+ exit 0
+fi
+
+# If the person locking matches the lock's owner, allow the lock to
+# happen:
+if [ "$LOCK_OWNER" = "$USER" ]; then
+ exit 0
+fi
+
+# Otherwise, we've got an owner mismatch, so return failure:
+echo "Error: $PATH already locked by ${LOCK_OWNER}." 1>&2
+exit 1
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/pre-revprop-change.tmpl
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/pre-revprop-change.tmpl b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/pre-revprop-change.tmpl
new file mode 100644
index 0000000..576fb36
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/pre-revprop-change.tmpl
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+# PRE-REVPROP-CHANGE HOOK
+#
+# The pre-revprop-change hook is invoked before a revision property
+# is added, modified or deleted. Subversion runs this hook by invoking
+# a program (script, executable, binary, etc.) named 'pre-revprop-change'
+# (for which this file is a template), with the following ordered
+# arguments:
+#
+# [1] REPOS-PATH (the path to this repository)
+# [2] REVISION (the revision being tweaked)
+# [3] USER (the username of the person tweaking the property)
+# [4] PROPNAME (the property being set on the revision)
+# [5] ACTION (the property is being 'A'dded, 'M'odified, or 'D'eleted)
+#
+# [STDIN] PROPVAL ** the new property value is passed via STDIN.
+#
+# If the hook program exits with success, the propchange happens; but
+# if it exits with failure (non-zero), the propchange doesn't happen.
+# The hook program can use the 'svnlook' utility to examine the
+# existing value of the revision property.
+#
+# WARNING: unlike other hooks, this hook MUST exist for revision
+# properties to be changed. If the hook does not exist, Subversion
+# will behave as if the hook were present, but failed. The reason
+# for this is that revision properties are UNVERSIONED, meaning that
+# a successful propchange is destructive; the old value is gone
+# forever. We recommend the hook back up the old value somewhere.
+#
+# On a Unix system, the normal procedure is to have 'pre-revprop-change'
+# invoke other programs to do the real work, though it may do the
+# work itself too.
+#
+# Note that 'pre-revprop-change' must be executable by the user(s) who will
+# invoke it (typically the user httpd runs as), and that user must
+# have filesystem-level permission to access the repository.
+#
+# On a Windows system, you should name the hook program
+# 'pre-revprop-change.bat' or 'pre-revprop-change.exe',
+# but the basic idea is the same.
+#
+# The hook program typically does not inherit the environment of
+# its parent process. For example, a common problem is for the
+# PATH environment variable to not be set to its usual value, so
+# that subprograms fail to launch unless invoked via absolute path.
+# If you're having unexpected problems with a hook program, the
+# culprit may be unusual (or missing) environment variables.
+#
+# Here is an example hook script, for a Unix /bin/sh interpreter.
+# For more examples and pre-written hooks, see those in
+# /usr/share/subversion/hook-scripts, and in the repository at
+# http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and
+# http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/
+
+
+REPOS="$1"
+REV="$2"
+USER="$3"
+PROPNAME="$4"
+ACTION="$5"
+
+if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
+
+echo "Changing revision properties other than svn:log is prohibited" >&2
+exit 1
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/pre-unlock.tmpl
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/pre-unlock.tmpl b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/pre-unlock.tmpl
new file mode 100644
index 0000000..d1aa858
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/pre-unlock.tmpl
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+# PRE-UNLOCK HOOK
+#
+# The pre-unlock hook is invoked before an exclusive lock is
+# destroyed. Subversion runs this hook by invoking a program
+# (script, executable, binary, etc.) named 'pre-unlock' (for which
+# this file is a template), with the following ordered arguments:
+#
+# [1] REPOS-PATH (the path to this repository)
+# [2] PATH (the path in the repository about to be unlocked)
+# [3] USER (the user destroying the lock)
+# [4] TOKEN (the lock token to be destroyed)
+# [5] BREAK-UNLOCK (1 if the user is breaking the lock, else 0)
+#
+# The default working directory for the invocation is undefined, so
+# the program should set one explicitly if it cares.
+#
+# If the hook program exits with success, the lock is destroyed; but
+# if it exits with failure (non-zero), the unlock action is aborted
+# and STDERR is returned to the client.
+
+# On a Unix system, the normal procedure is to have 'pre-unlock'
+# invoke other programs to do the real work, though it may do the
+# work itself too.
+#
+# Note that 'pre-unlock' must be executable by the user(s) who will
+# invoke it (typically the user httpd runs as), and that user must
+# have filesystem-level permission to access the repository.
+#
+# On a Windows system, you should name the hook program
+# 'pre-unlock.bat' or 'pre-unlock.exe',
+# but the basic idea is the same.
+#
+# Here is an example hook script, for a Unix /bin/sh interpreter:
+
+REPOS="$1"
+PATH="$2"
+USER="$3"
+
+# If a lock is owned by a different person, don't allow it be broken.
+# (Maybe this script could send email to the lock owner?)
+
+SVNLOOK=/usr/bin/svnlook
+GREP=/bin/grep
+SED=/bin/sed
+
+LOCK_OWNER=`$SVNLOOK lock "$REPOS" "$PATH" | \
+ $GREP '^Owner: ' | $SED 's/Owner: //'`
+
+# If we get no result from svnlook, there's no lock, return success:
+if [ "$LOCK_OWNER" = "" ]; then
+ exit 0
+fi
+
+# If the person unlocking matches the lock's owner, return success:
+if [ "$LOCK_OWNER" = "$USER" ]; then
+ exit 0
+fi
+
+# Otherwise, we've got an owner mismatch, so return failure:
+echo "Error: $PATH locked by ${LOCK_OWNER}." 1>&2
+exit 1
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/start-commit.tmpl
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/start-commit.tmpl b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/start-commit.tmpl
new file mode 100644
index 0000000..c10868f
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/hooks/start-commit.tmpl
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+# START-COMMIT HOOK
+#
+# The start-commit hook is invoked before a Subversion txn is created
+# in the process of doing a commit. Subversion runs this hook
+# by invoking a program (script, executable, binary, etc.) named
+# 'start-commit' (for which this file is a template)
+# with the following ordered arguments:
+#
+# [1] REPOS-PATH (the path to this repository)
+# [2] USER (the authenticated user attempting to commit)
+# [3] CAPABILITIES (a colon-separated list of capabilities reported
+# by the client; see note below)
+#
+# Note: The CAPABILITIES parameter is new in Subversion 1.5, and 1.5
+# clients will typically report at least the "mergeinfo" capability.
+# If there are other capabilities, then the list is colon-separated,
+# e.g.: "mergeinfo:some-other-capability" (the order is undefined).
+#
+# The list is self-reported by the client. Therefore, you should not
+# make security assumptions based on the capabilities list, nor should
+# you assume that clients reliably report every capability they have.
+#
+# The working directory for this hook program's invocation is undefined,
+# so the program should set one explicitly if it cares.
+#
+# If the hook program exits with success, the commit continues; but
+# if it exits with failure (non-zero), the commit is stopped before
+# a Subversion txn is created, and STDERR is returned to the client.
+#
+# On a Unix system, the normal procedure is to have 'start-commit'
+# invoke other programs to do the real work, though it may do the
+# work itself too.
+#
+# Note that 'start-commit' must be executable by the user(s) who will
+# invoke it (typically the user httpd runs as), and that user must
+# have filesystem-level permission to access the repository.
+#
+# On a Windows system, you should name the hook program
+# 'start-commit.bat' or 'start-commit.exe',
+# but the basic idea is the same.
+#
+# The hook program typically does not inherit the environment of
+# its parent process. For example, a common problem is for the
+# PATH environment variable to not be set to its usual value, so
+# that subprograms fail to launch unless invoked via absolute path.
+# If you're having unexpected problems with a hook program, the
+# culprit may be unusual (or missing) environment variables.
+#
+# Here is an example hook script, for a Unix /bin/sh interpreter.
+# For more examples and pre-written hooks, see those in
+# /usr/share/subversion/hook-scripts, and in the repository at
+# http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and
+# http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/
+
+
+REPOS="$1"
+USER="$2"
+
+# Exit on all errors.
+set -e
+
+"$REPOS"/hooks/commit-allower.pl --repository "$REPOS" --user "$USER"
+"$REPOS"/hooks/special-auth-check.py --user "$USER" --auth-level 3
+
+# All checks passed, so allow the commit.
+exit 0
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/locks/db-logs.lock
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/locks/db-logs.lock b/ForgeSVN/forgesvn/tests/data/testsvn-rename/locks/db-logs.lock
new file mode 100644
index 0000000..20dd636
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/locks/db-logs.lock
@@ -0,0 +1,3 @@
+This file is not used by Subversion 1.3.x or later.
+However, its existence is required for compatibility with
+Subversion 1.2.x or earlier.
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/data/testsvn-rename/locks/db.lock
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/data/testsvn-rename/locks/db.lock b/ForgeSVN/forgesvn/tests/data/testsvn-rename/locks/db.lock
new file mode 100644
index 0000000..20dd636
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/data/testsvn-rename/locks/db.lock
@@ -0,0 +1,3 @@
+This file is not used by Subversion 1.3.x or later.
+However, its existence is required for compatibility with
+Subversion 1.2.x or earlier.
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/functional/test_controllers.py b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
index 16fd989..eb7d409 100644
--- a/ForgeSVN/forgesvn/tests/functional/test_controllers.py
+++ b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
@@ -274,3 +274,30 @@ class TestImportController(SVNTestController):
r = self.app.post('/p/test/admin/empty/importer/do_import',
{'checkout_url': 'http://fake.svn/'})
assert tasks.reclone.post.called
+
+
+class SVNTestRenames(TestController):
+ def setUp(self):
+ TestController.setUp(self)
+ self.setup_with_tools()
+
+ @with_svn
+ def setup_with_tools(self):
+ h.set_context('test', 'src', neighborhood='Projects')
+ repo_dir = pkg_resources.resource_filename(
+ 'forgesvn', 'tests/data/')
+ c.app.repo.fs_path = repo_dir
+ c.app.repo.status = 'ready'
+ c.app.repo.name = 'testsvn'
+ ThreadLocalORMSession.flush_all()
+ ThreadLocalORMSession.close_all()
+ h.set_context('test', 'src', neighborhood='Projects')
+ c.app.repo.refresh()
+ ThreadLocalORMSession.flush_all()
+ ThreadLocalORMSession.close_all()
+ h.set_context('test', 'src', neighborhood='Projects')
+
+ def test_log(self):
+ r = self.app.get('/src/3/log/?path=/dir/b.txt')
+ assert '<b>renamed from</b>' in r
+ assert '/dir/a.txt' in r
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d509748e/ForgeSVN/forgesvn/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/model/test_repository.py b/ForgeSVN/forgesvn/tests/model/test_repository.py
index e47158f..2ed5de3 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -237,7 +237,8 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
'message': u'Copied a => b',
'parents': [4],
'refs': ['HEAD'],
- 'size': 0},
+ 'size': 0,
+ 'rename_details':{}},
{'authored': {'date': datetime(2010, 10, 8, 15, 32, 59, 383719),
'email': '',
'name': u'rick446'},
@@ -248,7 +249,8 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
'message': u'Remove hello.txt',
'parents': [3],
'refs': [],
- 'size': 0},
+ 'size': 0,
+ 'rename_details':{}},
{'authored': {'date': datetime(2010, 10, 8, 15, 32, 48, 272296),
'email': '',
'name': u'rick446'},
@@ -259,7 +261,8 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
'message': u'Modify readme',
'parents': [2],
'refs': [],
- 'size': 0},
+ 'size': 0,
+ 'rename_details':{}},
{'authored': {'date': datetime(2010, 10, 8, 15, 32, 36, 221863),
'email': '',
'name': u'rick446'},
@@ -270,7 +273,8 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
'message': u'Add path',
'parents': [1],
'refs': [],
- 'size': 0},
+ 'size': 0,
+ 'rename_details':{}},
{'authored': {'date': datetime(2010, 10, 8, 15, 32, 7, 238375),
'email': '',
'name': u'rick446'},
@@ -281,7 +285,8 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
'message': u'Create readme',
'parents': [],
'refs': [],
- 'size': 0},
+ 'size': 0,
+ 'rename_details':{}},
])
def test_log_file(self):
@@ -297,7 +302,8 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
'message': u'Modify readme',
'parents': [2],
'refs': [],
- 'size': 28},
+ 'size': 28,
+ 'rename_details': {}},
{'authored': {'date': datetime(2010, 10, 8, 15, 32, 7, 238375),
'email': '',
'name': u'rick446'},
@@ -308,7 +314,8 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
'message': u'Create readme',
'parents': [],
'refs': [],
- 'size': 28},
+ 'size': 28,
+ 'rename_details': {}},
])
def test_is_file(self):
@@ -846,7 +853,7 @@ class TestMergeRequest(_TestWithRepoAndCommit):
assert_equal(_svn().log.call_args[0], ('file:///tmp/svn/p/test/test2',))
assert_equal(_svn().log.call_args[1]['revision_start'].number, 2)
assert_equal(_svn().log.call_args[1]['limit'], 25)
- _map_log.assert_called_once_with(_svn().log.return_value[0], 'file:///tmp/svn/p/test/test2')
+ _map_log.assert_called_once_with(_svn().log.return_value[0], 'file:///tmp/svn/p/test/test2', None)
class TestRepoObject(_TestWithRepoAndCommit):
@@ -1010,3 +1017,36 @@ class TestCommit(_TestWithRepo):
def test_context(self):
self.ci.context()
+
+
+class TestRename(unittest.TestCase):
+
+ def setUp(self):
+ setup_basic_test()
+ self.setup_with_tools()
+
+ @with_svn
+ def setup_with_tools(self):
+ setup_global_objects()
+ h.set_context('test', 'src', neighborhood='Projects')
+ repo_dir = pkg_resources.resource_filename(
+ 'forgesvn', 'tests/data/')
+ self.repo = SM.Repository(
+ name='testsvn-rename',
+ fs_path=repo_dir,
+ url_path = '/test/',
+ tool = 'svn',
+ status = 'creating')
+ self.repo.refresh()
+ self.rev = self.repo.commit('HEAD')
+ ThreadLocalORMSession.flush_all()
+ ThreadLocalORMSession.close_all()
+
+ def test_log_file_with_rename(self):
+ entry = list(self.repo.log(path='/dir/b.txt', id_only=False))[0]
+ assert_equal(entry['id'], 3)
+ assert_equal(entry['rename_details']['path'], '/dir/a.txt')
+ assert_equal(
+ entry['rename_details']['commit_url'],
+ self.repo.url_for_commit(2) # previous revision
+ )
[14/50] git commit: [#6611] provide mechanism to disable any allura
entry point
Posted by jo...@apache.org.
[#6611] provide mechanism to disable any allura entry point
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/1581f299
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/1581f299
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/1581f299
Branch: refs/heads/cj/6596
Commit: 1581f299c20aa4babfa8a5a1f781625e49534346
Parents: 10cb90c
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Aug 28 19:05:30 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Aug 28 19:05:38 2013 +0000
----------------------------------------------------------------------
Allura/allura/command/base.py | 3 +--
Allura/allura/config/resources.py | 6 ++++--
Allura/allura/controllers/project.py | 4 ++--
Allura/allura/ext/admin/admin_main.py | 2 +-
Allura/allura/lib/app_globals.py | 2 +-
Allura/allura/lib/custom_middleware.py | 4 ++--
Allura/allura/lib/helpers.py | 12 +++++++++++-
Allura/allura/lib/package_path_loader.py | 7 +++----
Allura/allura/model/auth.py | 1 -
Allura/docs/extending.rst | 10 +++++++++-
ForgeImporters/forgeimporters/base.py | 10 ++++------
ForgeImporters/forgeimporters/tests/test_base.py | 8 ++++----
scripts/rethumb.py | 6 ++++--
13 files changed, 46 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1581f299/Allura/allura/command/base.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/base.py b/Allura/allura/command/base.py
index 536159d..38bb0d5 100644
--- a/Allura/allura/command/base.py
+++ b/Allura/allura/command/base.py
@@ -20,7 +20,6 @@ import sys
import logging
import shlex
from multiprocessing import Process
-from pkg_resources import iter_entry_points
import pylons
from paste.script import command
@@ -31,6 +30,7 @@ import activitystream
import ming
from allura.config.environment import load_environment
from allura.lib.decorators import task
+from allura.lib.helpers import iter_entry_points
log = None
@@ -117,4 +117,3 @@ class Command(command.Command):
def teardown_globals(self):
self.registry.cleanup()
-
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1581f299/Allura/allura/config/resources.py
----------------------------------------------------------------------
diff --git a/Allura/allura/config/resources.py b/Allura/allura/config/resources.py
index 9122687..6e231e4 100644
--- a/Allura/allura/config/resources.py
+++ b/Allura/allura/config/resources.py
@@ -20,6 +20,8 @@ import logging
import pkg_resources
+from allura.lib.helpers import iter_entry_points
+
log = logging.getLogger(__name__)
def register_ew_resources(manager):
@@ -29,7 +31,7 @@ def register_ew_resources(manager):
'css', pkg_resources.resource_filename('allura', 'lib/widgets/resources/css'))
manager.register_directory(
'allura', pkg_resources.resource_filename('allura', 'public/nf'))
- for ep in pkg_resources.iter_entry_points('allura'):
+ for ep in iter_entry_points('allura'):
try:
manager.register_directory(
'tool/%s' % ep.name.lower(),
@@ -39,7 +41,7 @@ def register_ew_resources(manager):
except ImportError:
log.warning('Cannot import entry point %s', ep)
raise
- for ep in pkg_resources.iter_entry_points('allura.theme'):
+ for ep in iter_entry_points('allura.theme'):
try:
theme = ep.load()
theme.register_ew_resources(manager, ep.name)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1581f299/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index 5f293a6..9914dc9 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -20,7 +20,6 @@ import logging
from datetime import datetime, timedelta
from urllib import unquote
from itertools import chain, islice
-from pkg_resources import iter_entry_points
from bson import ObjectId
from tg import expose, flash, redirect, validate, request, response, config
@@ -38,6 +37,7 @@ from allura import model as M
from allura.app import SitemapEntry
from allura.lib.base import WsgiDispatchController
from allura.lib import helpers as h
+from allura.lib.helpers import iter_entry_points
from allura.lib import utils
from allura.lib.decorators import require_post
from allura.controllers.error import ErrorController
@@ -310,7 +310,7 @@ class ProjectController(FeedController):
for s in c.project.grouped_navbar_entries():
entry = dict(name=s.label, url=s.url, icon=s.ui_icon, tool_name=s.tool_name)
if s.children:
- entry['children'] = [dict(name=child.label, url=child.url, icon=child.ui_icon, tool_name=child.tool_name)
+ entry['children'] = [dict(name=child.label, url=child.url, icon=child.ui_icon, tool_name=child.tool_name)
for child in s.children]
menu.append(entry)
return dict(menu=menu)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1581f299/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index 22bd228..314c3a9 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -292,7 +292,7 @@ class ProjectAdminController(BaseController):
'<input name="source_url">'
'<input type="submit">'
'</form>')
- for ep in pkg_resources.iter_entry_points('allura', repo_type):
+ for ep in h.iter_entry_points('allura', repo_type):
break
if ep is None or source_url is None:
raise exc.HTTPNotFound
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1581f299/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 7f45f69..276af63 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -178,7 +178,7 @@ class Globals(object):
# Cache some loaded entry points
def _cache_eps(section_name, dict_cls=dict):
d = dict_cls()
- for ep in pkg_resources.iter_entry_points(section_name):
+ for ep in h.iter_entry_points(section_name):
value = ep.load()
d[ep.name] = value
return d
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1581f299/Allura/allura/lib/custom_middleware.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/custom_middleware.py b/Allura/allura/lib/custom_middleware.py
index 4458c48..d4652ab 100644
--- a/Allura/allura/lib/custom_middleware.py
+++ b/Allura/allura/lib/custom_middleware.py
@@ -35,7 +35,7 @@ import allura.model.repo
log = logging.getLogger(__name__)
-tool_entry_points = list(pkg_resources.iter_entry_points('allura'))
+tool_entry_points = list(h.iter_entry_points('allura'))
class StaticFilesMiddleware(object):
'''Custom static file middleware
@@ -169,7 +169,7 @@ class SSLMiddleware(object):
if not resp:
resp = self.app
return resp(environ, start_response)
-
+
class AlluraTimerMiddleware(TimerMiddleware):
def timers(self):
import genshi
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1581f299/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index b7b0060..3715de6 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -49,7 +49,7 @@ from tg.decorators import before_validate
from formencode.variabledecode import variable_decode
import formencode
from jinja2 import Markup
-from paste.deploy.converters import asbool
+from paste.deploy.converters import asbool, aslist
from webhelpers import date, feedgenerator, html, number, misc, text
@@ -984,3 +984,13 @@ def plain2markdown(text, preserve_multiple_spaces=False, has_html_entities=False
text = re_angle_bracket_open.sub('<', text)
text = re_angle_bracket_close.sub('>', text)
return text
+
+
+def iter_entry_points(group, *a, **kw):
+ '''
+ yield entry points that have not been disabled in the config
+ '''
+ disabled = aslist(tg.config.get('disable_entry_points.' + group), sep=',')
+ for ep in pkg_resources.iter_entry_points(group, *a, **kw):
+ if ep.name not in disabled:
+ yield ep
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1581f299/Allura/allura/lib/package_path_loader.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/package_path_loader.py b/Allura/allura/lib/package_path_loader.py
index 9bee4c4..8272acf 100644
--- a/Allura/allura/lib/package_path_loader.py
+++ b/Allura/allura/lib/package_path_loader.py
@@ -124,12 +124,11 @@ The positioners are:
"""
import pkg_resources
import os
-from collections import defaultdict
import jinja2
from ming.utils import LazyProperty
-from allura.lib.helpers import topological_sort
+from allura.lib.helpers import topological_sort, iter_entry_points
class PackagePathLoader(jinja2.BaseLoader):
@@ -163,7 +162,7 @@ class PackagePathLoader(jinja2.BaseLoader):
paths = self.default_paths[:] # copy default_paths
paths[-1:0] = [ # insert all eps just before last item, by default
[ep.name, pkg_resources.resource_filename(ep.module_name, "")]
- for ep in pkg_resources.iter_entry_points(self.override_entrypoint)
+ for ep in iter_entry_points(self.override_entrypoint)
]
return paths
@@ -190,7 +189,7 @@ class PackagePathLoader(jinja2.BaseLoader):
"""
order_rules = []
replacement_rules = {}
- for ep in pkg_resources.iter_entry_points(self.override_entrypoint):
+ for ep in iter_entry_points(self.override_entrypoint):
for rule in getattr(ep.load(), 'template_path_rules', []):
if rule[0] == '>':
order_rules.append((ep.name, rule[1]))
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1581f299/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index fb58ce9..b048ce6 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -28,7 +28,6 @@ from hashlib import sha256
import uuid
from pytz import timezone
from datetime import timedelta, date, datetime, time
-from pkg_resources import iter_entry_points
import iso8601
import pymongo
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1581f299/Allura/docs/extending.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/extending.rst b/Allura/docs/extending.rst
index a430202..6a6abe0 100644
--- a/Allura/docs/extending.rst
+++ b/Allura/docs/extending.rst
@@ -37,7 +37,15 @@ The available extension points for Allura are:
A listing of available 3rd-party extensions is at https://sourceforge.net/p/allura/wiki/Extensions/
-Other entry points are used to provider ``paster`` commands and ``easy_widget`` configuration.
+To disable any Allura entry point, simply add an entry in your ``.ini`` config file
+with names and values corresponding to entry points defined in any ``setup.py`` file.
+For example if you have ForgeImporter set up, but want to disable the google code importers::
+
+ disable_entry_points.allura.project_importers = google-code
+ disable_entry_points.allura.importers = google-code-tracker, google-code-repo
+
+Other entry points are used to provide ``paster`` commands and ``easy_widget`` configuration,
+which are not part of Allura but are used by Allura.
Event Handlers
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1581f299/ForgeImporters/forgeimporters/base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index bdff43b..7f25e69 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -20,8 +20,6 @@ import urllib
import urllib2
from collections import defaultdict
-from pkg_resources import iter_entry_points
-
from BeautifulSoup import BeautifulSoup
from tg import expose, validate, flash, redirect, config
from tg.decorators import with_trailing_slash
@@ -176,7 +174,7 @@ class ProjectImporter(BaseController):
as this project importer.
"""
tools = {}
- for ep in iter_entry_points('allura.importers'):
+ for ep in h.iter_entry_points('allura.importers'):
epv = ep.load()
if epv.source == self.source:
tools[ep.name] = epv()
@@ -289,7 +287,7 @@ class ToolImporter(object):
"""
Return a ToolImporter subclass instance given its entry-point name.
"""
- for ep in iter_entry_points('allura.importers', name):
+ for ep in h.iter_entry_points('allura.importers', name):
return ep.load()()
@staticmethod
@@ -298,7 +296,7 @@ class ToolImporter(object):
Return a ToolImporter subclass instance given its target_app class.
"""
importers = {}
- for ep in iter_entry_points('allura.importers'):
+ for ep in h.iter_entry_points('allura.importers'):
importer = ep.load()
if app in aslist(importer.target_app):
importers[ep.name] = importer()
@@ -370,7 +368,7 @@ class ProjectToolsImportController(object):
def index(self, *a, **kw):
importer_matrix = defaultdict(dict)
tools_with_importers = set()
- for ep in iter_entry_points('allura.importers'):
+ for ep in h.iter_entry_points('allura.importers'):
importer = ep.load()
for tool in aslist(importer.target_app):
tools_with_importers.add(tool.tool_label)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1581f299/ForgeImporters/forgeimporters/tests/test_base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/test_base.py b/ForgeImporters/forgeimporters/tests/test_base.py
index f1c93ad..92fb0cc 100644
--- a/ForgeImporters/forgeimporters/tests/test_base.py
+++ b/ForgeImporters/forgeimporters/tests/test_base.py
@@ -66,7 +66,7 @@ def ep(name, source=None, importer=None, **kw):
class TestProjectImporter(TestCase):
- @mock.patch.object(base, 'iter_entry_points')
+ @mock.patch.object(base.h, 'iter_entry_points')
def test_tool_importers(self, iep):
eps = iep.return_value = [ep('ep1', 'foo'), ep('ep2', 'bar'), ep('ep3', 'foo')]
pi = base.ProjectImporter(mock.Mock(name='neighborhood'))
@@ -100,7 +100,7 @@ class TI3(base.ToolImporter):
class TestToolImporter(TestCase):
- @mock.patch.object(base, 'iter_entry_points')
+ @mock.patch.object(base.h, 'iter_entry_points')
def test_by_name(self, iep):
eps = iep.return_value = [ep('my-name', 'my-source')]
importer = base.ToolImporter.by_name('my-name')
@@ -113,7 +113,7 @@ class TestToolImporter(TestCase):
iep.assert_called_once_with('allura.importers', 'other-name')
self.assertEqual(importer, None)
- @mock.patch.object(base, 'iter_entry_points')
+ @mock.patch.object(base.h, 'iter_entry_points')
def test_by_app(self, iep):
eps = iep.return_value = [
ep('importer1', importer=TI1),
@@ -190,7 +190,7 @@ class TestProjectToolsImportController(TestController):
def test_pages(self):
admin_page = self.app.get('/admin/')
- with mock.patch.object(base, 'iter_entry_points') as iep:
+ with mock.patch.object(base.h, 'iter_entry_points') as iep:
iep.return_value = [
ep('importer1', importer=TI1),
ep('importer2', importer=TI2),
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1581f299/scripts/rethumb.py
----------------------------------------------------------------------
diff --git a/scripts/rethumb.py b/scripts/rethumb.py
index 5f753ff..6ee190a 100644
--- a/scripts/rethumb.py
+++ b/scripts/rethumb.py
@@ -18,14 +18,16 @@
import sys
import time
-import pkg_resources
import PIL
import tg
from pylons import tmpl_context as c
from paste.deploy.converters import asint
from ming.orm import mapper, ThreadLocalORMSession, session, state, Mapper
+
from allura.command import base
+from allura.lib.helpers import iter_entry_points
+
import forgetracker.model
@@ -109,7 +111,7 @@ class RethumbCommand(base.Command):
self.process_att_of_type(M.DiscussionAttachment, {'app_config_id': app._id, 'discussion_id': {'$ne': None}})
# Otherwise, we'll take attachment classes belonging to app's package
- ep = pkg_resources.iter_entry_points('allura', app.tool_name).next()
+ ep = iter_entry_points('allura', app.tool_name).next()
app_package = ep.module_name.split('.', 1)[0]
if app_package == 'allura':
# Apps in allura known to not define own attachment types
[31/50] git commit: [#6619] make h.absurl() have proper value in tasks
Posted by jo...@apache.org.
[#6619] make h.absurl() have proper value in tasks
* add hostname to taskd fake request
* add hostname for tests
* request.host_url is better, it doesn't include port numbers
* add tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f1253f6a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f1253f6a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f1253f6a
Branch: refs/heads/cj/6596
Commit: f1253f6a03cd48d2d6c088fd4c0de681cb9311ad
Parents: 208f608
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Aug 29 19:16:19 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Sep 3 21:01:57 2013 +0000
----------------------------------------------------------------------
Allura/allura/command/taskd.py | 10 ++++++----
Allura/allura/lib/app_globals.py | 4 ++--
Allura/allura/lib/helpers.py | 20 +++++++++++++-------
Allura/allura/tests/test_helpers.py | 12 ++++++++++++
4 files changed, 33 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f1253f6a/Allura/allura/command/taskd.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/taskd.py b/Allura/allura/command/taskd.py
index 50402f0..87dbfa4 100644
--- a/Allura/allura/command/taskd.py
+++ b/Allura/allura/command/taskd.py
@@ -27,7 +27,7 @@ import sys
import faulthandler
import pylons
from setproctitle import setproctitle, getproctitle
-
+import tg
from paste.deploy import loadapp
from paste.deploy.converters import asint
from webob import Request
@@ -134,10 +134,12 @@ class TaskdCommand(base.Command):
only=only)
if self.task:
with(proctitle("taskd:{0}:{1}".format(
- self.task.task_name, self.task._id))):
+ self.task.task_name, self.task._id))):
# Build the (fake) request
- r = Request.blank('/--%s--/%s/' % (self.task.task_name, self.task._id),
- {'task': self.task,
+ request_path = '/--%s--/%s/' % (self.task.task_name, self.task._id)
+ r = Request.blank(request_path,
+ base_url=tg.config['base_url'].rstrip('/') + request_path,
+ environ={'task': self.task,
})
list(wsgi_app(r.environ, start_response))
self.task = None
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f1253f6a/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 276af63..c1c0b32 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -471,9 +471,9 @@ class Globals(object):
def url(self, base, **kw):
params = urlencode(kw)
if params:
- return '%s://%s%s?%s' % (request.scheme, request.host, base, params)
+ return '%s%s?%s' % (request.host_url, base, params)
else:
- return '%s://%s%s' % (request.scheme, request.host, base)
+ return '%s%s' % (request.host_url, base)
def postload_contents(self):
text = '''
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f1253f6a/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index 3715de6..adfb339 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -360,18 +360,24 @@ class DateTimeConverter(FancyValidator):
def _from_python(self, value, state):
return value.isoformat()
+
def absurl(url):
- if url is None: return None
- if '://' in url: return url
- # some __json__ methods call absurl
- # and in tests request is not set so exception raises
- # this check prevents it
+ """
+ Given a root-relative URL, return a full URL including protocol and host
+ """
+ if url is None:
+ return None
+ if '://' in url:
+ return url
try:
- host = request.scheme + '://' + request.host
+ # try request first, so we can get proper http/https value
+ host = request.host_url
except TypeError:
- host = ''
+ # for tests, etc
+ host = tg.config['base_url'].rstrip('/')
return host + url
+
def diff_text(t1, t2, differ=None):
t1_lines = t1.replace('\r', '').split('\n')
t2_lines = t2.replace('\r', '').split('\n')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f1253f6a/Allura/allura/tests/test_helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_helpers.py b/Allura/allura/tests/test_helpers.py
index 3c79e61..3d4ad96 100644
--- a/Allura/allura/tests/test_helpers.py
+++ b/Allura/allura/tests/test_helpers.py
@@ -25,6 +25,7 @@ from pylons import tmpl_context as c
from nose.tools import eq_, assert_equals
from IPython.testing.decorators import skipif, module_not_available
from datadiff import tools as dd
+from webob import Request
from allura import model as M
from allura.lib import helpers as h
@@ -382,3 +383,14 @@ class TestUrlOpen(TestCase):
urlopen.side_effect = side_effect
self.assertRaises(HTTPError, h.urlopen, 'myurl')
self.assertEqual(urlopen.call_count, 1)
+
+
+def test_absurl_no_request():
+ assert_equals(h.absurl('/p/test/foobar'), 'http://localhost/p/test/foobar')
+
+
+@patch.object(h, 'request',
+ new=Request.blank('/p/test/foobar', base_url='https://www.mysite.com/p/test/foobar'))
+def test_absurl_with_request():
+ assert_equals(h.absurl('/p/test/foobar'), 'https://www.mysite.com/p/test/foobar')
+
[48/50] git commit: [#6229] add merge commit to test data
Posted by jo...@apache.org.
[#6229] add merge commit to test data
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/39b6d205
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/39b6d205
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/39b6d205
Branch: refs/heads/cj/6596
Commit: 39b6d205dafd241b9105c258d4ca404b905f4c4f
Parents: 562b3f3
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Sep 5 14:55:31 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Sep 5 14:55:31 2013 +0000
----------------------------------------------------------------------
.../objects/13/951944969cf45a701bf90f83647b309815e6d5 | 2 ++
.../objects/65/3667b582ef2950c1954a0c7e1e8797b19d778a | 3 +++
.../objects/6b/0bbf7169927069f7839b682307ec4ecb85c2e9 | Bin 0 -> 56 bytes
.../objects/d4/99ed2dc5606d4d0953937bca92157743df79ab | Bin 0 -> 77 bytes
.../tests/data/testrename.git/refs/heads/master | 2 +-
5 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/39b6d205/ForgeGit/forgegit/tests/data/testrename.git/objects/13/951944969cf45a701bf90f83647b309815e6d5
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/objects/13/951944969cf45a701bf90f83647b309815e6d5 b/ForgeGit/forgegit/tests/data/testrename.git/objects/13/951944969cf45a701bf90f83647b309815e6d5
new file mode 100644
index 0000000..49fdaba
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/objects/13/951944969cf45a701bf90f83647b309815e6d5
@@ -0,0 +1,2 @@
+x���JA�=�S�A�?��C����`oKO��; {�SQ|�[�L�)��a��L�J.�hRG9R�*L�g�uC�|�널IU����ȫ���\$%��y+���_r,k^�m��O9�4o+VO����_�������Wݭ1<j���������L/� �=���F
+�ݑ�X�i�-o6�
~yp���i���io
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/39b6d205/ForgeGit/forgegit/tests/data/testrename.git/objects/65/3667b582ef2950c1954a0c7e1e8797b19d778a
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/objects/65/3667b582ef2950c1954a0c7e1e8797b19d778a b/ForgeGit/forgegit/tests/data/testrename.git/objects/65/3667b582ef2950c1954a0c7e1e8797b19d778a
new file mode 100644
index 0000000..bf8f5c9
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testrename.git/objects/65/3667b582ef2950c1954a0c7e1e8797b19d778a
@@ -0,0 +1,3 @@
+x��A
+�0E]��J21�DD�H&��`�����m���z���?�Z�
+Hf���q�#��8�:3H�I��3J�i��[4��D�e�c'�} ,,a���.=��&8���ij�2KM�/���|K�4�R��ϭ��u)ؚ%��.wU�-��F����
F�R���S�
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/39b6d205/ForgeGit/forgegit/tests/data/testrename.git/objects/6b/0bbf7169927069f7839b682307ec4ecb85c2e9
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/objects/6b/0bbf7169927069f7839b682307ec4ecb85c2e9 b/ForgeGit/forgegit/tests/data/testrename.git/objects/6b/0bbf7169927069f7839b682307ec4ecb85c2e9
new file mode 100644
index 0000000..7e24884
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/testrename.git/objects/6b/0bbf7169927069f7839b682307ec4ecb85c2e9 differ
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/39b6d205/ForgeGit/forgegit/tests/data/testrename.git/objects/d4/99ed2dc5606d4d0953937bca92157743df79ab
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/objects/d4/99ed2dc5606d4d0953937bca92157743df79ab b/ForgeGit/forgegit/tests/data/testrename.git/objects/d4/99ed2dc5606d4d0953937bca92157743df79ab
new file mode 100644
index 0000000..cdd9526
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/testrename.git/objects/d4/99ed2dc5606d4d0953937bca92157743df79ab differ
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/39b6d205/ForgeGit/forgegit/tests/data/testrename.git/refs/heads/master
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/refs/heads/master b/ForgeGit/forgegit/tests/data/testrename.git/refs/heads/master
index e83ab53..a0aeefb 100644
--- a/ForgeGit/forgegit/tests/data/testrename.git/refs/heads/master
+++ b/ForgeGit/forgegit/tests/data/testrename.git/refs/heads/master
@@ -1 +1 @@
-259c77dd6ee0e6091d11e429b56c44ccbf1e64a3
+13951944969cf45a701bf90f83647b309815e6d5
[08/50] git commit: [#6482] change page to show importers in a grid
Posted by jo...@apache.org.
[#6482] change page to show importers in a grid
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/b7fb5f2d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b7fb5f2d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b7fb5f2d
Branch: refs/heads/cj/6596
Commit: b7fb5f2dd43636783c58c6f5d03b4fbe0a216820
Parents: f705a17
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Aug 13 19:20:11 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Aug 27 17:24:58 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/base.py | 31 +++++++++--
.../forgeimporters/templates/list_all.html | 58 ++++++++------------
2 files changed, 51 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b7fb5f2d/ForgeImporters/forgeimporters/base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index 620097e..c6cdf4a 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -18,6 +18,7 @@
import logging
import urllib
import urllib2
+from collections import defaultdict
from pkg_resources import iter_entry_points
@@ -359,11 +360,33 @@ class ProjectToolsImportController(object):
@with_trailing_slash
@expose('jinja:forgeimporters:templates/list_all.html')
def index(self, *a, **kw):
- importers = {}
- for app_name, app in g.entry_points['tool'].iteritems():
- importers[app] = ToolImporter.by_app(app)
+ # make dictionaries of both axis
+ importers_by_source = defaultdict(dict)
+ importers_by_tool = defaultdict(dict)
+ for ep in iter_entry_points('allura.importers'):
+ importer = ep.load()
+ importers_by_source[importer.source][ep.name] = importer
+ for tool in aslist(importer.target_app):
+ importers_by_tool[tool][ep.name] = importer
+
+ relevant_tools = sorted(importers_by_tool.keys(), key=lambda t: t.tool_label)
+
+ # build a full matrix including empty spots
+ importer_matrix = dict() # source -> [importer names]
+ for source, src_importers in importers_by_source.iteritems():
+ row = list()
+ for tool in relevant_tools:
+ for ep_name, importer in src_importers.iteritems():
+ if tool in aslist(importer.target_app):
+ row.append(ep_name)
+ break
+ else:
+ row.append(None)
+ importer_matrix[source] = row
+
return {
- 'importers': importers
+ 'tools': relevant_tools,
+ 'importer_matrix': importer_matrix,
}
@expose()
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b7fb5f2d/ForgeImporters/forgeimporters/templates/list_all.html
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/templates/list_all.html b/ForgeImporters/forgeimporters/templates/list_all.html
index 58c9f34..b91e0df 100644
--- a/ForgeImporters/forgeimporters/templates/list_all.html
+++ b/ForgeImporters/forgeimporters/templates/list_all.html
@@ -21,42 +21,32 @@
{% block title %}{{c.project.name}} / Import{% endblock %}
-{% block header %}Import from external sources{% endblock %}
-
-{% block extra_css %}
-<style type="text/css">
- .tool {
- margin-bottom: 3em;
- }
- .tool img {
- float: left;
- margin: 0 1em;
- }
- .importer .descr {
- margin: 0 2em 1em 2em;
- }
-</style>
-{% endblock %}
+{% block header %}Import{% endblock %}
{% block content %}
- {% for tool, tool_importers in importers.iteritems() %}
- <div class="tool">
- {% for importer_name, importer in tool_importers.iteritems() %}
- {% if loop.first %}
- <img src="{{ g.theme.app_icon_url(tool, 48) }}" alt="{{ tool.tool_label }} icon">
- <h2>{{ tool.tool_label }}</h2>
- {% endif %}
- <div class="importer">
- <a href="{{importer_name}}"><h3>
- {{importer.source}}:
- {{importer.tool_label}}
- </h3>
- </a>
- <div class="descr">
- {{importer.tool_description}}
- </div>
- </div>
+<p>
+ To import from one of these external sources into your project, just click on "Import" and fill out the form.
+</p>
+<table>
+ <thead>
+ <tr>
+ <th></th>
+ {% for tool in tools %}
+ <th>{{tool.tool_label}}</th>
+ {% endfor %}
+ </tr>
+ </thead>
+ {% for source, importers in importer_matrix|dictsort %}
+ <tr>
+ <td><strong>{{ source }}</strong></td>
+ {% for importer_name in importers %}
+ <td>
+ {% if importer_name %}
+ <a href="{{importer_name}}">Import</a>
+ {% endif %}
+ </td>
{% endfor %}
- </div>
+ </tr>
{% endfor %}
+</table>
{% endblock %}
[34/50] git commit: [#4595] ticket:421 Check the checkbox when
clicking on the corresponding row
Posted by jo...@apache.org.
[#4595] ticket:421 Check the checkbox when clicking on the corresponding row
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/16f3bece
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/16f3bece
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/16f3bece
Branch: refs/heads/cj/6596
Commit: 16f3beceae726cc4c3b849236be47510aea3c173
Parents: 22f7c86
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Sep 2 11:10:55 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:54 2013 +0000
----------------------------------------------------------------------
Allura/allura/public/nf/js/site_admin_new_projects.js | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/16f3bece/Allura/allura/public/nf/js/site_admin_new_projects.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/site_admin_new_projects.js b/Allura/allura/public/nf/js/site_admin_new_projects.js
index 42b6e08..d27322e 100644
--- a/Allura/allura/public/nf/js/site_admin_new_projects.js
+++ b/Allura/allura/public/nf/js/site_admin_new_projects.js
@@ -31,4 +31,10 @@ $(document).ready(function() {
$('#selected-projects').text(shortnames.join(' '));
}
});
+
+ $('tr').click(function(event) {
+ if (event.target.tagName !== 'A' && event.target.type !== 'checkbox') {
+ $(this).find(':checkbox').trigger('click');
+ }
+ });
});
[43/50] git commit: [#6530] Improved error handling on import_tool
task
Posted by jo...@apache.org.
[#6530] Improved error handling on import_tool task
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/43f56c26
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/43f56c26
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/43f56c26
Branch: refs/heads/cj/6596
Commit: 43f56c26f225c0a5835a0c80c1ed374f240be829
Parents: 19070bd
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Aug 22 20:59:59 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Sep 4 14:30:55 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/helpers.py | 6 ++++
Allura/allura/tests/test_helpers.py | 34 ++++++++++++++++++++
ForgeImporters/forgeimporters/base.py | 20 +++++++++---
ForgeImporters/forgeimporters/google/tracker.py | 3 ++
.../forgeimporters/tests/google/test_tracker.py | 14 ++++++++
.../forgeimporters/tests/test_base.py | 20 +++++++++++-
.../forgeimporters/trac/tests/test_tickets.py | 33 +++++++++++++++----
ForgeImporters/forgeimporters/trac/tickets.py | 31 ++++++++++--------
8 files changed, 137 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/43f56c26/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index adfb339..0e13fad 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -214,6 +214,12 @@ def _make_xs(X, ids):
result = (results.get(i) for i in ids)
return (r for r in result if r is not None)
+def make_app_admin_only(app):
+ from allura.model.auth import ProjectRole
+ admin_role = ProjectRole.by_name('Admin', app.project)
+ for ace in [ace for ace in app.acl if ace.role_id != admin_role._id]:
+ app.acl.remove(ace)
+
@contextmanager
def push_config(obj, **kw):
saved_attrs = {}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/43f56c26/Allura/allura/tests/test_helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_helpers.py b/Allura/allura/tests/test_helpers.py
index 3d4ad96..e9bc8f9 100644
--- a/Allura/allura/tests/test_helpers.py
+++ b/Allura/allura/tests/test_helpers.py
@@ -26,10 +26,13 @@ from nose.tools import eq_, assert_equals
from IPython.testing.decorators import skipif, module_not_available
from datadiff import tools as dd
from webob import Request
+from ming.orm import ThreadLocalORMSession
from allura import model as M
from allura.lib import helpers as h
from allura.lib.search import inject_user
+from allura.lib.security import has_access
+from allura.lib.security import Credentials
from allura.tests import decorators as td
from alluratest.controller import setup_basic_test
@@ -104,6 +107,37 @@ def test_make_roles():
assert h.make_roles([pr._id]).next() == pr
@td.with_wiki
+def test_make_app_admin_only():
+ h.set_context('test', 'wiki', neighborhood='Projects')
+ anon = M.User.anonymous()
+ dev = M.User.query.get(username='test-user')
+ admin = M.User.query.get(username='test-admin')
+ c.project.add_user(dev, ['Developer'])
+ ThreadLocalORMSession.flush_all()
+ Credentials.get().clear()
+ assert has_access(c.app, 'read', user=anon)()
+ assert has_access(c.app, 'read', user=dev)()
+ assert has_access(c.app, 'read', user=admin)()
+ assert not has_access(c.app, 'create', user=anon)()
+ assert has_access(c.app, 'create', user=dev)()
+ assert has_access(c.app, 'create', user=admin)()
+ assert c.app.is_visible_to(anon)
+ assert c.app.is_visible_to(dev)
+ assert c.app.is_visible_to(admin)
+ h.make_app_admin_only(c.app)
+ ThreadLocalORMSession.flush_all()
+ Credentials.get().clear()
+ assert not has_access(c.app, 'read', user=anon)()
+ assert not has_access(c.app, 'read', user=dev)()
+ assert has_access(c.app, 'read', user=admin)()
+ assert not has_access(c.app, 'create', user=anon)()
+ assert not has_access(c.app, 'create', user=dev)()
+ assert has_access(c.app, 'create', user=admin)()
+ assert not c.app.is_visible_to(anon)
+ assert not c.app.is_visible_to(dev)
+ assert c.app.is_visible_to(admin)
+
+@td.with_wiki
def test_context_setters():
h.set_context('test', 'wiki', neighborhood='Projects')
assert c.project is not None
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/43f56c26/ForgeImporters/forgeimporters/base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index 7f25e69..69db8d6 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -19,11 +19,13 @@ import logging
import urllib
import urllib2
from collections import defaultdict
+import traceback
from BeautifulSoup import BeautifulSoup
from tg import expose, validate, flash, redirect, config
from tg.decorators import with_trailing_slash
-from pylons import tmpl_context as c, app_globals as g
+from pylons import app_globals as g
+from pylons import tmpl_context as c
from formencode import validators as fev, schema
from webob import exc
@@ -66,9 +68,19 @@ class ToolImportForm(schema.Schema):
@task(notifications_disabled=True)
def import_tool(importer_name, project_name=None, mount_point=None, mount_label=None, **kw):
- importer = ToolImporter.by_name(importer_name)
- importer.import_tool(c.project, c.user, project_name=project_name,
- mount_point=mount_point, mount_label=mount_label, **kw)
+ try:
+ importer = ToolImporter.by_name(importer_name)
+ importer.import_tool(c.project, c.user, project_name=project_name,
+ mount_point=mount_point, mount_label=mount_label, **kw)
+ except Exception as e:
+ g.post_event('import_tool_task_failed',
+ error=str(e),
+ traceback=traceback.format_exc(),
+ importer_name=importer_name,
+ project_name=project_name,
+ mount_point=mount_point,
+ mount_label=mount_label,
+ **kw)
class ProjectExtractor(object):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/43f56c26/ForgeImporters/forgeimporters/google/tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/tracker.py b/ForgeImporters/forgeimporters/google/tracker.py
index b7fccbe..eb97c07 100644
--- a/ForgeImporters/forgeimporters/google/tracker.py
+++ b/ForgeImporters/forgeimporters/google/tracker.py
@@ -135,6 +135,9 @@ class GoogleCodeTrackerImporter(ToolImporter):
g.post_event('project_updated')
app.globals.invalidate_bin_counts()
return app
+ except Exception as e:
+ h.make_app_admin_only(app)
+ raise
finally:
M.session.artifact_orm_session._get().skip_mod_date = False
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/43f56c26/ForgeImporters/forgeimporters/tests/google/test_tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/google/test_tracker.py b/ForgeImporters/forgeimporters/tests/google/test_tracker.py
index 3c7f0aa..5bbf836 100644
--- a/ForgeImporters/forgeimporters/tests/google/test_tracker.py
+++ b/ForgeImporters/forgeimporters/tests/google/test_tracker.py
@@ -82,6 +82,20 @@ class TestTrackerImporter(TestCase):
g.post_event.assert_called_once_with('project_updated')
app.globals.invalidate_bin_counts.assert_called_once_with()
+ @mock.patch.object(tracker, 'ThreadLocalORMSession')
+ @mock.patch.object(tracker, 'M')
+ @mock.patch.object(tracker, 'h')
+ def test_import_tool_failure(self, h, M, ThreadLocalORMSession):
+ h.push_config.side_effect = ValueError
+ project = mock.Mock()
+ user = mock.Mock()
+
+ importer = tracker.GoogleCodeTrackerImporter()
+ self.assertRaises(ValueError, importer.import_tool, project, user, project_name='project_name',
+ mount_point='mount_point', mount_label='mount_label')
+
+ h.make_app_admin_only.assert_called_once_with(project.install_app.return_value)
+
def test_custom_fields(self):
importer = tracker.GoogleCodeTrackerImporter()
importer.custom_fields = {}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/43f56c26/ForgeImporters/forgeimporters/tests/test_base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/test_base.py b/ForgeImporters/forgeimporters/tests/test_base.py
index 92fb0cc..a61ecda 100644
--- a/ForgeImporters/forgeimporters/tests/test_base.py
+++ b/ForgeImporters/forgeimporters/tests/test_base.py
@@ -42,7 +42,8 @@ class TestProjectExtractor(TestCase):
@mock.patch.object(base.ToolImporter, 'by_name')
@mock.patch.object(base, 'c')
-def test_import_tool(c, by_name):
+@mock.patch.object(base, 'g')
+def test_import_tool(g, c, by_name):
c.project = mock.Mock(name='project')
c.user = mock.Mock(name='user')
base.import_tool('importer_name', project_name='project_name',
@@ -51,6 +52,23 @@ def test_import_tool(c, by_name):
by_name.return_value.import_tool.assert_called_once_with(c.project,
c.user, project_name='project_name', mount_point='mount_point',
mount_label='mount_label')
+ assert not g.post_event.called
+
+@mock.patch.object(base.ToolImporter, 'by_name')
+@mock.patch.object(base, 'g')
+def test_import_tool_failed(g, by_name):
+ by_name.side_effect = RuntimeError('my error')
+ base.import_tool('importer_name', project_name='project_name',
+ mount_point='mount_point', mount_label='mount_label', other='other')
+ g.post_event.assert_called_once_with(
+ 'import_tool_task_failed',
+ error=by_name.side_effect,
+ importer_name='importer_name',
+ project_name='project_name',
+ mount_point='mount_point',
+ mount_label='mount_label',
+ other='other',
+ )
def ep(name, source=None, importer=None, **kw):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/43f56c26/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/trac/tests/test_tickets.py b/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
index 953c6d7..74e1049 100644
--- a/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
+++ b/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
@@ -46,12 +46,13 @@ class TestTracTicketImporter(TestCase):
project = Mock(name='Project', shortname='myproject')
project.install_app.return_value = app
user = Mock(name='User', _id='id')
- res = importer.import_tool(project, user,
- mount_point='bugs',
- mount_label='Bugs',
- trac_url='http://example.com/trac/url',
- user_map=json.dumps(user_map),
- )
+ with patch.dict('forgeimporters.trac.tickets.config', {'base_url': 'foo'}):
+ res = importer.import_tool(project, user,
+ mount_point='bugs',
+ mount_label='Bugs',
+ trac_url='http://example.com/trac/url',
+ user_map=json.dumps(user_map),
+ )
self.assertEqual(res, app)
project.install_app.assert_called_once_with(
'Tickets', mount_point='bugs', mount_label='Bugs')
@@ -68,6 +69,26 @@ class TestTracTicketImporter(TestCase):
validate=False)
g.post_event.assert_called_once_with('project_updated')
+ @patch('forgeimporters.trac.tickets.session')
+ @patch('forgeimporters.trac.tickets.h')
+ @patch('forgeimporters.trac.tickets.TracExport')
+ def test_import_tool_failure(self, TracExport, h, session):
+ importer = TracTicketImporter()
+ app = Mock(name='ForgeTrackerApp')
+ project = Mock(name='Project', shortname='myproject')
+ project.install_app.return_value = app
+ user = Mock(name='User', _id='id')
+ TracExport.side_effect = ValueError
+
+ self.assertRaises(ValueError, importer.import_tool, project, user,
+ mount_point='bugs',
+ mount_label='Bugs',
+ trac_url='http://example.com/trac/url',
+ user_map=None,
+ )
+
+ h.make_app_admin_only.assert_called_once_with(app)
+
class TestTracTicketImportController(TestController, TestCase):
def setUp(self):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/43f56c26/ForgeImporters/forgeimporters/trac/tickets.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/trac/tickets.py b/ForgeImporters/forgeimporters/trac/tickets.py
index 3e0e486..941ff32 100644
--- a/ForgeImporters/forgeimporters/trac/tickets.py
+++ b/ForgeImporters/forgeimporters/trac/tickets.py
@@ -42,6 +42,7 @@ from allura.controllers import BaseController
from allura.lib.decorators import require_post, task
from allura.lib.import_api import AlluraImportApiClient
from allura.lib import validators as v
+from allura.lib import helpers as h
from allura.model import ApiTicket
from allura.scripts.trac_export import (
TracExport,
@@ -116,16 +117,20 @@ class TracTicketImporter(ToolImporter):
)
session(app.config).flush(app.config)
session(app.globals).flush(app.globals)
- export = [ticket for ticket in TracExport(trac_url)]
- export_string = json.dumps(export, cls=DateJSONEncoder)
- api_ticket = ApiTicket(user_id=user._id,
- capabilities={"import": ["Projects", project.shortname]},
- expires=datetime.utcnow() + timedelta(minutes=60))
- session(api_ticket).flush(api_ticket)
- cli = AlluraImportApiClient(config['base_url'], api_ticket.api_key,
- api_ticket.secret_key, verbose=True)
- import_tracker(cli, project.shortname, mount_point,
- {'user_map': json.loads(user_map) if user_map else {}},
- export_string, validate=False)
- g.post_event('project_updated')
- return app
+ try:
+ export = [ticket for ticket in TracExport(trac_url)]
+ export_string = json.dumps(export, cls=DateJSONEncoder)
+ api_ticket = ApiTicket(user_id=user._id,
+ capabilities={"import": ["Projects", project.shortname]},
+ expires=datetime.utcnow() + timedelta(minutes=60))
+ session(api_ticket).flush(api_ticket)
+ cli = AlluraImportApiClient(config['base_url'], api_ticket.api_key,
+ api_ticket.secret_key, verbose=True)
+ import_tracker(cli, project.shortname, mount_point,
+ {'user_map': json.loads(user_map) if user_map else {}},
+ export_string, validate=False)
+ g.post_event('project_updated')
+ return app
+ except Exception as e:
+ h.make_app_admin_only(app)
+ raise
[21/50] git commit: [5775] ticket:404 added renaming tracking for
file history in git
Posted by jo...@apache.org.
[5775] ticket:404 added renaming tracking for file history in git
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/dd57c984
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/dd57c984
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/dd57c984
Branch: refs/heads/cj/6596
Commit: dd57c984cdcd581abe665fbb571ad8080839184a
Parents: 839e624
Author: Anton Kasyanov <mi...@gmail.com>
Authored: Thu Aug 1 13:36:45 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Aug 29 19:00:44 2013 +0000
----------------------------------------------------------------------
Allura/allura/templates/widgets/repo/log.html | 8 +++++
ForgeGit/forgegit/model/git_repo.py | 35 +++++++++++++++++++++-
2 files changed, 42 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dd57c984/Allura/allura/templates/widgets/repo/log.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/repo/log.html b/Allura/allura/templates/widgets/repo/log.html
index 69d7129..b54685f 100644
--- a/Allura/allura/templates/widgets/repo/log.html
+++ b/Allura/allura/templates/widgets/repo/log.html
@@ -54,6 +54,14 @@
pushed by {{ user_link(commit.committed.email, commit.committed.name) }}
{% endif %}
{{g.markdown.convert(commit.message)}}
+ {% if commit.renamed_from %}
+ <div>
+ <b>renamed from</b> 
+ <a href={{commit.renamed_from['commit_url']}}log/?path={{ commit.renamed_from['path'] }}>
+ {{ commit.renamed_from['path'] }}
+ </a>
+ </div>
+ {% endif %}
</div>
</td>
<td style="vertical-align: text-top">
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dd57c984/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index e0e47b8..f400d56 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -302,12 +302,40 @@ class GitImplementation(M.RepositoryImplementation):
if exclude is not None:
revs.extend(['^%s' % e for e in exclude])
- for ci, refs in self._iter_commits_with_refs(revs, '--', path):
+ for ci, refs in self._iter_commits_with_refs(revs, '--follow', '--', path):
if id_only:
yield ci.hexsha
else:
size = None
+ renamed_from = {}
if path:
+ # checking for renaming in this commit
+ # log is called with follow, so there should be all commits
+ # even before renaming
+ diffs_with_parent = ci.diff(ci.parents[0])
+ deleted_file_diffs = []
+ renamed = False
+ for diff in diffs_with_parent:
+ if not diff.b_mode and not diff.b_blob:
+ #new file was created
+ if diff.a_blob.name == os.path.basename(path):
+ renamed = True
+ if not diff.a_mode and not diff.a_blob:
+ #file was deleted
+ deleted_file_diffs.append(diff)
+ if renamed:
+ if len(deleted_file_diffs) > 1:
+ log.info('Couldn\'t find if file was renamed: too many deletions')
+ elif len(deleted_file_diffs) == 1:
+ deleted_diff = deleted_file_diffs[0]
+ renamed_from['path'] = '{}/{}'.format(
+ os.path.dirname(path),
+ deleted_diff.b_blob.name,
+ )
+ renamed_from['commit_id'] = ci.hexsha
+ renamed_from['commit_url'] = self._repo.url_for_commit(
+ ci.hexsha
+ )
try:
node = ci.tree/path
size = node.size if node.type == 'blob' else None
@@ -329,7 +357,12 @@ class GitImplementation(M.RepositoryImplementation):
'refs': refs,
'parents': [pci.hexsha for pci in ci.parents],
'size': size,
+ 'renamed_from': renamed_from,
}
+ if renamed_from:
+ # if file was renamed, do not yield commits
+ # before renaming
+ break
def _iter_commits_with_refs(self, *args, **kwargs):
"""
[30/50] git commit: [#6539] use _id (indexed) instead of full_slug as
key when approving posts
Posted by jo...@apache.org.
[#6539] use _id (indexed) instead of full_slug as key when approving posts
In 93768a36 test_post_count was already rendered irrelevant, so removing
altogether. Fixed up test_threads_with_zero_posts as best we can for now
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/7a51d42e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/7a51d42e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/7a51d42e
Branch: refs/heads/cj/6596
Commit: 7a51d42e7e0f03702ae3e80fdc97da91372a6d27
Parents: faa5a9e
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Sep 3 20:16:37 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Sep 3 20:16:37 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/discuss.py | 5 +-
.../templates/widgets/moderate_posts.html | 2 +-
.../test_discussion_moderation_controller.py | 18 ++---
.../tests/functional/test_forum.py | 73 +++++++++-----------
4 files changed, 48 insertions(+), 50 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7a51d42e/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index 9f745a3..74879ad 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -429,7 +429,10 @@ class ModerationController(BaseController):
def save_moderation(self, post=[], delete=None, spam=None, approve=None, **kw):
for p in post:
if 'checked' in p:
- posted = self.PostModel.query.get(full_slug=p['full_slug'])
+ posted = self.PostModel.query.get(
+ _id=p['_id'],
+ discussion_id=self.discussion._id, # make sure nobody hacks the HTML form to moderate other posts
+ )
if posted:
if delete:
posted.delete()
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7a51d42e/Allura/allura/templates/widgets/moderate_posts.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/moderate_posts.html b/Allura/allura/templates/widgets/moderate_posts.html
index 2babc7f..25294a3 100644
--- a/Allura/allura/templates/widgets/moderate_posts.html
+++ b/Allura/allura/templates/widgets/moderate_posts.html
@@ -43,7 +43,7 @@
{% for post in value.posts %}
<tr>
<td>
- <input type="hidden" name="post-{{loop.index0}}.full_slug" value="{{post.full_slug}}"/>
+ <input type="hidden" name="post-{{loop.index0}}._id" value="{{post._id}}"/>
<input type="checkbox" name="post-{{loop.index0}}.checked"/>
</td>
<td>{{h.ago(post.timestamp)}}</td>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7a51d42e/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py b/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
index ccf1fc2..520f691 100644
--- a/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
+++ b/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
@@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
+from nose.tools import assert_equal
from mock import Mock
from ming.orm import ThreadLocalORMSession
@@ -33,27 +34,29 @@ class TestWhenModerating(WithDatabase):
def setUp(self):
super(TestWhenModerating, self).setUp()
- create_post('mypost')
- discussion_controller = Mock()
+ post = create_post('mypost')
+ discussion_controller = Mock(
+ discussion = Mock(_id=post.discussion_id),
+ )
self.controller = ModerationController(discussion_controller)
def test_that_it_can_approve(self):
mod_date = self.get_post().mod_date
self.moderate_post(approve=True)
post = self.get_post()
- assert post.status == 'ok'
- assert post.thread.last_post_date.strftime("%Y-%m-%d %H:%M:%S") == mod_date.strftime("%Y-%m-%d %H:%M:%S")
+ assert_equal(post.status, 'ok')
+ assert_equal(post.thread.last_post_date.strftime("%Y-%m-%d %H:%M:%S"), mod_date.strftime("%Y-%m-%d %H:%M:%S"))
def test_that_it_can_mark_as_spam(self):
self.moderate_post(spam=True)
- assert self.get_post().status == 'spam'
+ assert_equal(self.get_post().status, 'spam')
def test_that_it_can_be_deleted(self):
self.moderate_post(delete=True)
- assert self.get_post() is None
+ assert_equal(self.get_post(), None)
def moderate_post(self, **kwargs):
- self.controller.save_moderation(post=[dict(checked=True, full_slug=self.get_post().full_slug)],
+ self.controller.save_moderation(post=[dict(checked=True, _id=self.get_post()._id)],
**kwargs)
ThreadLocalORMSession.flush_all()
@@ -95,4 +98,3 @@ def show_moderation_index(discussion, **kwargs_for_controller):
controller = ModerationController(discussion_controller)
template_variables = controller.index(**kwargs_for_controller)
return template_variables
-
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7a51d42e/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py b/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
index c319263..89efa7c 100644
--- a/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
+++ b/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
@@ -27,6 +27,7 @@ from email.mime.multipart import MIMEMultipart
import pkg_resources
from pylons import tmpl_context as c, app_globals as g
from nose.tools import assert_equal, assert_in
+from ming.orm import ThreadLocalORMSession
from allura import model as M
from allura.tasks import mail_tasks
@@ -326,32 +327,16 @@ class TestForum(TestController):
r = self.app.get('/discussion/testforum/')
r = self.app.get('/discussion/testforum/childforum/')
- def test_post_count(self):
- # Make sure post counts don't get skewed during moderation
- r = self.app.get('/discussion/create_topic/')
- f = r.html.find('form',{'action':'/p/test/discussion/save_new_topic'})
- params = dict()
- inputs = f.findAll('input')
- for field in inputs:
- if field.has_key('name'):
- params[field['name']] = field.has_key('value') and field['value'] or ''
- params[f.find('textarea')['name']] = '1st post in Test Post Count thread'
- params[f.find('select')['name']] = 'testforum'
- params[f.find('input',{'style':'width: 90%'})['name']] = 'Test Post Count'
- r = self.app.post('/discussion/save_new_topic', params=params)
- for i in range(2):
- r = self.app.get('/discussion/testforum/moderate')
- slug = r.html.find('input', {'name': 'post-0.full_slug'})
- if slug is None: slug = '' #FIXME this makes the test keep passing, but clearly something isn't found
- r = self.app.post('/discussion/testforum/moderate/save_moderation', params={
- 'post-0.full_slug': slug,
- 'post-0.checked': 'on',
- 'approve': 'Approve Marked'})
-
def test_threads_with_zero_posts(self):
# Make sure that threads with zero posts (b/c all posts have been
# deleted or marked as spam) don't show in the UI.
- def _post():
+
+ # FIXME: This only works for posts that were initially pending, not
+ # those deleted or spammed later.
+
+ self._set_anon_allowed()
+
+ def _post_pending():
r = self.app.get('/discussion/create_topic/')
f = r.html.find('form',{'action':'/p/test/discussion/save_new_topic'})
params = dict()
@@ -362,30 +347,35 @@ class TestForum(TestController):
params[f.find('textarea')['name']] = '1st post in Zero Posts thread'
params[f.find('select')['name']] = 'testforum'
params[f.find('input',{'style':'width: 90%'})['name']] = 'Test Zero Posts'
- r = self.app.post('/discussion/save_new_topic', params=params)
+ r = self.app.post('/discussion/save_new_topic', params=params,
+ extra_environ=dict(username='*anonymous'),
+ status=302)
+ assert r.location.startswith('http://localhost/p/test/discussion/testforum/thread/'), r.location
+
def _check():
- r = self.app.get('/discussion/')
- assert 'Test Zero Posts' in r
+ # FIXME fix [#5907]
+ #r = self.app.get('/discussion/')
+ #assert 'Test Zero Posts' not in r
r = self.app.get('/discussion/testforum/')
- assert 'Test Zero Posts' in r
+ assert 'Test Zero Posts' not in r
+
# test posts marked as spam
- _post()
- r = self.app.get('/discussion/testforum/moderate')
- slug = r.html.find('input', {'name': 'post-0.full_slug'})
- if slug is None: slug = '' #FIXME this makes the test keep passing, but clearly something isn't found
+ _post_pending()
+ r = self.app.get('/discussion/testforum/moderate?status=pending')
+ post_id = r.html.find('input', {'name': 'post-0._id'})['value']
r = self.app.post('/discussion/testforum/moderate/save_moderation', params={
- 'post-0.full_slug': slug,
+ 'post-0._id': post_id,
'post-0.checked': 'on',
'spam': 'Spam Marked'})
_check()
+
# test posts deleted
- _post()
- r = self.app.get('/discussion/testforum/moderate')
- slug = r.html.find('input', {'name': 'post-0.full_slug'})
- if slug is None: slug = '' #FIXME this makes the test keep passing, but clearly something isn't found
+ _post_pending()
+ r = self.app.get('/discussion/testforum/moderate?status=pending')
+ post_id = r.html.find('input', {'name': 'post-0._id'})['value']
r = self.app.post('/discussion/testforum/moderate/save_'
'moderation', params={
- 'post-0.full_slug': slug,
+ 'post-0._id': post_id,
'post-0.checked': 'on',
'delete': 'Delete Marked'})
_check()
@@ -428,9 +418,7 @@ class TestForum(TestController):
n = M.Notification.query.find(dict(subject="[test:discussion] this is <h2> o'clock")).first()
assert_in('---\n\n[this is <h2> o'clock]', n.text)
- @mock.patch('allura.model.discuss.g.spam_checker')
- def test_anonymous_post(self, spam_checker):
- spam_checker.check.return_value = True
+ def _set_anon_allowed(self):
r = self.app.get('/admin/discussion/permissions')
select = r.html.find('select', {'name': 'card-3.new'})
opt_anon = select.find(text='*anonymous').parent
@@ -444,6 +432,11 @@ class TestForum(TestController):
'card-3.value': opt_auth['value'],
'card-3.new': opt_anon['value'],
'card-3.id': 'post'})
+
+ @mock.patch('allura.model.discuss.g.spam_checker')
+ def test_anonymous_post(self, spam_checker):
+ spam_checker.check.return_value = True
+ self._set_anon_allowed()
r = self.app.get('/discussion/create_topic/')
f = r.html.find('form',{'action':'/p/test/discussion/save_new_topic'})
params = dict()
[27/50] git commit: [#5775] Bump ForgeHg version
Posted by jo...@apache.org.
[#5775] Bump ForgeHg version
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ddac2b66
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ddac2b66
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ddac2b66
Branch: refs/heads/cj/6596
Commit: ddac2b664d38f3c772d52e860be60d5cdd17968e
Parents: d509748
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Aug 29 19:18:43 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Aug 29 19:18:43 2013 +0000
----------------------------------------------------------------------
requirements-sf.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ddac2b66/requirements-sf.txt
----------------------------------------------------------------------
diff --git a/requirements-sf.txt b/requirements-sf.txt
index 4e00d83..6115291 100644
--- a/requirements-sf.txt
+++ b/requirements-sf.txt
@@ -4,7 +4,7 @@ akismet==0.2.0
amqplib==0.6.1
kombu==1.0.4
coverage==3.5a1-20110413
-ForgeHg==0.1.15
+ForgeHg==0.1.16
ForgePastebin==0.2.7
GoogleCodeWikiImporter==0.3.0
mechanize==0.2.4
[47/50] git commit: [#6229] remove unnecessary test git files
Posted by jo...@apache.org.
[#6229] remove unnecessary test git files
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/562b3f37
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/562b3f37
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/562b3f37
Branch: refs/heads/cj/6596
Commit: 562b3f37c8f25d876aa98716554f11c79734e0a4
Parents: 94a3b1c
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Sep 5 14:53:10 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Sep 5 14:53:10 2013 +0000
----------------------------------------------------------------------
.../tests/data/testrename.git/description | 1 -
.../testrename.git/hooks/applypatch-msg.sample | 15 --
.../data/testrename.git/hooks/commit-msg.sample | 24 ---
.../data/testrename.git/hooks/post-receive | 9 -
.../testrename.git/hooks/post-update.sample | 8 -
.../testrename.git/hooks/pre-applypatch.sample | 14 --
.../data/testrename.git/hooks/pre-commit.sample | 50 ------
.../data/testrename.git/hooks/pre-rebase.sample | 169 -------------------
.../hooks/prepare-commit-msg.sample | 36 ----
.../data/testrename.git/hooks/update.sample | 128 --------------
10 files changed, 454 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/562b3f37/ForgeGit/forgegit/tests/data/testrename.git/description
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/description b/ForgeGit/forgegit/tests/data/testrename.git/description
deleted file mode 100644
index 498b267..0000000
--- a/ForgeGit/forgegit/tests/data/testrename.git/description
+++ /dev/null
@@ -1 +0,0 @@
-Unnamed repository; edit this file 'description' to name the repository.
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/562b3f37/ForgeGit/forgegit/tests/data/testrename.git/hooks/applypatch-msg.sample
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/applypatch-msg.sample b/ForgeGit/forgegit/tests/data/testrename.git/hooks/applypatch-msg.sample
deleted file mode 100755
index 8b2a2fe..0000000
--- a/ForgeGit/forgegit/tests/data/testrename.git/hooks/applypatch-msg.sample
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to check the commit log message taken by
-# applypatch from an e-mail message.
-#
-# The hook should exit with non-zero status after issuing an
-# appropriate message if it wants to stop the commit. The hook is
-# allowed to edit the commit message file.
-#
-# To enable this hook, rename this file to "applypatch-msg".
-
-. git-sh-setup
-test -x "$GIT_DIR/hooks/commit-msg" &&
- exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
-:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/562b3f37/ForgeGit/forgegit/tests/data/testrename.git/hooks/commit-msg.sample
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/commit-msg.sample b/ForgeGit/forgegit/tests/data/testrename.git/hooks/commit-msg.sample
deleted file mode 100755
index b58d118..0000000
--- a/ForgeGit/forgegit/tests/data/testrename.git/hooks/commit-msg.sample
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to check the commit log message.
-# Called by "git commit" with one argument, the name of the file
-# that has the commit message. The hook should exit with non-zero
-# status after issuing an appropriate message if it wants to stop the
-# commit. The hook is allowed to edit the commit message file.
-#
-# To enable this hook, rename this file to "commit-msg".
-
-# Uncomment the below to add a Signed-off-by line to the message.
-# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
-# hook is more suited to it.
-#
-# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
-# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
-
-# This example catches duplicate Signed-off-by lines.
-
-test "" = "$(grep '^Signed-off-by: ' "$1" |
- sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
- echo >&2 Duplicate Signed-off-by lines.
- exit 1
-}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/562b3f37/ForgeGit/forgegit/tests/data/testrename.git/hooks/post-receive
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/post-receive b/ForgeGit/forgegit/tests/data/testrename.git/hooks/post-receive
deleted file mode 100755
index 3ab92f5..0000000
--- a/ForgeGit/forgegit/tests/data/testrename.git/hooks/post-receive
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# The following is required for site integration, do not remove/modify.
-# Place user hook code in post-receive-user and it will be called from here.
-curl -s http://localhost:8080/auth/refresh_repo/p/test2/code/
-
-DIR="$(dirname "${BASH_SOURCE[0]}")"
-if [ -x $DIR/post-receive-user ]; then
- exec $DIR/post-receive-user
-fi
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/562b3f37/ForgeGit/forgegit/tests/data/testrename.git/hooks/post-update.sample
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/post-update.sample b/ForgeGit/forgegit/tests/data/testrename.git/hooks/post-update.sample
deleted file mode 100755
index ec17ec1..0000000
--- a/ForgeGit/forgegit/tests/data/testrename.git/hooks/post-update.sample
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to prepare a packed repository for use over
-# dumb transports.
-#
-# To enable this hook, rename this file to "post-update".
-
-exec git update-server-info
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/562b3f37/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-applypatch.sample
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-applypatch.sample b/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-applypatch.sample
deleted file mode 100755
index b1f187c..0000000
--- a/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-applypatch.sample
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to verify what is about to be committed
-# by applypatch from an e-mail message.
-#
-# The hook should exit with non-zero status after issuing an
-# appropriate message if it wants to stop the commit.
-#
-# To enable this hook, rename this file to "pre-applypatch".
-
-. git-sh-setup
-test -x "$GIT_DIR/hooks/pre-commit" &&
- exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
-:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/562b3f37/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-commit.sample
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-commit.sample b/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-commit.sample
deleted file mode 100755
index 18c4829..0000000
--- a/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-commit.sample
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to verify what is about to be committed.
-# Called by "git commit" with no arguments. The hook should
-# exit with non-zero status after issuing an appropriate message if
-# it wants to stop the commit.
-#
-# To enable this hook, rename this file to "pre-commit".
-
-if git rev-parse --verify HEAD >/dev/null 2>&1
-then
- against=HEAD
-else
- # Initial commit: diff against an empty tree object
- against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
-fi
-
-# If you want to allow non-ascii filenames set this variable to true.
-allownonascii=$(git config hooks.allownonascii)
-
-# Redirect output to stderr.
-exec 1>&2
-
-# Cross platform projects tend to avoid non-ascii filenames; prevent
-# them from being added to the repository. We exploit the fact that the
-# printable range starts at the space character and ends with tilde.
-if [ "$allownonascii" != "true" ] &&
- # Note that the use of brackets around a tr range is ok here, (it's
- # even required, for portability to Solaris 10's /usr/bin/tr), since
- # the square bracket bytes happen to fall in the designated range.
- test $(git diff --cached --name-only --diff-filter=A -z $against |
- LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
-then
- echo "Error: Attempt to add a non-ascii file name."
- echo
- echo "This can cause problems if you want to work"
- echo "with people on other platforms."
- echo
- echo "To be portable it is advisable to rename the file ..."
- echo
- echo "If you know what you are doing you can disable this"
- echo "check using:"
- echo
- echo " git config hooks.allownonascii true"
- echo
- exit 1
-fi
-
-# If there are whitespace errors, print the offending file names and fail.
-exec git diff-index --check --cached $against --
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/562b3f37/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-rebase.sample
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-rebase.sample b/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-rebase.sample
deleted file mode 100755
index 33730ca..0000000
--- a/ForgeGit/forgegit/tests/data/testrename.git/hooks/pre-rebase.sample
+++ /dev/null
@@ -1,169 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2006, 2008 Junio C Hamano
-#
-# The "pre-rebase" hook is run just before "git rebase" starts doing
-# its job, and can prevent the command from running by exiting with
-# non-zero status.
-#
-# The hook is called with the following parameters:
-#
-# $1 -- the upstream the series was forked from.
-# $2 -- the branch being rebased (or empty when rebasing the current branch).
-#
-# This sample shows how to prevent topic branches that are already
-# merged to 'next' branch from getting rebased, because allowing it
-# would result in rebasing already published history.
-
-publish=next
-basebranch="$1"
-if test "$#" = 2
-then
- topic="refs/heads/$2"
-else
- topic=`git symbolic-ref HEAD` ||
- exit 0 ;# we do not interrupt rebasing detached HEAD
-fi
-
-case "$topic" in
-refs/heads/??/*)
- ;;
-*)
- exit 0 ;# we do not interrupt others.
- ;;
-esac
-
-# Now we are dealing with a topic branch being rebased
-# on top of master. Is it OK to rebase it?
-
-# Does the topic really exist?
-git show-ref -q "$topic" || {
- echo >&2 "No such branch $topic"
- exit 1
-}
-
-# Is topic fully merged to master?
-not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
-if test -z "$not_in_master"
-then
- echo >&2 "$topic is fully merged to master; better remove it."
- exit 1 ;# we could allow it, but there is no point.
-fi
-
-# Is topic ever merged to next? If so you should not be rebasing it.
-only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
-only_next_2=`git rev-list ^master ${publish} | sort`
-if test "$only_next_1" = "$only_next_2"
-then
- not_in_topic=`git rev-list "^$topic" master`
- if test -z "$not_in_topic"
- then
- echo >&2 "$topic is already up-to-date with master"
- exit 1 ;# we could allow it, but there is no point.
- else
- exit 0
- fi
-else
- not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
- /usr/bin/perl -e '
- my $topic = $ARGV[0];
- my $msg = "* $topic has commits already merged to public branch:\n";
- my (%not_in_next) = map {
- /^([0-9a-f]+) /;
- ($1 => 1);
- } split(/\n/, $ARGV[1]);
- for my $elem (map {
- /^([0-9a-f]+) (.*)$/;
- [$1 => $2];
- } split(/\n/, $ARGV[2])) {
- if (!exists $not_in_next{$elem->[0]}) {
- if ($msg) {
- print STDERR $msg;
- undef $msg;
- }
- print STDERR " $elem->[1]\n";
- }
- }
- ' "$topic" "$not_in_next" "$not_in_master"
- exit 1
-fi
-
-<<\DOC_END
-
-This sample hook safeguards topic branches that have been
-published from being rewound.
-
-The workflow assumed here is:
-
- * Once a topic branch forks from "master", "master" is never
- merged into it again (either directly or indirectly).
-
- * Once a topic branch is fully cooked and merged into "master",
- it is deleted. If you need to build on top of it to correct
- earlier mistakes, a new topic branch is created by forking at
- the tip of the "master". This is not strictly necessary, but
- it makes it easier to keep your history simple.
-
- * Whenever you need to test or publish your changes to topic
- branches, merge them into "next" branch.
-
-The script, being an example, hardcodes the publish branch name
-to be "next", but it is trivial to make it configurable via
-$GIT_DIR/config mechanism.
-
-With this workflow, you would want to know:
-
-(1) ... if a topic branch has ever been merged to "next". Young
- topic branches can have stupid mistakes you would rather
- clean up before publishing, and things that have not been
- merged into other branches can be easily rebased without
- affecting other people. But once it is published, you would
- not want to rewind it.
-
-(2) ... if a topic branch has been fully merged to "master".
- Then you can delete it. More importantly, you should not
- build on top of it -- other people may already want to
- change things related to the topic as patches against your
- "master", so if you need further changes, it is better to
- fork the topic (perhaps with the same name) afresh from the
- tip of "master".
-
-Let's look at this example:
-
- o---o---o---o---o---o---o---o---o---o "next"
- / / / /
- / a---a---b A / /
- / / / /
- / / c---c---c---c B /
- / / / \ /
- / / / b---b C \ /
- / / / / \ /
- ---o---o---o---o---o---o---o---o---o---o---o "master"
-
-
-A, B and C are topic branches.
-
- * A has one fix since it was merged up to "next".
-
- * B has finished. It has been fully merged up to "master" and "next",
- and is ready to be deleted.
-
- * C has not merged to "next" at all.
-
-We would want to allow C to be rebased, refuse A, and encourage
-B to be deleted.
-
-To compute (1):
-
- git rev-list ^master ^topic next
- git rev-list ^master next
-
- if these match, topic has not merged in next at all.
-
-To compute (2):
-
- git rev-list master..topic
-
- if this is empty, it is fully merged to "master".
-
-DOC_END
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/562b3f37/ForgeGit/forgegit/tests/data/testrename.git/hooks/prepare-commit-msg.sample
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/prepare-commit-msg.sample b/ForgeGit/forgegit/tests/data/testrename.git/hooks/prepare-commit-msg.sample
deleted file mode 100755
index f093a02..0000000
--- a/ForgeGit/forgegit/tests/data/testrename.git/hooks/prepare-commit-msg.sample
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to prepare the commit log message.
-# Called by "git commit" with the name of the file that has the
-# commit message, followed by the description of the commit
-# message's source. The hook's purpose is to edit the commit
-# message file. If the hook fails with a non-zero status,
-# the commit is aborted.
-#
-# To enable this hook, rename this file to "prepare-commit-msg".
-
-# This hook includes three examples. The first comments out the
-# "Conflicts:" part of a merge commit.
-#
-# The second includes the output of "git diff --name-status -r"
-# into the message, just before the "git status" output. It is
-# commented because it doesn't cope with --amend or with squashed
-# commits.
-#
-# The third example adds a Signed-off-by line to the message, that can
-# still be edited. This is rarely a good idea.
-
-case "$2,$3" in
- merge,)
- /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
-
-# ,|template,)
-# /usr/bin/perl -i.bak -pe '
-# print "\n" . `git diff --cached --name-status -r`
-# if /^#/ && $first++ == 0' "$1" ;;
-
- *) ;;
-esac
-
-# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
-# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/562b3f37/ForgeGit/forgegit/tests/data/testrename.git/hooks/update.sample
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testrename.git/hooks/update.sample b/ForgeGit/forgegit/tests/data/testrename.git/hooks/update.sample
deleted file mode 100755
index 71ab04e..0000000
--- a/ForgeGit/forgegit/tests/data/testrename.git/hooks/update.sample
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to blocks unannotated tags from entering.
-# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
-#
-# To enable this hook, rename this file to "update".
-#
-# Config
-# ------
-# hooks.allowunannotated
-# This boolean sets whether unannotated tags will be allowed into the
-# repository. By default they won't be.
-# hooks.allowdeletetag
-# This boolean sets whether deleting tags will be allowed in the
-# repository. By default they won't be.
-# hooks.allowmodifytag
-# This boolean sets whether a tag may be modified after creation. By default
-# it won't be.
-# hooks.allowdeletebranch
-# This boolean sets whether deleting branches will be allowed in the
-# repository. By default they won't be.
-# hooks.denycreatebranch
-# This boolean sets whether remotely creating branches will be denied
-# in the repository. By default this is allowed.
-#
-
-# --- Command line
-refname="$1"
-oldrev="$2"
-newrev="$3"
-
-# --- Safety check
-if [ -z "$GIT_DIR" ]; then
- echo "Don't run this script from the command line." >&2
- echo " (if you want, you could supply GIT_DIR then run" >&2
- echo " $0 <ref> <oldrev> <newrev>)" >&2
- exit 1
-fi
-
-if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
- echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
- exit 1
-fi
-
-# --- Config
-allowunannotated=$(git config --bool hooks.allowunannotated)
-allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
-denycreatebranch=$(git config --bool hooks.denycreatebranch)
-allowdeletetag=$(git config --bool hooks.allowdeletetag)
-allowmodifytag=$(git config --bool hooks.allowmodifytag)
-
-# check for no description
-projectdesc=$(sed -e '1q' "$GIT_DIR/description")
-case "$projectdesc" in
-"Unnamed repository"* | "")
- echo "*** Project description file hasn't been set" >&2
- exit 1
- ;;
-esac
-
-# --- Check types
-# if $newrev is 0000...0000, it's a commit to delete a ref.
-zero="0000000000000000000000000000000000000000"
-if [ "$newrev" = "$zero" ]; then
- newrev_type=delete
-else
- newrev_type=$(git cat-file -t $newrev)
-fi
-
-case "$refname","$newrev_type" in
- refs/tags/*,commit)
- # un-annotated tag
- short_refname=${refname##refs/tags/}
- if [ "$allowunannotated" != "true" ]; then
- echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
- echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
- exit 1
- fi
- ;;
- refs/tags/*,delete)
- # delete tag
- if [ "$allowdeletetag" != "true" ]; then
- echo "*** Deleting a tag is not allowed in this repository" >&2
- exit 1
- fi
- ;;
- refs/tags/*,tag)
- # annotated tag
- if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
- then
- echo "*** Tag '$refname' already exists." >&2
- echo "*** Modifying a tag is not allowed in this repository." >&2
- exit 1
- fi
- ;;
- refs/heads/*,commit)
- # branch
- if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
- echo "*** Creating a branch is not allowed in this repository" >&2
- exit 1
- fi
- ;;
- refs/heads/*,delete)
- # delete branch
- if [ "$allowdeletebranch" != "true" ]; then
- echo "*** Deleting a branch is not allowed in this repository" >&2
- exit 1
- fi
- ;;
- refs/remotes/*,commit)
- # tracking branch
- ;;
- refs/remotes/*,delete)
- # delete tracking branch
- if [ "$allowdeletebranch" != "true" ]; then
- echo "*** Deleting a tracking branch is not allowed in this repository" >&2
- exit 1
- fi
- ;;
- *)
- # Anything else (is there anything else?)
- echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
- exit 1
- ;;
-esac
-
-# --- Finished
-exit 0
[32/50] git commit: [#6619] update all the tests using :80
Posted by jo...@apache.org.
[#6619] update all the tests using :80
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/8b15df90
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/8b15df90
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/8b15df90
Branch: refs/heads/cj/6596
Commit: 8b15df9016a6a63154b2bcc338a81c337dbea0d8
Parents: f1253f6
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Aug 29 19:31:14 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Sep 3 21:01:57 2013 +0000
----------------------------------------------------------------------
Allura/allura/tests/functional/test_rest.py | 2 +-
Allura/allura/tests/test_globals.py | 4 ++--
ForgeBlog/forgeblog/tests/functional/test_rest.py | 2 +-
.../forgediscussion/tests/functional/test_forum_admin.py | 4 ++--
.../forgediscussion/tests/functional/test_rest.py | 10 +++++-----
ForgeGit/forgegit/tests/functional/test_controllers.py | 8 ++++----
ForgeSVN/forgesvn/tests/functional/test_controllers.py | 8 ++++----
ForgeTracker/forgetracker/tests/functional/test_root.py | 10 +++++-----
ForgeWiki/forgewiki/tests/functional/test_rest.py | 4 ++--
9 files changed, 26 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/Allura/allura/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_rest.py b/Allura/allura/tests/functional/test_rest.py
index 0977f26..8bb3a28 100644
--- a/Allura/allura/tests/functional/test_rest.py
+++ b/Allura/allura/tests/functional/test_rest.py
@@ -80,7 +80,7 @@ class TestRestHome(TestRestApiBase):
admin_dev = r.json['developers'][0]
assert_equal(admin_dev['username'], 'test-admin')
assert_equal(admin_dev['name'], 'Test Admin')
- assert_equal(admin_dev['url'], 'http://localhost:80/u/test-admin/')
+ assert_equal(admin_dev['url'], 'http://localhost/u/test-admin/')
@td.with_tool('test', 'Tickets', 'bugs')
@td.with_tool('test', 'Tickets', 'private-bugs')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/Allura/allura/tests/test_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index 437021b..3ce26bb 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -54,8 +54,8 @@ def test_app_globals():
g.oid_session()
with h.push_context('test', 'wiki', neighborhood='Projects'):
assert g.app_static('css/wiki.css') == '/nf/_static_/wiki/css/wiki.css', g.app_static('css/wiki.css')
- assert g.url('/foo', a='foo bar') == 'http://localhost:80/foo?a=foo+bar', g.url('/foo', a='foo bar')
- assert g.url('/foo') == 'http://localhost:80/foo', g.url('/foo')
+ assert g.url('/foo', a='foo bar') == 'http://localhost/foo?a=foo+bar', g.url('/foo', a='foo bar')
+ assert g.url('/foo') == 'http://localhost/foo', g.url('/foo')
@with_setup(teardown=setUp) # reset everything we changed
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/ForgeBlog/forgeblog/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/tests/functional/test_rest.py b/ForgeBlog/forgeblog/tests/functional/test_rest.py
index f545c7e..b1b3bc7 100644
--- a/ForgeBlog/forgeblog/tests/functional/test_rest.py
+++ b/ForgeBlog/forgeblog/tests/functional/test_rest.py
@@ -44,7 +44,7 @@ class TestBlogApi(TestRestApiBase):
'labels': 'label1, label2'
}
r = self.api_post('/rest/p/test/blog/', **data)
- assert_equal(r.location, 'http://localhost:80/rest/p/test/blog/%s/%s/test/' % (date.today().strftime("%Y"), date.today().strftime("%m")))
+ assert_equal(r.location, 'http://localhost/rest/p/test/blog/%s/%s/test/' % (date.today().strftime("%Y"), date.today().strftime("%m")))
assert_equal(r.status_int, 201)
url = '/rest' + BM.BlogPost.query.find().first().url()
r = self.api_get('/rest/p/test/blog/')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/ForgeDiscussion/forgediscussion/tests/functional/test_forum_admin.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/tests/functional/test_forum_admin.py b/ForgeDiscussion/forgediscussion/tests/functional/test_forum_admin.py
index cb85182..8a92969 100644
--- a/ForgeDiscussion/forgediscussion/tests/functional/test_forum_admin.py
+++ b/ForgeDiscussion/forgediscussion/tests/functional/test_forum_admin.py
@@ -288,5 +288,5 @@ class TestForumAdmin(TestController):
r = self.app.post('/discussion/save_new_topic', params=params)
M.MonQTask.run_ready()
email_tasks = M.MonQTask.query.find(dict(task_name='allura.tasks.mail_tasks.sendsimplemail')).all()
- assert 'Sent from sourceforge.net because email@monitoring.com is subscribed to http://localhost:80/p/test/discussion/testforum/' in email_tasks[0].kwargs['text'],email_tasks[0].kwargs['text']
- assert 'a project admin can change settings at http://localhost:80/p/test/admin/discussion/forums' in email_tasks[0].kwargs['text']
+ assert 'Sent from sourceforge.net because email@monitoring.com is subscribed to http://localhost/p/test/discussion/testforum/' in email_tasks[0].kwargs['text'],email_tasks[0].kwargs['text']
+ assert 'a project admin can change settings at http://localhost/p/test/admin/discussion/forums' in email_tasks[0].kwargs['text']
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py b/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
index afdcdc5..d9f0c39 100644
--- a/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
+++ b/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
@@ -71,14 +71,14 @@ class TestRootRestController(TestDiscussionApiBase):
assert_equal(forums[0]['name'], 'General Discussion')
assert_equal(forums[0]['description'], 'Forum about anything you want to talk about.')
assert_equal(forums[0]['num_topics'], 2)
- assert_equal(forums[0]['url'], 'http://localhost:80/rest/p/test/discussion/general/')
+ assert_equal(forums[0]['url'], 'http://localhost/rest/p/test/discussion/general/')
assert_equal(forums[0]['last_post']['subject'], 'Hi guys')
assert_equal(forums[0]['last_post']['author'], 'test-admin')
assert_equal(forums[0]['last_post']['text'], 'Hi boys and girls')
assert_equal(forums[1]['name'], u'Say Héllo')
assert_equal(forums[1]['description'], u'Say héllo here')
assert_equal(forums[1]['num_topics'], 0)
- assert_equal(forums[1]['url'], 'http://localhost:80/rest/p/test/discussion/h%C3%A9llo/')
+ assert_equal(forums[1]['url'], 'http://localhost/rest/p/test/discussion/h%C3%A9llo/')
assert_equal(forums[1]['last_post'], None)
def test_forum(self):
@@ -94,7 +94,7 @@ class TestRootRestController(TestDiscussionApiBase):
assert_equal(topics[0]['last_post']['author'], 'test-admin')
assert_equal(topics[0]['last_post']['text'], 'Hi boys and girls')
t = ForumThread.query.find({'subject': 'Hi guys'}).first()
- url = 'http://localhost:80/rest/p/test/discussion/general/thread/%s/' % t._id
+ url = 'http://localhost/rest/p/test/discussion/general/thread/%s/' % t._id
assert_equal(topics[0]['url'], url)
assert_equal(topics[1]['subject'], 'Let\'s talk')
assert_equal(topics[1]['num_views'], 0)
@@ -102,7 +102,7 @@ class TestRootRestController(TestDiscussionApiBase):
assert_equal(topics[1]['last_post']['author'], 'test-admin')
assert_equal(topics[1]['last_post']['text'], '1st post')
t = ForumThread.query.find({'subject': 'Let\'s talk'}).first()
- url = 'http://localhost:80/rest/p/test/discussion/general/thread/%s/' % t._id
+ url = 'http://localhost/rest/p/test/discussion/general/thread/%s/' % t._id
assert_equal(topics[1]['url'], url)
def test_forum_show_ok_topics(self):
@@ -128,7 +128,7 @@ class TestRootRestController(TestDiscussionApiBase):
assert_equal(forum['name'], 'General Discussion')
assert_equal(forum['description'], 'Forum about anything you want to talk about.')
topics = forum['topics']
- topic = self.api_get(topics[0]['url'][len('http://localhost:80'):])
+ topic = self.api_get(topics[0]['url'][len('http://localhost'):])
topic = topic.json['topic']
assert_equal(len(topic['posts']), 1)
assert_equal(topic['subject'], 'Hi guys')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 638fd90..919e97b 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -176,10 +176,10 @@ class TestRootController(_TestCase):
description = channel.find('description').text
assert_equal(description, 'Recent changes to Git repository in test project')
link = channel.find('link').text
- assert_equal(link, 'http://localhost:80/p/test/src-git/')
+ assert_equal(link, 'http://localhost/p/test/src-git/')
commit = channel.find('item')
assert_equal(commit.find('title').text, 'Initial commit')
- link = 'http://localhost:80/p/test/src-git/ci/9a7df788cf800241e3bb5a849c8870f2f8259d98/'
+ link = 'http://localhost/p/test/src-git/ci/9a7df788cf800241e3bb5a849c8870f2f8259d98/'
assert_equal(commit.find('link').text, link)
assert_equal(commit.find('guid').text, link)
# .atom has slightly different structure
@@ -188,10 +188,10 @@ class TestRootController(_TestCase):
title = r.xml.find(prefix + 'title').text
assert_equal(title, 'test Git changes')
link = r.xml.find(prefix + 'link').attrib['href']
- assert_equal(link, 'http://localhost:80/p/test/src-git/')
+ assert_equal(link, 'http://localhost/p/test/src-git/')
commit = r.xml.find(prefix + 'entry')
assert_equal(commit.find(prefix + 'title').text, 'Initial commit')
- link = 'http://localhost:80/p/test/src-git/ci/9a7df788cf800241e3bb5a849c8870f2f8259d98/'
+ link = 'http://localhost/p/test/src-git/ci/9a7df788cf800241e3bb5a849c8870f2f8259d98/'
assert_equal(commit.find(prefix + 'link').attrib['href'], link)
def test_tree(self):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/ForgeSVN/forgesvn/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/functional/test_controllers.py b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
index eb7d409..ae8c86d 100644
--- a/ForgeSVN/forgesvn/tests/functional/test_controllers.py
+++ b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
@@ -109,10 +109,10 @@ class TestRootController(SVNTestController):
description = channel.find('description').text
assert_equal(description, 'Recent changes to SVN repository in test project')
link = channel.find('link').text
- assert_equal(link, 'http://localhost:80/p/test/src/')
+ assert_equal(link, 'http://localhost/p/test/src/')
commit = channel.find('item')
assert_equal(commit.find('title').text, 'Create readme')
- link = 'http://localhost:80/p/test/src/1/'
+ link = 'http://localhost/p/test/src/1/'
assert_equal(commit.find('link').text, link)
assert_equal(commit.find('guid').text, link)
# .atom has slightly different structure
@@ -121,10 +121,10 @@ class TestRootController(SVNTestController):
title = r.xml.find(prefix + 'title').text
assert_equal(title, 'test SVN changes')
link = r.xml.find(prefix + 'link').attrib['href']
- assert_equal(link, 'http://localhost:80/p/test/src/')
+ assert_equal(link, 'http://localhost/p/test/src/')
commit = r.xml.find(prefix + 'entry')
assert_equal(commit.find(prefix + 'title').text, 'Create readme')
- link = 'http://localhost:80/p/test/src/1/'
+ link = 'http://localhost/p/test/src/1/'
assert_equal(commit.find(prefix + 'link').attrib['href'], link)
def test_commit(self):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index a78abd9..0ba4f0b 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -1877,10 +1877,10 @@ class TestFunctionalController(TrackerTestController):
discussion_url = r.html.findAll('form')[-1]['action'][:-4]
r = self.app.get('/rest/p/test/bugs/1/')
r = json.loads(r.body)
- assert_equal(r['ticket']['discussion_thread_url'],'http://localhost:80/rest%s' % discussion_url)
+ assert_equal(r['ticket']['discussion_thread_url'],'http://localhost/rest%s' % discussion_url)
slug = r['ticket']['discussion_thread']['posts'][0]['slug']
assert_equal(r['ticket']['discussion_thread']['posts'][0]['attachments'][0]['url'],
- 'http://localhost:80%s%s/attachment/test.txt' % (discussion_url, slug))
+ 'http://localhost%s%s/attachment/test.txt' % (discussion_url, slug))
assert_equal(r['ticket']['discussion_thread']['posts'][0]['attachments'][0]['bytes'], 11)
file_name = 'test_root.py'
@@ -1891,7 +1891,7 @@ class TestFunctionalController(TrackerTestController):
}, upload_files=[upload]).follow()
r = self.app.get('/rest/p/test/bugs/1/')
r = json.loads(r.body)
- assert_equal(r['ticket']['attachments'][0]['url'], 'http://localhost:80/p/test/bugs/1/attachment/test_root.py')
+ assert_equal(r['ticket']['attachments'][0]['url'], 'http://localhost/p/test/bugs/1/attachment/test_root.py')
def test_html_escaping(self):
with mock.patch.object(mail_tasks.smtp_client, '_client') as _client:
@@ -2138,8 +2138,8 @@ class TestEmailMonitoring(TrackerTestController):
ThreadLocalORMSession.flush_all()
M.MonQTask.run_ready()
email_tasks = M.MonQTask.query.find(dict(task_name='allura.tasks.mail_tasks.sendsimplemail')).all()
- assert 'Sent from sourceforge.net because mailinglist@example.com is subscribed to http://localhost:80/p/test/bugs/' in email_tasks[0].kwargs['text']
- assert 'a project admin can change settings at http://localhost:80/p/test/admin/bugs/options' in email_tasks[0].kwargs['text']
+ assert 'Sent from sourceforge.net because mailinglist@example.com is subscribed to http://localhost/p/test/bugs/' in email_tasks[0].kwargs['text']
+ assert 'a project admin can change settings at http://localhost/p/test/admin/bugs/options' in email_tasks[0].kwargs['text']
class TestCustomUserField(TrackerTestController):
def setUp(self):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/ForgeWiki/forgewiki/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_rest.py b/ForgeWiki/forgewiki/tests/functional/test_rest.py
index 0b93680..2b5cfd5 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_rest.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_rest.py
@@ -45,8 +45,8 @@ class TestWikiApi(TestRestApiBase):
self.app.post('/wiki/Home/attach', upload_files=[('file_info', 'test_root.py', content)])
r = self.app.get('/rest/p/test/wiki/Home/')
r = json.loads(r.body)
- assert_equal(r['attachments'][0]['url'], 'http://localhost:80/p/test/wiki/Home/attachment/test_root.py')
- assert_equal(r['discussion_thread_url'], 'http://localhost:80/rest%s' % discussion_url)
+ assert_equal(r['attachments'][0]['url'], 'http://localhost/p/test/wiki/Home/attachment/test_root.py')
+ assert_equal(r['discussion_thread_url'], 'http://localhost/rest%s' % discussion_url)
assert_equal(r['discussion_thread']['_id'], discussion_url.split('/')[-2])
self.app.post('/wiki/Home/attach', upload_files=[('file_info', '__init__.py', content),])
r = self.app.get('/rest/p/test/wiki/Home/')