<commit_before><?xml version="1.0" encoding="UTF-8"?>

<!--
	1. SvnAnt must be installed to ANT_HOME/lib from http://subclipse.tigris.org/svnant.html
	2. Ant-Contrib must be installed to ANT_HOME/lib from http://ant-contrib.sourceforge.ne
	3, ORO must be installed to ANT_HOME/lib
	4. "svn" must be in PATH
	5. "cvs" must be in PATH
	6. "p4" must be in PATH
	7. Make sure that the repo exist in SVN, CVS and P4
	7. Configure hook scripts for SVN, CVS and P4
	8. Configure commit acceptance rules
	9. Create the 4 preconfigured issues
	10. Run "commitAll" and check the result log
-->
<project basedir="." default="commitAll">
	<taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask"/>
	<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>

	<!-- configuration -->
	<property name="tempDir.path" location="/temp/jira-commitacceptance-test" />
	<property name="logfile.path" location="${tempDir.path}/log.txt" />
	<property name="commitMessage" value="<NAME>!" />

	<property name="svn.repo.url" value="file:///new/testrepos/jira-svn-repo" />
	<property name="svn.workingCopy.dir" location="${tempDir.path}/svn-workingcopy" />
	<property name="svn.testFile.path" location="${svn.workingCopy.dir}/LICENSE.txt" />

	<property name="cvs.repo.cvsRoot" value="\new\testrepos\cvs-server-jira" />
	<property name="cvs.repo.package" value="x" />
	<property name="cvs.workingCopy.dir" location="${tempDir.path}/cvs-workingcopy" />
	<property name="cvs.testFile.path" location="${cvs.workingCopy.dir}/${cvs.repo.package}/file.txt" />
	
	<property name="p4.client" value="commitacceptance" />
	<property name="p4.testFile.depotPath" value="LICENSE.txt" />
	<property name="p4.workingCopy.dir" location="${tempDir.path}/p4-workingcopy" />
	<property name="p4.testFile.path" location="${p4.workingCopy.dir}\${p4.testFile.depotPath}" />

	<property name="issue.nonExisting" value="TST-0"></property>
	<property name="issue.unresolvedUnassigned" value="TST-1"></property><!-- can be assigned to a different user -->
	<property name="issue.unresolvedAssigned" value="TST-2"></property>
	<property name="issue.resolvedUnassigned" value="TST-3"></property><!-- can be assigned to a different user -->
	<property name="issue.resolvedAssigned" value="TST-4"></property>
	<property name="issue.anotherProject" value="ARP-1"></property><!-- can be anything, but must be valid -->

	<target name="init">
		<!-- checkout SVN working copy -->
		<if>
			<available file="${svn.testFile.path}" />
			<then>
				<echo>SVN working copy exists.</echo>
			</then>
			<else>
				<mkdir dir="${svn.workingCopy.dir}" />
				<svn>
					<checkout url="${svn.repo.url}" destPath="${svn.workingCopy.dir}" />
				</svn>
			</else>
		</if>
		<!-- checkout CVS working copy -->
		<if>
			<available file="${cvs.testFile.path}" />
			<then>
				<echo>CVS working copy exists.</echo>
			</then>
			<else>
				<mkdir dir="${cvs.workingCopy.dir}" />
				<cvs command="checkout" cvsroot="${cvs.repo.cvsRoot}" package="${cvs.repo.package}" dest="${cvs.workingCopy.dir}" />
			</else>
		</if>
		<!-- checkout P4 working copy -->
		<if>
			<available file="${p4.testFile.path}" />
			<then>
				<echo>P4 working copy exists.</echo>
			</then>
			<else>
				<mkdir dir="${p4.workingCopy.dir}" />
				<p4sync />
			</else>
		</if>
	</target>

	<target name="commit" depends="init" description="TODO">
		<!-- commit to SVN -->
		<buildnumber file="${svn.testFile.path}"/>
		<svn>
			<status path="${svn.testFile.path}" revisionProperty="svn.oldRevision" />
		</svn>
		<exec executable="svn"><!-- commandline SVN executable is used to commit as SvnAnt can treat with commit hooks?! -->
			<arg value="commit" />
			<arg value="-m" />
			<arg value="${commitMessage}" />
			<arg value="${svn.testFile.path}" />
		</exec>
		<svn>
			<status path="${svn.testFile.path}" revisionProperty="svn.newRevision" />
		</svn>
		<!-- commit to CVS -->
		<buildnumber file="${cvs.testFile.path}"/>
		<exec dir="${cvs.workingCopy.dir}/${cvs.repo.package}" executable="cvs" resultproperty="cvsResultCode"><!-- commandline CVS executable is used to commit as the <cvs> task had problems with the current dir -->
			<arg value="-d"/>
			<arg value="${cvs.repo.cvsRoot}"/>
			<arg value="commit"/>
			<arg value="-m"/>
			<arg value="${commitMessage}"/>
		</exec>
		<!-- commit to P4 -->
		<p4change description="${commitMessage}" />
		<p4edit change="${p4.change}" view="${p4.testFile.path}" />
		<buildnumber file="${p4.testFile.path}" />
		<exec executable="p4" resultproperty="p4ResultCode"><!-- TODO commandline P4 executable is used to commit as p4submit task does not return any result code -->
			<arg value="-c" />
			<arg value="${p4.client}" />
			<arg value="submit" />
			<arg value="-c" />
			<arg value="${p4.change}" />
		</exec>
		<!-- log -->
		<if>
			<equals arg1="${svn.newRevision}" arg2="${svn.oldRevision}" />
			<then>
				<echo file="${logfile.path}" append="true">REJECTED  </echo>
			</then>
			<else>
				<echo file="${logfile.path}" append="true">Accepted  </echo>
			</else>
		</if>
		<if>
			<not>
				<equals arg1="${cvsResultCode}" arg2="0" />
			</not>
			<then>
				<echo file="${logfile.path}" append="true">REJECTED  </echo>
			</then>
			<else>
				<echo file="${logfile.path}" append="true">Accepted  </echo>
			</else>
		</if>
		<if><commit_msg>TODO tag removed<commit_after><?xml version="1.0" encoding="UTF-8"?>

<!--
	1. SvnAnt must be installed to ANT_HOME/lib from http://subclipse.tigris.org/svnant.html
	2. Ant-Contrib must be installed to ANT_HOME/lib from http://ant-contrib.sourceforge.ne
	3, ORO must be installed to ANT_HOME/lib
	4. "svn" must be in PATH
	5. "cvs" must be in PATH
	6. "p4" must be in PATH
	7. Make sure that the repo exist in SVN, CVS and P4
	7. Configure hook scripts for SVN, CVS and P4
	8. Configure commit acceptance rules
	9. Create the 4 preconfigured issues
	10. Run "commitAll" and check the result log
-->
<project basedir="." default="commitAll">
	<taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask"/>
	<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>

	<!-- configuration -->
	<property name="tempDir.path" location="/temp/jira-commitacceptance-test" />
	<property name="logfile.path" location="${tempDir.path}/log.txt" />
	<property name="commitMessage" value="<NAME>!" />

	<property name="svn.repo.url" value="file:///new/testrepos/jira-svn-repo" />
	<property name="svn.workingCopy.dir" location="${tempDir.path}/svn-workingcopy" />
	<property name="svn.testFile.path" location="${svn.workingCopy.dir}/LICENSE.txt" />

	<property name="cvs.repo.cvsRoot" value="\new\testrepos\cvs-server-jira" />
	<property name="cvs.repo.package" value="x" />
	<property name="cvs.workingCopy.dir" location="${tempDir.path}/cvs-workingcopy" />
	<property name="cvs.testFile.path" location="${cvs.workingCopy.dir}/${cvs.repo.package}/file.txt" />
	
	<property name="p4.client" value="commitacceptance" />
	<property name="p4.testFile.depotPath" value="LICENSE.txt" />
	<property name="p4.workingCopy.dir" location="${tempDir.path}/p4-workingcopy" />
	<property name="p4.testFile.path" location="${p4.workingCopy.dir}\${p4.testFile.depotPath}" />

	<property name="issue.nonExisting" value="TST-0"></property>
	<property name="issue.unresolvedUnassigned" value="TST-1"></property><!-- can be assigned to a different user -->
	<property name="issue.unresolvedAssigned" value="TST-2"></property>
	<property name="issue.resolvedUnassigned" value="TST-3"></property><!-- can be assigned to a different user -->
	<property name="issue.resolvedAssigned" value="TST-4"></property>
	<property name="issue.anotherProject" value="ARP-1"></property><!-- can be anything, but must be valid -->

	<target name="init">
		<!-- checkout SVN working copy -->
		<if>
			<available file="${svn.testFile.path}" />
			<then>
				<echo>SVN working copy exists.</echo>
			</then>
			<else>
				<mkdir dir="${svn.workingCopy.dir}" />
				<svn>
					<checkout url="${svn.repo.url}" destPath="${svn.workingCopy.dir}" />
				</svn>
			</else>
		</if>
		<!-- checkout CVS working copy -->
		<if>
			<available file="${cvs.testFile.path}" />
			<then>
				<echo>CVS working copy exists.</echo>
			</then>
			<else>
				<mkdir dir="${cvs.workingCopy.dir}" />
				<cvs command="checkout" cvsroot="${cvs.repo.cvsRoot}" package="${cvs.repo.package}" dest="${cvs.workingCopy.dir}" />
			</else>
		</if>
		<!-- checkout P4 working copy -->
		<if>
			<available file="${p4.testFile.path}" />
			<then>
				<echo>P4 working copy exists.</echo>
			</then>
			<else>
				<mkdir dir="${p4.workingCopy.dir}" />
				<p4sync />
			</else>
		</if>
	</target>

	<target name="commit" depends="init" description="TODO">
		<!-- commit to SVN -->
		<buildnumber file="${svn.testFile.path}"/>
		<svn>
			<status path="${svn.testFile.path}" revisionProperty="svn.oldRevision" />
		</svn>
		<exec executable="svn"><!-- commandline SVN executable is used to commit as SvnAnt can treat with commit hooks?! -->
			<arg value="commit" />
			<arg value="-m" />
			<arg value="${commitMessage}" />
			<arg value="${svn.testFile.path}" />
		</exec>
		<svn>
			<status path="${svn.testFile.path}" revisionProperty="svn.newRevision" />
		</svn>
		<!-- commit to CVS -->
		<buildnumber file="${cvs.testFile.path}"/>
		<exec dir="${cvs.workingCopy.dir}/${cvs.repo.package}" executable="cvs" resultproperty="cvsResultCode"><!-- commandline CVS executable is used to commit as the <cvs> task had problems with the current dir -->
			<arg value="-d"/>
			<arg value="${cvs.repo.cvsRoot}"/>
			<arg value="commit"/>
			<arg value="-m"/>
			<arg value="${commitMessage}"/>
		</exec>
		<!-- commit to P4 -->
		<p4change description="${commitMessage}" />
		<p4edit change="${p4.change}" view="${p4.testFile.path}" />
		<buildnumber file="${p4.testFile.path}" />
		<exec executable="p4" resultproperty="p4ResultCode"><!-- commandline P4 executable is used to commit as p4submit task does not return any result code -->
			<arg value="-c" />
			<arg value="${p4.client}" />
			<arg value="submit" />
			<arg value="-c" />
			<arg value="${p4.change}" />
		</exec>
		<!-- log -->
		<if>
			<equals arg1="${svn.newRevision}" arg2="${svn.oldRevision}" />
			<then>
				<echo file="${logfile.path}" append="true">REJECTED  </echo>
			</then>
			<else>
				<echo file="${logfile.path}" append="true">Accepted  </echo>
			</else>
		</if>
		<if>
			<not>
				<equals arg1="${cvsResultCode}" arg2="0" />
			</not>
			<then>
				<echo file="${logfile.path}" append="true">REJECTED  </echo>
			</then>
			<else>
				<echo file="${logfile.path}" append="true">Accepted  </echo>
			</else>
		</if>
		<if>
{'fraction_non_alphanumeric': 0.20363772735795987, 'fraction_numerical': 0.010125632852053253, 'mean_word_length': 3.866332116788321, 'pattern_counts': {'":': 0, '<': 285, '<?xml version=': 2, '>': 285, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1013639', 'n_tokens_mistral': 4090, 'n_tokens_neox': 3683, 'n_words': 808}