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 2014/03/26 22:57:24 UTC

[1/5] git commit: fix flaky tests

Repository: allura
Updated Branches:
  refs/heads/cj/7134 4b1c1880b -> 1c2ed49b5 (forced update)


fix flaky tests


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/f9c81e2a
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/f9c81e2a
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/f9c81e2a

Branch: refs/heads/cj/7134
Commit: f9c81e2a14a3811a1de0f70118b21d3ad2937fbd
Parents: f970d43
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Mar 25 21:24:58 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Mar 25 21:24:58 2014 +0000

----------------------------------------------------------------------
 Allura/allura/tests/functional/test_admin.py | 9 +++++++--
 Allura/allura/tests/functional/test_home.py  | 5 +++--
 2 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/f9c81e2a/Allura/allura/tests/functional/test_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_admin.py b/Allura/allura/tests/functional/test_admin.py
index 49246a8..0861a15 100644
--- a/Allura/allura/tests/functional/test_admin.py
+++ b/Allura/allura/tests/functional/test_admin.py
@@ -21,10 +21,11 @@ import allura
 import pkg_resources
 import StringIO
 from contextlib import contextmanager
+import logging
 
 import tg
 import PIL
-from nose.tools import assert_equals, assert_in, assert_not_in
+from nose.tools import assert_equals, assert_in, assert_not_in, assert_greater_equal
 from ming.orm.ormsession import ThreadLocalORMSession
 from tg import expose
 from pylons import tmpl_context as c, app_globals as g
@@ -43,6 +44,8 @@ from forgetracker.tracker_main import ForgeTrackerApp
 from forgewiki.wiki_main import ForgeWikiApp
 
 
+log = logging.getLogger(__name__)
+
 @contextmanager
 def audits(*messages):
     M.AuditLog.query.remove()
@@ -321,7 +324,9 @@ class TestProjectAdmin(TestController):
 
     def test_tool_paging(self):
         r = self.app.get('/admin/tools')
-        assert_equals(2, len(r.html.findAll('ul', {'class': 'deck'})))
+        items = r.html.findAll('ul', {'class': 'deck'})
+        log.debug('test_tool_paging: got %s tools: %s', len(items), items)
+        assert_greater_equal(2, len(items))
         r = self.app.get('/admin/tools?limit=1&page=0')
         assert_equals(1, len(r.html.findAll('ul', {'class': 'deck'})))
         r = self.app.get('/admin/tools?limit=1&page=1')

http://git-wip-us.apache.org/repos/asf/allura/blob/f9c81e2a/Allura/allura/tests/functional/test_home.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_home.py b/Allura/allura/tests/functional/test_home.py
index 8a8d087..58f1d61 100644
--- a/Allura/allura/tests/functional/test_home.py
+++ b/Allura/allura/tests/functional/test_home.py
@@ -83,9 +83,10 @@ class TestProjectHome(TestController):
                 c.app = p.install_app('wiki', tool_name, tool_name, i)
         response = self.app.get('/p/test/_nav.json')
         menu = response.json['menu']
-        assert_equal(len(menu[0]['children']), 10)
+        wiki_menu = [m for m in menu if m['tool_name'] == 'wiki'][0]
+        assert_equal(len(wiki_menu['children']), 10)
         assert {u'url': u'/p/test/_list/wiki', u'name': u'More...',
-                u'icon': u'tool-wiki', 'tool_name': 'wiki'} in menu[0]['children']
+                u'icon': u'tool-wiki', 'tool_name': 'wiki'} in wiki_menu['children']
 
     @td.with_wiki
     def test_neighborhood_home(self):


[3/5] git commit: [#6701] add license header - file was contributed in https://sourceforge.net/p/allura/tickets/6701/

Posted by jo...@apache.org.
[#6701] add license header - file was contributed in https://sourceforge.net/p/allura/tickets/6701/


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/8e88e3ad
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/8e88e3ad
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/8e88e3ad

Branch: refs/heads/cj/7134
Commit: 8e88e3ad569b93274f2c902a28018682299d0142
Parents: 800530c
Author: Dave Brondsema <da...@brondsema.net>
Authored: Wed Mar 26 10:59:13 2014 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Wed Mar 26 10:59:13 2014 -0400

----------------------------------------------------------------------
 scripts/ApacheAccessHandler.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/8e88e3ad/scripts/ApacheAccessHandler.py
----------------------------------------------------------------------
diff --git a/scripts/ApacheAccessHandler.py b/scripts/ApacheAccessHandler.py
index 69e1d62..1af3714 100644
--- a/scripts/ApacheAccessHandler.py
+++ b/scripts/ApacheAccessHandler.py
@@ -1,3 +1,20 @@
+#       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.
+
 """
 An Apache authorization handler for Allura
 


[4/5] git commit: [#7134] Added option to allow overriding repo clone URL

Posted by jo...@apache.org.
[#7134] Added option to allow overriding repo clone URL

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/7ce36bfa
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/7ce36bfa
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/7ce36bfa

Branch: refs/heads/cj/7134
Commit: 7ce36bfa0707cba117b7bd1ef65c5e80e0213fcb
Parents: 8e88e3a
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Mar 20 21:27:05 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Mar 26 18:58:16 2014 +0000

----------------------------------------------------------------------
 Allura/allura/lib/repository.py                 | 19 ++++++++++--
 Allura/allura/model/repository.py               |  7 +++--
 Allura/allura/templates/repo/admin_options.html | 32 ++++++++++++++++++++
 ForgeGit/forgegit/model/git_repo.py             |  5 ++-
 .../forgegit/tests/model/test_repository.py     | 12 ++++++++
 ForgeGit/forgegit/tests/test_git_app.py         |  2 +-
 .../forgesvn/tests/model/test_repository.py     |  4 +++
 ForgeSVN/forgesvn/tests/test_svn_app.py         |  2 +-
 8 files changed, 75 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/7ce36bfa/Allura/allura/lib/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/repository.py b/Allura/allura/lib/repository.py
index 6e073d9..4e956bf 100644
--- a/Allura/allura/lib/repository.py
+++ b/Allura/allura/lib/repository.py
@@ -20,7 +20,7 @@ from urllib import quote
 
 from pylons import tmpl_context as c, app_globals as g
 from pylons import request
-from tg import expose, redirect
+from tg import expose, redirect, flash
 from tg.decorators import with_trailing_slash, without_trailing_slash
 from bson import ObjectId
 
@@ -54,7 +54,8 @@ class RepositoryApp(Application):
     config_options = Application.config_options + [
         ConfigOption('cloned_from_project_id', ObjectId, None),
         ConfigOption('cloned_from_repo_id', ObjectId, None),
-        ConfigOption('init_from_url', str, None)
+        ConfigOption('init_from_url', str, None),
+        ConfigOption('clone_url', str, None)
     ]
     tool_label = 'Repository'
     default_mount_label = 'Code'
@@ -101,7 +102,6 @@ class RepositoryApp(Application):
                                   '/refresh',
                                   ))
         links += super(RepositoryApp, self).admin_menu()
-        [links.remove(l) for l in links[:] if l.label == 'Options']
         return links
 
     @h.exceptionless([], log)
@@ -246,3 +246,16 @@ class RepoAdminController(DefaultAdminController):
         else:
             return dict(app=self.app,
                         default_branch_name=self.app.default_branch_name)
+
+    @without_trailing_slash
+    @expose('jinja:allura:templates/repo/admin_options.html')
+    def options(self):
+        return dict(app=self.app)
+
+    @without_trailing_slash
+    @expose()
+    @require_post()
+    def set_options(self, clone_url=None, **kw):
+        self.app.config.options.clone_url = clone_url or None
+        flash('Repo options updated')
+        redirect(c.project.url() + 'admin/tools')

http://git-wip-us.apache.org/repos/asf/allura/blob/7ce36bfa/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 2c08017..12661a9 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -555,8 +555,11 @@ class Repository(Artifact, ActivityObject):
         '''Return a URL string suitable for copy/paste that describes _this_ repo,
            e.g., for use in a clone/checkout command
         '''
-        tpl = string.Template(
-            tg.config.get('scm.host.%s.%s' % (category, self.tool)))
+        if self.app.config.options.clone_url:
+            tpl = string.Template(self.app.config.options.clone_url)
+        else:
+            tpl = string.Template(
+                tg.config.get('scm.host.%s.%s' % (category, self.tool)))
         return tpl.substitute(dict(username=username, path=self.url_path + self.name))
 
     def clone_command(self, category, username=''):

http://git-wip-us.apache.org/repos/asf/allura/blob/7ce36bfa/Allura/allura/templates/repo/admin_options.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/admin_options.html b/Allura/allura/templates/repo/admin_options.html
new file mode 100644
index 0000000..2b2c0b7
--- /dev/null
+++ b/Allura/allura/templates/repo/admin_options.html
@@ -0,0 +1,32 @@
+{#-
+       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.
+-#}
+<!DOCTYPE html>
+<form action="{{c.project.url()}}admin/{{app.config.options.mount_point}}/set_options" method="post">
+    <label class="grid-4">Clone / checkout URL:</label>
+    <div class="grid-9">
+        <input type="text" name="clone_url" id="clone_url" value="{{app.config.options.clone_url or ''}}"/>
+    </div>
+    <div class="grid-13">&nbsp;</div>
+    <hr>
+    <div class="grid-13">&nbsp;</div>
+    <div class="grid-13">
+	<input type="submit" value="Save"/>
+        <a href="#" class="close">Cancel</a>
+    </div>
+</form>

http://git-wip-us.apache.org/repos/asf/allura/blob/7ce36bfa/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 8b9d1f8..1cb771b 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -71,7 +71,10 @@ class Repository(M.Repository):
         return super(Repository, self).suggested_clone_dest_path()[:-4]
 
     def clone_url(self, category, username=''):
-        return super(Repository, self).clone_url(category, username)[:-4]
+        clone_url = super(Repository, self).clone_url(category, username)
+        if clone_url.endswith('.git'):
+            clone_url = clone_url[:-4]
+        return clone_url
 
     def merge_command(self, merge_request):
         '''Return the command to merge a given commit to a given target branch'''

http://git-wip-us.apache.org/repos/asf/allura/blob/7ce36bfa/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 215ba0b..106c63e 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -470,6 +470,18 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
             ThreadLocalORMSession.flush_all()
             assert repo2.is_empty()
 
+    def test_clone_url(self):
+        assert_equal(
+            self.repo.clone_url('rw', 'nobody'),
+            'ssh://nobody@localhost:8022/scm-repo/test/testgit')
+        assert_equal(
+            self.repo.clone_url('https', 'nobody'),
+            'https://nobody@localhost:8022/scm-repo/test/testgit')
+        with h.push_config(self.repo.app.config.options, clone_url='https://$username@foo.com/'):
+            assert_equal(
+                self.repo.clone_url('https', 'user'),
+                'https://user@foo.com/')
+
 
 class TestGitImplementation(unittest.TestCase):
 

http://git-wip-us.apache.org/repos/asf/allura/blob/7ce36bfa/ForgeGit/forgegit/tests/test_git_app.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/test_git_app.py b/ForgeGit/forgegit/tests/test_git_app.py
index 0b59396..44ce991 100644
--- a/ForgeGit/forgegit/tests/test_git_app.py
+++ b/ForgeGit/forgegit/tests/test_git_app.py
@@ -40,7 +40,7 @@ class TestGitApp(unittest.TestCase):
         ThreadLocalORMSession.close_all()
 
     def test_admin_menu(self):
-        assert_equals(len(c.app.admin_menu()), 5)
+        assert_equals(len(c.app.admin_menu()), 6)
 
     def test_default_branch(self):
         assert c.app.default_branch_name == 'master'

http://git-wip-us.apache.org/repos/asf/allura/blob/7ce36bfa/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 7dc2177..2fb7207 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -784,6 +784,10 @@ class TestRepo(_TestWithRepo):
             self.repo.clone_url('https', 'nobody')
             == 'https://nobody@localhost:8022/scm-repo/p/test/test1/'),\
             self.repo.clone_url('https', 'nobody')
+        with h.push_config(self.repo.app.config.options, clone_url='https://$username@foo.com/'):
+            assert_equal(
+                self.repo.clone_url('https', 'user'),
+                'https://user@foo.com/')
 
     def test_merge_request(self):
         M.MergeRequest.upsert(app_config_id=c.app.config._id, status='open')

http://git-wip-us.apache.org/repos/asf/allura/blob/7ce36bfa/ForgeSVN/forgesvn/tests/test_svn_app.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/test_svn_app.py b/ForgeSVN/forgesvn/tests/test_svn_app.py
index 7fd8545..6ea576a 100644
--- a/ForgeSVN/forgesvn/tests/test_svn_app.py
+++ b/ForgeSVN/forgesvn/tests/test_svn_app.py
@@ -40,7 +40,7 @@ class TestSVNApp(unittest.TestCase):
         ThreadLocalORMSession.close_all()
 
     def test_admin_menu(self):
-        assert_equals(len(c.app.admin_menu()), 6)
+        assert_equals(len(c.app.admin_menu()), 7)
         assert_equals(c.app.admin_menu()[0].label, 'Checkout URL')
 
     def test_uninstall(self):


[5/5] git commit: [#7134] Refactoring of external checkout URL option

Posted by jo...@apache.org.
[#7134] Refactoring of external checkout URL option

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/1c2ed49b
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/1c2ed49b
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/1c2ed49b

Branch: refs/heads/cj/7134
Commit: 1c2ed49b5dff8e4017cc383c022c82b96a4d458e
Parents: 7ce36bf
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Mar 26 21:47:56 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Mar 26 21:47:56 2014 +0000

----------------------------------------------------------------------
 Allura/allura/lib/repository.py                 | 33 ++++++++++++------
 Allura/allura/model/repository.py               |  4 +--
 Allura/allura/templates/repo/admin_options.html | 32 -----------------
 Allura/allura/templates/repo/checkout_url.html  | 36 ++++++++++++++++++++
 .../forgegit/tests/model/test_repository.py     |  2 +-
 ForgeSVN/forgesvn/svn_main.py                   | 31 +++++++----------
 .../forgesvn/templates/svn/checkout_url.html    | 19 +++++++++--
 .../forgesvn/tests/model/test_repository.py     |  2 +-
 ForgeSVN/forgesvn/tests/test_svn_app.py         |  2 +-
 9 files changed, 92 insertions(+), 69 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/1c2ed49b/Allura/allura/lib/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/repository.py b/Allura/allura/lib/repository.py
index 4e956bf..0dda832 100644
--- a/Allura/allura/lib/repository.py
+++ b/Allura/allura/lib/repository.py
@@ -55,7 +55,7 @@ class RepositoryApp(Application):
         ConfigOption('cloned_from_project_id', ObjectId, None),
         ConfigOption('cloned_from_repo_id', ObjectId, None),
         ConfigOption('init_from_url', str, None),
-        ConfigOption('clone_url', str, None)
+        ConfigOption('external_checkout_url', str, None)
     ]
     tool_label = 'Repository'
     default_mount_label = 'Code'
@@ -95,13 +95,24 @@ class RepositoryApp(Application):
         admin_url = c.project.url() + 'admin/' + \
             self.config.options.mount_point + '/'
         links = [
-            SitemapEntry('Viewable Files', admin_url + 'extensions', className='admin_modal')]
-        links.append(SitemapEntry('Refresh Repository',
-                                  c.project.url() +
-                                  self.config.options.mount_point +
-                                  '/refresh',
-                                  ))
+            SitemapEntry(
+                'Checkout URL',
+                c.project.url() + 'admin/' +
+                self.config.options.mount_point +
+                '/' + 'checkout_url',
+                className='admin_modal'),
+            SitemapEntry(
+                'Viewable Files',
+                admin_url + 'extensions',
+                className='admin_modal'),
+            SitemapEntry(
+                'Refresh Repository',
+                c.project.url() +
+                self.config.options.mount_point +
+                '/refresh'),
+        ]
         links += super(RepositoryApp, self).admin_menu()
+        [links.remove(l) for l in links[:] if l.label == 'Options']
         return links
 
     @h.exceptionless([], log)
@@ -248,14 +259,14 @@ class RepoAdminController(DefaultAdminController):
                         default_branch_name=self.app.default_branch_name)
 
     @without_trailing_slash
-    @expose('jinja:allura:templates/repo/admin_options.html')
-    def options(self):
+    @expose('jinja:allura:templates/repo/checkout_url.html')
+    def checkout_url(self):
         return dict(app=self.app)
 
     @without_trailing_slash
     @expose()
     @require_post()
-    def set_options(self, clone_url=None, **kw):
-        self.app.config.options.clone_url = clone_url or None
+    def set_checkout_url(self, **post_data):
+        self.app.config.options.external_checkout_url = post_data.get('external_checkout_url') or None
         flash('Repo options updated')
         redirect(c.project.url() + 'admin/tools')

http://git-wip-us.apache.org/repos/asf/allura/blob/1c2ed49b/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 12661a9..c08e546 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -555,8 +555,8 @@ class Repository(Artifact, ActivityObject):
         '''Return a URL string suitable for copy/paste that describes _this_ repo,
            e.g., for use in a clone/checkout command
         '''
-        if self.app.config.options.clone_url:
-            tpl = string.Template(self.app.config.options.clone_url)
+        if self.app.config.options.get('external_checkout_url', None):
+            tpl = string.Template(self.app.config.options.external_checkout_url)
         else:
             tpl = string.Template(
                 tg.config.get('scm.host.%s.%s' % (category, self.tool)))

http://git-wip-us.apache.org/repos/asf/allura/blob/1c2ed49b/Allura/allura/templates/repo/admin_options.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/admin_options.html b/Allura/allura/templates/repo/admin_options.html
deleted file mode 100644
index 2b2c0b7..0000000
--- a/Allura/allura/templates/repo/admin_options.html
+++ /dev/null
@@ -1,32 +0,0 @@
-{#-
-       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.
--#}
-<!DOCTYPE html>
-<form action="{{c.project.url()}}admin/{{app.config.options.mount_point}}/set_options" method="post">
-    <label class="grid-4">Clone / checkout URL:</label>
-    <div class="grid-9">
-        <input type="text" name="clone_url" id="clone_url" value="{{app.config.options.clone_url or ''}}"/>
-    </div>
-    <div class="grid-13">&nbsp;</div>
-    <hr>
-    <div class="grid-13">&nbsp;</div>
-    <div class="grid-13">
-	<input type="submit" value="Save"/>
-        <a href="#" class="close">Cancel</a>
-    </div>
-</form>

http://git-wip-us.apache.org/repos/asf/allura/blob/1c2ed49b/Allura/allura/templates/repo/checkout_url.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/checkout_url.html b/Allura/allura/templates/repo/checkout_url.html
new file mode 100644
index 0000000..8eaafd9
--- /dev/null
+++ b/Allura/allura/templates/repo/checkout_url.html
@@ -0,0 +1,36 @@
+{#-
+       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.
+-#}
+<!DOCTYPE html>
+<form action="{{c.project.url()}}admin/{{app.config.options.mount_point}}/set_checkout_url" method="post">
+    <label class="grid-4">External checkout URL:</label>
+    <div class="grid-9">
+        <input type="text" name="external_checkout_url" id="external_checkout_url" value="{{app.config.options.external_checkout_url or ''}}"/>
+    </div>
+    <div class="grid-13">
+        Override the checkout URL with an external one.  This is useful if this repository is a mirror
+        of another, canonical repository.
+    </div>
+    <div class="grid-13">&nbsp;</div>
+    <hr>
+    <div class="grid-13">&nbsp;</div>
+    <div class="grid-13">
+        <input type="submit" value="Save"/>
+        <a href="#" class="close">Cancel</a>
+    </div>
+</form>

http://git-wip-us.apache.org/repos/asf/allura/blob/1c2ed49b/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 106c63e..ff4ee48 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -477,7 +477,7 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
         assert_equal(
             self.repo.clone_url('https', 'nobody'),
             'https://nobody@localhost:8022/scm-repo/test/testgit')
-        with h.push_config(self.repo.app.config.options, clone_url='https://$username@foo.com/'):
+        with h.push_config(self.repo.app.config.options, external_checkout_url='https://$username@foo.com/'):
             assert_equal(
                 self.repo.clone_url('https', 'user'),
                 'https://user@foo.com/')

http://git-wip-us.apache.org/repos/asf/allura/blob/1c2ed49b/ForgeSVN/forgesvn/svn_main.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/svn_main.py b/ForgeSVN/forgesvn/svn_main.py
index 0bce7f6..e1cf7f7 100644
--- a/ForgeSVN/forgesvn/svn_main.py
+++ b/ForgeSVN/forgesvn/svn_main.py
@@ -100,17 +100,10 @@ class ForgeSVNApp(RepositoryApp):
             allura.tasks.repo_tasks.init.post()
 
     def admin_menu(self):
-        links = []
-        links.append(SitemapEntry(
-            'Checkout URL',
-            c.project.url() + 'admin/' +
-            self.config.options.mount_point +
-            '/' + 'checkout_url',
-            className='admin_modal'))
-        links.append(SitemapEntry(
+        links = super(ForgeSVNApp, self).admin_menu()
+        links.insert(1, SitemapEntry(
             'Import Repo',
             c.project.url() + 'admin/' + self.config.options.mount_point + '/' + 'importer/'))
-        links += super(ForgeSVNApp, self).admin_menu()
         return links
 
 
@@ -123,23 +116,25 @@ class SVNRepoAdminController(RepoAdminController):
     @without_trailing_slash
     @expose('jinja:forgesvn:templates/svn/checkout_url.html')
     def checkout_url(self, **kw):
-        return dict(app=self.app,
-                    allow_config=True,
-                    checkout_url=self.app.config.options.get('checkout_url'))
+        return dict(app=self.app, allow_config=True)
 
     @without_trailing_slash
     @expose()
     @require_post()
     def set_checkout_url(self, **post_data):
-        if svn_path_exists("file://%s%s/%s" %
-                          (self.app.repo.fs_path,
-                           self.app.repo.name,
-                           post_data['checkout_url'])):
-            self.app.config.options['checkout_url'] = post_data['checkout_url']
+        checkout_url = post_data.get('checkout_url')
+        external_checkout_url = post_data.get('external_checkout_url')
+        if checkout_url and svn_path_exists("file://%s%s/%s" %
+                                            (self.app.repo.fs_path,
+                                             self.app.repo.name,
+                                             checkout_url)):
+            self.app.config.options['checkout_url'] = checkout_url
             flash("Checkout URL successfully changed")
         else:
             flash("%s is not a valid path for this repository" %
-                  post_data['checkout_url'], "error")
+                  checkout_url, "error")
+        self.app.config.options.external_checkout_url = external_checkout_url
+        flash("External checkout URL successfully changed")
 
 
 class SVNImportController(BaseController):

http://git-wip-us.apache.org/repos/asf/allura/blob/1c2ed49b/ForgeSVN/forgesvn/templates/svn/checkout_url.html
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/templates/svn/checkout_url.html b/ForgeSVN/forgesvn/templates/svn/checkout_url.html
index 3960798..9931d0c 100644
--- a/ForgeSVN/forgesvn/templates/svn/checkout_url.html
+++ b/ForgeSVN/forgesvn/templates/svn/checkout_url.html
@@ -18,17 +18,29 @@
 -#}
 {% block content %}
 <form>
-  <label class="grid-13" for="checkout_url">Checkout url:</label>
-  <div class="grid-13">
+  <label class="grid-13" for="checkout_url">Checkout branch:</label>
+  <div class="grid-9" style="text-align:right">
     {{app.repo.clone_url('ro', app)}}
     {% if allow_config %}
       <input type="text" name="checkout_url"
              id="checkout_url"
-             {% if checkout_url %} value="{{checkout_url}}"{% endif %}/>
+             {% if app.config.options.checkout_url %} value="{{app.config.options.checkout_url}}"{% endif %}/>
     {% else %}
       <span>{{checkout_url}}</span>
     {% endif %}
   </div>
+  <div class="grid-4">
+      e.g., trunk
+  </div>
+  <div class="grid-13">&nbsp;</div>
+  <label class="grid-4">External checkout URL:</label>
+  <div class="grid-5" style="text-align:right">
+      <input type="text" name="external_checkout_url" id="external_checkout_url" value="{{app.config.options.external_checkout_url or ''}}"/>
+  </div>
+  <div class="grid-13">
+      Override the checkout URL with an external one.  This is useful if this repository is a mirror
+      of another, canonical repository.
+  </div>
 
   {% if allow_config %}
   <div class="grid-13">&nbsp;</div>
@@ -45,6 +57,7 @@
         var cval = $.cookie('_session_id');
         $.post('{{c.project.url()}}admin/{{app.config.options.mount_point}}/set_checkout_url', {
             checkout_url: $('#checkout_url').val(),
+            external_checkout_url: $('#external_checkout_url').val(),
             _session_id:cval
         },
         function () {

http://git-wip-us.apache.org/repos/asf/allura/blob/1c2ed49b/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 2fb7207..3ad13c7 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -784,7 +784,7 @@ class TestRepo(_TestWithRepo):
             self.repo.clone_url('https', 'nobody')
             == 'https://nobody@localhost:8022/scm-repo/p/test/test1/'),\
             self.repo.clone_url('https', 'nobody')
-        with h.push_config(self.repo.app.config.options, clone_url='https://$username@foo.com/'):
+        with h.push_config(self.repo.app.config.options, external_checkout_url='https://$username@foo.com/'):
             assert_equal(
                 self.repo.clone_url('https', 'user'),
                 'https://user@foo.com/')

http://git-wip-us.apache.org/repos/asf/allura/blob/1c2ed49b/ForgeSVN/forgesvn/tests/test_svn_app.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/test_svn_app.py b/ForgeSVN/forgesvn/tests/test_svn_app.py
index 6ea576a..7fd8545 100644
--- a/ForgeSVN/forgesvn/tests/test_svn_app.py
+++ b/ForgeSVN/forgesvn/tests/test_svn_app.py
@@ -40,7 +40,7 @@ class TestSVNApp(unittest.TestCase):
         ThreadLocalORMSession.close_all()
 
     def test_admin_menu(self):
-        assert_equals(len(c.app.admin_menu()), 7)
+        assert_equals(len(c.app.admin_menu()), 6)
         assert_equals(c.app.admin_menu()[0].label, 'Checkout URL')
 
     def test_uninstall(self):


[2/5] git commit: actually fix the flaky test

Posted by jo...@apache.org.
actually fix the flaky test


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/800530cc
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/800530cc
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/800530cc

Branch: refs/heads/cj/7134
Commit: 800530cc07bf87fe570db243c7ebdc41487e79b4
Parents: f9c81e2
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Mar 25 22:21:38 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Mar 25 22:21:38 2014 +0000

----------------------------------------------------------------------
 Allura/allura/tests/functional/test_admin.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/800530cc/Allura/allura/tests/functional/test_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_admin.py b/Allura/allura/tests/functional/test_admin.py
index 0861a15..fd77f6d 100644
--- a/Allura/allura/tests/functional/test_admin.py
+++ b/Allura/allura/tests/functional/test_admin.py
@@ -25,7 +25,7 @@ import logging
 
 import tg
 import PIL
-from nose.tools import assert_equals, assert_in, assert_not_in, assert_greater_equal
+from nose.tools import assert_equals, assert_in, assert_not_in
 from ming.orm.ormsession import ThreadLocalORMSession
 from tg import expose
 from pylons import tmpl_context as c, app_globals as g
@@ -325,8 +325,8 @@ class TestProjectAdmin(TestController):
     def test_tool_paging(self):
         r = self.app.get('/admin/tools')
         items = r.html.findAll('ul', {'class': 'deck'})
-        log.debug('test_tool_paging: got %s tools: %s', len(items), items)
-        assert_greater_equal(2, len(items))
+        # sometimes the activity tool is present, sometimes it isn't - not sure why
+        assert_in(len(items), (2, 3))
         r = self.app.get('/admin/tools?limit=1&page=0')
         assert_equals(1, len(r.html.findAll('ul', {'class': 'deck'})))
         r = self.app.get('/admin/tools?limit=1&page=1')