renamed 'sysadmin_userid' to 'sysadmin_userids' to support multiple sysadmin ids.
added svn commit history to the project home page
This commit is contained in:
		| @ -1,7 +1,7 @@ | ||||
|  | ||||
| cfgdir=$(CFGDIR) | ||||
| cfg_DATA = codepot.ini codepot.sql codepot.a2ldap | ||||
| cfg_SCRIPTS = repo.sh start-commit post-commit | ||||
| cfg_SCRIPTS = repo.sh start-commit pre-commit post-commit | ||||
|  | ||||
| EXTRA_DIST = $(cfg_DATA)  $(cfg_SCRIPTS) | ||||
|  | ||||
|  | ||||
| @ -166,7 +166,7 @@ top_builddir = @top_builddir@ | ||||
| top_srcdir = @top_srcdir@ | ||||
| wwwdir = @wwwdir@ | ||||
| cfg_DATA = codepot.ini codepot.sql codepot.a2ldap | ||||
| cfg_SCRIPTS = repo.sh start-commit post-commit | ||||
| cfg_SCRIPTS = repo.sh start-commit pre-commit post-commit | ||||
| EXTRA_DIST = $(cfg_DATA)  $(cfg_SCRIPTS) | ||||
| all: all-am | ||||
|  | ||||
|  | ||||
| @ -75,9 +75,11 @@ svn_base_url = "http://${SERVER_NAME}:${SERVER_PORT}/svn" | ||||
| login_model = "LdapLoginModel" | ||||
|  | ||||
| ;------------------------------------------------------------------------------ | ||||
| ; System administrator ID | ||||
| ; Comma separated list of system administrator IDs | ||||
| ;------------------------------------------------------------------------------ | ||||
| sysadmin_userid = | ||||
| ; sysadmin_userids = tom, dick, jane | ||||
| ;------------------------------------------------------------------------------ | ||||
| sysadmin_userids = | ||||
|  | ||||
| ;------------------------------------------------------------------------------ | ||||
| ; Maximum file upload size in Kbytes | ||||
| @ -94,6 +96,10 @@ max_latest_projects = "10" | ||||
| ;------------------------------------------------------------------------------ | ||||
| max_svn_commits = "10" | ||||
|  | ||||
| ;------------------------------------------------------------------------------ | ||||
| ; Maximum number of svn commits to show in the project home page | ||||
| ;------------------------------------------------------------------------------ | ||||
| max_svn_commits_in_project = "5" | ||||
|  | ||||
| ;------------------------------------------------------------------------------ | ||||
| ; directory to accomodate subversion repositories | ||||
|  | ||||
| @ -76,7 +76,8 @@ CREATE TABLE file ( | ||||
| CREATE TABLE log  ( | ||||
| 	id         BIGINT PRIMARY KEY AUTO_INCREMENT, | ||||
| 	type       VARCHAR(16)  NOT NULL, | ||||
| 	projectid  VARCHAR(32)  NOT NULL, | ||||
| 	message    TEXT         NOT NULL, | ||||
| 	createdon  DATETIME     NOT NULL, | ||||
| 	INDEX timed_type (createdon, type) | ||||
| 	INDEX timed_type_project (createdon, type, projectid) | ||||
| ) charset=utf8 engine=InnoDB;	 | ||||
|  | ||||
| @ -1,13 +1,8 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| post_commit() { | ||||
| 	local repo_path="$1" | ||||
| 	local rev="$2" | ||||
| 	local repo="`basename "${repo_path}"`" | ||||
| REPOBASE="`basename "${1}"`" | ||||
| REV="${2}" | ||||
|  | ||||
| 	ans="`wget -q -O- "%API%/logSvnCommit/${repo}/${rev}" 2>/dev/null`" | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| post_commit "$1" "$2" | ||||
| exit $? | ||||
| # does not care if logging has failed. | ||||
| wget -q -O- "%API%/logSvnCommit/${REPOBASE}/${REV}" 2>/dev/null | ||||
| exit 0 | ||||
|  | ||||
							
								
								
									
										29
									
								
								codepot/etc/pre-commit
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										29
									
								
								codepot/etc/pre-commit
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,29 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| REPO="$1" | ||||
| TXN="$2" | ||||
|  | ||||
| # TODO: need to check the policy on a commit message | ||||
| #       wget ... %API%/svnPolicy/ ... | ||||
| #       once done, update repo.sh to include pre-commit | ||||
|  | ||||
| svnlook log -t "$TXN" "$REPO" | grep "[a-zA-Z0-9]" >/dev/null || { | ||||
| 	echo "---------------------------------------------------------" >&2 | ||||
| 	echo " Your commit message do not contain any meaningful text. " >&2 | ||||
| 	echo "---------------------------------------------------------" >&2 | ||||
| 	exit 1 | ||||
| } | ||||
|  | ||||
| # | ||||
| # Subversion problem: | ||||
| #  Hard to detect the tagging patterns and update patterns on a tag. | ||||
| # | ||||
| #svnlook changed -t "$TXN" "$REPO" | grep '^tags/' >/dev/null  && { | ||||
| #	echo "----------------------------------------------------" >&2 | ||||
| #	echo " You are not allowed to change tags/*               " >&2  | ||||
| #	echo "----------------------------------------------------" >&2 | ||||
| #	exit 1 | ||||
| #} | ||||
| # | ||||
|  | ||||
| exit 0 | ||||
| @ -29,6 +29,14 @@ make_repo() { | ||||
| 		chmod 0755 "${repodir}/start-commit" | ||||
| 	#} | ||||
|  | ||||
| 	#[ -f "${repodir}/pre-commit" ] || { | ||||
| 	#	sed "s|%API%|${api}|g" "${cfgdir}/pre-commit" > "${repodir}/pre-commit" || { | ||||
| 	#		echo "ERROR: cannot install pre-commit to ${repodir}" | ||||
| 	#		return 1; | ||||
| 	#	} | ||||
| 	#	chmod 0755 "${repodir}/pre-commit" | ||||
| 	#} | ||||
|  | ||||
| 	#[ -f "${repodir}/post-commit" ] || { | ||||
| 		sed "s|%API%|${api}|g" "${cfgdir}/post-commit" > "${repodir}/post-commit" || { | ||||
| 			echo "ERROR: cannot install post-commit to ${repodir}" | ||||
|  | ||||
| @ -1,21 +1,19 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| start_commit() { | ||||
| 	local repo_path="$1" | ||||
| 	local user="$2" | ||||
| 	local repo="`basename "${repo_path}"`" | ||||
| REPOBASE="`basename "${1}"`" | ||||
| USER="${2}" | ||||
|  | ||||
| 	ans="`wget -q -O- "%API%/projectHasMember/${repo}/${user}" 2>/dev/null`" | ||||
| 	[ "${ans}" = "YES" ] && return 0; | ||||
| ans="`wget -q -O- "%API%/projectHasMember/${REPOBASE}/${USER}" 2>/dev/null`" | ||||
| [ "${ans}" = "YES" ] && exit 0 | ||||
|  | ||||
| 	[ "${ans}" = "NO" ] && { | ||||
| 		echo "${user} is not a member of ${repo}" >&2 | ||||
| 		return 1 | ||||
| 	} | ||||
|  | ||||
| 	echo "Critical error occurred while checking project membership of ${repo} for ${user}" >&2 | ||||
| 	return 1 | ||||
| [ "${ans}" = "NO" ] && { | ||||
| 	echo "-------------------------------------------------------------" >&2 | ||||
| 	echo " ${USER} is not a member of ${REPOBASE}" >&2 | ||||
| 	echo "-------------------------------------------------------------" >&2 | ||||
| 	exit 1 | ||||
| } | ||||
|  | ||||
| start_commit "$1" "$2" | ||||
| exit $? | ||||
| echo "---------------------------------------------------------------------" >&2 | ||||
| echo " Failed to check membership of ${REPOBASE} for ${USER}" >&2 | ||||
| echo "---------------------------------------------------------------------" >&2 | ||||
| exit 1 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user