You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/04/21 11:33:28 UTC

[01/14] allura git commit: [#7870] Standardize .ini comments with ;

Repository: allura
Updated Branches:
  refs/heads/ib/7866 49298f0c6 -> d162d676d (forced update)


[#7870] Standardize .ini comments with ;

'#' sort of works, but you actually end up with config keys like '# my comment'


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

Branch: refs/heads/ib/7866
Commit: 251f413d4c8242aca04d2218d2cf25004f3cdc76
Parents: 3ff1ade
Author: Dave Brondsema <da...@brondsema.net>
Authored: Thu Apr 9 17:03:57 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Mon Apr 20 12:51:29 2015 -0400

----------------------------------------------------------------------
 Allura/development.ini | 310 ++++++++++++++++++++++----------------------
 1 file changed, 155 insertions(+), 155 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/251f413d/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index b6c3154..b7ccde6 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -1,34 +1,34 @@
-#       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.
-#
-# allura - Pylons development environment configuration
-#
-# The %(here)s variable will be replaced with the parent directory of this file
-#
-# This file is for deployment specific config options -- other configuration
-# that is always required for the app is done in the config directory,
-# and generally should not be modified by end users.
+;       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.
+;
+; allura - Pylons development environment configuration
+;
+; The %(here)s variable will be replaced with the parent directory of this file
+;
+; This file is for deployment specific config options -- other configuration
+; that is always required for the app is done in the config directory,
+; and generally should not be modified by end users.
 
 [DEFAULT]
 debug = true
-# Uncomment and replace with the address which should receive any error reports
-#email_to = you@yourdomain.com
+; Uncomment and replace with the address which should receive any error reports
+;email_to = you@yourdomain.com
 
-# Smtp settings
+; Smtp settings
 ;smtp_tls = False
 ;smtp_ssl = True
 ;smtp_user = some_user
@@ -59,12 +59,12 @@ site_name = Allura
 domain = localhost
 base_url = http://localhost:8080
 
-#lang = ru
+;lang = ru
 cache_dir = %(here)s/data
 
-# Cache Neighborhood objects for N seconds (speeds up requests).
-# Set to 0 to disable (the default).
-# neighborhood.cache.duration = 0
+; Cache Neighborhood objects for N seconds (speeds up requests).
+; Set to 0 to disable (the default).
+; neighborhood.cache.duration = 0
 
 ; Docs at http://beaker.readthedocs.org/en/latest/configuration.html#session-options
 ; and http://beaker.readthedocs.org/en/latest/modules/session.html#beaker.session.CookieSession
@@ -76,29 +76,29 @@ beaker.session.secure = false
 ; CHANGE THIS VALUE FOR YOUR SITE
 beaker.session.validate_key = 714bfe3612c42390726f
 
-# Google Analytics account for tracking
-# ga.account = UA-XXXXX-X
+; Google Analytics account for tracking
+; ga.account = UA-XXXXX-X
 
 registration.method = local
-# theme = sftheme
+; theme = sftheme
 theme = allura
 show_export_control = false
 
-# auth.method = ldap
+; auth.method = ldap
 auth.method = local
 auth.remember_for = 365  ; in days, for the "remember me" checkbox on login
-# auth.login_url = /auth/
-# auth.logout_url = /auth/logout
-# auth.login_fragment_url = /auth/login_fragment
+; auth.login_url = /auth/
+; auth.logout_url = /auth/logout
+; auth.login_fragment_url = /auth/login_fragment
 
 auth.min_password_len = 6
 auth.max_password_len = 30
 
-# password expiration options (disabled if neither is set)
-# auth.pwdexpire.days = 1
-# auth.pwdexpire.before = 1401949912  ; unix timestamp
+; password expiration options (disabled if neither is set)
+; auth.pwdexpire.days = 1
+; auth.pwdexpire.before = 1401949912  ; unix timestamp
 
-# if using LDAP, also run `pip install python-ldap` in your Allura environment
+; if using LDAP, also run `pip install python-ldap` in your Allura environment
 
 auth.ldap.server = ldap://localhost
 auth.ldap.suffix = ou=people,dc=localdomain
@@ -108,11 +108,11 @@ auth.ldap.schroot_name = scm
 auth.ldap.password.algorithm = 6
 auth.ldap.password.rounds = 6000
 auth.ldap.password.salt_len = 16
-# "autoregister" allows users to log in to Allura with an existing LDAP account
-# If using ldap, with autoregister, you should also set "allow_user_registration"
-# to false below.
-# Set "autoregister" to false to require user to register in Allura to create
-# the LDAP record and Allura record for the user.
+; "autoregister" allows users to log in to Allura with an existing LDAP account
+; If using ldap, with autoregister, you should also set "allow_user_registration"
+; to false below.
+; Set "autoregister" to false to require user to register in Allura to create
+; the LDAP record and Allura record for the user.
 auth.ldap.autoregister = true
 
 auth.allow_user_registration = true
@@ -125,16 +125,16 @@ auth.allow_birth_date = true
 auth.allow_non_primary_email_password_reset = true
 auth.require_email_addr = true
 
-# In seconds
+; In seconds
 auth.recovery_hash_expiry_period = 600
 
 user_prefs_storage.method = local
-# user_prefs_storage.method = ldap
-# If using ldap, you can specify which fields to use for a preference.
-# Any fields not specified here will be stored locally in mongo
+; user_prefs_storage.method = ldap
+; If using ldap, you can specify which fields to use for a preference.
+; Any fields not specified here will be stored locally in mongo
 user_prefs_storage.ldap.fields.display_name = cn
 
-# Limit the number of emails a user can claim.
+; Limit the number of emails a user can claim.
 user_prefs.maximum_claimed_emails = 20
 
 ; Spam filtering service: mollom or akismet
@@ -145,32 +145,32 @@ user_prefs.maximum_claimed_emails = 20
 ;spam.public_key =
 ;spam.private_key =
 
-# webhook.timeout = 30  # seconds, default = 30
+; webhook.timeout = 30  # seconds, default = 30
 
-# List of pauses between retries, if hook fails (in seconds)
-# webhook.retry = 60 120 240
+; List of pauses between retries, if hook fails (in seconds)
+; webhook.retry = 60 120 240
 
-# Limit rate of webhook firing (in seconds, default = 30)
-# Option format: webhook.<hook type>.limit,
-# all '-' in hook type must be changed to '_'
-# e.g. for repo-push webhook:
-# webhook.repo_push.limit = 10
+; Limit rate of webhook firing (in seconds, default = 30)
+; Option format: webhook.<hook type>.limit,
+; all '-' in hook type must be changed to '_'
+; e.g. for repo-push webhook:
+; webhook.repo_push.limit = 10
 
-# Limit max number of hooks that can be created for given project/app
-# Option name format: same as above.
-# Value format: json dict, where keys are app names (as appears in
-# `WebhookSender.triggered_by`) and values are actual limits (default=3), e.g.:
-# webhook.repo_push.max_hooks = {"git": 3, "hg": 3, "svn": 3}
+; Limit max number of hooks that can be created for given project/app
+; Option name format: same as above.
+; Value format: json dict, where keys are app names (as appears in
+; `WebhookSender.triggered_by`) and values are actual limits (default=3), e.g.:
+; webhook.repo_push.max_hooks = {"git": 3, "hg": 3, "svn": 3}
 
-# Additional fields for admin project/user search
-# Note: whitespace after comma is important!
-# search.project.additional_search_fields = private, url, title
-# search.user.additional_search_fields = email_addresses
+; Additional fields for admin project/user search
+; Note: whitespace after comma is important!
+; search.project.additional_search_fields = private, url, title
+; search.user.additional_search_fields = email_addresses
 
-# Additional fields to show in the result of admin project/user search
-# Note: whitespace after comma is important!
-# search.project.additional_display_fields = private, url, title
-# search.user.additional_display_fields = email_addresses
+; Additional fields to show in the result of admin project/user search
+; Note: whitespace after comma is important!
+; search.project.additional_display_fields = private, url, title
+; search.user.additional_display_fields = email_addresses
 
 ; To make all pages use ssl:   (also set beaker.session.secure above)
 ; force_ssl.pattern = .
@@ -182,10 +182,10 @@ user_prefs.maximum_claimed_emails = 20
 ; no_redirect.pattern = ^/nf/\d+/_(ew|static)_/|^/rest/|^/nf/tool_icon_css|^/auth/refresh_repo
 
 
-# Set the locations of some static resources.  ("ew" stands for EasyWidgets library)
-#  script_name is the path that is handled by the application
-#  url_base is the prefix that references to the static resources should have
-# If you use a CDN, put your CDN prefix in the url_base values
+; Set the locations of some static resources.  ("ew" stands for EasyWidgets library)
+;  script_name is the path that is handled by the application
+;  url_base is the prefix that references to the static resources should have
+; If you use a CDN, put your CDN prefix in the url_base values
 ew.script_name = /nf/%(build_key)s/_ew_/
 ew.url_base = /nf/%(build_key)s/_ew_/
 static.script_name = /nf/%(build_key)s/_static_/
@@ -199,26 +199,26 @@ ew.extra_headers = [ ('Access-Control-Allow-Origin', '*') ]
 ; If your environment (e.g. behind a server-side proxy) needs to look at an http header to get the actual remote addr
 ;ip_address_header = X-Forwarded-For
 
-# SCM settings for local development
+; SCM settings for local development
 scm.host.ro.git = /srv/git$path
 scm.host.rw.git = /srv/git$path
-# remote access varies by configuration.  If you are using a vagrant VM, this should work:
-#scm.host.rw.git = ssh://vagrant@localhost:2222/srv/git$path
+; remote access varies by configuration.  If you are using a vagrant VM, this should work:
+;scm.host.rw.git = ssh://vagrant@localhost:2222/srv/git$path
 scm.host.ro.hg = /srv/hg$path
 scm.host.rw.hg = /srv/hg$path
 scm.host.ro.svn = file:///srv/svn$path/
 scm.host.rw.svn = file:///srv/svn$path/
 
-# SCM settings for chroot + ldap configuration.  See Allura/docs/getting_started/scm_host.rst
-# scm.host.ro.git = git://git.localhost$path
-# scm.host.rw.git = ssh://$username@localhost:8022/scm-repo$path
-# scm.host.ro.hg = http://hg.localhost$path
-# scm.host.rw.hg = ssh://$username@localhost:8022/scm-repo$path
-# scm.host.ro.svn = http://svn.localhost$path/
-# scm.host.rw.svn = svn+ssh://localhost:8022/scm-repo$path/
+; SCM settings for chroot + ldap configuration.  See Allura/docs/getting_started/scm_host.rst
+; scm.host.ro.git = git://git.localhost$path
+; scm.host.rw.git = ssh://$username@localhost:8022/scm-repo$path
+; scm.host.ro.hg = http://hg.localhost$path
+; scm.host.rw.hg = ssh://$username@localhost:8022/scm-repo$path
+; scm.host.ro.svn = http://svn.localhost$path/
+; scm.host.rw.svn = svn+ssh://localhost:8022/scm-repo$path/
 
-# SCM settings for https (sorry no docs for setting these up)
-# these settings are currently required by the template, no matter what
+; SCM settings for https (sorry no docs for setting these up)
+; these settings are currently required by the template, no matter what
 scm.host.https.git = https://$username@localhost:8022/scm-repo$path
 scm.host.https_anon.git = https://localhost:8022/scm-repo$path
 scm.host.https.hg = https://$username@localhost:8022/scm-repo$path
@@ -253,21 +253,21 @@ bulk_export_download_instructions = Sample instructions for {project}
 
 importer_upload_path = /tmp/importer_upload/{nbhd}/{project}
 
-# GitHub importer keys.  For github ticket import, it is best to set
-# up an app at https://github.com/settings/applications  Use the root URL
-# of your Allura instance for both URLs, and enter client values here:
-# github_importer.client_id =
-# github_importer.client_secret =
+; GitHub importer keys.  For github ticket import, it is best to set
+; up an app at https://github.com/settings/applications  Use the root URL
+; of your Allura instance for both URLs, and enter client values here:
+; github_importer.client_id =
+; github_importer.client_secret =
 
-# space-separated list of tool names that are valid options
-# for project admins to set for their 'support_page' field
-# this field is not used by default in Allura, so this option
-# is disabled by default
-#support_tool_choices = wiki tickets discussion
+; space-separated list of tool names that are valid options
+; for project admins to set for their 'support_page' field
+; this field is not used by default in Allura, so this option
+; is disabled by default
+;support_tool_choices = wiki tickets discussion
 
 trovecategories.enableediting = true
 
-# ActivityStream
+; ActivityStream
 activitystream.master = mongodb://127.0.0.1:27017
 activitystream.database = activitystream
 activitystream.activity_collection = activities
@@ -276,9 +276,9 @@ activitystream.timeline_collection = timelines
 activitystream.enabled = true
 activitystream.recording.enabled = true
 
-# Ming setup
-# These don't necessarily have to be separate databases, they could
-# be all in the same database if desired
+; Ming setup
+; These don't necessarily have to be separate databases, they could
+; be all in the same database if desired
 ming.main.uri = mongodb://127.0.0.1:27017/allura
 ming.main.auto_ensure_indexes = False
 ming.project.uri = mongodb://127.0.0.1:27017/project-data
@@ -288,57 +288,57 @@ ming.task.auto_ensure_indexes = False
 ming.zarkov.uri = mongodb://127.0.0.1:27017/zarkov
 ming.zarkov.auto_ensure_indexes = False
 
-# Zarkov host setting, requires the zarkov and gevent libraries.
-#zarkov.host = tcp://127.0.0.1:9000
+; Zarkov host setting, requires the zarkov and gevent libraries.
+;zarkov.host = tcp://127.0.0.1:9000
 
 stats.sample_rate = 1
 
 ; Taskd setup
 monq.poll_interval=2
 
-# SOLR setup
+; SOLR setup
 solr.server = http://localhost:8983/solr
-# commit on every add/delete?
+; commit on every add/delete?
 solr.commit = false
-# commit add operations within N ms
+; commit add operations within N ms
 solr.commitWithin = 10000
-# Use improved data types for labels and custom fields?
-# New Allura deployments should leave this set to true. Existing deployments
-# should set to false until existing data has been reindexed. Reindexing will
-# convert existing label and custom field data to more appropriate solr types.
+; Use improved data types for labels and custom fields?
+; New Allura deployments should leave this set to true. Existing deployments
+; should set to false until existing data has been reindexed. Reindexing will
+; convert existing label and custom field data to more appropriate solr types.
 solr.use_new_types = true
 
-# Forgemail server
+; Forgemail server
 forgemail.host = 0.0.0.0
 forgemail.port = 8825
 forgemail.domain = .in.sf.net
 forgemail.url = http://localhost:8080
 forgemail.return_path = noreply@sf.net
 
-# Specify the number of projects allowed to be created by a user
-# depending on the age of their user account.
-# Keys are number of seconds, values are max number of projects allowed
-# (including the default user-project, so you probably want to add 1)
-# This example allows for 1 project if the account is less than an hour old
-# and 5 projects if the account is less than a day old.  No limits after that
-# project.rate_limits = {"3600": 2, "86400": 6}
+; Specify the number of projects allowed to be created by a user
+; depending on the age of their user account.
+; Keys are number of seconds, values are max number of projects allowed
+; (including the default user-project, so you probably want to add 1)
+; This example allows for 1 project if the account is less than an hour old
+; and 5 projects if the account is less than a day old.  No limits after that
+; project.rate_limits = {"3600": 2, "86400": 6}
 
-# Special Command settings
-# no need to sleep in devel
+; Special Command settings
+; no need to sleep in devel
 ensure_index.sleep = 0
 
-# set this to "false" if you are deploying to production and want performance improvements
+; set this to "false" if you are deploying to production and want performance improvements
 auto_reload_templates = true
 
-# WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*
-# Debug mode will enable the interactive debugging tool, allowing ANYONE to
-# execute malicious code after an exception is raised.
-#set debug = false
+; WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*
+; Debug mode will enable the interactive debugging tool, allowing ANYONE to
+; execute malicious code after an exception is raised.
+;set debug = false
 
-# Enable or disable external RSS feed importing in ForgeBlog tool.
-# Default is "false". This feature requires GPL library "html2text". Install it
-# with following command:
-# pip install -e git://github.com/brondsem/html2text.git#egg=html2text
+; Enable or disable external RSS feed importing in ForgeBlog tool.
+; Default is "false". This feature requires GPL library "html2text". Install it
+; with following command:
+; pip install -e git://github.com/brondsem/html2text.git#egg=html2text
 forgeblog.exfeed = false
 
 short_url.url_pattern = {base_url}/{nbhd}/{project}/{mount_point}/{short_name}
@@ -356,16 +356,16 @@ beaker.session.key = allura
 beaker.session.type = cookie
 beaker.session.validate_key = 714bfe3612c42390726f
 
-# Ming setup
+; Ming setup
 ming.main.uri = mongo://127.0.0.1:27017/allura:test
 
 sqlalchemy.url = sqlite:///%(here)s/devdata.db
-#echo shouldn't be used together with the logging module.
+;echo shouldn't be used together with the logging module.
 sqlalchemy.echo = false
 sqlalchemy.echo_pool = false
 sqlalchemy.pool_recycle = 3600
 
-# Forgemail server
+; Forgemail server
 forgemail.host = 0.0.0.0
 forgemail.port = 8825
 forgemail.domain = .in.sf.net
@@ -375,26 +375,26 @@ forgemail.url = http://localhost:8080
 auth.method = local
 registration.method = local
 
-# When rendering discussion post Markdown to html, if the render takes longer
-# than `markdown_cache_threshold` (in seconds), the resulting html will be
-# cached and served from cache on subsequent requests. Set to 0 to cache all
-# posts. Remove entirely to cache nothing.
+; When rendering discussion post Markdown to html, if the render takes longer
+; than `markdown_cache_threshold` (in seconds), the resulting html will be
+; cached and served from cache on subsequent requests. Set to 0 to cache all
+; posts. Remove entirely to cache nothing.
 markdown_cache_threshold = .1
-# markdown text longer than max length will not be converted to html
+; markdown text longer than max length will not be converted to html
 markdown_render_max_length = 999999999
 
-# If your site has docs about specific importers, you can add them here and
-# they'll appear on the import forms
-#doc.url.importers.Google Code = http://...
+; If your site has docs about specific importers, you can add them here and
+; they'll appear on the import forms
+;doc.url.importers.Google Code = http://...
 
 [app:task]
 use = main
 override_root = task ; TurboGears will use controllers/task.py as root controller
 
-# Logging configuration
-# Add additional loggers, handlers, formatters here
-# Uses python's logging config file format
-# http://docs.python.org/lib/logging-config-fileformat.html
+; Logging configuration
+; Add additional loggers, handlers, formatters here
+; Uses python's logging config file format
+; http://docs.python.org/lib/logging-config-fileformat.html
 
 [loggers]
 keys = root, allura, sqlalchemy, paste, pylons, taskdstatus, timermiddleware, tmw_details
@@ -405,7 +405,7 @@ keys = console, stats, taskdstatus, timermiddleware
 [formatters]
 keys = generic, stats, timermiddleware
 
-# If you create additional loggers, add them as a key to [loggers]
+; If you create additional loggers, add them as a key to [loggers]
 [logger_root]
 level = INFO
 handlers = console, stats
@@ -419,9 +419,9 @@ qualname = allura
 level = INFO
 handlers =
 qualname = sqlalchemy.engine
-# "level = INFO" logs SQL queries.
-# "level = DEBUG" logs SQL queries and results.
-# "level = WARN" logs neither.  (Recommended for production systems.)
+; "level = INFO" logs SQL queries.
+; "level = DEBUG" logs SQL queries and results.
+; "level = WARN" logs neither.  (Recommended for production systems.)
 
 [logger_paste]
 level = INFO
@@ -434,7 +434,7 @@ qualname = pylons
 handlers =
 
 [logger_tmw_details]
-# DEBUG will include every instrumented call in our logging
+; DEBUG will include every instrumented call in our logging
 level = INFO
 qualname = timermiddleware
 handlers =
@@ -450,7 +450,7 @@ handlers = timermiddleware
 qualname = stats
 propagate = 0
 
-# If you create additional handlers, add them as a key to [handlers]
+; If you create additional handlers, add them as a key to [handlers]
 [handler_console]
 class = StreamHandler
 args = (sys.stderr,)
@@ -471,13 +471,13 @@ formatter = generic
 
 [handler_timermiddleware]
 class = handlers.WatchedFileHandler
-# if you run 'paster serve' in allura/Allura/ then that's where this file will be
-# you may want to hard-code a specific directory here.
+; if you run 'paster serve' in allura/Allura/ then that's where this file will be
+; you may want to hard-code a specific directory here.
 args = ('stats.log', 'a')
 level = NOTSET
 formatter = timermiddleware
 
-# If you create additional formatters, add them as a key to [formatters]
+; If you create additional formatters, add them as a key to [formatters]
 [formatter_generic]
 format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
 datefmt = %H:%M:%S


[05/14] allura git commit: [#7870] further comments in development.ini

Posted by je...@apache.org.
[#7870] further comments in development.ini


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

Branch: refs/heads/ib/7866
Commit: 95af4cb76ceb03a832ab91f515331bf88daba5d1
Parents: 2cdb4f8
Author: Dave Brondsema <da...@brondsema.net>
Authored: Mon Apr 20 12:11:46 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Mon Apr 20 12:51:30 2015 -0400

----------------------------------------------------------------------
 Allura/development.ini | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/95af4cb7/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index b7e0b95..5d68aed 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -77,7 +77,9 @@ full_stack = true
 site_name = Allura
 ; Change these to your website's domain
 domain = localhost
+; Change this to your website's full URL
 base_url = http://localhost:8080
+; This should be the same as base_url
 forgemail.url = http://localhost:8080
 
 ; Used to uniquify references to static resources, can be a timestamp or any unique value
@@ -111,7 +113,7 @@ beaker.session.validate_key = 714bfe3612c42390726f
 ; Google Analytics account for tracking
 ;ga.account = UA-XXXXX-X
 
-; Project registration system.  Only local is available, unless you write a custom one for custom integratino.
+; Project registration system.  Only local is available, unless you write a custom one for custom integration.
 registration.method = local
 theme = allura
 
@@ -123,6 +125,7 @@ auth.remember_for = 365  ; in days, for the "remember me" checkbox on login
 ; Customize login/logout URLs only if you have some custom authentication set up.
 auth.login_url = /auth/
 auth.logout_url = /auth/logout
+; the login fragement URL shows just the form, not a whole page.  It is used within a login overlay on some pages
 auth.login_fragment_url = /auth/login_fragment/
 auth.post_logout_url = /
 
@@ -367,6 +370,7 @@ ming.task.auto_ensure_indexes = False
 stats.sample_rate = 1
 
 ; Taskd setup
+; number of seconds to sleep between checking for new tasks
 monq.poll_interval=2
 
 ; SOLR setup
@@ -404,10 +408,13 @@ forgemail.domain = .in.localhost
 ; set this to "false" if you are deploying to production and want performance improvements
 auto_reload_templates = true
 
-; How frequently users can send messages
+; How frequently users can send messages, in seconds
 user_message.time_interval = 3600
+; Max number of messages that can be sent within that time interval.
 user_message.max_messages = 20
+
 ; Default number of times to show a sitewide notification
+; See https://forge-allura.apache.org/docs/getting_started/administration.html#site-notifications
 site_notification.impressions = 0
 
 ; When rendering discussion post Markdown to html, if the render takes longer
@@ -424,6 +431,7 @@ markdown_render_max_length = 999999999
 show_export_control = false
 
 ; By default project admins can soft-delete their projects.
+; A soft-deleted project will still be in the database and visible to admins, but not to others.
 allow_project_delete = true
 allow_project_undelete = true
 
@@ -483,7 +491,7 @@ override_root = task ; TurboGears will use controllers/task.py as root controlle
 ;
 ; Add additional loggers, handlers, formatters here
 ; Uses python's logging config file format
-; http://docs.python.org/lib/logging-config-fileformat.html
+; https://docs.python.org/2/library/logging.config.html#configuration-file-format
 ;
 [loggers]
 keys = root, allura, sqlalchemy, paste, pylons, taskdstatus, timermiddleware, tmw_details


[12/14] allura git commit: [#7866] ticket:754 Cache can_merge results

Posted by je...@apache.org.
[#7866] ticket:754 Cache can_merge results


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

Branch: refs/heads/ib/7866
Commit: 17b495be4a4f35d83c0d06298b7eb49521884ad0
Parents: 93a4230
Author: Igor Bondarenko <je...@gmail.com>
Authored: Sat Apr 18 11:34:27 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Apr 21 08:15:32 2015 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py         |  5 ++++
 Allura/allura/model/repository.py               | 28 ++++++++++++++++----
 Allura/allura/tasks/repo_tasks.py               |  4 ++-
 Allura/allura/templates/repo/merge_request.html | 15 ++++++++---
 4 files changed, 42 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/17b495be/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 07a522b..ce38b2b 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -460,6 +460,11 @@ class MergeRequestController(object):
     def can_merge_task_status(self):
         return {'status': self.req.can_merge_task_status()}
 
+    @expose('json:')
+    def can_merge_result(self):
+        """Return result from the cache. Used by js, after task was completed."""
+        return {'can_merge': self.req.can_merge()}
+
 
 class RefsController(object):
 

http://git-wip-us.apache.org/repos/asf/allura/blob/17b495be/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 35d2870..a9b07a0 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -737,6 +737,7 @@ class MergeRequest(VersionedArtifact, ActivityObject):
     created = FieldProperty(datetime, if_missing=datetime.utcnow)
     summary = FieldProperty(str)
     description = FieldProperty(str)
+    can_merge_cache = FieldProperty({str: bool})
 
     @property
     def activity_name(self):
@@ -838,17 +839,34 @@ class MergeRequest(VersionedArtifact, ActivityObject):
             return False
         return True
 
-    def can_merge_cache(self, source_hash, target_hash):
+    def can_merge_cache_key(self):
         """
-        Returns True/False or None in case of cache miss.
+        Returns key for can_merge_cache constructed from current
+        source & target branch commits.
         """
-        return None
+        source_hash = self.downstream.commit_id
+        target_hash = self.app.repo.commit(self.target_branch)._id
+        key = '{}-{}'.format(source_hash, target_hash)
+        return key
+
+    def get_can_merge_cache(self):
+        """Returns True/False or None in case of cache miss."""
+        key = self.can_merge_cache_key()
+        return self.can_merge_cache.get(key)
+
+    def set_can_merge_cache(self, val):
+        key = self.can_merge_cache_key()
+        self.can_merge_cache[key] = val
 
     def can_merge(self):
         """
-        Returns true if you can merge cleanly (no conflicts)
+        Returns boolean indicating if automatic merge is possible (no
+        conflicts). If result is unknown yet, returns None and fires a task to
+        get the result. Caches result for later reuse.
         """
-        cached = self.can_merge_cache(None, None)
+        if self.status == 'merged':
+            return True
+        cached = self.get_can_merge_cache()
         if cached is not None:
             return cached
         in_progress = self.can_merge_task_status() in ['ready', 'busy']

http://git-wip-us.apache.org/repos/asf/allura/blob/17b495be/Allura/allura/tasks/repo_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/repo_tasks.py b/Allura/allura/tasks/repo_tasks.py
index 8191b54..614b4b0 100644
--- a/Allura/allura/tasks/repo_tasks.py
+++ b/Allura/allura/tasks/repo_tasks.py
@@ -169,4 +169,6 @@ def can_merge(merge_request_id):
     from allura import model as M
     mr = M.MergeRequest.query.get(_id=merge_request_id)
     result = mr.app.repo.can_merge(mr)
-    # TODO: set cache (or inside repo's can_merge?)
+    source_hash = mr.downstream.commit_id
+    target_hash = mr.app.repo.commit(mr.target_branch)._id
+    mr.set_can_merge_cache(result)

http://git-wip-us.apache.org/repos/asf/allura/blob/17b495be/Allura/allura/templates/repo/merge_request.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/merge_request.html b/Allura/allura/templates/repo/merge_request.html
index 37830b8..f87a894 100644
--- a/Allura/allura/templates/repo/merge_request.html
+++ b/Allura/allura/templates/repo/merge_request.html
@@ -201,12 +201,19 @@ $(function() {
     {% elif can_merge_status in ('ready', 'busy') %}
       var spinner = '#can_merge_task_status > .spinner';
       var url = "{{request.path.rstrip('/') + '/can_merge_task_status'}}";
+      var can_merge_result_url = "{{request.path.rstrip('/') + '/can_merge_result'}}";
       function on_complete() {
         $('#can_merge_task_status h2').hide();
-        // TODO: check if actually can merge and show appropriate message
-        $('.merge-help-text').hide();
-        $('.merge-ok').show();
-        $('#merge-btn').prop('disabled', false);
+        $.get(can_merge_result_url, function(data) {
+          $('.merge-help-text').hide();
+          if (data.can_merge) {
+            $('.merge-ok').show();
+            $('#merge-btn').prop('disabled', false);
+          } else {
+            $('.merge-conflicts').show();
+            $('#merge-btn').prop('disabled', true);
+          }
+        });
       }
       function on_progress() {
         $('#can_merge_task_status h2').hide();


[04/14] allura git commit: [#7870] Add missing config examples, move some configs up from app:tool_test, standardize format for example vs default configs

Posted by je...@apache.org.
[#7870] Add missing config examples, move some configs up from app:tool_test, standardize format for example vs default configs


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

Branch: refs/heads/ib/7866
Commit: c566681169a1f4c95c9b1a6314290d52e82a844a
Parents: 251f413
Author: Dave Brondsema <da...@brondsema.net>
Authored: Thu Apr 9 18:23:55 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Mon Apr 20 12:51:30 2015 -0400

----------------------------------------------------------------------
 Allura/development.ini | 258 ++++++++++++++++++++++++++++++--------------
 1 file changed, 178 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/c5666811/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index b7ccde6..4a4f18c 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -14,28 +14,42 @@
 ;       KIND, either express or implied.  See the License for the
 ;       specific language governing permissions and limitations
 ;       under the License.
+
+
+;
+; Allura configuration
 ;
-; allura - Pylons development environment configuration
+; Default config values are shown in this file.
+; Commented-out configurations are examples that you can use if you want.
 ;
-; The %(here)s variable will be replaced with the parent directory of this file
+; Logging configuration is at the end of the file (starting at [loggers])
 ;
-; This file is for deployment specific config options -- other configuration
-; that is always required for the app is done in the config directory,
-; and generally should not be modified by end users.
+; There are many settings you should change for your site (name, domain, secret keys, etc)
+; More settings should be changed for good performance in a production site (no autoreload, no debugging, etc)
+;
+; You may copy this file to make a new configuration file (e.g. production.ini)
+; Just use the new file name instead of development.ini for any paster commands you run.
+
+
+; TODO:
+; remove test config
+; clarify debug settings
 
 [DEFAULT]
 debug = true
 ; Uncomment and replace with the address which should receive any error reports
 ;email_to = you@yourdomain.com
 
-; Smtp settings
-;smtp_tls = False
-;smtp_ssl = True
+; SMTP settings for outgoing mail
+smtp_tls = false
+smtp_ssl = false
 ;smtp_user = some_user
 ;smtp_password = some_password
-;smtp_timeout = 10
+smtp_timeout = 10
 smtp_server = localhost
 smtp_port = 8826
+; Reply-To and From address often used in email notifications:
+forgemail.return_path = noreply@sf.net
 
 error_email_from = paste@localhost
 ; Used to uniquify references to static resources, can be a timestamp or any unique value
@@ -54,17 +68,25 @@ next=main
 [app:main]
 use = egg:Allura
 full_stack = true
-site_name = Allura
 
+; Change this to your website's name
+site_name = Allura
+; Change these to your website's domain
 domain = localhost
 base_url = http://localhost:8080
 
-;lang = ru
 cache_dir = %(here)s/data
 
 ; Cache Neighborhood objects for N seconds (speeds up requests).
 ; Set to 0 to disable (the default).
-; neighborhood.cache.duration = 0
+;neighborhood.cache.duration = 0
+
+; Template cache settings
+; See http://jinja.pocoo.org/docs/api/#jinja2.Environment
+jinja_cache_size = -1
+;jinja_bytecode_cache_type = filesystem
+;jinja_bytecode_cache_type = memcached
+;memcached_host =
 
 ; Docs at http://beaker.readthedocs.org/en/latest/configuration.html#session-options
 ; and http://beaker.readthedocs.org/en/latest/modules/session.html#beaker.session.CookieSession
@@ -77,26 +99,29 @@ beaker.session.secure = false
 beaker.session.validate_key = 714bfe3612c42390726f
 
 ; Google Analytics account for tracking
-; ga.account = UA-XXXXX-X
+;ga.account = UA-XXXXX-X
 
+; Project registration system.  Only local is available, unless you write a custom one for custom integratino.
 registration.method = local
-; theme = sftheme
 theme = allura
-show_export_control = false
 
-; auth.method = ldap
+; For LDAP see https://forge-allura.apache.org/docs/getting_started/installation.html#using-ldap
+;auth.method = ldap
 auth.method = local
 auth.remember_for = 365  ; in days, for the "remember me" checkbox on login
-; auth.login_url = /auth/
-; auth.logout_url = /auth/logout
-; auth.login_fragment_url = /auth/login_fragment
+
+; Customize login/logout URLs only if you have some custom authentication set up.
+auth.login_url = /auth/
+auth.logout_url = /auth/logout
+auth.login_fragment_url = /auth/login_fragment/
+auth.post_logout_url = /
 
 auth.min_password_len = 6
 auth.max_password_len = 30
 
 ; password expiration options (disabled if neither is set)
-; auth.pwdexpire.days = 1
-; auth.pwdexpire.before = 1401949912  ; unix timestamp
+;auth.pwdexpire.days = 1
+;auth.pwdexpire.before = 1401949912  ; unix timestamp
 
 ; if using LDAP, also run `pip install python-ldap` in your Allura environment
 
@@ -124,6 +149,8 @@ auth.allow_user_messages_config = true
 auth.allow_birth_date = true
 auth.allow_non_primary_email_password_reset = true
 auth.require_email_addr = true
+; List of social network options to use on user account settings
+socialnetworks = Facebook, Linkedin, Twitter, Google+
 
 ; In seconds
 auth.recovery_hash_expiry_period = 600
@@ -137,6 +164,13 @@ user_prefs_storage.ldap.fields.display_name = cn
 ; Limit the number of emails a user can claim.
 user_prefs.maximum_claimed_emails = 20
 
+; Control the order of sections on the user profile page
+;user_profile_sections.order = activity, personal-data, skills
+
+; Site admins will be the same as the admins of this project:
+site_admin_project = allura
+site_admin_project_nbhd = Projects
+
 ; Spam filtering service: mollom or akismet
 ;spam.method = akismet
 ; for akismet:
@@ -145,41 +179,39 @@ user_prefs.maximum_claimed_emails = 20
 ;spam.public_key =
 ;spam.private_key =
 
-; webhook.timeout = 30  # seconds, default = 30
-
+; Webhook timeout in seconds
+webhook.timeout = 30
 ; List of pauses between retries, if hook fails (in seconds)
-; webhook.retry = 60 120 240
-
+webhook.retry = 60 120 240
 ; Limit rate of webhook firing (in seconds, default = 30)
 ; Option format: webhook.<hook type>.limit,
 ; all '-' in hook type must be changed to '_'
 ; e.g. for repo-push webhook:
-; webhook.repo_push.limit = 10
-
+webhook.repo_push.limit = 10
 ; Limit max number of hooks that can be created for given project/app
 ; Option name format: same as above.
 ; Value format: json dict, where keys are app names (as appears in
 ; `WebhookSender.triggered_by`) and values are actual limits (default=3), e.g.:
-; webhook.repo_push.max_hooks = {"git": 3, "hg": 3, "svn": 3}
+webhook.repo_push.max_hooks = {"git": 3, "hg": 3, "svn": 3}
 
 ; Additional fields for admin project/user search
 ; Note: whitespace after comma is important!
-; search.project.additional_search_fields = private, url, title
-; search.user.additional_search_fields = email_addresses
+;search.project.additional_search_fields = private, url, title
+;search.user.additional_search_fields = email_addresses
 
 ; Additional fields to show in the result of admin project/user search
 ; Note: whitespace after comma is important!
-; search.project.additional_display_fields = private, url, title
-; search.user.additional_display_fields = email_addresses
+;search.project.additional_display_fields = private, url, title
+;search.user.additional_display_fields = email_addresses
 
 ; To make all pages use ssl:   (also set beaker.session.secure above)
-; force_ssl.pattern = .
+;force_ssl.pattern = .
 ; To use ssl if and only if a user is logged in:
-; force_ssl.logged_in = true
+;force_ssl.logged_in = true
 ; If you set force_ssl.logged_in, you probably want some URLs to be ssl when logged out:
-; force_ssl.pattern = ^/auth|^/[a-z0-9-]+/import_project/  ; import_project uses a login overlay
+;force_ssl.pattern = ^/auth|^/[a-z0-9-]+/import_project/  ; import_project uses a login overlay
 ; And to permit some URLs to be accessed over http anyway:
-; no_redirect.pattern = ^/nf/\d+/_(ew|static)_/|^/rest/|^/nf/tool_icon_css|^/auth/refresh_repo
+;no_redirect.pattern = ^/nf/\d+/_(ew|static)_/|^/rest/|^/nf/tool_icon_css|^/auth/refresh_repo
 
 
 ; Set the locations of some static resources.  ("ew" stands for EasyWidgets library)
@@ -210,12 +242,12 @@ scm.host.ro.svn = file:///srv/svn$path/
 scm.host.rw.svn = file:///srv/svn$path/
 
 ; SCM settings for chroot + ldap configuration.  See Allura/docs/getting_started/scm_host.rst
-; scm.host.ro.git = git://git.localhost$path
-; scm.host.rw.git = ssh://$username@localhost:8022/scm-repo$path
-; scm.host.ro.hg = http://hg.localhost$path
-; scm.host.rw.hg = ssh://$username@localhost:8022/scm-repo$path
-; scm.host.ro.svn = http://svn.localhost$path/
-; scm.host.rw.svn = svn+ssh://localhost:8022/scm-repo$path/
+;scm.host.ro.git = git://git.localhost$path
+;scm.host.rw.git = ssh://$username@localhost:8022/scm-repo$path
+;scm.host.ro.hg = http://hg.localhost$path
+;scm.host.rw.hg = ssh://$username@localhost:8022/scm-repo$path
+;scm.host.ro.svn = http://svn.localhost$path/
+;scm.host.rw.svn = svn+ssh://localhost:8022/scm-repo$path/
 
 ; SCM settings for https (sorry no docs for setting these up)
 ; these settings are currently required by the template, no matter what
@@ -240,24 +272,46 @@ scm.repos.tarball.zip_binary = /usr/bin/zip
 
 ; SCM imports (currently just SVN) will retry if it fails
 ; You can control the number of tries and delay between tries here:
-;scm.import.retry_count = 50
-;scm.import.retry_sleep_secs = 5
+scm.import.retry_count = 50
+scm.import.retry_sleep_secs = 5
 
 ; One-click merge is enabled by default, but can be turned off on for each type of repo
-;scm.merge.git.disabled = true
-;scm.merge.hg.disabled = true
+scm.merge.git.disabled = false
+scm.merge.hg.disabled = false
 
+
+; bulk_export_enabled = true
+; If you keep bulk_export_enabled, you should set up your server to securely share bulk_export_path with users somehow
 bulk_export_path = /tmp/bulk_export/{nbhd}/{project}
 bulk_export_filename = {project}-backup-{date:%Y-%m-%d-%H%M%S}.zip
+; You will need to specify site-specific instructions here for accessing the exported files.
 bulk_export_download_instructions = Sample instructions for {project}
 
 importer_upload_path = /tmp/importer_upload/{nbhd}/{project}
 
+; To disable any plugin, tool, importer, etc from being available, you can use the disable_entry_points config option.
+; Specify the keys and values as they are declared in the tool's "setup.py" file.
+; Examples:
+;disable_entry_points.importers = google-code-tracker, google-code-repo
+;disable_entry_points.allura.project_importers = google-code
+
+; Importers specifically, can be left enabled but not linked to.  You have to know the URL to use it.  Example:
+;hidden_importers = trac-tickets
+
 ; GitHub importer keys.  For github ticket import, it is best to set
 ; up an app at https://github.com/settings/applications  Use the root URL
 ; of your Allura instance for both URLs, and enter client values here:
-; github_importer.client_id =
-; github_importer.client_secret =
+;github_importer.client_id =
+;github_importer.client_secret =
+
+; If your site has docs about specific importers, you can add them here and
+; they'll appear on the import forms
+;doc.url.importers.Google Code = http://...
+
+; List of oauth API keys permitted to use special forum import API
+; (should be converted to newer importer system)
+;oauth.can_import_forum = api-key-1234, fa832r0fdsafd, f23f80sdf32fd
+
 
 ; space-separated list of tool names that are valid options
 ; for project admins to set for their 'support_page' field
@@ -265,7 +319,13 @@ importer_upload_path = /tmp/importer_upload/{nbhd}/{project}
 ; is disabled by default
 ;support_tool_choices = wiki tickets discussion
 
+; Control how /categories URL can be accessed to edit trove categories (used in project categories and user skills)
+; Default: everyone
 trovecategories.enableediting = true
+; Nobody:
+;trovecategories.enableediting = false
+; Site admins only:
+;trovecategories.enableediting = admin
 
 ; ActivityStream
 activitystream.master = mongodb://127.0.0.1:27017
@@ -285,12 +345,14 @@ ming.project.uri = mongodb://127.0.0.1:27017/project-data
 ming.project.auto_ensure_indexes = False
 ming.task.uri = mongodb://127.0.0.1:27017/task
 ming.task.auto_ensure_indexes = False
-ming.zarkov.uri = mongodb://127.0.0.1:27017/zarkov
-ming.zarkov.auto_ensure_indexes = False
+;ming.zarkov.uri = mongodb://127.0.0.1:27017/zarkov
+;ming.zarkov.auto_ensure_indexes = False
 
 ; Zarkov host setting, requires the zarkov and gevent libraries.
 ;zarkov.host = tcp://127.0.0.1:9000
 
+; A float from 0-1 representing a % of requests to measure timing on.
+; Sampled requests will have timing logged to stats.log (can change file in [handler_timermiddleware] logging section)
 stats.sample_rate = 1
 
 ; Taskd setup
@@ -298,6 +360,10 @@ monq.poll_interval=2
 
 ; SOLR setup
 solr.server = http://localhost:8983/solr
+; Alternate server to use just for querying
+;solr.query_server =
+; Shorter timeout for search queries (longer timeout for saving to solr)
+solr.short_timeout = 10
 ; commit on every add/delete?
 solr.commit = false
 ; commit add operations within N ms
@@ -308,12 +374,15 @@ solr.commitWithin = 10000
 ; convert existing label and custom field data to more appropriate solr types.
 solr.use_new_types = true
 
-; Forgemail server
+; Incoming email settings.  Used when you run: paster smtp_server development.ini
+; address to listen to
 forgemail.host = 0.0.0.0
 forgemail.port = 8825
+; domain suffix for your mail, change this.  You also need to route *.*.*.forgemail.domain to the above host/port via
+; your mail and DNS configuration
 forgemail.domain = .in.sf.net
+; probably unused?
 forgemail.url = http://localhost:8080
-forgemail.return_path = noreply@sf.net
 
 ; Specify the number of projects allowed to be created by a user
 ; depending on the age of their user account.
@@ -321,11 +390,7 @@ forgemail.return_path = noreply@sf.net
 ; (including the default user-project, so you probably want to add 1)
 ; This example allows for 1 project if the account is less than an hour old
 ; and 5 projects if the account is less than a day old.  No limits after that
-; project.rate_limits = {"3600": 2, "86400": 6}
-
-; Special Command settings
-; no need to sleep in devel
-ensure_index.sleep = 0
+;project.rate_limits = {"3600": 2, "86400": 6}
 
 ; set this to "false" if you are deploying to production and want performance improvements
 auto_reload_templates = true
@@ -335,17 +400,64 @@ auto_reload_templates = true
 ; execute malicious code after an exception is raised.
 ;set debug = false
 
+; How frequently users can send messages
+user_message.time_interval = 3600
+user_message.max_messages = 20
+; Default number of times to show a sitewide notification
+site_notification.impressions = 0
+
+; When rendering discussion post Markdown to html, if the render takes longer
+; than `markdown_cache_threshold` (in seconds), the resulting html will be
+; cached and served from cache on subsequent requests. Set to 0 to cache all
+; posts. Remove entirely to cache nothing.
+markdown_cache_threshold = .1
+; markdown text longer than max length will not be converted to html
+markdown_render_max_length = 999999999
+; Don't add rel=nofollow to these domains when generating links from Markdown content
+;nofollow_exempt_domains =
+
+; Export control choices on the project admin overview page.
+show_export_control = false
+
+; By default project admins can soft-delete their projects.
+allow_project_delete = true
+allow_project_undelete = true
+
+; Advanced settings for controlling "Last Commit Doc" algorithm used when visiting any repo browse page
+lcd_thread_chunk_size = 10
+lcd_timeout = 60
+
+
+;
+; Settings for the Blog tool
+;
 ; Enable or disable external RSS feed importing in ForgeBlog tool.
-; Default is "false". This feature requires GPL library "html2text". Install it
-; with following command:
-; pip install -e git://github.com/brondsem/html2text.git#egg=html2text
+; Default is "false". This feature requires GPL library "html2text". Install it with following command:
+;   pip install -e git://github.com/brondsem/html2text.git#egg=html2text
+; You will also need to run `paster pull-rss-feeds development.ini` in a cron job to fetch them.
 forgeblog.exfeed = false
 
+;
+; Settings for the Chat tool
+;
+forgechat.host = irc.freenode.net
+forgechat.port = 6667
+ircbot.nick = allurabot
+
+;
+; Settings for ShortUrl tool
+;
+; Override this if you set up an additional shortening mechanism (e.g. custom short domain)
 short_url.url_pattern = {base_url}/{nbhd}/{project}/{mount_point}/{short_name}
 
-user_message.time_interval = 3600
-user_message.max_messages = 20
 
+;
+; Settings for UserStats tool
+;
+userstats.count_lines_of_code = true
+
+
+; Setup for tool testing
 [app:tool_test]
 use = egg:Allura
 override_root=basetest_project_root ; TurboGears will use controllers/basetest_project_root.py as root controller
@@ -359,12 +471,6 @@ beaker.session.validate_key = 714bfe3612c42390726f
 ; Ming setup
 ming.main.uri = mongo://127.0.0.1:27017/allura:test
 
-sqlalchemy.url = sqlite:///%(here)s/devdata.db
-;echo shouldn't be used together with the logging module.
-sqlalchemy.echo = false
-sqlalchemy.echo_pool = false
-sqlalchemy.pool_recycle = 3600
-
 ; Forgemail server
 forgemail.host = 0.0.0.0
 forgemail.port = 8825
@@ -375,22 +481,14 @@ forgemail.url = http://localhost:8080
 auth.method = local
 registration.method = local
 
-; When rendering discussion post Markdown to html, if the render takes longer
-; than `markdown_cache_threshold` (in seconds), the resulting html will be
-; cached and served from cache on subsequent requests. Set to 0 to cache all
-; posts. Remove entirely to cache nothing.
-markdown_cache_threshold = .1
-; markdown text longer than max length will not be converted to html
-markdown_render_max_length = 999999999
-
-; If your site has docs about specific importers, you can add them here and
-; they'll appear on the import forms
-;doc.url.importers.Google Code = http://...
-
+; setup for the taskd background daemon request controller
 [app:task]
 use = main
 override_root = task ; TurboGears will use controllers/task.py as root controller
 
+
+
+
 ; Logging configuration
 ; Add additional loggers, handlers, formatters here
 ; Uses python's logging config file format


[02/14] allura git commit: [#7870] Added a note indicating a possible test falure on OSX

Posted by je...@apache.org.
[#7870]  Added a note indicating a possible test falure on OSX


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

Branch: refs/heads/ib/7866
Commit: 1877bb3b31e84107561af1dc9df4108f88347cc3
Parents: 95af4cb
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Apr 20 12:51:00 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Mon Apr 20 12:51:30 2015 -0400

----------------------------------------------------------------------
 Allura/allura/tests/unit/test_ldap_auth_provider.py | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/1877bb3b/Allura/allura/tests/unit/test_ldap_auth_provider.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/test_ldap_auth_provider.py b/Allura/allura/tests/unit/test_ldap_auth_provider.py
index 7d7f5b5..abce671 100644
--- a/Allura/allura/tests/unit/test_ldap_auth_provider.py
+++ b/Allura/allura/tests/unit/test_ldap_auth_provider.py
@@ -41,6 +41,7 @@ class TestLdapAuthenticationProvider(object):
     def test_password_encoder(self):
         # Verify salt
         ep = self.provider._encode_password
+        # Note: OSX uses a crypt library with a known issue relating the hashing algorithms.
         assert_not_equal(ep('test_pass'), ep('test_pass'))
         assert_equal(ep('test_pass', '0000'), ep('test_pass', '0000'))
         # Test password format


[11/14] allura git commit: [#7866] ticket:754 Test can_merge task

Posted by je...@apache.org.
[#7866] ticket:754 Test can_merge task


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

Branch: refs/heads/ib/7866
Commit: f32d2c387986eb29a3e53d76f0a0b4e34d7162f6
Parents: b76a949
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Apr 20 10:11:15 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Apr 21 08:15:32 2015 +0000

----------------------------------------------------------------------
 Allura/allura/tasks/repo_tasks.py | 2 --
 Allura/allura/tests/test_tasks.py | 9 +++++++++
 2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/f32d2c38/Allura/allura/tasks/repo_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/repo_tasks.py b/Allura/allura/tasks/repo_tasks.py
index 614b4b0..e44ea94 100644
--- a/Allura/allura/tasks/repo_tasks.py
+++ b/Allura/allura/tasks/repo_tasks.py
@@ -169,6 +169,4 @@ def can_merge(merge_request_id):
     from allura import model as M
     mr = M.MergeRequest.query.get(_id=merge_request_id)
     result = mr.app.repo.can_merge(mr)
-    source_hash = mr.downstream.commit_id
-    target_hash = mr.app.repo.commit(mr.target_branch)._id
     mr.set_can_merge_cache(result)

http://git-wip-us.apache.org/repos/asf/allura/blob/f32d2c38/Allura/allura/tests/test_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_tasks.py b/Allura/allura/tests/test_tasks.py
index d822229..4ad311c 100644
--- a/Allura/allura/tests/test_tasks.py
+++ b/Allura/allura/tests/test_tasks.py
@@ -75,6 +75,15 @@ class TestRepoTasks(unittest.TestCase):
         session.assert_called_once_with(mr)
         session.return_value.flush.assert_called_once_with(mr)
 
+    @mock.patch.object(M, 'MergeRequest', autospec=True)
+    def test_can_merge(self, MR):
+        mr = M.MergeRequest(_id='_id')
+        MR.query.get.return_value = mr
+        repo_tasks.can_merge(mr._id)
+        mr.app.repo.can_merge.assert_called_once_with(mr)
+        val = mr.app.repo.can_merge.return_value
+        mr.set_can_merge_cache.assert_called_once_with(val)
+
 
 class TestEventTasks(unittest.TestCase):
 


[08/14] allura git commit: [#7866] ticket:754 Refactor code to support can_merge backgroud task (WIP)

Posted by je...@apache.org.
[#7866] ticket:754 Refactor code to support can_merge backgroud task (WIP)


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

Branch: refs/heads/ib/7866
Commit: 76f05fabc43acab1f15416b3dd2423daf34a954b
Parents: fb7f2cf
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Apr 17 13:04:14 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Apr 21 08:15:31 2015 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py         |   8 +-
 Allura/allura/model/repository.py               |  34 ++++--
 Allura/allura/tasks/repo_tasks.py               |   9 +-
 Allura/allura/templates/repo/merge_request.html | 113 +++++++++++++------
 4 files changed, 118 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/76f05fab/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index b36449c..07a522b 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -366,7 +366,9 @@ class MergeRequestController(object):
         return dict(
             downstream_app=downstream_app,
             req=self.req,
-            status=self.req.merge_task_status(),
+            can_merge=self.req.can_merge(),
+            can_merge_status=self.req.can_merge_task_status(),
+            merge_status=self.req.merge_task_status(),
             page=page,
             limit=limit,
             count=self.req.discussion_thread.post_count)
@@ -454,6 +456,10 @@ class MergeRequestController(object):
     def merge_task_status(self):
         return {'status': self.req.merge_task_status()}
 
+    @expose('json:')
+    def can_merge_task_status(self):
+        return {'status': self.req.can_merge_task_status()}
+
 
 class RefsController(object):
 

http://git-wip-us.apache.org/repos/asf/allura/blob/76f05fab/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 8083e17..35d2870 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -838,20 +838,23 @@ class MergeRequest(VersionedArtifact, ActivityObject):
             return False
         return True
 
+    def can_merge_cache(self, source_hash, target_hash):
+        """
+        Returns True/False or None in case of cache miss.
+        """
+        return None
+
     def can_merge(self):
         """
         Returns true if you can merge cleanly (no conflicts)
         """
-        if not self.app.forkable:
-            return False
-        try:
-            result = self.app.repo.can_merge(self)
-        except:
-            log.exception(
-                "Can't determine if merge request %s can be merged",
-                self.url())
-            return False
-        return result
+        cached = self.can_merge_cache(None, None)
+        if cached is not None:
+            return cached
+        in_progress = self.can_merge_task_status() in ['ready', 'busy']
+        if self.app.forkable and not in_progress:
+            from allura.tasks import repo_tasks
+            repo_tasks.can_merge.post(self._id)
 
     def merge(self):
         in_progress = self.merge_task_status() in ['ready', 'busy']
@@ -870,6 +873,17 @@ class MergeRequest(VersionedArtifact, ActivityObject):
             return task.state
         return None
 
+    def can_merge_task_status(self):
+        task = MonQTask.query.find({
+            'state': {'$in': ['busy', 'complete', 'error', 'ready']},  # needed to use index
+            'task_name': 'allura.tasks.repo_tasks.can_merge',
+            'args': [self._id],
+            'time_queue': {'$gt': datetime.utcnow() - timedelta(days=1)}, # constrain on index further
+        }).sort('_id', -1).limit(1).first()
+        if task:
+            return task.state
+        return None
+
 
 # Basic commit information
 # One of these for each commit in the physical repo on disk. The _id is the

http://git-wip-us.apache.org/repos/asf/allura/blob/76f05fab/Allura/allura/tasks/repo_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/repo_tasks.py b/Allura/allura/tasks/repo_tasks.py
index e873694..d16755c 100644
--- a/Allura/allura/tasks/repo_tasks.py
+++ b/Allura/allura/tasks/repo_tasks.py
@@ -158,8 +158,15 @@ def tarball(revision, path):
 @task
 def merge(merge_request_id):
     from allura import model as M
-    log = logging.getLogger(__name__)
     mr = M.MergeRequest.query.get(_id=merge_request_id)
     mr.app.repo.merge(mr)
     mr.status = 'merged'
     session(mr).flush(mr)
+
+
+@task
+def can_merge(merge_request_id):
+    from allura import model as M
+    mr = M.MergeRequest.query.get(_id=merge_request_id)
+    result = self.app.repo.can_merge(self)
+    # TODO: set cache

http://git-wip-us.apache.org/repos/asf/allura/blob/76f05fab/Allura/allura/templates/repo/merge_request.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/merge_request.html b/Allura/allura/templates/repo/merge_request.html
index 928a0db..99bcdec 100644
--- a/Allura/allura/templates/repo/merge_request.html
+++ b/Allura/allura/templates/repo/merge_request.html
@@ -34,8 +34,8 @@ Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
 
 {% block content %}
   <div class="grid-19">
-    <div id="task_status">
-      {% if status == 'complete' %}
+    <div id="merge_task_status" class="task_status">
+      {% if merge_status == 'complete' %}
         <h2 class="complete">Merged</h2>
       {% else %}
         <img src="{{g.forge_static('images/spinner.gif')}}" class="spinner" style="display:none"/>
@@ -44,6 +44,13 @@ Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
         <h2 class="fail">Something went wrong. Please, merge manually</h2>
       {% endif %}
     </div>
+    <div id="can_merge_task_status" class="task_status">
+      {% if can_merge_status != 'complete' %}
+        <img src="{{g.forge_static('images/spinner.gif')}}" class="spinner" style="display:none"/>
+        <h2 class="busy ready">Checking if merge is possible...</h2>
+        <h2 class="fail">Something went wrong. Please, merge manually</h2>
+      {% endif %}
+    </div>
   </div>
 
   {% if req.downstream_repo %}
@@ -58,20 +65,19 @@ Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
     <div>{{g.markdown.convert(req.description)}}</div>
 
     {% if req.merge_allowed(c.user) %}
-      {% set can_merge = req.can_merge() %}
       <div class="grid-19">
         <form action="merge" method="POST">
           {{ lib.csrf_token() }}
-          <input type="submit" value="Merge"{% if not can_merge or status in ('ready', 'busy') %}disabled="disabled"{% endif %}>
-          {% if can_merge %}
-            <div class="merge-ok">
-              Merge request has no conflicts. You can merge automatically.
-            </div>
-          {% else %}
-            <div class="merge-conflicts">
-              Merge request has conflicts. Follow manual instructions below to merge.
-            </div>
-          {% endif %}
+          <input id="merge-btn" type="submit" value="Merge"{% if not can_merge or merge_status in ('ready', 'busy') %}disabled="disabled"{% endif %}>
+          <div class="merge-help-text can-merge-in-progress" {% if can_merge == None %}style="display: block;"{% endif %}>
+            Checking if merge is possible...
+          </div>
+          <div class="merge-help-text merge-ok" {% if can_merge == True %}style="display: block;"{% endif %}>
+            Merge request has no conflicts. You can merge automatically.
+          </div>
+          <div class="merge-help-text merge-conflicts" {% if can_merge == False %}style="display: block;"{% endif %}>
+            Merge request has conflicts. Follow manual instructions below to merge.
+          </div>
         </form>
       </div>
     {% endif %}
@@ -87,7 +93,7 @@ Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
       <div class="grid-19">
         <textarea style="width:80%; height:60px;" readonly>{{ c.app.repo.merge_command(req) | safe }}</textarea>
       </div>
-      {% if status not in ('ready', 'busy') %}
+      {% if merge_status not in ('ready', 'busy') %}
         {{ c.mr_dispose_form.display(action="save", value=dict(status=req.status)) }}
         <br style="clear:both">
       {% endif %}
@@ -122,15 +128,17 @@ Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
 
 {% block extra_css %}
 <style type="text/css">
+  .merge-help-text { display: none; }
   .merge-ok { color: green; }
   .merge-conflicts { color: red; }
-
-  #task_status { margin: 0 10px; }
-  #task_status h2 { display: none; }
-  #task_status .{{ status }} { display: inline-block; }
-  #task_status h2.complete { color: #C6D880; }
-  #task_status h2.busy, #task_status h2.busy { color: #003565; }
-  #task_status h2.fail { color: #f33; }
+  .can-merge-in-progress { color: grey; }
+
+  .task_status { margin: 0 10px; }
+  .task_status h2 { display: none; }
+  .task_status .{{ merge_status }} { display: inline-block; }
+  .task_status h2.complete { color: #C6D880; }
+  .task_status h2.busy, .task_status h2.busy { color: #003565; }
+  .task_status h2.fail { color: #f33; }
 </style>
 {% endblock %}
 
@@ -138,35 +146,72 @@ Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
 {{ super() }}
 <script type="text/javascript">
 $(function() {
-    {% if status in ('ready', 'busy') %}
-        $('.spinner').show();
+    {% if merge_status in ('ready', 'busy') %}
+        $('#merge_task_status > .spinner').show();
         var delay = 500;
-        function check_status() {
+        function check_merge_status() {
           $.get("{{request.path.rstrip('/') + '/merge_task_status'}}", function(data) {
                 if (data.status === 'complete') {
-                    $('.spinner').hide();
-                    $('#task_status h2').hide();
-                    $('#task_status h2.complete').show();
+                    $('#merge_task_status > .spinner').hide();
+                    $('#merge_task_status h2').hide();
+                    $('#merge_task_status h2.complete').show();
                     location.reload();
                 } else {
                     if (data.status === 'ready' || data.status === 'busy') {
                         // keep waiting
-                        $('#task_status h2').hide();
-                        $('#task_status h2.busy').show();
+                        $('#merge_task_status h2').hide();
+                        $('#merge_task_status h2.busy').show();
+                    } else {
+                        // something went wrong
+                        $('#merge_task_status > .spinner').hide();
+                        $('#merge_task_status h2').hide();
+                        $('#merge_task_status h2.fail').show();
+                    }
+                    if (delay < 60000){
+                        delay = delay * 2;
+                    }
+                    window.setTimeout(check_merge_status, delay);
+                }
+            });
+        }
+        window.setTimeout(check_merge_status, delay);
+    {% endif %}
+
+    {% if can_merge_status in ('ready', 'busy') %}
+        $('#can_merge_task_status > .spinner').show();
+        var delay = 500;
+        function check_can_merge_status() {
+          $.get("{{request.path.rstrip('/') + '/can_merge_task_status'}}", function(data) {
+                if (data.status === 'complete') {
+                    $('#can_merge_task_status > .spinner').hide();
+                    $('#can_merge_task_status h2').hide();
+                    // TODO: check if actually can merge and show appropriate message
+                    $('.merge-help-text').hide();
+                    $('.merge-ok').show();
+                    $('.merge-btn').prop('disabled', false);
+                } else {
+                    if (data.status === 'ready' || data.status === 'busy') {
+                        // keep waiting
+                        $('#can_merge_task_status h2').hide();
+                        $('#can_merge_task_status h2.busy').show();
+                        $('.merge-help-text').hide();
+                        $('.can-merge-in-progress').show();
                     } else {
                         // something went wrong
-                        $('.spinner').hide();
-                        $('#task_status h2').hide();
-                        $('#task_status h2.fail').show();
+                        $('#can_merge_task_status > .spinner').hide();
+                        $('#can_merge_task_status h2').hide();
+                        $('#merge_task_status h2.fail').show();
+                        $('.merge-help-text').hide();
+                        $('.merge-conflicts').show();
                     }
                     if (delay < 60000){
                         delay = delay * 2;
                     }
-                    window.setTimeout(check_status, delay);
+                    window.setTimeout(check_can_merge_status, delay);
                 }
             });
         }
-        window.setTimeout(check_status, delay);
+        window.setTimeout(check_can_merge_status, delay);
     {% endif %}
 });
 </script>


[06/14] allura git commit: [#7870] restore paster entry points that are actually needed

Posted by je...@apache.org.
[#7870] restore paster entry points that are actually needed


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

Branch: refs/heads/ib/7866
Commit: fb7f2cf1377be7b49c3648bf47303c4f2322acf2
Parents: 1877bb3
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Mon Apr 20 17:11:20 2015 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Apr 20 17:11:20 2015 +0000

----------------------------------------------------------------------
 Allura/setup.py | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/fb7f2cf1/Allura/setup.py
----------------------------------------------------------------------
diff --git a/Allura/setup.py b/Allura/setup.py
index f2213b3..05cbf0b 100644
--- a/Allura/setup.py
+++ b/Allura/setup.py
@@ -94,6 +94,11 @@ setup(
     # Other packages (the Forge* directories) or 3rd-party can add more too.
     # development.ini is used for many cases to specify which to actually use.
     entry_points="""
+    [paste.app_factory]
+    main = allura.config.middleware:make_app
+    [paste.app_install]
+    main = pylons.util:PylonsInstaller
+
     [allura]
     profile = allura.ext.user_profile:UserProfileApp
     admin = allura.ext.admin:AdminApp


[10/14] allura git commit: [#7866] ticket:754 Fix error in can_merge task

Posted by je...@apache.org.
[#7866] ticket:754 Fix error in can_merge task


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

Branch: refs/heads/ib/7866
Commit: 93a4230a87df0785c31faf21a5f7c9e1ccbc17c1
Parents: 0be08e5
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Apr 17 13:43:52 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Apr 21 08:15:32 2015 +0000

----------------------------------------------------------------------
 Allura/allura/tasks/repo_tasks.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/93a4230a/Allura/allura/tasks/repo_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/repo_tasks.py b/Allura/allura/tasks/repo_tasks.py
index d16755c..8191b54 100644
--- a/Allura/allura/tasks/repo_tasks.py
+++ b/Allura/allura/tasks/repo_tasks.py
@@ -168,5 +168,5 @@ def merge(merge_request_id):
 def can_merge(merge_request_id):
     from allura import model as M
     mr = M.MergeRequest.query.get(_id=merge_request_id)
-    result = self.app.repo.can_merge(self)
-    # TODO: set cache
+    result = mr.app.repo.can_merge(mr)
+    # TODO: set cache (or inside repo's can_merge?)


[09/14] allura git commit: [#7866] ticket:754 Rewrite can_merge tests

Posted by je...@apache.org.
[#7866] ticket:754 Rewrite can_merge tests


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

Branch: refs/heads/ib/7866
Commit: b76a9492d3664e56fe9a9b4f6570f2f439c000e5
Parents: 13ba80e
Author: Igor Bondarenko <je...@gmail.com>
Authored: Sat Apr 18 12:23:37 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Apr 21 08:15:32 2015 +0000

----------------------------------------------------------------------
 Allura/allura/tests/model/test_repo.py | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/b76a9492/Allura/allura/tests/model/test_repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_repo.py b/Allura/allura/tests/model/test_repo.py
index 54a30a6..d083675 100644
--- a/Allura/allura/tests/model/test_repo.py
+++ b/Allura/allura/tests/model/test_repo.py
@@ -760,15 +760,22 @@ class TestMergeRequest(object):
         self.mr.set_can_merge_cache(False)
         assert_equal(self.mr.can_merge_cache, {key: True, '123-123': False})
 
-    def test_can_merge(self):
-        assert_equal(self.mr.can_merge(),
-                     self.mr.app.repo.can_merge.return_value)
-        self.mr.app.repo.can_merge.assert_called_once_with(self.mr)
+    def test_can_merge_merged(self):
+        self.mr.status = 'merged'
+        assert_equal(self.mr.can_merge(), True)
 
-        self.mr.app.reset_mock()
-        self.mr.app.forkable = False
+    @mock.patch('allura.tasks.repo_tasks.can_merge', autospec=True)
+    def test_can_merge_cached(self, can_merge_task):
+        self.mr.set_can_merge_cache(False)
         assert_equal(self.mr.can_merge(), False)
-        assert_equal(self.mr.app.repo.can_merge.called, False)
+        self.mr.set_can_merge_cache(True)
+        assert_equal(self.mr.can_merge(), True)
+        assert_equal(can_merge_task.post.call_count, 0)
+
+    @mock.patch('allura.tasks.repo_tasks.can_merge', autospec=True)
+    def test_can_merge_not_cached(self, can_merge_task):
+        assert_equal(self.mr.can_merge(), None)
+        can_merge_task.post.assert_called_once_with(self.mr._id)
 
     @mock.patch('allura.tasks.repo_tasks.merge', autospec=True)
     def test_merge(self, merge_task):
@@ -788,3 +795,11 @@ class TestMergeRequest(object):
         assert_equal(self.mr.merge_task_status(), 'ready')
         M.MonQTask.run_ready()
         assert_equal(self.mr.merge_task_status(), 'complete')
+
+    def test_can_merge_task_status(self):
+        from allura.tasks import repo_tasks
+        assert_equal(self.mr.can_merge_task_status(), None)
+        repo_tasks.can_merge.post(self.mr._id)
+        assert_equal(self.mr.can_merge_task_status(), 'ready')
+        M.MonQTask.run_ready()
+        assert_equal(self.mr.can_merge_task_status(), 'complete')


[14/14] allura git commit: [#7866] ticket:758 Don't run can_merge task when merge is dissabled

Posted by je...@apache.org.
[#7866] ticket:758 Don't run can_merge task when merge is dissabled


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

Branch: refs/heads/ib/7866
Commit: d162d676dfa780eb0dd11de2e60c714b57c78aed
Parents: f32d2c3
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Apr 21 08:56:34 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Apr 21 08:56:34 2015 +0000

----------------------------------------------------------------------
 Allura/allura/model/repository.py      | 6 ++++--
 Allura/allura/tests/model/test_repo.py | 7 +++++++
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/d162d676/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index a9b07a0..8455395 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -827,13 +827,13 @@ class MergeRequest(VersionedArtifact, ActivityObject):
         """
         Returns true if a merge is allowed by system and tool configuration.
         """
-        if not c.app.forkable:
+        if not self.app.forkable:
             return False
         if self.status != 'open':
             return False
         if asbool(tg.config.get('scm.merge.{}.disabled'.format(self.app.config.tool_name))):
             return False
-        if not h.has_access(c.app, 'write', user):
+        if not h.has_access(self.app, 'write', user):
             return False
         if self.app.config.options.get('merge_disabled'):
             return False
@@ -864,6 +864,8 @@ class MergeRequest(VersionedArtifact, ActivityObject):
         conflicts). If result is unknown yet, returns None and fires a task to
         get the result. Caches result for later reuse.
         """
+        if not self.merge_allowed(c.user):
+            return None
         if self.status == 'merged':
             return True
         cached = self.get_can_merge_cache()

http://git-wip-us.apache.org/repos/asf/allura/blob/d162d676/Allura/allura/tests/model/test_repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_repo.py b/Allura/allura/tests/model/test_repo.py
index d083675..f71ad71 100644
--- a/Allura/allura/tests/model/test_repo.py
+++ b/Allura/allura/tests/model/test_repo.py
@@ -735,6 +735,7 @@ class TestMergeRequest(object):
         )
         self.mr.app = mock.Mock(forkable=True)
         self.mr.app.repo.commit.return_value = mock.Mock(_id='09876')
+        self.mr.merge_allowed = mock.Mock(return_value=True)
 
     def test_can_merge_cache_key(self):
         key = self.mr.can_merge_cache_key()
@@ -777,6 +778,12 @@ class TestMergeRequest(object):
         assert_equal(self.mr.can_merge(), None)
         can_merge_task.post.assert_called_once_with(self.mr._id)
 
+    @mock.patch('allura.tasks.repo_tasks.can_merge', autospec=True)
+    def test_can_merge_disabled(self, can_merge_task):
+        self.mr.merge_allowed.return_value = False
+        assert_equal(self.mr.can_merge(), None)
+        assert_equal(can_merge_task.post.call_count, 0)
+
     @mock.patch('allura.tasks.repo_tasks.merge', autospec=True)
     def test_merge(self, merge_task):
         self.mr.merge_task_status = lambda: None


[03/14] allura git commit: [#7870] Make test.ini inherit from development.ini, update tests. And:

Posted by je...@apache.org.
[#7870] Make test.ini inherit from development.ini, update tests.  And:

* specify only the settings needed in test.ini
* remove tool_test section from development.ini (part of test.ini)
* remove unnecessary entry points


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

Branch: refs/heads/ib/7866
Commit: 2cdb4f85c131bce7ac3c3f85a4f630d1f823e5bf
Parents: c566681
Author: Dave Brondsema <da...@brondsema.net>
Authored: Thu Apr 9 18:34:47 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Mon Apr 20 12:51:30 2015 -0400

----------------------------------------------------------------------
 Allura/allura/tests/functional/test_auth.py     |   4 +-
 .../tests/functional/test_neighborhood.py       |   2 +-
 .../tests/functional/test_user_profile.py       |   4 +-
 Allura/allura/tests/test_globals.py             |   2 +-
 Allura/allura/tests/unit/test_app.py            |   4 +-
 .../tests/unit/test_ldap_auth_provider.py       |  10 +-
 Allura/allura/websetup/bootstrap.py             |   1 -
 Allura/development.ini                          |  87 ++++-----
 Allura/setup.py                                 |  12 +-
 Allura/test.ini                                 | 185 ++++++-------------
 .../forgegit/tests/model/test_repository.py     |   6 +-
 .../forgesvn/tests/model/test_repository.py     |   8 +-
 .../forgetracker/tests/functional/test_root.py  |   2 +-
 .../tests/unit/test_root_controller.py          |   9 +-
 14 files changed, 128 insertions(+), 208 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/2cdb4f85/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index f288b0b..0f9a8ee 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -771,8 +771,8 @@ class TestAuth(TestController):
         r = self.app.get('/auth/logout')
         r = self.app.post('/auth/do_login', params=dict(
             username='test-user', password='foo',
-            return_to='https://localhost/foo'))
-        assert_equal(r.location, 'https://localhost/foo')
+            return_to='http://localhost:8080/foo'))
+        assert_equal(r.location, 'http://localhost:8080/foo')
 
         r = self.app.get('/auth/logout')
         r = self.app.post('/auth/do_login', params=dict(

http://git-wip-us.apache.org/repos/asf/allura/blob/2cdb4f85/Allura/allura/tests/functional/test_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_neighborhood.py b/Allura/allura/tests/functional/test_neighborhood.py
index 332a60b..afe4dc6 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -281,7 +281,7 @@ class TestNeighborhood(TestController):
                           extra_environ=dict(username='root'))
         r = self.app.get('/adobe/adobe-1/admin/overview',
                          extra_environ=dict(username='root'))
-        assert "_add_tracking('nbhd', 'U-123456');" in r
+        assert "_add_tracking('nbhd', 'U-123456');" in r, r
         assert "_add_tracking('proj', 'U-654321');" in r
         # analytics not allowed
         neighborhood = M.Neighborhood.query.get(name='Adobe')

http://git-wip-us.apache.org/repos/asf/allura/blob/2cdb4f85/Allura/allura/tests/functional/test_user_profile.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_user_profile.py b/Allura/allura/tests/functional/test_user_profile.py
index a3ea741..c539baf 100644
--- a/Allura/allura/tests/functional/test_user_profile.py
+++ b/Allura/allura/tests/functional/test_user_profile.py
@@ -80,7 +80,7 @@ class TestUserProfile(TestController):
 
         sendsimplemail.post.assert_called_once_with(
             cc=User.by_username('test-admin').get_pref('email_address'),
-            text=u'test message\n\n---\n\nThis message was sent to you via the Allura web mail form.  You may reply to this message directly, or send a message to Test Admin at http://localhost/u/test-admin/profile/send_message\n',
+            text=u'test message\n\n---\n\nThis message was sent to you via the Allura web mail form.  You may reply to this message directly, or send a message to Test Admin at http://localhost:8080/u/test-admin/profile/send_message\n',
             toaddr=User.by_username('test-user').get_pref('email_address'),
             fromaddr=User.by_username('test-admin').get_pref('email_address'),
             reply_to=User.by_username('test-admin').get_pref('email_address'),
@@ -93,7 +93,7 @@ class TestUserProfile(TestController):
 
         sendsimplemail.post.assert_called_once_with(
             cc=None,
-            text=u'test message\n\n---\n\nThis message was sent to you via the Allura web mail form.  You may reply to this message directly, or send a message to Test Admin at http://localhost/u/test-admin/profile/send_message\n',
+            text=u'test message\n\n---\n\nThis message was sent to you via the Allura web mail form.  You may reply to this message directly, or send a message to Test Admin at http://localhost:8080/u/test-admin/profile/send_message\n',
             toaddr=User.by_username('test-user').get_pref('email_address'),
             fromaddr=User.by_username('test-admin').get_pref('email_address'),
             reply_to=User.by_username('test-admin').get_pref('email_address'),

http://git-wip-us.apache.org/repos/asf/allura/blob/2cdb4f85/Allura/allura/tests/test_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index 6920f6d..ca04652 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -430,7 +430,7 @@ Some text in a regular paragraph
     for i in range(10):
         print i
 ''')
-    assert 'http://localhost/' in g.forge_markdown(email=True).convert('[Home]')
+    assert_in('http://localhost:8080/', g.forge_markdown(email=True).convert('[Home]'))
     assert 'class="codehilite"' in g.markdown.convert('''
 ~~~~
 def foo(): pass

http://git-wip-us.apache.org/repos/asf/allura/blob/2cdb4f85/Allura/allura/tests/unit/test_app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/test_app.py b/Allura/allura/tests/unit/test_app.py
index 95c56c5..eca1ae7 100644
--- a/Allura/allura/tests/unit/test_app.py
+++ b/Allura/allura/tests/unit/test_app.py
@@ -17,6 +17,8 @@
 
 from unittest import TestCase
 
+from nose.tools import assert_equal
+
 from allura.app import Application
 from allura import model
 from allura.tests.unit import WithDatabase
@@ -100,7 +102,7 @@ class TestAppDefaults(WithDatabase):
 
     def test_email_address(self):
         self.app.url = '/p/project/mount-point/'
-        assert self.app.email_address == 'mount-point@project.p.in.localhost'
+        assert_equal(self.app.email_address, 'mount-point@project.p.in.localhost')
 
 
 def install_app():

http://git-wip-us.apache.org/repos/asf/allura/blob/2cdb4f85/Allura/allura/tests/unit/test_ldap_auth_provider.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/test_ldap_auth_provider.py b/Allura/allura/tests/unit/test_ldap_auth_provider.py
index 1dc4bf3..7d7f5b5 100644
--- a/Allura/allura/tests/unit/test_ldap_auth_provider.py
+++ b/Allura/allura/tests/unit/test_ldap_auth_provider.py
@@ -53,7 +53,7 @@ class TestLdapAuthenticationProvider(object):
         self.provider._encode_password = Mock(return_value='new-pass-hash')
         ldap.dn.escape_dn_chars = lambda x: x
 
-        dn = 'uid=%s,ou=users,dc=sf,dc=net' % user.username
+        dn = 'uid=%s,ou=people,dc=localdomain' % user.username
         self.provider.set_password(user, 'old-pass', 'new-pass')
         ldap.initialize.assert_called_once_with('ldaps://localhost/')
         connection = ldap.initialize.return_value
@@ -74,7 +74,7 @@ class TestLdapAuthenticationProvider(object):
 
         self.provider._login()
 
-        dn = 'uid=%s,ou=users,dc=sf,dc=net' % params['username']
+        dn = 'uid=%s,ou=people,dc=localdomain' % params['username']
         ldap.initialize.assert_called_once_with('ldaps://localhost/')
         connection = ldap.initialize.return_value
         connection.bind_s.called_once_with(dn, 'test-password')
@@ -90,7 +90,7 @@ class TestLdapAuthenticationProvider(object):
         self.provider.request.method = 'POST'
         self.provider.request.body = '&'.join(['%s=%s' % (k,v) for k,v in params.iteritems()])
         ldap.dn.escape_dn_chars = lambda x: x
-        dn = 'uid=%s,ou=users,dc=sf,dc=net' % params['username']
+        dn = 'uid=%s,ou=people,dc=localdomain' % params['username']
         conn = ldap.initialize.return_value
         conn.search_s.return_value = [(dn, {'cn': [u'åℒƒ'.encode('utf-8')]})]
 
@@ -117,11 +117,11 @@ class TestLdapAuthenticationProvider(object):
         ThreadLocalORMSession.flush_all()
         assert_not_equal(M.User.query.get(username=user_doc['username']), None)
 
-        dn = 'uid=%s,ou=users,dc=sf,dc=net' % user_doc['username']
+        dn = 'uid=%s,ou=people,dc=localdomain' % user_doc['username']
         ldap.initialize.assert_called_once_with('ldaps://localhost/')
         connection = ldap.initialize.return_value
         connection.bind_s.called_once_with(
-            'cn=site,ou=admin,dc=sf,dc=net',
+            'cn=admin,dc=localdomain',
             'admin-password')
         connection.add_s.assert_called_once_with(dn, modlist.addModlist.return_value)
         connection.unbind_s.assert_called_once()

http://git-wip-us.apache.org/repos/asf/allura/blob/2cdb4f85/Allura/allura/websetup/bootstrap.py
----------------------------------------------------------------------
diff --git a/Allura/allura/websetup/bootstrap.py b/Allura/allura/websetup/bootstrap.py
index bb89995..ed76c15 100644
--- a/Allura/allura/websetup/bootstrap.py
+++ b/Allura/allura/websetup/bootstrap.py
@@ -90,7 +90,6 @@ def bootstrap(command, conf, vars):
     # Clean up all old stuff
     ThreadLocalORMSession.close_all()
     c.user = c.project = c.app = None
-    database = conf.get('db_prefix', '') + 'project:test'
     wipe_database()
     try:
         g.solr.delete(q='*:*')

http://git-wip-us.apache.org/repos/asf/allura/blob/2cdb4f85/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 4a4f18c..b7e0b95 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -28,17 +28,22 @@
 ; More settings should be changed for good performance in a production site (no autoreload, no debugging, etc)
 ;
 ; You may copy this file to make a new configuration file (e.g. production.ini)
-; Just use the new file name instead of development.ini for any paster commands you run.
+; Or inherit from this file by starting your .ini file like this:
+;    [app:main]
+;    use = config:development.ini#main
+; Then just use the new file name instead of development.ini for any paster commands you run.
 
 
-; TODO:
-; remove test config
-; clarify debug settings
-
 [DEFAULT]
+; this section is for a few settings that are shared with error handling middleware
+
+; WARNING: *THE LINE BELOW MUST BE CHANGED ON A PRODUCTION ENVIRONMENT*
+; Debug mode will enable the interactive debugging tool, allowing ANYONE to
+; execute malicious code after an exception is raised.
 debug = true
-; Uncomment and replace with the address which should receive any error reports
+; If you want to receive an email for every unhandled HTTP 500 error, set your email address here:
 ;email_to = you@yourdomain.com
+error_email_from = paste@localhost
 
 ; SMTP settings for outgoing mail
 smtp_tls = false
@@ -49,22 +54,21 @@ smtp_timeout = 10
 smtp_server = localhost
 smtp_port = 8826
 ; Reply-To and From address often used in email notifications:
-forgemail.return_path = noreply@sf.net
+forgemail.return_path = noreply@localhost
 
-error_email_from = paste@localhost
-; Used to uniquify references to static resources, can be a timestamp or any unique value
-; This should be updated each time you deploy (or make significant changes, like new tools, new css)
-build_key=1276635823
 
+;
+; Settings for `paster serve` command
+;
 [server:main]
 use = egg:Paste#http
 host = 0.0.0.0
 port = 8080
 
-[filter-app:profile]
-use=egg:keas.profile#profiler
-next=main
 
+;
+; The main allura settings
+;
 [app:main]
 use = egg:Allura
 full_stack = true
@@ -74,7 +78,13 @@ site_name = Allura
 ; Change these to your website's domain
 domain = localhost
 base_url = http://localhost:8080
+forgemail.url = http://localhost:8080
 
+; Used to uniquify references to static resources, can be a timestamp or any unique value
+; This should be updated each time you deploy (or make significant changes, like new tools, new css)
+build_key=1276635823
+
+; Used by Turbogears / Pylons in some cases.  Not particularly relevant for Allura.
 cache_dir = %(here)s/data
 
 ; Cache Neighborhood objects for N seconds (speeds up requests).
@@ -125,11 +135,12 @@ auth.max_password_len = 30
 
 ; if using LDAP, also run `pip install python-ldap` in your Allura environment
 
-auth.ldap.server = ldap://localhost
+auth.ldap.server = ldaps://localhost/
 auth.ldap.suffix = ou=people,dc=localdomain
 auth.ldap.admin_dn = cn=admin,dc=localdomain
 auth.ldap.admin_password = secret
 auth.ldap.schroot_name = scm
+auth.ldap.use_schroot = false
 auth.ldap.password.algorithm = 6
 auth.ldap.password.rounds = 6000
 auth.ldap.password.salt_len = 16
@@ -187,7 +198,7 @@ webhook.retry = 60 120 240
 ; Option format: webhook.<hook type>.limit,
 ; all '-' in hook type must be changed to '_'
 ; e.g. for repo-push webhook:
-webhook.repo_push.limit = 10
+webhook.repo_push.limit = 30
 ; Limit max number of hooks that can be created for given project/app
 ; Option name format: same as above.
 ; Value format: json dict, where keys are app names (as appears in
@@ -380,9 +391,7 @@ forgemail.host = 0.0.0.0
 forgemail.port = 8825
 ; domain suffix for your mail, change this.  You also need to route *.*.*.forgemail.domain to the above host/port via
 ; your mail and DNS configuration
-forgemail.domain = .in.sf.net
-; probably unused?
-forgemail.url = http://localhost:8080
+forgemail.domain = .in.localhost
 
 ; Specify the number of projects allowed to be created by a user
 ; depending on the age of their user account.
@@ -395,11 +404,6 @@ forgemail.url = http://localhost:8080
 ; set this to "false" if you are deploying to production and want performance improvements
 auto_reload_templates = true
 
-; WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*
-; Debug mode will enable the interactive debugging tool, allowing ANYONE to
-; execute malicious code after an exception is raised.
-;set debug = false
-
 ; How frequently users can send messages
 user_message.time_interval = 3600
 user_message.max_messages = 20
@@ -457,43 +461,30 @@ short_url.url_pattern = {base_url}/{nbhd}/{project}/{mount_point}/{short_name}
 userstats.count_lines_of_code = true
 
 
-; Setup for tool testing
-[app:tool_test]
-use = egg:Allura
-override_root=basetest_project_root ; TurboGears will use controllers/basetest_project_root.py as root controller
-full_stack = true
-
-cache_dir = %(here)s/data
-beaker.session.key = allura
-beaker.session.type = cookie
-beaker.session.validate_key = 714bfe3612c42390726f
-
-; Ming setup
-ming.main.uri = mongo://127.0.0.1:27017/allura:test
-
-; Forgemail server
-forgemail.host = 0.0.0.0
-forgemail.port = 8825
-forgemail.domain = .in.sf.net
-forgemail.return_path = noreply@sourceforge.net
-forgemail.url = http://localhost:8080
+;
+; Optional settings for profiling with https://pypi.python.org/pypi/keas.profile
+;
+[filter-app:profile]
+use=egg:keas.profile#profiler
+next=main
 
-auth.method = local
-registration.method = local
 
+;
 ; setup for the taskd background daemon request controller
+;
 [app:task]
 use = main
 override_root = task ; TurboGears will use controllers/task.py as root controller
 
 
 
-
+;
 ; Logging configuration
+;
 ; Add additional loggers, handlers, formatters here
 ; Uses python's logging config file format
 ; http://docs.python.org/lib/logging-config-fileformat.html
-
+;
 [loggers]
 keys = root, allura, sqlalchemy, paste, pylons, taskdstatus, timermiddleware, tmw_details
 

http://git-wip-us.apache.org/repos/asf/allura/blob/2cdb4f85/Allura/setup.py
----------------------------------------------------------------------
diff --git a/Allura/setup.py b/Allura/setup.py
index e44c0c2..f2213b3 100644
--- a/Allura/setup.py
+++ b/Allura/setup.py
@@ -90,16 +90,10 @@ setup(
         ('templates/**.html', 'genshi', None),
         ('public/**', 'ignore', None)]},
 
+    # These entry points define what tools and plugins are available for Allura.
+    # Other packages (the Forge* directories) or 3rd-party can add more too.
+    # development.ini is used for many cases to specify which to actually use.
     entry_points="""
-    [paste.app_factory]
-    main = allura.config.middleware:make_app
-    task = allura.config.middleware:make_task_app
-    tool_test = allura.config.middleware:make_tool_test_app
-
-    [paste.app_install]
-    main = pylons.util:PylonsInstaller
-    tool_test = pylons.util:PylonsInstaller
-
     [allura]
     profile = allura.ext.user_profile:UserProfileApp
     admin = allura.ext.admin:AdminApp

http://git-wip-us.apache.org/repos/asf/allura/blob/2cdb4f85/Allura/test.ini
----------------------------------------------------------------------
diff --git a/Allura/test.ini b/Allura/test.ini
index ecf1639..4381cb6 100644
--- a/Allura/test.ini
+++ b/Allura/test.ini
@@ -1,168 +1,97 @@
-#       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.
-#
-# allura - TurboGears 2 testing environment configuration
-#
-# The %(here)s variable will be replaced with the parent directory of this file
-#
-[DEFAULT]
-debug = false
-# make sure, since this extends development.ini
-set debug = false
-# Uncomment and replace with the address which should receive any error reports
-# email_to = you@yourdomain.com
-smtp_server = localhost
-error_email_from = paste@localhost
-
-[server:main]
-use = egg:Paste#http
-host = 0.0.0.0
-port = 5000
+;       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.
+;
+; Allura - testing configuration
+;
+;
+
+;
+; This inherits all the settings from development.ini
+; and then overrides only settings needed for tests to work.
+;
 
 [app:main]
-use = config:development.ini#tool_test
-db_prefix = test_
+use = config:development.ini#main
+override_root=basetest_project_root ; TurboGears will use controllers/basetest_project_root.py as root controller
 disable_template_overrides = True
 
-site_name = Allura
-base_url = http://localhost
-domain = localhost
-
-mediawikiimporter.db_config_prefix = hostedapps.db.
-mediawikiimporter.attachments_dir_prefix = /nfs/mediawiki-attachments/
-mediawikiimporter.db_name_template = p_%s_mediawiki
-hostedapps.db.host = localhost
-hostedapps.db.port = 3306
-hostedapps.db.user = user
-hostedapps.db.password = password
-
-# Use test MongoDB DB server
-# ming.main.master = mongo://127.0.0.1:27018/allura
+; Use in-memory MongoDB
 ming.main.uri = mim:///allura
 ming.project.uri = mim:///project-data
 ming.task.uri = mim:///task
-
-trovecategories.enableediting = true
-
-# ActivityStream
 activitystream.master = mim://
-activitystream.database = activitystream
-activitystream.activity_collection = activities
-activitystream.node_collection = nodes
-activitystream.timeline_collection = timelines
-activitystream.recording.enabled = true
-activitystream.enabled = true
-
-solr.mock = true
-amqp.mock = true
-smtp.mock = true
 
-# Forgemail server
-forgemail.host = 0.0.0.0
-forgemail.port = 8825
-forgemail.domain = .in.localhost
-forgemail.url = http://localhost:8080
-forgemail.return_path = noreply@localhost
+solr.server =
+smtp.mock = true
 
 load_test_data = true
 cache_test_data = false
 site_admin_project = test
 
-# useful primarily for test suites, where we want to see the error right away
+; useful primarily for test suites, where we want to see the error right away
 monq.raise_errors = true
 
-# Set the locations of some static resources
-#  script_name is the path that is handled by the application
-#  url_base is the prefix that references to the static resources should have
+; Required so that g.production_mode is True, and Google Analytics is included (weird.)
+; may also be useful for other reasons during tests (e.g. not intercepting error handling)
+debug = false
+
+; if enabled during tests, TimerMiddleware will end up wrapping requests way too many times instead of just once
+; not necessary anyway
+stats.sample_rate = 0
+
+; specify these without any build_key being included
 ew.script_name = /nf/_ew_/
 ew.url_base = /nf/_ew_/
 static.script_name = /nf/_static_/
 static.url_base = /nf/_static_/
 
+; tests check for these values in output
 scm.host.ro.git = git://git.localhost$path
 scm.host.rw.git = ssh://$username@localhost:8022/scm-repo$path
-scm.host.https.git = https://$username@localhost:8022/scm-repo$path
-scm.host.https_anon.git = https://localhost:8022/scm-repo$path
-scm.host.ro.hg = http://hg.localhost$path
-scm.host.rw.hg = ssh://$username@localhost:8022/scm-repo$path
-scm.host.https.hg = https://$username@localhost:8022/scm-repo$path
-scm.host.https_anon.hg = https://localhost:8022/scm-repo$path
 scm.host.ro.svn = http://svn.localhost$path/
 scm.host.rw.svn = svn+ssh://$username@localhost:8022/scm-repo$path/
 scm.host.https.svn = https://$username@localhost:8022/scm-repo$path/
-scm.host.https_anon.svn = https://localhost:8022/scm-repo$path/
-
-scm.clone.git = git clone $source_url $dest_path
-scm.clone.hg = hg clone $source_url $dest_path
-scm.clone.https_anon.svn = svn checkout $source_url $dest_path
-scm.clone.ro.svn = svn checkout $source_url $dest_path
-scm.clone.svn = svn checkout --username=$username $source_url $dest_path
+scm.host.ro.hg = http://hg.localhost$path
+scm.host.rw.hg = ssh://$username@localhost:8022/scm-repo$path
 
 scm.repos.root = /tmp
 scm.repos.tarball.enable = true
 scm.repos.tarball.root = /tmp/tarball
 scm.repos.tarball.url_prefix = file://
 
-bulk_export_path = /tmp/bulk_export/{nbhd}/{project}
-bulk_export_filename = {project}.zip
-bulk_export_download_instructions = Sample instructions for {project}
-
 support_tool_choices = wiki tickets discussion
 
-#stats.sample_rate = 0
+; markdown text longer than max length will not be converted to html
+; tests expect max length of 40000
+markdown_render_max_length = 40000
 
-short_url.url_pattern = {base_url}/{nbhd}/{project}/{mount_point}/{short_name}
+; TODO: make this and tests match development.ini
+bulk_export_filename = {project}.zip
+
+; TODO: update tests and let this be true
+solr.use_new_types = false
+
+; TODO: update tests and remove this setting override
+auth.require_email_addr = false
 
-# markdown text longer than max length will not be converted to html
-# tests expect max length of 40000
-markdown_render_max_length = 40000
 
-user_message.time_interval = 3600
-user_message.max_messages = 200
-
-auth.min_password_len = 6
-auth.max_password_len = 30
-
-# LDAP auth provider
-auth.ldap.server = ldaps://localhost/
-auth.ldap.suffix = ou=users,dc=sf,dc=net
-auth.ldap.admin_dn = cn=site,ou=admin,dc=sf,dc=net
-auth.ldap.admin_password = admin-password
-auth.ldap.use_schroot = False
-auth.ldap.password.algorithm = 6
-auth.ldap.password.rounds = 6000
-auth.ldap.password.salt_len = 16
-user_prefs_storage.ldap.fields.display_name = cn
-
-auth.allow_user_to_disable_account = true
-auth.allow_edit_prefs = true
-
-[app:main_with_amqp]
-use = main
-# Use test RabbitMQ vhost
-amqp.mock = false
-amqp.hostname = localhost
-amqp.port = 5672
-amqp.userid = testuser
-amqp.password = testpw
-amqp.vhost = vhost_testing
-
-
-# Add additional test specific configuration options as necessary.
+;
+; Logging goes to a test.log file in current directory
+;
 [loggers]
 keys = root, allura
 

http://git-wip-us.apache.org/repos/asf/allura/blob/2cdb4f85/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 3ffb2a2..dbc12b0 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -82,6 +82,7 @@ class TestNewGit(unittest.TestCase):
             '1e146e67985dcd71c74de79613719bef7bddca4a/')
         all_cis = list(self.repo.log(self.rev._id, id_only=True))
         assert len(all_cis) == 4
+        c.lcid_cache = {}
         self.rev.tree.ls()
         # print self.rev.tree.readme()
         assert_equal(self.rev.tree.readme(), (
@@ -204,7 +205,7 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
         with open(os.path.join(g.tmpdir, 'testgit.git/hooks/post-receive')) as f:
             c = f.read()
         self.assertIn(
-            'curl -s http://localhost/auth/refresh_repo/p/test/src-git/\n', c)
+            'curl -s http://localhost:8080/auth/refresh_repo/p/test/src-git/\n', c)
         self.assertIn('exec $DIR/post-receive-user\n', c)
         shutil.rmtree(dirname)
 
@@ -238,7 +239,7 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
             with open(os.path.join(g.tmpdir, 'testgit.git/hooks/post-receive')) as f:
                 c = f.read()
             self.assertIn(
-                'curl -s http://localhost/auth/refresh_repo/p/test/src-git/\n', c)
+                'curl -s http://localhost:8080/auth/refresh_repo/p/test/src-git/\n', c)
             self.assertIn('exec $DIR/post-receive-user\n', c)
             shutil.rmtree(dirname)
 
@@ -403,6 +404,7 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
         self.assertEqual(cids[-1], '9a7df788cf800241e3bb5a849c8870f2f8259d98')
 
     def test_ls(self):
+        c.lcid_cache = {}  # else it'll be a mock
         lcd_map = self.repo.commit('HEAD').tree.ls()
         self.assertEqual(lcd_map, [{
             'href': u'README',

http://git-wip-us.apache.org/repos/asf/allura/blob/2cdb4f85/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 92ccaf5..6276df8 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -169,7 +169,7 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
         with open(os.path.join(g.tmpdir, 'testsvn/hooks/post-commit')) as f:
             hook_data = f.read()
         self.assertIn(
-            'curl -s http://localhost/auth/refresh_repo/p/test/src/\n',
+            'curl -s http://localhost:8080/auth/refresh_repo/p/test/src/\n',
             hook_data)
         self.assertIn('exec $DIR/post-commit-user "$@"\n', hook_data)
 
@@ -221,7 +221,7 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
         with open(os.path.join(g.tmpdir, 'testsvn/hooks/post-commit')) as f:
             c = f.read()
         self.assertIn(
-            'curl -s http://localhost/auth/refresh_repo/p/test/src/\n', c)
+            'curl -s http://localhost:8080/auth/refresh_repo/p/test/src/\n', c)
         self.assertIn('exec $DIR/post-commit-user "$@"\n', c)
 
         repo.refresh(notify=False)
@@ -696,7 +696,7 @@ class TestSVNRev(unittest.TestCase):
         n = M.Notification.query.find(
             dict(subject='[test:src] [r1] - rick446: Create readme')).first()
         assert n
-        assert_equal(n.text, 'Create readme http://localhost/p/test/src/1/')
+        assert_equal(n.text, 'Create readme http://localhost:8080/p/test/src/1/')
 
 
 class _Test(unittest.TestCase):
@@ -890,7 +890,7 @@ class TestRepo(_TestWithRepo):
         notifications = M.Notification.query.find().all()
         for n in notifications:
             if '100 new commits' in n.subject:
-                assert "master,branch:  by %s http://localhost/ci/foo99" % committer_name in n.text
+                assert "master,branch:  by %s http://localhost:8080/ci/foo99" % committer_name in n.text
                 break
         else:
             assert False, 'Did not find notification'

http://git-wip-us.apache.org/repos/asf/allura/blob/2cdb4f85/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 e8195d5..7f67b3a 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -2351,7 +2351,7 @@ class TestFunctionalController(TrackerTestController):
             return_path, rcpts, body = _client.sendmail.call_args[0]
             body = body.split('\n')
             assert 'Subject: [test:bugs] #1 test <h2> ticket' in body
-            assert '<p><strong> <a class="alink" href="http://localhost/p/test/bugs/1">[bugs:#1]</a> test &lt;h2&gt; ticket</strong></p>' in body
+            assert_in('<p><strong> <a class="alink" href="http://localhost:8080/p/test/bugs/1">[bugs:#1]</a> test &lt;h2&gt; ticket</strong></p>', body)
 
     @patch('forgetracker.search.query_filter_choices')
     def test_multiselect(self, query_filter_choices):

http://git-wip-us.apache.org/repos/asf/allura/blob/2cdb4f85/ForgeTracker/forgetracker/tests/unit/test_root_controller.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/unit/test_root_controller.py b/ForgeTracker/forgetracker/tests/unit/test_root_controller.py
index facc28c..ae2f7a1 100644
--- a/ForgeTracker/forgetracker/tests/unit/test_root_controller.py
+++ b/ForgeTracker/forgetracker/tests/unit/test_root_controller.py
@@ -15,16 +15,19 @@
 #       specific language governing permissions and limitations
 #       under the License.
 
+import unittest
+
 from mock import Mock, patch
 from ming.orm.ormsession import session
+from pylons import tmpl_context as c
+from nose.tools import assert_equal
 
 from allura.lib import helpers as h
 from allura.model import User
-from pylons import tmpl_context as c
+
 from forgetracker.tests.unit import TrackerTestWithModel
 from forgetracker.model import Ticket
 from forgetracker import tracker_main
-import unittest
 
 
 class WithUserAndBugsApp(TrackerTestWithModel):
@@ -46,7 +49,7 @@ class TestWhenSearchingWithCustomFields(WithUserAndBugsApp):
         expected = [dict(sortable_name='_iteration_number_s',
                          name='_iteration_number',
                          label='Iteration Number')]
-        assert self.response['sortable_custom_fields'] == expected
+        assert_equal(self.response['sortable_custom_fields'], expected)
 
     def test_that_tickets_are_listed(self):
         assert self.response['tickets'][0].summary == 'colors are wrong'


[07/14] allura git commit: [#7866] ticket:754 Make ajax status checking more DRY

Posted by je...@apache.org.
[#7866] ticket:754 Make ajax status checking more DRY


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

Branch: refs/heads/ib/7866
Commit: 0be08e5fb7237f54c56c9614238270b923c7abe9
Parents: 76f05fa
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Apr 17 13:20:14 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Apr 21 08:15:31 2015 +0000

----------------------------------------------------------------------
 Allura/allura/templates/repo/merge_request.html | 144 ++++++++++---------
 1 file changed, 77 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/0be08e5f/Allura/allura/templates/repo/merge_request.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/merge_request.html b/Allura/allura/templates/repo/merge_request.html
index 99bcdec..37830b8 100644
--- a/Allura/allura/templates/repo/merge_request.html
+++ b/Allura/allura/templates/repo/merge_request.html
@@ -133,11 +133,12 @@ Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
   .merge-conflicts { color: red; }
   .can-merge-in-progress { color: grey; }
 
+  #merge_task_status .{{ merge_status }} { display: inline-block; }
+  #can_merge_task_status .{{ can_merge_status }} { display: inline-block; }
   .task_status { margin: 0 10px; }
   .task_status h2 { display: none; }
-  .task_status .{{ merge_status }} { display: inline-block; }
   .task_status h2.complete { color: #C6D880; }
-  .task_status h2.busy, .task_status h2.busy { color: #003565; }
+  .task_status h2.busy { color: #003565; }
   .task_status h2.fail { color: #f33; }
 </style>
 {% endblock %}
@@ -146,72 +147,81 @@ Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
 {{ super() }}
 <script type="text/javascript">
 $(function() {
-    {% if merge_status in ('ready', 'busy') %}
-        $('#merge_task_status > .spinner').show();
-        var delay = 500;
-        function check_merge_status() {
-          $.get("{{request.path.rstrip('/') + '/merge_task_status'}}", function(data) {
-                if (data.status === 'complete') {
-                    $('#merge_task_status > .spinner').hide();
-                    $('#merge_task_status h2').hide();
-                    $('#merge_task_status h2.complete').show();
-                    location.reload();
-                } else {
-                    if (data.status === 'ready' || data.status === 'busy') {
-                        // keep waiting
-                        $('#merge_task_status h2').hide();
-                        $('#merge_task_status h2.busy').show();
-                    } else {
-                        // something went wrong
-                        $('#merge_task_status > .spinner').hide();
-                        $('#merge_task_status h2').hide();
-                        $('#merge_task_status h2.fail').show();
-                    }
-                    if (delay < 60000){
-                        delay = delay * 2;
-                    }
-                    window.setTimeout(check_merge_status, delay);
-                }
-            });
-        }
-        window.setTimeout(check_merge_status, delay);
-    {% endif %}
+    function make_status_watcher(spinner_selector, status_url, on_complete, on_progress, on_error) {
+      var delay = 500;
+      var delay_threshold = 60000;
+
+      var check_status = function() {
+        $.get(status_url, function(data) {
+          if (data.status === 'complete') {
+            $(spinner).hide();
+            on_complete();
+          } else {
+            if (data.status === 'ready' || data.status === 'busy') {
+              on_progress();
+            } else {
+              $(spinner).hide();
+              on_error();
+            }
+            if (delay < delay_threshold) {
+              delay = delay * 2;
+            }
+            window.setTimeout(check_status, delay);
+          }
+        });
+      }
+
+      var start = function() {
+        $(spinner_selector).show();
+        window.setTimeout(check_status, delay);
+      }
+
+      return start;
+    }
 
-    {% if can_merge_status in ('ready', 'busy') %}
-        $('#can_merge_task_status > .spinner').show();
-        var delay = 500;
-        function check_can_merge_status() {
-          $.get("{{request.path.rstrip('/') + '/can_merge_task_status'}}", function(data) {
-                if (data.status === 'complete') {
-                    $('#can_merge_task_status > .spinner').hide();
-                    $('#can_merge_task_status h2').hide();
-                    // TODO: check if actually can merge and show appropriate message
-                    $('.merge-help-text').hide();
-                    $('.merge-ok').show();
-                    $('.merge-btn').prop('disabled', false);
-                } else {
-                    if (data.status === 'ready' || data.status === 'busy') {
-                        // keep waiting
-                        $('#can_merge_task_status h2').hide();
-                        $('#can_merge_task_status h2.busy').show();
-                        $('.merge-help-text').hide();
-                        $('.can-merge-in-progress').show();
-                    } else {
-                        // something went wrong
-                        $('#can_merge_task_status > .spinner').hide();
-                        $('#can_merge_task_status h2').hide();
-                        $('#merge_task_status h2.fail').show();
-                        $('.merge-help-text').hide();
-                        $('.merge-conflicts').show();
-                    }
-                    if (delay < 60000){
-                        delay = delay * 2;
-                    }
-                    window.setTimeout(check_can_merge_status, delay);
-                }
-            });
-        }
-        window.setTimeout(check_can_merge_status, delay);
+    {% if merge_status in ('ready', 'busy') %}
+      var spinner = '#merge_task_status > .spinner';
+      var url = "{{request.path.rstrip('/') + '/merge_task_status'}}";
+      function on_complete() {
+        $('#merge_task_status h2').hide();
+        $('#merge_task_status h2.complete').show();
+        location.reload();
+      }
+      function on_progress() {
+        $('#merge_task_status h2').hide();
+        $('#merge_task_status h2.busy').show();
+      }
+      function on_error() {
+        $('#merge_task_status h2').hide();
+        $('#merge_task_status h2.fail').show();
+      }
+      var start_watcher = make_status_watcher(spinner, url, on_complete, on_progress, on_error);
+      start_watcher();
+
+    {% elif can_merge_status in ('ready', 'busy') %}
+      var spinner = '#can_merge_task_status > .spinner';
+      var url = "{{request.path.rstrip('/') + '/can_merge_task_status'}}";
+      function on_complete() {
+        $('#can_merge_task_status h2').hide();
+        // TODO: check if actually can merge and show appropriate message
+        $('.merge-help-text').hide();
+        $('.merge-ok').show();
+        $('#merge-btn').prop('disabled', false);
+      }
+      function on_progress() {
+        $('#can_merge_task_status h2').hide();
+        $('#can_merge_task_status h2.busy').show();
+        $('.merge-help-text').hide();
+        $('.can-merge-in-progress').show();
+      }
+      function on_error() {
+        $('#can_merge_task_status h2').hide();
+        $('#can_merge_task_status h2.fail').show();
+        $('.merge-help-text').hide();
+        $('.merge-conflicts').show();
+      }
+      var start_watcher = make_status_watcher(spinner, url, on_complete, on_progress, on_error);
+      start_watcher();
     {% endif %}
 });
 </script>


[13/14] allura git commit: [#7866] ticket:754 Add tests for can_merge cache helpers

Posted by je...@apache.org.
[#7866] ticket:754 Add tests for can_merge cache helpers


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

Branch: refs/heads/ib/7866
Commit: 13ba80eab2acb6934ffb2b9b92e407b46794fbc5
Parents: 17b495b
Author: Igor Bondarenko <je...@gmail.com>
Authored: Sat Apr 18 12:13:49 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Apr 21 08:15:32 2015 +0000

----------------------------------------------------------------------
 Allura/allura/tests/model/test_repo.py | 30 ++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/13ba80ea/Allura/allura/tests/model/test_repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_repo.py b/Allura/allura/tests/model/test_repo.py
index 8b406da..54a30a6 100644
--- a/Allura/allura/tests/model/test_repo.py
+++ b/Allura/allura/tests/model/test_repo.py
@@ -729,8 +729,36 @@ class TestMergeRequest(object):
     def setUp(self):
         setup_basic_test()
         setup_global_objects()
-        self.mr = M.MergeRequest(app_config=mock.Mock(_id=ObjectId()))
+        self.mr = M.MergeRequest(
+            app_config=mock.Mock(_id=ObjectId()),
+            downstream={'commit_id': '12345'},
+        )
         self.mr.app = mock.Mock(forkable=True)
+        self.mr.app.repo.commit.return_value = mock.Mock(_id='09876')
+
+    def test_can_merge_cache_key(self):
+        key = self.mr.can_merge_cache_key()
+        assert_equal(key, '12345-09876')
+
+    def test_get_can_merge_cache(self):
+        key = self.mr.can_merge_cache_key()
+        assert_equal(self.mr.get_can_merge_cache(), None)
+        self.mr.can_merge_cache[key] = True
+        assert_equal(self.mr.get_can_merge_cache(), True)
+
+        self.mr.can_merge_cache_key = lambda: '123-123'
+        self.mr.can_merge_cache['123-123'] = False
+        assert_equal(self.mr.get_can_merge_cache(), False)
+
+    def test_set_can_merge_cache(self):
+        key = self.mr.can_merge_cache_key()
+        assert_equal(self.mr.can_merge_cache, {})
+        self.mr.set_can_merge_cache(True)
+        assert_equal(self.mr.can_merge_cache, {key: True})
+
+        self.mr.can_merge_cache_key = lambda: '123-123'
+        self.mr.set_can_merge_cache(False)
+        assert_equal(self.mr.can_merge_cache, {key: True, '123-123': False})
 
     def test_can_merge(self):
         assert_equal(self.mr.can_merge(),