Merge branch '42cc_2886' of ssh://git.code.sf.net/p/allura/git into 42cc_2886
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 4e5709d..472eef7 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -74,7 +74,7 @@
         mount_label = mount_label or '%s - Code' % c.project.name
         try:
             to_name = (to_name or
-                    re.search('\w+$', from_project.shortname).group(0))
+                    re.search('[a-z]+$', from_project.shortname).group(0))
         except AttributeError:
             to_name = ''
         if request.method != 'POST' or not to_name:
@@ -87,7 +87,6 @@
                 if not to_project.database_configured:
                     to_project.configure_project(is_user_project=True)
                 security.require(security.has_access(to_project, 'admin'))
-                to_name = from_project.shortname
                 try:
                     to_project.install_app(
                         ep_name=from_repo.tool_name,
diff --git a/Allura/allura/controllers/static.py b/Allura/allura/controllers/static.py
index 358ba68..4052bc9 100644
--- a/Allura/allura/controllers/static.py
+++ b/Allura/allura/controllers/static.py
@@ -20,25 +20,3 @@
         h.set_context(project, app, neighborhood=neighborhood)
         html = g.markdown_wiki.convert(markdown)
         return html
-
-    @expose()
-    @with_trailing_slash
-    def redirect(self, path, **kw):
-        """Redirect to external sites."""
-
-        # Make sure the url can be encoded to iso-8859-1 (required for HTTP
-        # headers. If it can't, urlquote it first, then redirect. Allows us to
-        # redirect to external links in markdown, even if the url contains
-        # unquoted unicode chars.
-        try:
-            path.encode('ISO-8859-1')
-        except UnicodeEncodeError:
-            i = path.find('://')
-            if i > -1:
-                scheme = path[:i+3]
-                path = path[i+3:]
-            else:
-                scheme = ''
-            path = scheme + h.urlquote(path)
-        redirect(path)
-
diff --git a/Allura/allura/ext/user_profile/templates/user_index.html b/Allura/allura/ext/user_profile/templates/user_index.html
index af87c8e..2ccaacd 100644
--- a/Allura/allura/ext/user_profile/templates/user_index.html
+++ b/Allura/allura/ext/user_profile/templates/user_index.html
@@ -22,7 +22,6 @@
   {% if user.preferences.email_address %}
     <p>{{lib.gravatar(user)}}</p>
   {% endif %}
-  {{c.project.description_html|safe}}
   <div class="project-list grid-18">
     <b>Projects</b>
     <ul>
diff --git a/Allura/allura/lib/markdown_extensions.py b/Allura/allura/lib/markdown_extensions.py
index 14039ee..5982710 100644
--- a/Allura/allura/lib/markdown_extensions.py
+++ b/Allura/allura/lib/markdown_extensions.py
@@ -228,7 +228,6 @@
             if 'sf.net' in val or 'sourceforge.net' in val:
                 return
             else:
-                tag[attr] = '/nf/redirect/?path=%s' % h.urlquote(val)
                 tag['rel']='nofollow'
                 return
         if val.startswith('/'): return
diff --git a/Allura/allura/tests/functional/test_root.py b/Allura/allura/tests/functional/test_root.py
index 299baaa..6d89187 100644
--- a/Allura/allura/tests/functional/test_root.py
+++ b/Allura/allura/tests/functional/test_root.py
@@ -92,15 +92,6 @@
         r = self.app.get('/nf/markdown_to_html?markdown=*aaa*bb[wiki:Home]&project=test&app=bugs&neighborhood=%s' % n._id, validate_chunk=True)
         assert '<p><em>aaa</em>bb<a href="/p/test/wiki/Home/">[wiki:Home]</a></p>' in r, r
 
-    def test_redirect_external(self):
-        r = self.app.get('/nf/redirect/?path=%s' % quote('http://en.wikipedia.org/wiki/Aho–Corasick_string_matching_algorithm'))
-        assert r.status_int == 302
-        assert r.location == 'http://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_string_matching_algorithm'
-
-        r = self.app.get('/nf/redirect/?path=%s' % quote('http://google.com'))
-        assert r.status_int == 302
-        assert r.location == 'http://google.com'
-
     def test_slash_redirect(self):
         r = self.app.get('/p',status=301)
         r = self.app.get('/p/',status=200)
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index 118a79e..0557672 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -123,9 +123,9 @@
     assert '<a href=' not in g.markdown.convert('# Foo!\n[Rooted]')
     assert '<a href=' in g.markdown.convert('This is http://sf.net')
     tgt = 'http://everything2.com/?node=nate+oostendorp'
-    url = '/nf/redirect/?path=%s' % quote(tgt)
     s = g.markdown.convert('This is %s' % tgt)
-    assert s == '<div class="markdown_content"><p>This is <a href="%s" rel="nofollow">%s</a></p></div>' % (url, tgt), s
+    assert_equal(
+        s, '<div class="markdown_content"><p>This is <a href="%s" rel="nofollow">%s</a></p></div>' % (tgt, tgt))
     assert '<a href=' in g.markdown.convert('This is http://sf.net')
     # assert '<a href=' in g.markdown_wiki.convert('This is a WikiPage')
     # assert '<a href=' not in g.markdown_wiki.convert('This is a WIKIPAGE')
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 2660955..7826cba 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -37,18 +37,26 @@
         ThreadLocalORMSession.close_all()
 
     def test_fork(self):
+        r = self.app.get('%sfork/' % c.app.repo.url())
+        assert '<input type="text" name="to_name" value="test"/>' in r
+        assert '<input type="text" name="mount_label" value="test - Code"/>' \
+                in r
+
         to_project = M.Project.query.get(shortname='test2', neighborhood_id=c.project.neighborhood_id)
+        to_name = 'reponame'
         r = self.app.post('/src-git/fork', params=dict(
             project_id=str(to_project._id),
-            to_name='code'))
+            to_name=to_name,
+            mount_label='Test forked repository'))
         cloned_from = c.app.repo
-        with h.push_context('test2', 'code', neighborhood='Projects'):
+        with h.push_context('test2', to_name, neighborhood='Projects'):
             c.app.repo.init_as_clone(
                     cloned_from.full_fs_path,
                     cloned_from.app.config.script_name(),
                     cloned_from.full_fs_path)
-        r = self.app.get('/p/test2/code').follow().follow().follow()
+        r = self.app.get('/p/test2/%s' % to_name).follow().follow().follow()
         assert 'Clone of' in r
+        assert 'Test forked repository' in r
         r = self.app.get('/src-git/').follow().follow()
         assert 'Forks' in r
 
diff --git a/scripts/migrations/023-migrate-custom-profile-text.py b/scripts/migrations/023-migrate-custom-profile-text.py
new file mode 100644
index 0000000..e2eda7d
--- /dev/null
+++ b/scripts/migrations/023-migrate-custom-profile-text.py
@@ -0,0 +1,56 @@
+import logging
+import re
+
+from pylons import c
+
+from ming.orm import ThreadLocalORMSession
+
+from allura import model as M
+from forgewiki import model as WM
+from forgewiki.wiki_main import ForgeWikiApp
+
+log = logging.getLogger(__name__)
+
+default_description = r'^\s*(?:You can edit this description in the admin page)?\s*$'
+
+default_personal_project_tmpl = ("This is the personal project of %s."
+            " This project is created automatically during user registration"
+            " as an easy place to store personal data that doesn't need its own"
+            " project such as cloned repositories.\n\n%s")
+
+def main():
+    for p in M.Project.query.find().all():
+        user = p.user_project_of
+        if not user:
+            continue
+
+        description = p.description
+        if description is None or re.match(default_description, description):
+            continue
+
+        app = p.app_instance('wiki')
+        if app is None:
+            p.install_app('wiki')
+
+        page = WM.Page.query.get(app_config_id=app.config._id, title='Home')
+        if page is None:
+            continue
+
+        c.app = app
+        c.project = p
+        c.user = user
+
+        if "This is the personal project of" in page.text:
+            if description not in page.text:
+                page.text = "%s\n\n%s" % (page.text, description)
+                log.info("Update wiki home page text for %s" % user.username)
+        elif "This is the default page" in page.text:
+            page.text = default_personal_project_tmpl % (user.display_name, description)
+            log.info("Update wiki home page text for %s" % user.username)
+        else:
+            pass
+
+    ThreadLocalORMSession.flush_all()
+
+if __name__ == '__main__':
+    main()