diff options
author | Code Review <codereview-daemon@eclipse.org> | 2009-11-03 14:33:09 -0500 |
---|---|---|
committer | Code Review <codereview-daemon@eclipse.org> | 2009-11-03 14:33:09 -0500 |
commit | 9f9ea04350757f656a4aa6ec8f3ca641db605e4d (patch) | |
tree | 368786f0a5f8c947b29d227e2e76a991f444a1de | |
parent | 2bfe561f269afdd7f4772f8ebf34e5e25884942b (diff) | |
parent | 7e8dc53881a4f7babbab9cd9979a49edb7ad03f1 (diff) | |
download | jgit-9f9ea04350757f656a4aa6ec8f3ca641db605e4d.tar.gz jgit-9f9ea04350757f656a4aa6ec8f3ca641db605e4d.zip |
Merge changes I057c782c,Idff096ce,Ic9be0280,I07014d1b,Id8a76ee7,I9080f3dd,I8c1a0eb8,Ibaf87bb5,I9e1f1f5a,I355e95fa
* changes:
Prompt for passwords from the console in jgit command line tools
Move AWT based SSH authenticator to ui bundle
Refactor the cached Authenticator data out of AwtAuthenticator
Only import the sample data packs on tests that need them
Move T0007_Index to exttst
Refactor RepositoryTestCase to use LocalDiskRepository instead
Create JUnit test utilities for JGit derived sources
Delete obsolete JarLinkUtil
Refactor our Maven build to be modular
Switch pgm, test to proper plugin projects
79 files changed, 3162 insertions, 1158 deletions
diff --git a/.gitignore b/.gitignore deleted file mode 100644 index d73c6106c0..0000000000 --- a/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/jgit -/jgit.jar -/jgit_src.zip -/jgit_docs.zip -/org.eclipse.jgit/lib/jsch-*.jar -/org.eclipse.jgit.pgm/lib/args4j-*.jar diff --git a/jgit-maven/.gitignore b/jgit-maven/.gitignore deleted file mode 100644 index eb5a316cbd..0000000000 --- a/jgit-maven/.gitignore +++ /dev/null @@ -1 +0,0 @@ -target diff --git a/jgit-maven/jgit/pom.xml b/jgit-maven/jgit/pom.xml deleted file mode 100644 index 5f30afbfb4..0000000000 --- a/jgit-maven/jgit/pom.xml +++ /dev/null @@ -1,226 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (C) 2008, Imran M Yousuf <imyousuf@smartitengineering.com> - and other copyright owners as documented in the project's IP log. - - This program and the accompanying materials are made available - under the terms of the Eclipse Distribution License v1.0 which - accompanies this distribution, is reproduced below, and is - available at http://www.eclipse.org/org/documents/edl-v10.php - - All rights reserved. - - Redistribution and use in source and binary forms, with or - without modification, are permitted provided that the following - conditions are met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - - Neither the name of the Eclipse Foundation, Inc. nor the - names of its contributors may be used to endorse or promote - products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---> - -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>org.eclipse</groupId> - <artifactId>jgit</artifactId> - <packaging>jar</packaging> - <version>0.6.0-SNAPSHOT</version> - <name>jgit</name> - <url>http://repo.or.cz/w/jgit.git</url> - <mailingLists> - <mailingList> - <name>GIT Mailing List</name> - <post>git@vger.kernel.org</post> - <archive>http://marc.info/?l=git</archive> - </mailingList> - </mailingLists> - <description>Pure Java implementation of Git</description> - <developers> - <developer> - <name>Shawn O. Pearce</name> - <email>spearce@spearce.org</email> - <roles> - <role>Maintainer</role> - </roles> - </developer> - <developer> - <name>Robin Rosenberg</name> - <email>robin.rosenberg@dewire.com</email> - <roles> - <role>Maintainer</role> - </roles> - </developer> - <developer> - <name>Dave Watson</name> - <email>dwatson@mimvista.com</email> - <roles> - <role>Developer</role> - </roles> - </developer> - <developer> - <name>Roger C. Soares</name> - <email>rogersoares@intelinet.com.br</email> - <roles> - <role>Developer</role> - </roles> - </developer> - <developer> - <name>Marek Zawirski</name> - <email>marek.zawirski@gmail.com</email> - <roles> - <role>Developer</role> - </roles> - </developer> - <developer> - <name>Charles O'Farrell</name> - <email>charleso@charleso.org</email> - <roles> - <role>Contributor</role> - </roles> - </developer> - <developer> - <name>Imran M Yousuf</name> - <email>imyousuf@smartitengineering.com</email> - <organization>Smart IT Engineering</organization> - <roles> - <role>Contributor</role> - </roles> - </developer> - </developers> - <licenses> - <license> - <name>Eclipse Distribution License (New BSD License)</name> - <comments> - All rights reserved. - Redistribution and use in source and binary forms, with or - without modification, are permitted provided that the following - conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - Neither the name of the Eclipse Foundation, Inc. nor the - names of its contributors may be used to endorse or promote - products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - </comments> - </license> - </licenses> - <build> - <sourceDirectory>../../org.eclipse.jgit/src/</sourceDirectory> - <testResources> - <testResource> - <directory>../../org.eclipse.jgit.test/tst-rsrc/</directory> - </testResource> - </testResources> - <testSourceDirectory>../../org.eclipse.jgit.test/tst/</testSourceDirectory> - <plugins> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <version>2.0.2</version> - <configuration> - <source>1.5</source> - <target>1.5</target> - <encoding>UTF-8</encoding> - </configuration> - </plugin> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.4.2</version> - <configuration> - <includes> - <include>**/*Test.java</include> - <include>**/*TestCase.java</include> - <include>**/T000*.java</include> - </includes> - </configuration> - </plugin> - <plugin> - <artifactId>maven-source-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>jar</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-javadoc-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>jar</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>com.jcraft</groupId> - <artifactId>jsch</artifactId> - <version>0.1.41</version> - <scope>compile</scope> - </dependency> - </dependencies> - <distributionManagement> - <snapshotRepository> - <id>jgit-maven-snapshot-repository</id> - <name>JGit Maven Snapshot Repository</name> - <url>dav:https://egit.googlecode.com/svn/maven/snapshot-repository/</url> - <uniqueVersion>true</uniqueVersion> - </snapshotRepository> - </distributionManagement> -</project> diff --git a/make_jgit.sh b/make_jgit.sh deleted file mode 100644 index f7363f9f4b..0000000000 --- a/make_jgit.sh +++ /dev/null @@ -1,181 +0,0 @@ -#!/bin/sh -# Copyright (C) 2009, Christian Halstrick <christian.halstrick@sap.com> -# Copyright (C) 2008-2009, Google Inc. -# Copyright (C) 2009, Johannes Schindelin <Johannes.Schindelin@gmx.de> -# Copyright (C) 2008, Mike Ralphson <mike@abacus.co.uk> -# Copyright (C) 2009, Mykola Nikishov <mn@mn.com.ua> -# Copyright (C) 2009, Nicholas Campbell <nicholas.j.campbell@gmail.com> -# Copyright (C) 2009, Robin Rosenberg <robin.rosenberg@gmail.com> -# Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> -# and other copyright owners as documented in the project's IP log. -# -# This program and the accompanying materials are made available -# under the terms of the Eclipse Distribution License v1.0 which -# accompanies this distribution, is reproduced below, and is -# available at http://www.eclipse.org/org/documents/edl-v10.php -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or -# without modification, are permitted provided that the following -# conditions are met: -# -# - Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# - Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# -# - Neither the name of the Eclipse Foundation, Inc. nor the -# names of its contributors may be used to endorse or promote -# products derived from this software without specific prior -# written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -O_CLI=jgit -O_JAR=jgit.jar -O_SRC=jgit_src.zip -O_DOC=jgit_docs.zip - -PLUGINS=" - org.eclipse.jgit - org.eclipse.jgit.ui - org.eclipse.jgit.pgm -" -JARS=" - org.eclipse.jgit/lib/jsch-0.1.37.jar - org.eclipse.jgit.pgm/lib/args4j-2.0.9.jar -" - -PSEP=":" -T=".temp$$.$O_CLI" -T_MF="$T.MF" -R=`pwd` -if [ "$OSTYPE" = "cygwin" ] -then - R=`cygpath -m $R` - PSEP=";" -fi -if [ "$MSYSTEM" = "MINGW" -o "$MSYSTEM" = "MINGW32" ] -then - PSEP=";" - R=`pwd -W` -fi - -if [ -n "$JAVA_HOME" ] -then - PATH=${JAVA_HOME}/bin${PSEP}${PATH} -fi - -cleanup_bin() { - rm -f $T $O_CLI+ $O_JAR+ $O_SRC+ $T_MF - for p in $PLUGINS - do - rm -rf $p/bin2 - done - rm -rf docs -} - -die() { - cleanup_bin - rm -f $O_CLI $O_JAR $O_SRC - echo >&2 "$@" - exit 1 -} - -cleanup_bin -rm -f $O_CLI $O_JAR $O_SRC $O_DOC - -VN=`git describe --abbrev=4 HEAD 2>/dev/null` -git update-index -q --refresh -if [ -n "`git diff-index --name-only HEAD --`" ] -then - VN="$VN-dirty" -fi -VN=${VN:-untagged}`echo "$VN" | sed -e s/-/./g` - -CLASSPATH= -for j in $JARS -do - if [ -z "$CLASSPATH" ] - then - CLASSPATH="$R/$j" - else - CLASSPATH="${CLASSPATH}${PSEP}$R/$j" - fi -done -export CLASSPATH - -for p in $PLUGINS -do - echo "Entering $p ..." - (cd $p/src && - mkdir ../bin2 && - find . -name \*.java -type f | - xargs javac \ - -source 1.5 \ - -target 1.5 \ - -encoding UTF-8 \ - -g \ - -d ../bin2) || die "Building $p failed." - CLASSPATH="${CLASSPATH}${PSEP}$R/$p/bin2" -done -echo - -echo "Version $VN" && -echo Manifest-Version: 1.0 >$T_MF && -echo Implementation-Title: jgit >>$T_MF && -echo Implementation-Version: $VN >>$T_MF && - -java org.eclipse.jgit.pgm.build.JarLinkUtil \ - -include org.eclipse.jgit/bin2 \ - -file META-INF/MANIFEST.MF=$T_MF \ - >$O_JAR+ && -mv $O_JAR+ $O_JAR && -echo "Created $O_JAR." && - -java org.eclipse.jgit.pgm.build.JarLinkUtil \ - -include org.eclipse.jgit/src \ - -file META-INF/MANIFEST.MF=$T_MF \ - >$O_SRC+ && -mv $O_SRC+ $O_SRC && -echo "Created $O_SRC." && - -M_TB=META-INF/services/org.eclipse.jgit.pgm.TextBuiltin && -sed s/@@use_self@@/1/ jgit.sh >$O_CLI+ && -java org.eclipse.jgit.pgm.build.JarLinkUtil \ - `for p in $JARS ; do printf %s " -include $p" ;done` \ - `for p in $PLUGINS; do printf %s " -include $p/bin2";done` \ - -file $M_TB=org.eclipse.jgit.pgm/src/$M_TB \ - -file META-INF/MANIFEST.MF=$T_MF \ - >>$O_CLI+ && -chmod 555 $O_CLI+ && -mv $O_CLI+ $O_CLI && -echo "Created $O_CLI." || die "Build failed." - -echo "Building Javadocs ..." -for p in $PLUGINS; do - javadoc -quiet -sourcepath "$p/src/" -d "docs/$p/" \ - `find "$p/src" -name "*.java"` -done - -(cd docs && jar cf "../$O_DOC" .) -echo "Created $O_DOC." - -cleanup_bin diff --git a/org.eclipse.jgit.console/.classpath b/org.eclipse.jgit.console/.classpath new file mode 100644 index 0000000000..ad32c83a78 --- /dev/null +++ b/org.eclipse.jgit.console/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/org.eclipse.jgit.console/.gitignore b/org.eclipse.jgit.console/.gitignore new file mode 100644 index 0000000000..934e0e06ff --- /dev/null +++ b/org.eclipse.jgit.console/.gitignore @@ -0,0 +1,2 @@ +/bin +/target diff --git a/org.eclipse.jgit.console/.project b/org.eclipse.jgit.console/.project new file mode 100644 index 0000000000..4f272a7ccc --- /dev/null +++ b/org.eclipse.jgit.console/.project @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.jgit.console</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> + </natures> +</projectDescription> diff --git a/org.eclipse.jgit.console/.settings/org.eclipse.core.resources.prefs b/org.eclipse.jgit.console/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000..190e5c57d0 --- /dev/null +++ b/org.eclipse.jgit.console/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +#Sun Oct 11 08:00:39 EEST 2009 +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/org.eclipse.jgit.console/.settings/org.eclipse.core.runtime.prefs b/org.eclipse.jgit.console/.settings/org.eclipse.core.runtime.prefs new file mode 100644 index 0000000000..dc570415b6 --- /dev/null +++ b/org.eclipse.jgit.console/.settings/org.eclipse.core.runtime.prefs @@ -0,0 +1,3 @@ +#Sun Oct 11 08:00:39 EEST 2009 +eclipse.preferences.version=1 +line.separator=\n diff --git a/org.eclipse.jgit.console/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.console/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..214c48957a --- /dev/null +++ b/org.eclipse.jgit.console/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,331 @@ +#Sat Oct 31 19:37:20 PDT 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=error +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=error +org.eclipse.jdt.core.compiler.problem.unusedLabel=error +org.eclipse.jdt.core.compiler.problem.unusedLocal=error +org.eclipse.jdt.core.compiler.problem.unusedParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=1 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=80 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/org.eclipse.jgit.console/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.jgit.console/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000000..ccd15c2328 --- /dev/null +++ b/org.eclipse.jgit.console/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,61 @@ +#Sat Oct 31 16:20:21 PDT 2009 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_JGit Format +formatter_settings_version=11 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/> +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=false +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=false +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/org.eclipse.jgit.console/.settings/org.eclipse.pde.core.prefs b/org.eclipse.jgit.console/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 0000000000..9482745744 --- /dev/null +++ b/org.eclipse.jgit.console/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,3 @@ +#Sun Oct 11 07:58:06 EEST 2009 +eclipse.preferences.version=1 +resolve.requirebundle=false diff --git a/org.eclipse.jgit.console/META-INF/MANIFEST.MF b/org.eclipse.jgit.console/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..ed12693f0c --- /dev/null +++ b/org.eclipse.jgit.console/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Bundle-Localization: plugin +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %plugin_name +Bundle-SymbolicName: org.eclipse.jgit.console +Bundle-Version: 0.6.0.qualifier +Bundle-Vendor: %provider_name +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Export-Package: org.eclipse.jgit.console;version="0.6.0" +Import-Package: com.jcraft.jsch;version="0.1.41", + org.eclipse.jgit.transport;version="0.6.0", + org.eclipse.jgit.util diff --git a/org.eclipse.jgit.console/build.properties b/org.eclipse.jgit.console/build.properties new file mode 100644 index 0000000000..aa1a008269 --- /dev/null +++ b/org.eclipse.jgit.console/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.properties diff --git a/org.eclipse.jgit.console/plugin.properties b/org.eclipse.jgit.console/plugin.properties new file mode 100644 index 0000000000..a86bcd86b8 --- /dev/null +++ b/org.eclipse.jgit.console/plugin.properties @@ -0,0 +1,2 @@ +plugin_name=Java Git Console User Interface (Incubation) +provider_name=eclipse.org diff --git a/org.eclipse.jgit.console/pom.xml b/org.eclipse.jgit.console/pom.xml new file mode 100644 index 0000000000..98b1511ec1 --- /dev/null +++ b/org.eclipse.jgit.console/pom.xml @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (C) 2009, Google Inc. + Copyright (C) 2008, Imran M Yousuf <imyousuf@smartitengineering.com> + and other copyright owners as documented in the project's IP log. + + This program and the accompanying materials are made available + under the terms of the Eclipse Distribution License v1.0 which + accompanies this distribution, is reproduced below, and is + available at http://www.eclipse.org/org/documents/edl-v10.php + + All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, are permitted provided that the following + conditions are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + - Neither the name of the Eclipse Foundation, Inc. nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.jgit</groupId> + <artifactId>jgit-parent</artifactId> + <version>0.6.0-SNAPSHOT</version> + </parent> + + <artifactId>org.eclipse.jgit.console</artifactId> + <name>JGit - Console User Interface</name> + + <description> + Console based user interface + </description> + + <dependencies> + <dependency> + <groupId>org.eclipse.jgit</groupId> + <artifactId>org.eclipse.jgit</artifactId> + </dependency> + </dependencies> + + <build> + <sourceDirectory>src/</sourceDirectory> + + <resources> + <resource> + <directory>.</directory> + <includes> + <include>plugin.properties</include> + </includes> + </resource> + </resources> + + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.0.2</version> + <configuration> + <source>1.6</source> + <target>1.6</target> + <encoding>UTF-8</encoding> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifestFile>META-INF/MANIFEST.MF</manifestFile> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleAuthenticator.java b/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleAuthenticator.java new file mode 100644 index 0000000000..84fd520f75 --- /dev/null +++ b/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleAuthenticator.java @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2009, Google Inc. + * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> + * and other copyright owners as documented in the project's IP log. + * + * This program and the accompanying materials are made available + * under the terms of the Eclipse Distribution License v1.0 which + * accompanies this distribution, is reproduced below, and is + * available at http://www.eclipse.org/org/documents/edl-v10.php + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * - Neither the name of the Eclipse Foundation, Inc. nor the + * names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.eclipse.jgit.console; + +import java.io.Console; +import java.net.Authenticator; +import java.net.PasswordAuthentication; + +import org.eclipse.jgit.util.CachedAuthenticator; + +/** Basic network prompt for username/password when using the console. */ +public class ConsoleAuthenticator extends CachedAuthenticator { + /** Install this authenticator implementation into the JVM. */ + public static void install() { + final ConsoleAuthenticator c = new ConsoleAuthenticator(); + if (c.cons == null) + throw new NoClassDefFoundError("No System.console available"); + Authenticator.setDefault(c); + } + + private final Console cons = System.console(); + + @Override + protected PasswordAuthentication promptPasswordAuthentication() { + final String realm = formatRealm(); + String username = cons.readLine("Username for %s: ", realm); + if (username == null || username.isEmpty()) { + return null; + } + char[] password = cons.readPassword("Password: "); + if (password == null) { + password = new char[0]; + } + return new PasswordAuthentication(username, password); + } + + private String formatRealm() { + final StringBuilder realm = new StringBuilder(); + if (getRequestorType() == RequestorType.PROXY) { + realm.append(getRequestorType()); + realm.append(" "); + realm.append(getRequestingHost()); + if (getRequestingPort() > 0) { + realm.append(":"); + realm.append(getRequestingPort()); + } + } else { + realm.append(getRequestingURL()); + } + return realm.toString(); + } +} diff --git a/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleSshSessionFactory.java b/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleSshSessionFactory.java new file mode 100644 index 0000000000..7d36dded48 --- /dev/null +++ b/org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleSshSessionFactory.java @@ -0,0 +1,145 @@ +/* + * Copyright (C) 2009, Google Inc. + * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com> + * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> + * and other copyright owners as documented in the project's IP log. + * + * This program and the accompanying materials are made available + * under the terms of the Eclipse Distribution License v1.0 which + * accompanies this distribution, is reproduced below, and is + * available at http://www.eclipse.org/org/documents/edl-v10.php + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * - Neither the name of the Eclipse Foundation, Inc. nor the + * names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.eclipse.jgit.console; + +import java.io.Console; + +import org.eclipse.jgit.transport.OpenSshConfig; +import org.eclipse.jgit.transport.SshConfigSessionFactory; +import org.eclipse.jgit.transport.SshSessionFactory; + +import com.jcraft.jsch.Session; +import com.jcraft.jsch.UIKeyboardInteractive; +import com.jcraft.jsch.UserInfo; + +/** + * Loads known hosts and private keys from <code>$HOME/.ssh</code>. + * <p> + * This is the default implementation used by JGit and provides most of the + * compatibility necessary to match OpenSSH, a popular implementation of SSH + * used by C Git. + * <p> + * If user interactivity is required by SSH (e.g. to obtain a password) the + * system console is used to display a prompt to the end-user. + */ +public class ConsoleSshSessionFactory extends SshConfigSessionFactory { + /** Install this session factory implementation into the JVM. */ + public static void install() { + final ConsoleSshSessionFactory c = new ConsoleSshSessionFactory(); + if (c.cons == null) + throw new NoClassDefFoundError("No System.console available"); + SshSessionFactory.setInstance(c); + } + + private final Console cons = System.console(); + + @Override + protected void configure(final OpenSshConfig.Host hc, final Session session) { + if (!hc.isBatchMode()) + session.setUserInfo(new ConsoleUserInfo()); + } + + private class ConsoleUserInfo implements UserInfo, UIKeyboardInteractive { + private String passwd; + + private String passphrase; + + public void showMessage(final String msg) { + cons.printf("%s\n", msg); + cons.flush(); + } + + public boolean promptYesNo(final String msg) { + String r = cons.readLine("%s [y/n]? ", msg); + return "y".equalsIgnoreCase(r); + } + + public boolean promptPassword(final String msg) { + passwd = null; + char[] p = cons.readPassword("%s: ", msg); + if (p != null) { + passwd = new String(p); + return true; + } + return false; + } + + public boolean promptPassphrase(final String msg) { + passphrase = null; + char[] p = cons.readPassword("%s: ", msg); + if (p != null) { + passphrase = new String(p); + return true; + } + return false; + } + + public String getPassword() { + return passwd; + } + + public String getPassphrase() { + return passphrase; + } + + public String[] promptKeyboardInteractive(final String destination, + final String name, final String instruction, + final String[] prompt, final boolean[] echo) { + cons.printf("%s: %s\n", destination, name); + cons.printf("%s\n", instruction); + final String[] response = new String[prompt.length]; + for (int i = 0; i < prompt.length; i++) { + if (echo[i]) { + response[i] = cons.readLine("%s: ", prompt[i]); + } else { + final char[] p = cons.readPassword("%s: ", prompt[i]); + response[i] = p != null ? new String(p) : ""; + } + } + return response; + } + } +} diff --git a/org.eclipse.jgit.junit/.classpath b/org.eclipse.jgit.junit/.classpath new file mode 100644 index 0000000000..64c5e31b7a --- /dev/null +++ b/org.eclipse.jgit.junit/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/org.eclipse.jgit.junit/.gitignore b/org.eclipse.jgit.junit/.gitignore new file mode 100644 index 0000000000..934e0e06ff --- /dev/null +++ b/org.eclipse.jgit.junit/.gitignore @@ -0,0 +1,2 @@ +/bin +/target diff --git a/org.eclipse.jgit.junit/.project b/org.eclipse.jgit.junit/.project new file mode 100644 index 0000000000..90325d8fa2 --- /dev/null +++ b/org.eclipse.jgit.junit/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.jgit.junit</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.pde.PluginNature</nature> + </natures> +</projectDescription> diff --git a/org.eclipse.jgit.junit/.settings/org.eclipse.core.resources.prefs b/org.eclipse.jgit.junit/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000..6a9621db1d --- /dev/null +++ b/org.eclipse.jgit.junit/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +#Sat Dec 20 21:21:24 CET 2008 +eclipse.preferences.version=1 +encoding//tst-rsrc/org/eclipse/jgit/patch/testGetText_BothISO88591.patch=ISO-8859-1 +encoding//tst-rsrc/org/eclipse/jgit/patch/testGetText_Convert.patch=ISO-8859-1 +encoding//tst-rsrc/org/eclipse/jgit/patch/testGetText_DiffCc.patch=ISO-8859-1 +encoding/<project>=UTF-8 diff --git a/org.eclipse.jgit.junit/.settings/org.eclipse.core.runtime.prefs b/org.eclipse.jgit.junit/.settings/org.eclipse.core.runtime.prefs new file mode 100644 index 0000000000..9f733eeea7 --- /dev/null +++ b/org.eclipse.jgit.junit/.settings/org.eclipse.core.runtime.prefs @@ -0,0 +1,3 @@ +#Mon Mar 24 18:55:56 EDT 2008 +eclipse.preferences.version=1 +line.separator=\n diff --git a/org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..8bfa5f141a --- /dev/null +++ b/org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,320 @@ +#Tue Feb 05 00:01:29 CET 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=error +org.eclipse.jdt.core.compiler.problem.unusedLabel=error +org.eclipse.jdt.core.compiler.problem.unusedLocal=error +org.eclipse.jdt.core.compiler.problem.unusedParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error +org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=1 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false +org.eclipse.jdt.core.formatter.comment.format_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=80 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false diff --git a/org.eclipse.jgit.junit/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.jgit.junit/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000000..9adc9b1d31 --- /dev/null +++ b/org.eclipse.jgit.junit/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +#Sat Oct 31 14:53:06 PDT 2009 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_JGit +formatter_settings_version=10 +internal.default.compliance=default +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/> +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=false +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=false +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/org.eclipse.jgit.junit/META-INF/MANIFEST.MF b/org.eclipse.jgit.junit/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..0ff1c0f96a --- /dev/null +++ b/org.eclipse.jgit.junit/META-INF/MANIFEST.MF @@ -0,0 +1,27 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %plugin_name +Bundle-SymbolicName: org.eclipse.jgit.junit +Bundle-Version: 0.6.0.qualifier +Bundle-Localization: plugin +Bundle-Vendor: %provider_name +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: com.jcraft.jsch, + junit.framework, + org.eclipse.jgit.diff, + org.eclipse.jgit.dircache, + org.eclipse.jgit.errors, + org.eclipse.jgit.fnmatch, + org.eclipse.jgit.lib, + org.eclipse.jgit.merge, + org.eclipse.jgit.patch, + org.eclipse.jgit.revplot, + org.eclipse.jgit.revwalk, + org.eclipse.jgit.revwalk.filter, + org.eclipse.jgit.transport, + org.eclipse.jgit.treewalk, + org.eclipse.jgit.treewalk.filter, + org.eclipse.jgit.util, + org.eclipse.jgit.util.io +Export-Package: org.eclipse.jgit.junit;version="0.6.0" diff --git a/org.eclipse.jgit.junit/build.properties b/org.eclipse.jgit.junit/build.properties new file mode 100644 index 0000000000..aa1a008269 --- /dev/null +++ b/org.eclipse.jgit.junit/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.properties diff --git a/org.eclipse.jgit.junit/plugin.properties b/org.eclipse.jgit.junit/plugin.properties new file mode 100644 index 0000000000..d137bd4980 --- /dev/null +++ b/org.eclipse.jgit.junit/plugin.properties @@ -0,0 +1,2 @@ +plugin_name=Java Git JUnit Utility Classes (Incubation) +provider_name=eclipse.org diff --git a/org.eclipse.jgit.junit/pom.xml b/org.eclipse.jgit.junit/pom.xml new file mode 100644 index 0000000000..d38764a1fe --- /dev/null +++ b/org.eclipse.jgit.junit/pom.xml @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (C) 2009, Google Inc. + Copyright (C) 2008, Imran M Yousuf <imyousuf@smartitengineering.com> + and other copyright owners as documented in the project's IP log. + + This program and the accompanying materials are made available + under the terms of the Eclipse Distribution License v1.0 which + accompanies this distribution, is reproduced below, and is + available at http://www.eclipse.org/org/documents/edl-v10.php + + All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, are permitted provided that the following + conditions are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + - Neither the name of the Eclipse Foundation, Inc. nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.jgit</groupId> + <artifactId>jgit-parent</artifactId> + <version>0.6.0-SNAPSHOT</version> + </parent> + + <artifactId>org.eclipse.jgit.junit</artifactId> + <name>JGit - JUnit Utility Classes</name> + + <description> + Utility classes to support JUnit testing of JGit applications. + </description> + + <dependencies> + <dependency> + <groupId>org.eclipse.jgit</groupId> + <artifactId>org.eclipse.jgit</artifactId> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <sourceDirectory>src/</sourceDirectory> + + <resources> + <resource> + <directory>.</directory> + <includes> + <include>plugin.properties</include> + </includes> + </resource> + </resources> + + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifestFile>META-INF/MANIFEST.MF</manifestFile> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java new file mode 100644 index 0000000000..5c8935c490 --- /dev/null +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java @@ -0,0 +1,401 @@ +/* + * Copyright (C) 2009, Google Inc. + * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com> + * Copyright (C) 2007, Shawn O. Pearce <spearce@spearce.org> + * and other copyright owners as documented in the project's IP log. + * + * This program and the accompanying materials are made available + * under the terms of the Eclipse Distribution License v1.0 which + * accompanies this distribution, is reproduced below, and is + * available at http://www.eclipse.org/org/documents/edl-v10.php + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * - Neither the name of the Eclipse Foundation, Inc. nor the + * names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.eclipse.jgit.junit; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import junit.framework.TestCase; + +import org.eclipse.jgit.lib.FileBasedConfig; +import org.eclipse.jgit.lib.PersonIdent; +import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.lib.RepositoryCache; +import org.eclipse.jgit.lib.WindowCache; +import org.eclipse.jgit.lib.WindowCacheConfig; +import org.eclipse.jgit.util.IO; +import org.eclipse.jgit.util.SystemReader; + +/** + * JUnit TestCase with specialized support for temporary local repository. + * <p> + * A temporary directory is created for each test, allowing each test to use a + * fresh environment. The temporary directory is cleaned up after the test ends. + * <p> + * Callers should not use {@link RepositoryCache} from within these tests as it + * may wedge file descriptors open past the end of the test. + * <p> + * A system property {@code jgit.junit.usemmap} defines whether memory mapping + * is used. Memory mapping has an effect on the file system, in that memory + * mapped files in Java cannot be deleted as long as the mapped arrays have not + * been reclaimed by the garbage collector. The programmer cannot control this + * with precision, so temporary files may hang around longer than desired during + * a test, or tests may fail altogether if there is insufficient file + * descriptors or address space for the test process. + */ +public abstract class LocalDiskRepositoryTestCase extends TestCase { + private static Thread shutdownHook; + + private static int testCount; + + private static final boolean useMMAP = "true".equals(System + .getProperty("jgit.junit.usemmap")); + + /** A fake (but stable) identity for author fields in the test. */ + protected PersonIdent author; + + /** A fake (but stable) identity for committer fields in the test. */ + protected PersonIdent committer; + + private final File trash = new File(new File("target"), "trash"); + + private final List<Repository> toClose = new ArrayList<Repository>(); + + private MockSystemReader mockSystemReader; + + @Override + protected void setUp() throws Exception { + super.setUp(); + + if (shutdownHook == null) { + shutdownHook = new Thread() { + @Override + public void run() { + System.gc(); + recursiveDelete("SHUTDOWN", trash, false, false); + } + }; + Runtime.getRuntime().addShutdownHook(shutdownHook); + } + + recursiveDelete(testName(), trash, true, false); + + mockSystemReader = new MockSystemReader(); + mockSystemReader.userGitConfig = new FileBasedConfig(new File(trash, + "usergitconfig")); + SystemReader.setInstance(mockSystemReader); + + final long now = mockSystemReader.getCurrentTime(); + final int tz = mockSystemReader.getTimezone(now); + author = new PersonIdent("J. Author", "jauthor@example.com"); + author = new PersonIdent(author, now, tz); + + committer = new PersonIdent("J. Committer", "jcommitter@example.com"); + committer = new PersonIdent(committer, now, tz); + + final WindowCacheConfig c = new WindowCacheConfig(); + c.setPackedGitLimit(128 * WindowCacheConfig.KB); + c.setPackedGitWindowSize(8 * WindowCacheConfig.KB); + c.setPackedGitMMAP(useMMAP); + c.setDeltaBaseCacheLimit(8 * WindowCacheConfig.KB); + WindowCache.reconfigure(c); + } + + @Override + protected void tearDown() throws Exception { + RepositoryCache.clear(); + for (Repository r : toClose) + r.close(); + toClose.clear(); + + // Since memory mapping is controlled by the GC we need to + // tell it this is a good time to clean up and unlock + // memory mapped files. + // + if (useMMAP) + System.gc(); + + recursiveDelete(testName(), trash, false, true); + super.tearDown(); + } + + /** Increment the {@link #author} and {@link #committer} times. */ + protected void tick() { + final long delta = TimeUnit.MILLISECONDS.convert(5 * 60, + TimeUnit.SECONDS); + final long now = author.getWhen().getTime() + delta; + final int tz = mockSystemReader.getTimezone(now); + + author = new PersonIdent(author, now, tz); + committer = new PersonIdent(committer, now, tz); + } + + /** + * Recursively delete a directory, failing the test if the delete fails. + * + * @param dir + * the recursively directory to delete, if present. + */ + protected void recursiveDelete(final File dir) { + recursiveDelete(testName(), dir, false, true); + } + + private static boolean recursiveDelete(final String testName, + final File dir, boolean silent, boolean failOnError) { + assert !(silent && failOnError); + if (!dir.exists()) { + return silent; + } + final File[] ls = dir.listFiles(); + if (ls != null) { + for (int k = 0; k < ls.length; k++) { + final File e = ls[k]; + if (e.isDirectory()) { + silent = recursiveDelete(testName, e, silent, failOnError); + } else { + if (!e.delete()) { + if (!silent) { + reportDeleteFailure(testName, failOnError, e); + } + silent = !failOnError; + } + } + } + } + if (!dir.delete()) { + if (!silent) { + reportDeleteFailure(testName, failOnError, dir); + } + silent = !failOnError; + } + return silent; + } + + private static void reportDeleteFailure(final String testName, + final boolean failOnError, final File e) { + final String severity; + if (failOnError) + severity = "ERROR"; + else + severity = "WARNING"; + + final String msg = severity + ": Failed to delete " + e + " in " + + testName; + if (failOnError) + fail(msg); + else + System.err.println(msg); + } + + /** + * Creates a new empty bare repository. + * + * @return the newly created repository, opened for access + * @throws IOException + * the repository could not be created in the temporary area + */ + protected Repository createBareRepository() throws IOException { + return createRepository(true /* bare */); + } + + /** + * Creates a new empty repository within a new empty working directory. + * + * @return the newly created repository, opened for access + * @throws IOException + * the repository could not be created in the temporary area + */ + protected Repository createWorkRepository() throws IOException { + return createRepository(false /* not bare */); + } + + /** + * Creates a new empty repository. + * + * @param bare + * true to create a bare repository; false to make a repository + * within its working directory + * @return the newly created repository, opened for access + * @throws IOException + * the repository could not be created in the temporary area + */ + private Repository createRepository(boolean bare) throws IOException { + String uniqueId = System.currentTimeMillis() + "_" + (testCount++); + String gitdirName = "test" + uniqueId + (bare ? "" : "/") + ".git"; + File gitdir = new File(trash, gitdirName).getCanonicalFile(); + Repository db = new Repository(gitdir); + + assertFalse(gitdir.exists()); + db.create(); + toClose.add(db); + return db; + } + + /** + * Run a hook script in the repository, returning the exit status. + * + * @param db + * repository the script should see in GIT_DIR environment + * @param hook + * path of the hook script to execute, must be executable file + * type on this platform + * @param args + * arguments to pass to the hook script + * @return exit status code of the invoked hook + * @throws IOException + * the hook could not be executed + * @throws InterruptedException + * the caller was interrupted before the hook completed + */ + protected int runHook(final Repository db, final File hook, + final String... args) throws IOException, InterruptedException { + final String[] argv = new String[1 + args.length]; + argv[0] = hook.getAbsolutePath(); + System.arraycopy(args, 0, argv, 1, args.length); + + final Map<String, String> env = cloneEnv(); + env.put("GIT_DIR", db.getDirectory().getAbsolutePath()); + putPersonIdent(env, "AUTHOR", author); + putPersonIdent(env, "COMMITTER", committer); + + final File cwd = db.getWorkDir(); + final Process p = Runtime.getRuntime().exec(argv, toEnvArray(env), cwd); + p.getOutputStream().close(); + p.getErrorStream().close(); + p.getInputStream().close(); + return p.waitFor(); + } + + private static void putPersonIdent(final Map<String, String> env, + final String type, final PersonIdent who) { + final String ident = who.toExternalString(); + final String date = ident.substring(ident.indexOf("> ") + 2); + env.put("GIT_" + type + "_NAME", who.getName()); + env.put("GIT_" + type + "_EMAIL", who.getEmailAddress()); + env.put("GIT_" + type + "_DATE", date); + } + + /** + * Create a string to a UTF-8 temporary file and return the path. + * + * @param body + * complete content to write to the file. If the file should end + * with a trailing LF, the string should end with an LF. + * @return path of the temporary file created within the trash area. + * @throws IOException + * the file could not be written. + */ + protected File write(final String body) throws IOException { + final File f = File.createTempFile("temp", "txt", trash); + try { + write(f, body); + return f; + } catch (Error e) { + f.delete(); + throw e; + } catch (RuntimeException e) { + f.delete(); + throw e; + } catch (IOException e) { + f.delete(); + throw e; + } + } + + /** + * Write a string as a UTF-8 file. + * + * @param f + * file to write the string to. Caller is responsible for making + * sure it is in the trash directory or will otherwise be cleaned + * up at the end of the test. If the parent directory does not + * exist, the missing parent directories are automatically + * created. + * @param body + * content to write to the file. + * @throws IOException + * the file could not be written. + */ + protected void write(final File f, final String body) throws IOException { + f.getParentFile().mkdirs(); + Writer w = new OutputStreamWriter(new FileOutputStream(f), "UTF-8"); + try { + w.write(body); + } finally { + w.close(); + } + } + + /** + * Fully read a UTF-8 file and return as a string. + * + * @param f + * file to read the content of. + * @return UTF-8 decoded content of the file, empty string if the file + * exists but has no content. + * @throws IOException + * the file does not exist, or could not be read. + */ + protected String read(final File f) throws IOException { + final byte[] body = IO.readFully(f); + return new String(body, 0, body.length, "UTF-8"); + } + + private static String[] toEnvArray(final Map<String, String> env) { + final String[] envp = new String[env.size()]; + int i = 0; + for (Map.Entry<String, String> e : env.entrySet()) { + envp[i++] = e.getKey() + "=" + e.getValue(); + } + return envp; + } + + private static HashMap<String, String> cloneEnv() { + return new HashMap<String, String>(System.getenv()); + } + + private String testName() { + return getClass().getName() + "." + getName(); + } +} diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/MockSystemReader.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java index 2e94632cee..87125d280c 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/MockSystemReader.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java @@ -1,6 +1,5 @@ /* * Copyright (C) 2009, Google Inc. - * Copyright (C) 2009, Robin Rosenberg <robin.rosenberg@dewire.com> * Copyright (C) 2009, Yann Simon <yann.simon.fr@gmail.com> * and other copyright owners as documented in the project's IP log. * @@ -43,20 +42,22 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.eclipse.jgit.lib; +package org.eclipse.jgit.junit; import java.util.HashMap; import java.util.Map; import java.util.TimeZone; +import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.lib.FileBasedConfig; import org.eclipse.jgit.util.SystemReader; -class MockSystemReader extends SystemReader { +public class MockSystemReader extends SystemReader { final Map<String, String> values = new HashMap<String, String>(); FileBasedConfig userGitConfig; - MockSystemReader() { + public MockSystemReader() { init(Constants.OS_USER_NAME_KEY); init(Constants.GIT_AUTHOR_NAME_KEY); init(Constants.GIT_AUTHOR_EMAIL_KEY); @@ -66,21 +67,33 @@ class MockSystemReader extends SystemReader { } private void init(final String n) { - values.put(n, n); + setProperty(n, n); } + public void clearProperties() { + values.clear(); + } + + public void setProperty(String key, String value) { + values.put(key, value); + } + + @Override public String getenv(String variable) { return values.get(variable); } + @Override public String getProperty(String key) { return values.get(key); } + @Override public FileBasedConfig openUserConfig() { return userGitConfig; } + @Override public String getHostname() { return "fake.host.example.com"; } @@ -92,6 +105,6 @@ class MockSystemReader extends SystemReader { @Override public int getTimezone(long when) { - return TimeZone.getTimeZone("GMT-3:30").getOffset(when); + return TimeZone.getTimeZone("GMT-03:30").getOffset(when) / (60 * 1000); } } diff --git a/org.eclipse.jgit.pgm/.classpath b/org.eclipse.jgit.pgm/.classpath index 058848cf20..304e86186a 100644 --- a/org.eclipse.jgit.pgm/.classpath +++ b/org.eclipse.jgit.pgm/.classpath @@ -2,8 +2,6 @@ <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> - <classpathentry combineaccessrules="false" exported="true" kind="src" path="/org.eclipse.jgit"/> - <classpathentry combineaccessrules="false" kind="lib" path="/org.kohsuke.args4j"/> - <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.jgit.ui"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/org.eclipse.jgit.pgm/.gitignore b/org.eclipse.jgit.pgm/.gitignore index 5e56e040ec..934e0e06ff 100644 --- a/org.eclipse.jgit.pgm/.gitignore +++ b/org.eclipse.jgit.pgm/.gitignore @@ -1 +1,2 @@ /bin +/target diff --git a/org.eclipse.jgit.pgm/.project b/org.eclipse.jgit.pgm/.project index bbaafc2612..6fc89ae5e6 100644 --- a/org.eclipse.jgit.pgm/.project +++ b/org.eclipse.jgit.pgm/.project @@ -10,8 +10,19 @@ <arguments> </arguments> </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.pde.PluginNature</nature> </natures> </projectDescription> diff --git a/org.eclipse.jgit.pgm/.settings/org.eclipse.pde.core.prefs b/org.eclipse.jgit.pgm/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 0000000000..75c779a483 --- /dev/null +++ b/org.eclipse.jgit.pgm/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,3 @@ +#Sat Oct 31 18:40:07 PDT 2009 +eclipse.preferences.version=1 +resolve.requirebundle=false diff --git a/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF b/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..fe59357ab8 --- /dev/null +++ b/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF @@ -0,0 +1,25 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %plugin_name +Bundle-SymbolicName: org.eclipse.jgit.pgm +Bundle-Version: 0.6.0.qualifier +Bundle-Vendor: %provider_name +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: org.eclipse.jgit.awtui, + org.eclipse.jgit.dircache, + org.eclipse.jgit.errors, + org.eclipse.jgit.lib, + org.eclipse.jgit.revplot, + org.eclipse.jgit.revwalk, + org.eclipse.jgit.revwalk.filter, + org.eclipse.jgit.transport, + org.eclipse.jgit.treewalk, + org.eclipse.jgit.treewalk.filter, + org.eclipse.jgit.util, + org.kohsuke.args4j, + org.kohsuke.args4j.spi +Bundle-ActivationPolicy: lazy +Export-Package: org.eclipse.jgit.pgm +Main-Class: org.eclipse.jgit.pgm.Main +Implementation-Title: JGit Command Line Interface diff --git a/org.eclipse.jgit.pgm/src/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin b/org.eclipse.jgit.pgm/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin index 6c2a653066..6c2a653066 100644 --- a/org.eclipse.jgit.pgm/src/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin +++ b/org.eclipse.jgit.pgm/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin diff --git a/org.eclipse.jgit.pgm/build.properties b/org.eclipse.jgit.pgm/build.properties new file mode 100644 index 0000000000..aa1a008269 --- /dev/null +++ b/org.eclipse.jgit.pgm/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.properties diff --git a/jgit.sh b/org.eclipse.jgit.pgm/jgit.sh index 76b582919c..e6a2119ef1 100644 --- a/jgit.sh +++ b/org.eclipse.jgit.pgm/jgit.sh @@ -42,20 +42,9 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -if [ "@@use_self@@" = "1" ] -then - this_script=`which "$0" 2>/dev/null` - [ $? -gt 0 -a -f "$0" ] && this_script="$0" - cp=$this_script -else - jgit_home=`dirname $0` - cp="$jgit_home/org.eclipse.jgit/bin" - cp="$cp:$jgit_home/org.eclipse.jgit/lib/jsch-0.1.37.jar" - cp="$cp:$jgit_home/org.eclipse.jgit.pgm/bin" - cp="$cp:$jgit_home/org.eclipse.jgit.pgm/lib/args4j-2.0.9.jar" - unset jgit_home - java_args= -fi +this_script=`which "$0" 2>/dev/null` +[ $? -gt 0 -a -f "$0" ] && this_script="$0" +cp=$this_script if [ -n "$JGIT_CLASSPATH" ] then diff --git a/org.eclipse.jgit.pgm/plugin.properties b/org.eclipse.jgit.pgm/plugin.properties new file mode 100644 index 0000000000..f8fbd725c1 --- /dev/null +++ b/org.eclipse.jgit.pgm/plugin.properties @@ -0,0 +1,2 @@ +plugin_name=Java Git Command Line Interface (Incubation) +provider_name=eclipse.org diff --git a/org.eclipse.jgit.pgm/pom.xml b/org.eclipse.jgit.pgm/pom.xml new file mode 100644 index 0000000000..e06dbc2d02 --- /dev/null +++ b/org.eclipse.jgit.pgm/pom.xml @@ -0,0 +1,186 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (C) 2009, Google Inc. + and other copyright owners as documented in the project's IP log. + + This program and the accompanying materials are made available + under the terms of the Eclipse Distribution License v1.0 which + accompanies this distribution, is reproduced below, and is + available at http://www.eclipse.org/org/documents/edl-v10.php + + All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, are permitted provided that the following + conditions are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + - Neither the name of the Eclipse Foundation, Inc. nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.jgit</groupId> + <artifactId>jgit-parent</artifactId> + <version>0.6.0-SNAPSHOT</version> + </parent> + + <artifactId>org.eclipse.jgit.pgm</artifactId> + <name>JGit - Command Line Interface</name> + + <description> + Command line client tools built on top of JGit. + </description> + + <dependencies> + <dependency> + <groupId>args4j</groupId> + <artifactId>args4j</artifactId> + </dependency> + + <dependency> + <groupId>org.eclipse.jgit</groupId> + <artifactId>org.eclipse.jgit</artifactId> + </dependency> + + <dependency> + <groupId>org.eclipse.jgit</groupId> + <artifactId>org.eclipse.jgit.ui</artifactId> + </dependency> + </dependencies> + + <profiles> + <profile> + <id>java6</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <dependencies> + <dependency> + <groupId>org.eclipse.jgit</groupId> + <artifactId>org.eclipse.jgit.console</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + </profile> + </profiles> + + <build> + <sourceDirectory>src/</sourceDirectory> + + <resources> + <resource> + <directory>.</directory> + <includes> + <include>META-INF/services/org.eclipse.jgit.pgm.TextBuiltin</include> + </includes> + </resource> + </resources> + + + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>1.2</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <finalName>jgit-cli</finalName> + <createDependencyReducedPom>false</createDependencyReducedPom> + <transformers> + <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" /> + <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> + <manifestEntries> + <Main-Class>org.eclipse.jgit.pgm.Main</Main-Class> + <Implementation-Title>JGit Command Line Interface</Implementation-Title> + <Implementation-Version>${project.version}</Implementation-Version> + </manifestEntries> + </transformer> + </transformers> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.3</version> + <executions> + <execution> + <id>create_jgit</id> + <phase>package</phase> + <configuration> + <tasks> + <concat destfile="${basedir}/target/jgit" force="yes" binary="true"> + <fileset file="${basedir}/jgit.sh" /> + <fileset file="${basedir}/target/jgit-cli.jar" /> + </concat> + <chmod file="${basedir}/target/jgit" perm="a+x"/> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.3</version> + <executions> + <execution> + <id>attach_jgit</id> + <phase>package</phase> + <goals> + <goal>attach-artifact</goal> + </goals> + <configuration> + <artifacts> + <artifact> + <file>${basedir}/target/jgit</file> + <type>sh</type> + </artifact> + </artifacts> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java index 281e2f3894..18cf8be467 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java @@ -45,16 +45,19 @@ package org.eclipse.jgit.pgm; import java.io.File; +import java.lang.reflect.InvocationTargetException; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.jgit.awtui.AwtAuthenticator; +import org.eclipse.jgit.awtui.AwtSshSessionFactory; import org.eclipse.jgit.errors.TransportException; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.pgm.opt.CmdLineParser; import org.eclipse.jgit.pgm.opt.SubcommandHandler; +import org.eclipse.jgit.util.CachedAuthenticator; import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.ExampleMode; @@ -86,7 +89,10 @@ public class Main { public static void main(final String[] argv) { final Main me = new Main(); try { - AwtAuthenticator.install(); + if (!installConsole()) { + AwtAuthenticator.install(); + AwtSshSessionFactory.install(); + } configureHttpProxy(); me.execute(argv); } catch (Die err) { @@ -181,6 +187,45 @@ public class Main { return null; } + private static boolean installConsole() { + try { + install("org.eclipse.jgit.console.ConsoleAuthenticator"); + install("org.eclipse.jgit.console.ConsoleSshSessionFactory"); + return true; + } catch (ClassNotFoundException e) { + return false; + } catch (NoClassDefFoundError e) { + return false; + } catch (UnsupportedClassVersionError e) { + return false; + + } catch (IllegalArgumentException e) { + throw new RuntimeException("Cannot setup console", e); + } catch (SecurityException e) { + throw new RuntimeException("Cannot setup console", e); + } catch (IllegalAccessException e) { + throw new RuntimeException("Cannot setup console", e); + } catch (InvocationTargetException e) { + throw new RuntimeException("Cannot setup console", e); + } catch (NoSuchMethodException e) { + throw new RuntimeException("Cannot setup console", e); + } + } + + private static void install(final String name) + throws IllegalAccessException, InvocationTargetException, + NoSuchMethodException, ClassNotFoundException { + try { + Class.forName(name).getMethod("install").invoke(null); + } catch (InvocationTargetException e) { + if (e.getCause() instanceof RuntimeException) + throw (RuntimeException) e.getCause(); + if (e.getCause() instanceof Error) + throw (Error) e.getCause(); + throw e; + } + } + /** * Configure the JRE's standard HTTP based on <code>http_proxy</code>. * <p> @@ -215,8 +260,9 @@ public class Main { final int c = userpass.indexOf(':'); final String user = userpass.substring(0, c); final String pass = userpass.substring(c + 1); - AwtAuthenticator.add(new AwtAuthenticator.CachedAuthentication( - proxyHost, proxyPort, user, pass)); + CachedAuthenticator + .add(new CachedAuthenticator.CachedAuthentication( + proxyHost, proxyPort, user, pass)); } } } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/build/JarLinkUtil.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/build/JarLinkUtil.java deleted file mode 100644 index e63f39c01e..0000000000 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/build/JarLinkUtil.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> - * and other copyright owners as documented in the project's IP log. - * - * This program and the accompanying materials are made available - * under the terms of the Eclipse Distribution License v1.0 which - * accompanies this distribution, is reproduced below, and is - * available at http://www.eclipse.org/org/documents/edl-v10.php - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * - * - Neither the name of the Eclipse Foundation, Inc. nor the - * names of its contributors may be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.eclipse.jgit.pgm.build; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; -import java.util.zip.ZipOutputStream; - -import org.kohsuke.args4j.CmdLineException; -import org.kohsuke.args4j.CmdLineParser; -import org.kohsuke.args4j.Option; -import org.kohsuke.args4j.spi.MapOptionHandler; - -/** - * Combines multiple JAR and directory sources into a single JAR file. - * <p> - * This is a crude command line utility to combine multiple JAR files into a - * single JAR file, without first needing to unpack the individual JARs. - * <p> - * The output ZIP stream is sent to standard out and can be redirected onto the - * end of a shell script which starts the JRE. - */ -public class JarLinkUtil { - /** - * Combine multiple JARs. - * - * @param argv - * the command line arguments indicating the files to pack. - * @throws IOException - * a source file could not be read. - */ - public static void main(final String[] argv) throws IOException { - final JarLinkUtil util = new JarLinkUtil(); - final CmdLineParser clp = new CmdLineParser(util); - try { - clp.parseArgument(argv); - } catch (CmdLineException e) { - clp.printSingleLineUsage(System.err); - System.exit(1); - } - util.run(); - } - - @Option(name = "-include", required = true) - private List<File> includes = new ArrayList<File>(); - - @Option(name = "-file", handler = MapOptionHandler.class) - private Map<String, String> files = new HashMap<String, String>(); - - private final Map<String, File> chosenSources = new HashMap<String, File>(); - - private long creationTime; - - private ZipOutputStream zos; - - private JarLinkUtil() { - // Command line utility only. - } - - private void run() throws IOException { - for (final File src : includes) { - if (src.isFile()) - scanJar(src); - else - scanDirectory(src, src, ""); - } - for (final Map.Entry<String, String> e : files.entrySet()) - chosenSources.put(e.getKey(), new File(e.getValue())); - - creationTime = System.currentTimeMillis(); - zos = new ZipOutputStream(System.out); - zos.setLevel(9); - - for (final File src : includes) { - if (src.isFile()) - appendJar(src); - else - appendDirectory(src, src, ""); - } - for (final String name : files.keySet()) - appendFile(chosenSources.get(name), name); - - zos.close(); - } - - private void scanJar(final File jarPath) throws IOException { - final ZipFile zf = new ZipFile(jarPath); - final Enumeration<? extends ZipEntry> e = zf.entries(); - while (e.hasMoreElements()) - chosenSources.put(e.nextElement().getName(), jarPath); - zf.close(); - } - - private void scanDirectory(final File rootPath, final File dirPath, - final String pfx) throws IOException { - final File[] entries = dirPath.listFiles(); - if (entries == null) - return; - for (final File e : entries) { - if (e.getName().equals(".") || e.getName().equals("..")) - continue; - - if (e.isDirectory()) - scanDirectory(rootPath, e, pfx + e.getName() + "/"); - else - chosenSources.put(pfx + e.getName(), rootPath); - } - } - - private void appendJar(final File jarPath) throws IOException { - final ZipFile zf = new ZipFile(jarPath); - final Enumeration<? extends ZipEntry> e = zf.entries(); - while (e.hasMoreElements()) { - final ZipEntry ze = e.nextElement(); - final String name = ze.getName(); - if (chosenSources.get(name) == jarPath) - appendEntry(name, ze.getSize(), ze.getTime(), zf - .getInputStream(ze)); - } - zf.close(); - } - - private void appendDirectory(final File rootDir, final File dirPath, - final String pfx) throws IOException { - final File[] entries = dirPath.listFiles(); - if (entries == null) - return; - for (final File e : entries) { - if (e.getName().equals(".") || e.getName().equals("..")) - continue; - - if (e.isDirectory()) - appendDirectory(rootDir, e, pfx + e.getName() + "/"); - else if (chosenSources.get(pfx + e.getName()) == rootDir) - appendFile(e, pfx + e.getName()); - } - } - - private void appendFile(final File path, final String name) - throws IOException { - final long len = path.length(); - final InputStream is = new FileInputStream(path); - appendEntry(name, len, creationTime, is); - } - - private void appendEntry(final String name, final long len, - final long time, final InputStream is) throws IOException { - final ZipEntry ze = new ZipEntry(name); - ze.setSize(len); - ze.setTime(time); - zos.putNextEntry(ze); - try { - final byte[] buf = new byte[4096]; - int n; - while ((n = is.read(buf)) >= 0) - zos.write(buf, 0, n); - } finally { - is.close(); - } - zos.closeEntry(); - } -} diff --git a/org.eclipse.jgit.test/.classpath b/org.eclipse.jgit.test/.classpath index 3c42728dbf..ea41285773 100644 --- a/org.eclipse.jgit.test/.classpath +++ b/org.eclipse.jgit.test/.classpath @@ -4,7 +4,6 @@ <classpathentry kind="src" path="tst-rsrc"/> <classpathentry kind="src" path="exttst"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> - <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.jgit"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/org.eclipse.jgit.test/.gitignore b/org.eclipse.jgit.test/.gitignore index 9d7d1382b7..b5bbb0ab81 100644 --- a/org.eclipse.jgit.test/.gitignore +++ b/org.eclipse.jgit.test/.gitignore @@ -1,3 +1,3 @@ -bin -tst/todopack -trash +/bin +/target +/trash diff --git a/org.eclipse.jgit.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.test/META-INF/MANIFEST.MF index 8c89f045cf..32d5efdfc4 100644 --- a/org.eclipse.jgit.test/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.test/META-INF/MANIFEST.MF @@ -9,4 +9,20 @@ Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: J2SE-1.5 Import-Package: com.jcraft.jsch, junit.framework, - junit.textui + junit.textui, + org.eclipse.jgit.junit, + org.eclipse.jgit.diff, + org.eclipse.jgit.dircache, + org.eclipse.jgit.errors, + org.eclipse.jgit.fnmatch, + org.eclipse.jgit.lib, + org.eclipse.jgit.merge, + org.eclipse.jgit.patch, + org.eclipse.jgit.revplot, + org.eclipse.jgit.revwalk, + org.eclipse.jgit.revwalk.filter, + org.eclipse.jgit.transport, + org.eclipse.jgit.treewalk, + org.eclipse.jgit.treewalk.filter, + org.eclipse.jgit.util, + org.eclipse.jgit.util.io diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0007_Index.java b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/lib/T0007_GitIndexTest.java index ca2400cfb8..21dcdffbfd 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0007_Index.java +++ b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/lib/T0007_GitIndexTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2008, Robin Rosenberg <robin.rosenberg@dewire.com> + * Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com> * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> * and other copyright owners as documented in the project's IP log. * @@ -45,16 +45,16 @@ package org.eclipse.jgit.lib; import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase; import org.eclipse.jgit.lib.GitIndex.Entry; import org.eclipse.jgit.util.FS; -public class T0007_Index extends RepositoryTestCase { +public class T0007_GitIndexTest extends LocalDiskRepositoryTestCase { static boolean canrungitstatus; static { @@ -108,6 +108,17 @@ public class T0007_Index extends RepositoryTestCase { } } + private Repository db; + + private File trash; + + @Override + protected void setUp() throws Exception { + super.setUp(); + db = createWorkRepository(); + trash = db.getWorkDir(); + } + public void testCreateEmptyIndex() throws Exception { GitIndex index = new GitIndex(db); index.write(); @@ -317,9 +328,9 @@ public class T0007_Index extends RepositoryTestCase { "c696abc3ab8e091c665f49d00eb8919690b3aec3"))); index2.checkout(trash); - assertEquals("data:a/b", content(aslashb)); - assertEquals("data:a:b", content(acolonb)); - assertEquals("data:a.b", content(adotb)); + assertEquals("data:a/b", read(aslashb)); + assertEquals("data:a:b", read(acolonb)); + assertEquals("data:a.b", read(adotb)); if (canrungitstatus) assertEquals(0, system(trash, "git status")); @@ -436,20 +447,14 @@ public class T0007_Index extends RepositoryTestCase { } } - private String content(File f) throws IOException { - byte[] buf = new byte[(int) f.length()]; - FileInputStream is = new FileInputStream(f); - try { - int read = is.read(buf); - assertEquals(f.length(), read); - return new String(buf, 0); - } finally { - is.close(); - } - } - private void delete(File f) throws IOException { if (!f.delete()) throw new IOException("Failed to delete f"); } + + private File writeTrashFile(String name, String body) throws IOException { + final File path = new File(trash, name); + write(path, body); + return path; + } } diff --git a/org.eclipse.jgit.test/pom.xml b/org.eclipse.jgit.test/pom.xml new file mode 100644 index 0000000000..6938ea60a0 --- /dev/null +++ b/org.eclipse.jgit.test/pom.xml @@ -0,0 +1,100 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (C) 2009, Google Inc. + Copyright (C) 2008, Imran M Yousuf <imyousuf@smartitengineering.com> + Copyright (C) 2008, Jonas Fonseca <fonseca@diku.dk> + and other copyright owners as documented in the project's IP log. + + This program and the accompanying materials are made available + under the terms of the Eclipse Distribution License v1.0 which + accompanies this distribution, is reproduced below, and is + available at http://www.eclipse.org/org/documents/edl-v10.php + + All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, are permitted provided that the following + conditions are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + - Neither the name of the Eclipse Foundation, Inc. nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.jgit</groupId> + <artifactId>jgit-parent</artifactId> + <version>0.6.0-SNAPSHOT</version> + </parent> + + <artifactId>org.eclipse.jgit.test</artifactId> + <name>JGit - Core Tests</name> + + <description> + JUnit tests for the core library. + </description> + + <dependencies> + <dependency> + <groupId>org.eclipse.jgit</groupId> + <artifactId>org.eclipse.jgit</artifactId> + </dependency> + + <dependency> + <groupId>org.eclipse.jgit</groupId> + <artifactId>org.eclipse.jgit.junit</artifactId> + </dependency> + </dependencies> + + <build> + <testSourceDirectory>tst/</testSourceDirectory> + + <testResources> + <testResource> + <directory>tst-rsrc/</directory> + </testResource> + </testResources> + + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.4.2</version> + <configuration> + <includes> + <include>**/*Test.java</include> + <include>**/*TestCase.java</include> + <include>**/T000*.java</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConcurrentRepackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConcurrentRepackTest.java index 644c7b366c..9e83aa0e1e 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConcurrentRepackTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConcurrentRepackTest.java @@ -72,7 +72,7 @@ public class ConcurrentRepackTest extends RepositoryTestCase { IOException { // Create a new object in a new pack, and test that it is present. // - final Repository eden = createNewEmptyRepo(); + final Repository eden = createBareRepository(); final RevObject o1 = writeBlob(eden, "o1"); pack(eden, o1); assertEquals(o1.name(), parse(o1).name()); @@ -84,7 +84,7 @@ public class ConcurrentRepackTest extends RepositoryTestCase { // object into a different pack file, with some other object. We // still should be able to access the objects. // - final Repository eden = createNewEmptyRepo(); + final Repository eden = createBareRepository(); final RevObject o1 = writeBlob(eden, "o1"); final File[] out1 = pack(eden, o1); assertEquals(o1.name(), parse(o1).name()); @@ -108,7 +108,7 @@ public class ConcurrentRepackTest extends RepositoryTestCase { throws IncorrectObjectTypeException, IOException { // Create an object and pack it. // - final Repository eden = createNewEmptyRepo(); + final Repository eden = createBareRepository(); final RevObject o1 = writeBlob(eden, "o1"); final File[] out1 = pack(eden, o1); assertEquals(o1.name(), parse(o1).name()); @@ -141,7 +141,7 @@ public class ConcurrentRepackTest extends RepositoryTestCase { // object into a different pack file, with some other object. We // still should be able to access the objects. // - final Repository eden = createNewEmptyRepo(); + final Repository eden = createBareRepository(); final RevObject o1 = writeBlob(eden, "o1"); final File[] out1 = pack(eden, o1); assertEquals(o1.name(), parse(o1).name()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/PackWriterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/PackWriterTest.java index 7032907496..ca626d4db5 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/PackWriterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/PackWriterTest.java @@ -65,7 +65,7 @@ import org.eclipse.jgit.revwalk.RevWalk; import org.eclipse.jgit.transport.IndexPack; import org.eclipse.jgit.util.JGitTestUtil; -public class PackWriterTest extends RepositoryTestCase { +public class PackWriterTest extends SampleDataRepositoryTestCase { private static final List<ObjectId> EMPTY_LIST_OBJECT = Collections .<ObjectId> emptyList(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java index d7b6193ce1..67ed6abb21 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java @@ -56,7 +56,7 @@ import org.eclipse.jgit.lib.RefUpdate.Result; * Misc tests for refs. A lot of things are tested elsewhere so not having a * test for a ref related method, does not mean it is untested. */ -public class RefTest extends RepositoryTestCase { +public class RefTest extends SampleDataRepositoryTestCase { public void testReadAllIncludingSymrefs() throws Exception { ObjectId masterId = db.resolve("refs/heads/master"); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefUpdateTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefUpdateTest.java index 3704c56173..fa77c6a8d2 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefUpdateTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefUpdateTest.java @@ -54,7 +54,7 @@ import org.eclipse.jgit.lib.RefUpdate.Result; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevWalk; -public class RefUpdateTest extends RepositoryTestCase { +public class RefUpdateTest extends SampleDataRepositoryTestCase { private RefUpdate updateRef(final String name) throws IOException { final RefUpdate ref = db.updateRef(name); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java index e72b7e2156..8e5f6fc83b 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java @@ -1,6 +1,7 @@ /* * Copyright (C) 2009, Christian Halstrick <christian.halstrick@sap.com> * Copyright (C) 2009, Christian Halstrick, Matthias Sohn, SAP AG + * Copyright (C) 2009, Google Inc. * and other copyright owners as documented in the project's IP log. * * This program and the accompanying materials are made available @@ -53,16 +54,15 @@ public class ReflogConfigTest extends RepositoryTestCase { // check that there are no entries in the reflog and turn off writing // reflogs - assertTrue("there should be no entries in reflog", db.getReflogReader( - Constants.HEAD).getReverseEntries().size() == 0); + assertNull(db.getReflogReader(Constants.HEAD)); db.getConfig().setBoolean("core", null, "logallrefupdates", false); // do one commit and check that reflog size is 0: no reflogs should be // written final Tree t = new Tree(db); addFileToTree(t, "i-am-a-file", "and this is the data in me\n"); - commit(t, "A Commit\n", new PersonIdent(jauthor, commitTime, tz), - new PersonIdent(jcommitter, commitTime, tz)); + commit(t, "A Commit\n", new PersonIdent(author, commitTime, tz), + new PersonIdent(committer, commitTime, tz)); commitTime += 100; assertTrue( "Reflog for HEAD still contain no entry", @@ -74,8 +74,8 @@ public class ReflogConfigTest extends RepositoryTestCase { // do one commit and check that reflog size is increased to 1 addFileToTree(t, "i-am-another-file", "and this is other data in me\n"); - commit(t, "A Commit\n", new PersonIdent(jauthor, commitTime, tz), - new PersonIdent(jcommitter, commitTime, tz)); + commit(t, "A Commit\n", new PersonIdent(author, commitTime, tz), + new PersonIdent(committer, commitTime, tz)); commitTime += 100; assertTrue( "Reflog for HEAD should contain one entry", @@ -88,8 +88,8 @@ public class ReflogConfigTest extends RepositoryTestCase { // do one commit and check that reflog size is 2 addFileToTree(t, "i-am-anotheranother-file", "and this is other other data in me\n"); - commit(t, "A Commit\n", new PersonIdent(jauthor, commitTime, tz), - new PersonIdent(jcommitter, commitTime, tz)); + commit(t, "A Commit\n", new PersonIdent(author, commitTime, tz), + new PersonIdent(committer, commitTime, tz)); assertTrue( "Reflog for HEAD should contain two entries", db.getReflogReader(Constants.HEAD).getReverseEntries().size() == 2); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogReaderTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogReaderTest.java index 1f2f25d5e2..6144851fcd 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogReaderTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogReaderTest.java @@ -53,7 +53,7 @@ import java.util.List; import org.eclipse.jgit.lib.ReflogReader.Entry; -public class ReflogReaderTest extends RepositoryTestCase { +public class ReflogReaderTest extends SampleDataRepositoryTestCase { static byte[] oneLine = "da85355dfc525c9f6f3927b876f379f46ccf826e 3e7549db262d1e836d9bf0af7e22355468f1717c A O Thor Too <authortoo@wri.tr> 1243028200 +0200\tcommit: Add a toString for debugging to RemoteRefUpdate\n" .getBytes(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryCacheTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryCacheTest.java index c0591755f4..f05889308d 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryCacheTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryCacheTest.java @@ -64,7 +64,7 @@ public class RepositoryCacheTest extends RepositoryTestCase { } public void testBareFileKey() throws IOException { - Repository bare = createNewEmptyRepo(true); + Repository bare = createBareRepository(); File gitdir = bare.getDirectory(); File parent = gitdir.getParentFile(); String name = gitdir.getName(); @@ -92,7 +92,7 @@ public class RepositoryCacheTest extends RepositoryTestCase { } public void testFileKeyOpenNew() throws IOException { - final Repository n = createNewEmptyRepo(true); + final Repository n = createBareRepository(); final File gitdir = n.getDirectory(); n.close(); recursiveDelete(gitdir); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryConfigTest.java index 08e701ab50..2cbfc682ca 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryConfigTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryConfigTest.java @@ -53,6 +53,7 @@ import java.util.LinkedList; import junit.framework.TestCase; import org.eclipse.jgit.errors.ConfigInvalidException; +import org.eclipse.jgit.junit.MockSystemReader; import org.eclipse.jgit.util.SystemReader; /** @@ -115,9 +116,9 @@ public class RepositoryConfigTest extends TestCase { final MockSystemReader mockSystemReader = new MockSystemReader(); SystemReader.setInstance(mockSystemReader); final String hostname = mockSystemReader.getHostname(); - final Config userGitConfig = mockSystemReader.userGitConfig; + final Config userGitConfig = mockSystemReader.openUserConfig(); final Config localConfig = new Config(userGitConfig); - mockSystemReader.values.clear(); + mockSystemReader.clearProperties(); String authorName; String authorEmail; @@ -129,7 +130,7 @@ public class RepositoryConfigTest extends TestCase { assertEquals(Constants.UNKNOWN_USER_DEFAULT + "@" + hostname, authorEmail); // the system user name is defined - mockSystemReader.values.put(Constants.OS_USER_NAME_KEY, "os user name"); + mockSystemReader.setProperty(Constants.OS_USER_NAME_KEY, "os user name"); localConfig.uncache(UserConfig.KEY); authorName = localConfig.get(UserConfig.KEY).getAuthorName(); assertEquals("os user name", authorName); @@ -140,8 +141,8 @@ public class RepositoryConfigTest extends TestCase { } // the git environment variables are defined - mockSystemReader.values.put(Constants.GIT_AUTHOR_NAME_KEY, "git author name"); - mockSystemReader.values.put(Constants.GIT_AUTHOR_EMAIL_KEY, "author@email"); + mockSystemReader.setProperty(Constants.GIT_AUTHOR_NAME_KEY, "git author name"); + mockSystemReader.setProperty(Constants.GIT_AUTHOR_EMAIL_KEY, "author@email"); localConfig.uncache(UserConfig.KEY); authorName = localConfig.get(UserConfig.KEY).getAuthorName(); authorEmail = localConfig.get(UserConfig.KEY).getAuthorEmail(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java index ac8881b1fc..c5c6d998bb 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java @@ -1,6 +1,8 @@ /* - * Copyright (C) 2007-2009, Robin Rosenberg <robin.rosenberg@dewire.com> - * Copyright (C) 2007, Shawn O. Pearce <spearce@spearce.org> + * Copyright (C) 2009, Google Inc. + * Copyright (C) 2007-2008, Robin Rosenberg <robin.rosenberg@dewire.com> + * Copyright (C) 2006-2007, Shawn O. Pearce <spearce@spearce.org> + * Copyright (C) 2009, Yann Simon <yann.simon.fr@gmail.com> * and other copyright owners as documented in the project's IP log. * * This program and the accompanying materials are made available @@ -49,117 +51,17 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; -import java.io.OutputStreamWriter; import java.io.Reader; -import java.util.ArrayList; -import java.util.List; -import junit.framework.TestCase; - -import org.eclipse.jgit.util.JGitTestUtil; -import org.eclipse.jgit.util.SystemReader; +import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase; /** * Base class for most JGit unit tests. * * Sets up a predefined test repository and has support for creating additional * repositories and destroying them when the tests are finished. - * - * A system property <em>jgit.junit.usemmap</em> defines whether memory mapping - * is used. Memory mapping has an effect on the file system, in that memory - * mapped files in java cannot be deleted as long as they mapped arrays have not - * been reclaimed by the garbage collector. The programmer cannot control this - * with precision, though hinting using <em>{@link java.lang.System#gc}</em> - * often helps. */ -public abstract class RepositoryTestCase extends TestCase { - - protected final File trashParent = new File("trash"); - - protected File trash; - - protected File trash_git; - - protected static final PersonIdent jauthor; - - protected static final PersonIdent jcommitter; - - static { - jauthor = new PersonIdent("J. Author", "jauthor@example.com"); - jcommitter = new PersonIdent("J. Committer", "jcommitter@example.com"); - } - - protected boolean packedGitMMAP; - - /** - * Configure JGit before setting up test repositories. - */ - protected void configure() { - final WindowCacheConfig c = new WindowCacheConfig(); - c.setPackedGitLimit(128 * WindowCacheConfig.KB); - c.setPackedGitWindowSize(8 * WindowCacheConfig.KB); - c.setPackedGitMMAP("true".equals(System.getProperty("jgit.junit.usemmap"))); - c.setDeltaBaseCacheLimit(8 * WindowCacheConfig.KB); - WindowCache.reconfigure(c); - } - - /** - * Utility method to delete a directory recursively. It is - * also used internally. If a file or directory cannot be removed - * it throws an AssertionFailure. - * - * @param dir - */ - protected void recursiveDelete(final File dir) { - recursiveDelete(dir, false, getClass().getName() + "." + getName(), true); - } - - protected static boolean recursiveDelete(final File dir, boolean silent, - final String name, boolean failOnError) { - assert !(silent && failOnError); - if (!dir.exists()) - return silent; - final File[] ls = dir.listFiles(); - if (ls != null) { - for (int k = 0; k < ls.length; k++) { - final File e = ls[k]; - if (e.isDirectory()) { - silent = recursiveDelete(e, silent, name, failOnError); - } else { - if (!e.delete()) { - if (!silent) { - reportDeleteFailure(name, failOnError, e); - } - silent = !failOnError; - } - } - } - } - if (!dir.delete()) { - if (!silent) { - reportDeleteFailure(name, failOnError, dir); - } - silent = !failOnError; - } - return silent; - } - - private static void reportDeleteFailure(final String name, - boolean failOnError, final File e) { - String severity; - if (failOnError) - severity = "Error"; - else - severity = "Warning"; - String msg = severity + ": Failed to delete " + e; - if (name != null) - msg += " in " + name; - if (failOnError) - fail(msg); - else - System.out.println(msg); - } - +public abstract class RepositoryTestCase extends LocalDiskRepositoryTestCase { protected static void copyFile(final File src, final File dst) throws IOException { final FileInputStream fis = new FileInputStream(src); @@ -181,18 +83,9 @@ public abstract class RepositoryTestCase extends TestCase { protected File writeTrashFile(final String name, final String data) throws IOException { - File tf = new File(trash, name); - File tfp = tf.getParentFile(); - if (!tfp.exists() && !tf.getParentFile().mkdirs()) - throw new Error("Could not create directory " + tf.getParentFile()); - final OutputStreamWriter fw = new OutputStreamWriter( - new FileOutputStream(tf), "UTF-8"); - try { - fw.write(data); - } finally { - fw.close(); - } - return tf; + File path = new File(db.getWorkDir(), name); + write(path, data); + return path; } protected static void checkFile(File f, final String checkData) @@ -208,121 +101,16 @@ public abstract class RepositoryTestCase extends TestCase { } } + /** Test repository, initialized for this test case. */ protected Repository db; - private static Thread shutdownhook; - private static List<Runnable> shutDownCleanups = new ArrayList<Runnable>(); - private static int testcount; - - private ArrayList<Repository> repositoriesToClose = new ArrayList<Repository>(); + /** Working directory of {@link #db}. */ + protected File trash; - public void setUp() throws Exception { + @Override + protected void setUp() throws Exception { super.setUp(); - configure(); - final String name = getClass().getName() + "." + getName(); - recursiveDelete(trashParent, true, name, false); // Cleanup old failed stuff - trash = new File(trashParent,"trash"+System.currentTimeMillis()+"."+(testcount++)); - trash_git = new File(trash, ".git").getCanonicalFile(); - if (shutdownhook == null) { - shutdownhook = new Thread() { - @Override - public void run() { - // This may look superfluous, but is an extra attempt - // to clean up. First GC to release as many resources - // as possible and then try to clean up one test repo - // at a time (to record problems) and finally to drop - // the directory containing all test repositories. - System.gc(); - for (Runnable r : shutDownCleanups) - r.run(); - recursiveDelete(trashParent, false, null, false); - } - }; - Runtime.getRuntime().addShutdownHook(shutdownhook); - } - - final MockSystemReader mockSystemReader = new MockSystemReader(); - mockSystemReader.userGitConfig = new FileBasedConfig(new File( - trash_git, "usergitconfig")); - SystemReader.setInstance(mockSystemReader); - - db = new Repository(trash_git); - db.create(); - - final String[] packs = { - "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f", - "pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371", - "pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745", - "pack-546ff360fe3488adb20860ce3436a2d6373d2796", - "pack-cbdeda40019ae0e6e789088ea0f51f164f489d14", - "pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa", - "pack-3280af9c07ee18a87705ef50b0cc4cd20266cf12" - }; - final File packDir = new File(db.getObjectsDirectory(), "pack"); - for (int k = 0; k < packs.length; k++) { - copyFile(JGitTestUtil.getTestResourceFile(packs[k] + ".pack"), new File(packDir, - packs[k] + ".pack")); - copyFile(JGitTestUtil.getTestResourceFile(packs[k] + ".idx"), new File(packDir, - packs[k] + ".idx")); - } - - copyFile(JGitTestUtil.getTestResourceFile("packed-refs"), new File(trash_git,"packed-refs")); - } - - protected void tearDown() throws Exception { - RepositoryCache.clear(); - db.close(); - for (Repository r : repositoriesToClose) - r.close(); - - // Since memory mapping is controlled by the GC we need to - // tell it this is a good time to clean up and unlock - // memory mapped files. - if (packedGitMMAP) - System.gc(); - - final String name = getClass().getName() + "." + getName(); - recursiveDelete(trash, false, name, true); - for (Repository r : repositoriesToClose) - recursiveDelete(r.getWorkDir(), false, name, true); - repositoriesToClose.clear(); - - super.tearDown(); - } - - /** - * Helper for creating extra empty repos - * - * @return a new empty git repository for testing purposes - * - * @throws IOException - */ - protected Repository createNewEmptyRepo() throws IOException { - return createNewEmptyRepo(false); - } - - /** - * Helper for creating extra empty repos - * - * @param bare if true, create a bare repository. - * @return a new empty git repository for testing purposes - * - * @throws IOException - */ - protected Repository createNewEmptyRepo(boolean bare) throws IOException { - final File newTestRepo = new File(trashParent, "new" - + System.currentTimeMillis() + "." + (testcount++) - + (bare ? "" : "/") + ".git").getCanonicalFile(); - assertFalse(newTestRepo.exists()); - final Repository newRepo = new Repository(newTestRepo); - newRepo.create(); - final String name = getClass().getName() + "." + getName(); - shutDownCleanups.add(new Runnable() { - public void run() { - recursiveDelete(newTestRepo, false, name, false); - } - }); - repositoriesToClose.add(newRepo); - return newRepo; + db = createWorkRepository(); + trash = db.getWorkDir(); } } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SampleDataRepositoryTestCase.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SampleDataRepositoryTestCase.java new file mode 100644 index 0000000000..10c005679b --- /dev/null +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SampleDataRepositoryTestCase.java @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2009, Google Inc. + * Copyright (C) 2008-2009, Jonas Fonseca <fonseca@diku.dk> + * Copyright (C) 2007-2009, Robin Rosenberg <robin.rosenberg@dewire.com> + * Copyright (C) 2006-2007, Shawn O. Pearce <spearce@spearce.org> + * and other copyright owners as documented in the project's IP log. + * + * This program and the accompanying materials are made available + * under the terms of the Eclipse Distribution License v1.0 which + * accompanies this distribution, is reproduced below, and is + * available at http://www.eclipse.org/org/documents/edl-v10.php + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * - Neither the name of the Eclipse Foundation, Inc. nor the + * names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.eclipse.jgit.lib; + +import java.io.File; + +import org.eclipse.jgit.util.JGitTestUtil; + +/** Test case which includes C Git generated pack files for testing. */ +public abstract class SampleDataRepositoryTestCase extends RepositoryTestCase { + @Override + protected void setUp() throws Exception { + super.setUp(); + + final String[] packs = { + "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f", + "pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371", + "pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745", + "pack-546ff360fe3488adb20860ce3436a2d6373d2796", + "pack-cbdeda40019ae0e6e789088ea0f51f164f489d14", + "pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa", + "pack-3280af9c07ee18a87705ef50b0cc4cd20266cf12" + }; + final File packDir = new File(db.getObjectsDirectory(), "pack"); + for (String n : packs) { + copyFile(JGitTestUtil.getTestResourceFile(n + ".pack"), new File(packDir, n + ".pack")); + copyFile(JGitTestUtil.getTestResourceFile(n + ".idx"), new File(packDir, n + ".idx")); + } + + copyFile(JGitTestUtil.getTestResourceFile("packed-refs"), new File(db + .getDirectory(), "packed-refs")); + } +} diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0002_Tree.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0002_Tree.java index 66c3c75f18..7731880fd6 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0002_Tree.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0002_Tree.java @@ -49,7 +49,7 @@ import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; -public class T0002_Tree extends RepositoryTestCase { +public class T0002_Tree extends SampleDataRepositoryTestCase { private static final ObjectId SOME_FAKE_ID = ObjectId.fromString( "0123456789abcdef0123456789abcdef01234567"); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java index 74e98f1d8c..d1dfdf4fae 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java @@ -55,7 +55,7 @@ import java.io.PrintWriter; import org.eclipse.jgit.errors.ConfigInvalidException; -public class T0003_Basic extends RepositoryTestCase { +public class T0003_Basic extends SampleDataRepositoryTestCase { public void test001_Initalize() { final File gitdir = new File(trash, ".git"); final File objects = new File(gitdir, "objects"); @@ -83,7 +83,7 @@ public class T0003_Basic extends RepositoryTestCase { // open when we create it we won't write the object file out as a loose // object (as it already exists in the pack). // - final Repository newdb = createNewEmptyRepo(); + final Repository newdb = createBareRepository(); final Tree t = new Tree(newdb); t.accept(new WriteTree(trash, newdb), TreeEntry.MODIFIED_ONLY); assertEquals("4b825dc642cb6eb9a060e54bf8d69288fbee4904", t.getId() @@ -101,7 +101,8 @@ public class T0003_Basic extends RepositoryTestCase { t.accept(new WriteTree(trash, db), TreeEntry.MODIFIED_ONLY); assertEquals("4b825dc642cb6eb9a060e54bf8d69288fbee4904", t.getId() .name()); - final File o = new File(new File(new File(trash_git, "objects"), "4b"), + final File o = new File(new File( + new File(db.getDirectory(), "objects"), "4b"), "825dc642cb6eb9a060e54bf8d69288fbee4904"); assertFalse("Exists " + o, o.isFile()); } @@ -115,12 +116,12 @@ public class T0003_Basic extends RepositoryTestCase { .name()); File o; - o = new File(new File(new File(trash_git, "objects"), "7b"), + o = new File(new File(new File(db.getDirectory(), "objects"), "7b"), "b943559a305bdd6bdee2cef6e5df2413c3d30a"); assertTrue("Exists " + o, o.isFile()); assertTrue("Read-only " + o, !o.canWrite()); - o = new File(new File(new File(trash_git, "objects"), "e6"), + o = new File(new File(new File(db.getDirectory(), "objects"), "e6"), "9de29bb2d1d6434b8b29ae775ad8c2e48c5391"); assertTrue("Exists " + o, o.isFile()); assertTrue("Read-only " + o, !o.canWrite()); @@ -202,8 +203,8 @@ public class T0003_Basic extends RepositoryTestCase { t.getTreeId()); final Commit c = new Commit(db); - c.setAuthor(new PersonIdent(jauthor, 1154236443000L, -4 * 60)); - c.setCommitter(new PersonIdent(jcommitter, 1154236443000L, -4 * 60)); + c.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); + c.setCommitter(new PersonIdent(committer, 1154236443000L, -4 * 60)); c.setMessage("A Commit\n"); c.setTree(t); assertEquals(t.getTreeId(), c.getTreeId()); @@ -258,7 +259,7 @@ public class T0003_Basic extends RepositoryTestCase { t.setObjId(emptyId); t.setType("blob"); t.setTag("test020"); - t.setAuthor(new PersonIdent(jauthor, 1154236443000L, -4 * 60)); + t.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); t.setMessage("test020 tagged\n"); t.tag(); assertEquals("6759556b09fbb4fd8ae5e315134481cc25d46954", t.getTagId().name()); @@ -266,7 +267,7 @@ public class T0003_Basic extends RepositoryTestCase { Tag mapTag = db.mapTag("test020"); assertEquals("blob", mapTag.getType()); assertEquals("test020 tagged\n", mapTag.getMessage()); - assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag.getAuthor()); + assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag.getAuthor()); assertEquals("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", mapTag.getObjId().name()); } @@ -292,7 +293,7 @@ public class T0003_Basic extends RepositoryTestCase { t.setObjId(almostEmptyTreeId); t.setType("tree"); t.setTag("test021"); - t.setAuthor(new PersonIdent(jauthor, 1154236443000L, -4 * 60)); + t.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); t.setMessage("test021 tagged\n"); t.tag(); assertEquals("b0517bc8dbe2096b419d42424cd7030733f4abe5", t.getTagId().name()); @@ -300,7 +301,7 @@ public class T0003_Basic extends RepositoryTestCase { Tag mapTag = db.mapTag("test021"); assertEquals("tree", mapTag.getType()); assertEquals("test021 tagged\n", mapTag.getMessage()); - assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag.getAuthor()); + assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag.getAuthor()); assertEquals("417c01c8795a35b8e835113a85a5c0c1c77f67fb", mapTag.getObjId().name()); } @@ -310,8 +311,8 @@ public class T0003_Basic extends RepositoryTestCase { almostEmptyTree.addEntry(new FileTreeEntry(almostEmptyTree, emptyId, "empty".getBytes(), false)); final ObjectId almostEmptyTreeId = new ObjectWriter(db).writeTree(almostEmptyTree); final Commit almostEmptyCommit = new Commit(db); - almostEmptyCommit.setAuthor(new PersonIdent(jauthor, 1154236443000L, -2 * 60)); // not exactly the same - almostEmptyCommit.setCommitter(new PersonIdent(jauthor, 1154236443000L, -2 * 60)); + almostEmptyCommit.setAuthor(new PersonIdent(author, 1154236443000L, -2 * 60)); // not exactly the same + almostEmptyCommit.setCommitter(new PersonIdent(author, 1154236443000L, -2 * 60)); almostEmptyCommit.setMessage("test022\n"); almostEmptyCommit.setTreeId(almostEmptyTreeId); ObjectId almostEmptyCommitId = new ObjectWriter(db).writeCommit(almostEmptyCommit); @@ -319,7 +320,7 @@ public class T0003_Basic extends RepositoryTestCase { t.setObjId(almostEmptyCommitId); t.setType("commit"); t.setTag("test022"); - t.setAuthor(new PersonIdent(jauthor, 1154236443000L, -4 * 60)); + t.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); t.setMessage("test022 tagged\n"); t.tag(); assertEquals("0ce2ebdb36076ef0b38adbe077a07d43b43e3807", t.getTagId().name()); @@ -327,7 +328,7 @@ public class T0003_Basic extends RepositoryTestCase { Tag mapTag = db.mapTag("test022"); assertEquals("commit", mapTag.getType()); assertEquals("test022 tagged\n", mapTag.getMessage()); - assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag.getAuthor()); + assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag.getAuthor()); assertEquals("b5d3b45a96b340441f5abb9080411705c51cc86c", mapTag.getObjId().name()); } @@ -392,19 +393,19 @@ public class T0003_Basic extends RepositoryTestCase { assertNotNull("have tag test020", mapTag20); assertEquals("blob", mapTag20.getType()); assertEquals("test020 tagged\n", mapTag20.getMessage()); - assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag20.getAuthor()); + assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag20.getAuthor()); assertEquals("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", mapTag20.getObjId().name()); Tag mapTag21 = db.mapTag("test021"); assertEquals("tree", mapTag21.getType()); assertEquals("test021 tagged\n", mapTag21.getMessage()); - assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag21.getAuthor()); + assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag21.getAuthor()); assertEquals("417c01c8795a35b8e835113a85a5c0c1c77f67fb", mapTag21.getObjId().name()); Tag mapTag22 = db.mapTag("test022"); assertEquals("commit", mapTag22.getType()); assertEquals("test022 tagged\n", mapTag22.getMessage()); - assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag22.getAuthor()); + assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag22.getAuthor()); assertEquals("b5d3b45a96b340441f5abb9080411705c51cc86c", mapTag22.getObjId().name()); } @@ -426,8 +427,8 @@ public class T0003_Basic extends RepositoryTestCase { t.getTreeId()); final Commit c1 = new Commit(db); - c1.setAuthor(new PersonIdent(jauthor, 1154236443000L, -4 * 60)); - c1.setCommitter(new PersonIdent(jcommitter, 1154236443000L, -4 * 60)); + c1.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); + c1.setCommitter(new PersonIdent(committer, 1154236443000L, -4 * 60)); c1.setMessage("A Commit\n"); c1.setTree(t); assertEquals(t.getTreeId(), c1.getTreeId()); @@ -437,8 +438,8 @@ public class T0003_Basic extends RepositoryTestCase { assertEquals(cmtid1, c1.getCommitId()); final Commit c2 = new Commit(db); - c2.setAuthor(new PersonIdent(jauthor, 1154236443000L, -4 * 60)); - c2.setCommitter(new PersonIdent(jcommitter, 1154236443000L, -4 * 60)); + c2.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); + c2.setCommitter(new PersonIdent(committer, 1154236443000L, -4 * 60)); c2.setMessage("A Commit 2\n"); c2.setTree(t); assertEquals(t.getTreeId(), c2.getTreeId()); @@ -458,8 +459,8 @@ public class T0003_Basic extends RepositoryTestCase { assertEquals(c1.getCommitId(), rm2.getParentIds()[0]); final Commit c3 = new Commit(db); - c3.setAuthor(new PersonIdent(jauthor, 1154236443000L, -4 * 60)); - c3.setCommitter(new PersonIdent(jcommitter, 1154236443000L, -4 * 60)); + c3.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); + c3.setCommitter(new PersonIdent(committer, 1154236443000L, -4 * 60)); c3.setMessage("A Commit 3\n"); c3.setTree(t); assertEquals(t.getTreeId(), c3.getTreeId()); @@ -480,8 +481,8 @@ public class T0003_Basic extends RepositoryTestCase { assertEquals(c2.getCommitId(), rm3.getParentIds()[1]); final Commit c4 = new Commit(db); - c4.setAuthor(new PersonIdent(jauthor, 1154236443000L, -4 * 60)); - c4.setCommitter(new PersonIdent(jcommitter, 1154236443000L, -4 * 60)); + c4.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); + c4.setCommitter(new PersonIdent(committer, 1154236443000L, -4 * 60)); c4.setMessage("A Commit 4\n"); c4.setTree(t); assertEquals(t.getTreeId(), c3.getTreeId()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0004_PackReader.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0004_PackReader.java index be801e4940..b78b7b8554 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0004_PackReader.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0004_PackReader.java @@ -51,7 +51,7 @@ import java.io.IOException; import org.eclipse.jgit.util.JGitTestUtil; -public class T0004_PackReader extends RepositoryTestCase { +public class T0004_PackReader extends SampleDataRepositoryTestCase { private static final String PACK_NAME = "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f"; private static final File TEST_PACK = JGitTestUtil.getTestResourceFile(PACK_NAME + ".pack"); private static final File TEST_IDX = JGitTestUtil.getTestResourceFile(PACK_NAME + ".idx"); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0008_testparserev.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0008_testparserev.java index ac730ff6a2..ba8dbdb7b8 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0008_testparserev.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0008_testparserev.java @@ -1,4 +1,5 @@ /* + * Copyright (C) 2009, Google Inc. * Copyright (C) 2008, Jonas Fonseca <fonseca@diku.dk> * Copyright (C) 2007-2008, Robin Rosenberg <robin.rosenberg@dewire.com> * Copyright (C) 2006, Shawn O. Pearce <spearce@spearce.org> @@ -47,7 +48,7 @@ package org.eclipse.jgit.lib; import java.io.IOException; -public class T0008_testparserev extends RepositoryTestCase { +public class T0008_testparserev extends SampleDataRepositoryTestCase { public void testObjectId_existing() throws IOException { assertEquals("49322bb17d3acc9146f98c97d078513228bbf3c0",db.resolve("49322bb17d3acc9146f98c97d078513228bbf3c0").name()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/WindowCacheGetTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/WindowCacheGetTest.java index 55b568d8fd..8ff022ddc4 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/WindowCacheGetTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/WindowCacheGetTest.java @@ -54,7 +54,7 @@ import org.eclipse.jgit.errors.CorruptObjectException; import org.eclipse.jgit.util.JGitTestUtil; import org.eclipse.jgit.util.MutableInteger; -public class WindowCacheGetTest extends RepositoryTestCase { +public class WindowCacheGetTest extends SampleDataRepositoryTestCase { private List<TestObject> toLoad; @Override diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java index 0e50220067..690b166cbc 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java @@ -56,10 +56,10 @@ import org.eclipse.jgit.lib.FileMode; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectWriter; import org.eclipse.jgit.lib.PersonIdent; -import org.eclipse.jgit.lib.RepositoryTestCase; +import org.eclipse.jgit.lib.SampleDataRepositoryTestCase; import org.eclipse.jgit.treewalk.TreeWalk; -public class SimpleMergeTest extends RepositoryTestCase { +public class SimpleMergeTest extends SampleDataRepositoryTestCase { public void testOurs() throws IOException { Merger ourMerger = MergeStrategy.OURS.newMerger(db); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkTestCase.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkTestCase.java index 50fbce41aa..312fc00b13 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkTestCase.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkTestCase.java @@ -147,8 +147,8 @@ public abstract class RevWalkTestCase extends RepositoryTestCase { final Commit c = new Commit(db); c.setTreeId(tree); c.setParentIds(parents); - c.setAuthor(new PersonIdent(jauthor, new Date(nowTick))); - c.setCommitter(new PersonIdent(jcommitter, new Date(nowTick))); + c.setAuthor(new PersonIdent(author, new Date(nowTick))); + c.setCommitter(new PersonIdent(committer, new Date(nowTick))); c.setMessage(""); return rw.lookupCommit(ow.writeCommit(c)); } @@ -159,7 +159,7 @@ public abstract class RevWalkTestCase extends RepositoryTestCase { t.setType(Constants.typeString(dst.getType())); t.setObjId(dst.toObjectId()); t.setTag(name); - t.setTagger(new PersonIdent(jcommitter, new Date(nowTick))); + t.setTagger(new PersonIdent(committer, new Date(nowTick))); t.setMessage(""); return (RevTag) rw.lookupAny(ow.writeTag(t), Constants.OBJ_TAG); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java index 6a6b63cab8..2d6aa28d5a 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, Google Inc. + * Copyright (C) 2008-2009, Google Inc. * Copyright (C) 2008, Mike Ralphson <mike@abacus.co.uk> * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com> * and other copyright owners as documented in the project's IP log. @@ -60,11 +60,11 @@ import org.eclipse.jgit.lib.NullProgressMonitor; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; -import org.eclipse.jgit.lib.RepositoryTestCase; +import org.eclipse.jgit.lib.SampleDataRepositoryTestCase; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevWalk; -public class BundleWriterTest extends RepositoryTestCase { +public class BundleWriterTest extends SampleDataRepositoryTestCase { public void testWrite0() throws Exception { // Create a tiny bundle, (well one of) the first commits only @@ -74,7 +74,7 @@ public class BundleWriterTest extends RepositoryTestCase { // Then we clone a new repo from that bundle and do a simple test. This // makes sure // we could read the bundle we created. - Repository newRepo = createNewEmptyRepo(); + Repository newRepo = createBareRepository(); FetchResult fetchResult = fetchFromBundle(newRepo, bundle); Ref advertisedRef = fetchResult .getAdvertisedRef("refs/heads/firstcommit"); @@ -101,7 +101,7 @@ public class BundleWriterTest extends RepositoryTestCase { // Then we clone a new repo from that bundle and do a simple test. This // makes sure // we could read the bundle we created. - Repository newRepo = createNewEmptyRepo(); + Repository newRepo = createBareRepository(); FetchResult fetchResult = fetchFromBundle(newRepo, bundle); Ref advertisedRef = fetchResult.getAdvertisedRef("refs/heads/aa"); @@ -123,7 +123,7 @@ public class BundleWriterTest extends RepositoryTestCase { try { // Check that we actually needed the first bundle - Repository newRepo2 = createNewEmptyRepo(); + Repository newRepo2 = createBareRepository(); fetchResult = fetchFromBundle(newRepo2, bundle); fail("We should not be able to fetch from bundle with prerequisites that are not fulfilled"); } catch (MissingBundlePrerequisiteException e) { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushProcessTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushProcessTest.java index 4a47456f69..8e997e3f8c 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushProcessTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushProcessTest.java @@ -54,12 +54,12 @@ import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ProgressMonitor; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; -import org.eclipse.jgit.lib.RepositoryTestCase; +import org.eclipse.jgit.lib.SampleDataRepositoryTestCase; import org.eclipse.jgit.lib.TextProgressMonitor; import org.eclipse.jgit.lib.RefUpdate.Result; import org.eclipse.jgit.transport.RemoteRefUpdate.Status; -public class PushProcessTest extends RepositoryTestCase { +public class PushProcessTest extends SampleDataRepositoryTestCase { private PushProcess process; private MockTransport transport; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java index 75e661bcf9..e3518251fe 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java @@ -49,9 +49,9 @@ import java.util.Collection; import java.util.Collections; import org.eclipse.jgit.lib.RepositoryConfig; -import org.eclipse.jgit.lib.RepositoryTestCase; +import org.eclipse.jgit.lib.SampleDataRepositoryTestCase; -public class TransportTest extends RepositoryTestCase { +public class TransportTest extends SampleDataRepositoryTestCase { private Transport transport; private RemoteConfig remoteConfig; diff --git a/org.eclipse.jgit.ui/.gitignore b/org.eclipse.jgit.ui/.gitignore index 5e56e040ec..934e0e06ff 100644 --- a/org.eclipse.jgit.ui/.gitignore +++ b/org.eclipse.jgit.ui/.gitignore @@ -1 +1,2 @@ /bin +/target diff --git a/org.eclipse.jgit.ui/META-INF/MANIFEST.MF b/org.eclipse.jgit.ui/META-INF/MANIFEST.MF index a2c17a6a2a..a6710cd526 100644 --- a/org.eclipse.jgit.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.ui/META-INF/MANIFEST.MF @@ -7,6 +7,9 @@ Bundle-Version: 0.6.0.qualifier Bundle-Vendor: %provider_name Bundle-RequiredExecutionEnvironment: J2SE-1.5 Export-Package: org.eclipse.jgit.awtui;version="0.6.0" -Import-Package: org.eclipse.jgit.lib, +Import-Package: com.jcraft.jsch, + org.eclipse.jgit.lib;version="0.6.0", + org.eclipse.jgit.transport, org.eclipse.jgit.revplot, - org.eclipse.jgit.revwalk;version="0.6.0" + org.eclipse.jgit.revwalk, + org.eclipse.jgit.util diff --git a/org.eclipse.jgit.ui/plugin.properties b/org.eclipse.jgit.ui/plugin.properties index e6c6c08650..b9acc51512 100644 --- a/org.eclipse.jgit.ui/plugin.properties +++ b/org.eclipse.jgit.ui/plugin.properties @@ -1,2 +1,2 @@ -plugin_name=Java Git UI (Incubation) +plugin_name=Java Git AWT User Interface (Incubation) provider_name=eclipse.org diff --git a/org.eclipse.jgit.ui/pom.xml b/org.eclipse.jgit.ui/pom.xml new file mode 100644 index 0000000000..f77a143cb3 --- /dev/null +++ b/org.eclipse.jgit.ui/pom.xml @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (C) 2009, Google Inc. + Copyright (C) 2008, Imran M Yousuf <imyousuf@smartitengineering.com> + and other copyright owners as documented in the project's IP log. + + This program and the accompanying materials are made available + under the terms of the Eclipse Distribution License v1.0 which + accompanies this distribution, is reproduced below, and is + available at http://www.eclipse.org/org/documents/edl-v10.php + + All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, are permitted provided that the following + conditions are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + - Neither the name of the Eclipse Foundation, Inc. nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.jgit</groupId> + <artifactId>jgit-parent</artifactId> + <version>0.6.0-SNAPSHOT</version> + </parent> + + <artifactId>org.eclipse.jgit.ui</artifactId> + <name>JGit - AWT User Interface</name> + + <description> + AWT/Swing based UI + </description> + + <dependencies> + <dependency> + <groupId>org.eclipse.jgit</groupId> + <artifactId>org.eclipse.jgit</artifactId> + </dependency> + </dependencies> + + <build> + <sourceDirectory>src/</sourceDirectory> + + <resources> + <resource> + <directory>.</directory> + <includes> + <include>plugin.properties</include> + </includes> + </resource> + </resources> + + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifestFile>META-INF/MANIFEST.MF</manifestFile> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtAuthenticator.java b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtAuthenticator.java index 995fe9a935..1d2f9d765c 100644 --- a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtAuthenticator.java +++ b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtAuthenticator.java @@ -1,4 +1,5 @@ /* + * Copyright (C) 2009, Google Inc. * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> * and other copyright owners as documented in the project's IP log. * @@ -47,10 +48,7 @@ import java.awt.Container; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; -import java.net.Authenticator; import java.net.PasswordAuthentication; -import java.util.ArrayList; -import java.util.Collection; import javax.swing.JLabel; import javax.swing.JOptionPane; @@ -58,37 +56,17 @@ import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; -/** Basic network prompt for username/password when using AWT. */ -public class AwtAuthenticator extends Authenticator { - private static final AwtAuthenticator me = new AwtAuthenticator(); +import org.eclipse.jgit.util.CachedAuthenticator; +/** Basic network prompt for username/password when using AWT. */ +public class AwtAuthenticator extends CachedAuthenticator { /** Install this authenticator implementation into the JVM. */ public static void install() { - setDefault(me); - } - - /** - * Add a cached authentication for future use. - * - * @param ca - * the information we should remember. - */ - public static void add(final CachedAuthentication ca) { - synchronized (me) { - me.cached.add(ca); - } + setDefault(new AwtAuthenticator()); } - private final Collection<CachedAuthentication> cached = new ArrayList<CachedAuthentication>(); - @Override - protected PasswordAuthentication getPasswordAuthentication() { - for (final CachedAuthentication ca : cached) { - if (ca.host.equals(getRequestingHost()) - && ca.port == getRequestingPort()) - return ca.toPasswordAuthentication(); - } - + protected PasswordAuthentication promptPasswordAuthentication() { final GridBagConstraints gbc = new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0); @@ -150,48 +128,10 @@ public class AwtAuthenticator extends Authenticator { if (JOptionPane.showConfirmDialog(null, panel, "Authentication Required", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION) { - final CachedAuthentication ca = new CachedAuthentication( - getRequestingHost(), getRequestingPort(), username - .getText(), new String(password.getPassword())); - cached.add(ca); - return ca.toPasswordAuthentication(); + return new PasswordAuthentication(username.getText(), password + .getPassword()); } return null; // cancel } - - /** Authentication data to remember and reuse. */ - public static class CachedAuthentication { - final String host; - - final int port; - - final String user; - - final String pass; - - /** - * Create a new cached authentication. - * - * @param aHost - * system this is for. - * @param aPort - * port number of the service. - * @param aUser - * username at the service. - * @param aPass - * password at the service. - */ - public CachedAuthentication(final String aHost, final int aPort, - final String aUser, final String aPass) { - host = aHost; - port = aPort; - user = aUser; - pass = aPass; - } - - PasswordAuthentication toPasswordAuthentication() { - return new PasswordAuthentication(user, pass.toCharArray()); - } - } } diff --git a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtSshSessionFactory.java b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtSshSessionFactory.java new file mode 100644 index 0000000000..f6710854b4 --- /dev/null +++ b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtSshSessionFactory.java @@ -0,0 +1,185 @@ +/* + * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com> + * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> + * and other copyright owners as documented in the project's IP log. + * + * This program and the accompanying materials are made available + * under the terms of the Eclipse Distribution License v1.0 which + * accompanies this distribution, is reproduced below, and is + * available at http://www.eclipse.org/org/documents/edl-v10.php + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * - Neither the name of the Eclipse Foundation, Inc. nor the + * names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.eclipse.jgit.awtui; + +import java.awt.Container; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; + +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JPasswordField; +import javax.swing.JTextField; + +import org.eclipse.jgit.transport.OpenSshConfig; +import org.eclipse.jgit.transport.SshConfigSessionFactory; +import org.eclipse.jgit.transport.SshSessionFactory; + +import com.jcraft.jsch.Session; +import com.jcraft.jsch.UIKeyboardInteractive; +import com.jcraft.jsch.UserInfo; + +/** + * Loads known hosts and private keys from <code>$HOME/.ssh</code>. + * <p> + * This is the default implementation used by JGit and provides most of the + * compatibility necessary to match OpenSSH, a popular implementation of SSH + * used by C Git. + * <p> + * If user interactivity is required by SSH (e.g. to obtain a password) AWT is + * used to display a password input field to the end-user. + */ +public class AwtSshSessionFactory extends SshConfigSessionFactory { + /** Install this session factory implementation into the JVM. */ + public static void install() { + SshSessionFactory.setInstance(new AwtSshSessionFactory()); + } + + @Override + protected void configure(final OpenSshConfig.Host hc, final Session session) { + if (!hc.isBatchMode()) + session.setUserInfo(new AWT_UserInfo()); + } + + private static class AWT_UserInfo implements UserInfo, + UIKeyboardInteractive { + private String passwd; + + private String passphrase; + + public void showMessage(final String msg) { + JOptionPane.showMessageDialog(null, msg); + } + + public boolean promptYesNo(final String msg) { + return JOptionPane.showConfirmDialog(null, msg, "Warning", + JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; + } + + public boolean promptPassword(final String msg) { + passwd = null; + final JPasswordField passwordField = new JPasswordField(20); + final int result = JOptionPane.showConfirmDialog(null, + new Object[] { passwordField }, msg, + JOptionPane.OK_CANCEL_OPTION); + if (result == JOptionPane.OK_OPTION) { + passwd = new String(passwordField.getPassword()); + return true; + } + return false; + } + + public boolean promptPassphrase(final String msg) { + passphrase = null; + final JPasswordField passwordField = new JPasswordField(20); + final int result = JOptionPane.showConfirmDialog(null, + new Object[] { passwordField }, msg, + JOptionPane.OK_CANCEL_OPTION); + if (result == JOptionPane.OK_OPTION) { + passphrase = new String(passwordField.getPassword()); + return true; + } + return false; + } + + public String getPassword() { + return passwd; + } + + public String getPassphrase() { + return passphrase; + } + + public String[] promptKeyboardInteractive(final String destination, + final String name, final String instruction, + final String[] prompt, final boolean[] echo) { + final GridBagConstraints gbc = new GridBagConstraints(0, 0, 1, 1, + 1, 1, GridBagConstraints.NORTHWEST, + GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0); + final Container panel = new JPanel(); + panel.setLayout(new GridBagLayout()); + + gbc.weightx = 1.0; + gbc.gridwidth = GridBagConstraints.REMAINDER; + gbc.gridx = 0; + panel.add(new JLabel(instruction), gbc); + gbc.gridy++; + + gbc.gridwidth = GridBagConstraints.RELATIVE; + + final JTextField[] texts = new JTextField[prompt.length]; + for (int i = 0; i < prompt.length; i++) { + gbc.fill = GridBagConstraints.NONE; + gbc.gridx = 0; + gbc.weightx = 1; + panel.add(new JLabel(prompt[i]), gbc); + + gbc.gridx = 1; + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.weighty = 1; + if (echo[i]) { + texts[i] = new JTextField(20); + } else { + texts[i] = new JPasswordField(20); + } + panel.add(texts[i], gbc); + gbc.gridy++; + } + + if (JOptionPane.showConfirmDialog(null, panel, destination + ": " + + name, JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION) { + String[] response = new String[prompt.length]; + for (int i = 0; i < prompt.length; i++) { + response[i] = texts[i].getText(); + } + return response; + } + return null; // cancel + } + } +} diff --git a/org.eclipse.jgit/.gitignore b/org.eclipse.jgit/.gitignore index ba077a4031..934e0e06ff 100644 --- a/org.eclipse.jgit/.gitignore +++ b/org.eclipse.jgit/.gitignore @@ -1 +1,2 @@ -bin +/bin +/target diff --git a/org.eclipse.jgit/pom.xml b/org.eclipse.jgit/pom.xml new file mode 100644 index 0000000000..e0359398b0 --- /dev/null +++ b/org.eclipse.jgit/pom.xml @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (C) 2009, Google Inc. + Copyright (C) 2008, Imran M Yousuf <imyousuf@smartitengineering.com> + and other copyright owners as documented in the project's IP log. + + This program and the accompanying materials are made available + under the terms of the Eclipse Distribution License v1.0 which + accompanies this distribution, is reproduced below, and is + available at http://www.eclipse.org/org/documents/edl-v10.php + + All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, are permitted provided that the following + conditions are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + - Neither the name of the Eclipse Foundation, Inc. nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.jgit</groupId> + <artifactId>jgit-parent</artifactId> + <version>0.6.0-SNAPSHOT</version> + </parent> + + <artifactId>org.eclipse.jgit</artifactId> + <name>JGit - Core</name> + + <description> + Repository access and algorithms + </description> + + <dependencies> + <dependency> + <groupId>com.jcraft</groupId> + <artifactId>jsch</artifactId> + </dependency> + </dependencies> + + <build> + <sourceDirectory>src/</sourceDirectory> + + <resources> + <resource> + <directory>.</directory> + <includes> + <include>plugin.properties</include> + </includes> + </resource> + </resources> + + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifestFile>META-INF/MANIFEST.MF</manifestFile> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DefaultSshSessionFactory.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DefaultSshSessionFactory.java index 6ff3d4b2f3..53c1a2ce3a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DefaultSshSessionFactory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DefaultSshSessionFactory.java @@ -1,4 +1,6 @@ /* + * Copyright (C) 2009, Constantine Plotnikov <constantine.plotnikov@gmail.com> + * Copyright (C) 2009, Google Inc. * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com> * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> * and other copyright owners as documented in the project's IP log. @@ -44,20 +46,7 @@ package org.eclipse.jgit.transport; -import java.awt.Container; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; - -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JPasswordField; -import javax.swing.JTextField; - import com.jcraft.jsch.Session; -import com.jcraft.jsch.UIKeyboardInteractive; -import com.jcraft.jsch.UserInfo; /** * Loads known hosts and private keys from <code>$HOME/.ssh</code>. @@ -66,110 +55,11 @@ import com.jcraft.jsch.UserInfo; * compatibility necessary to match OpenSSH, a popular implementation of SSH * used by C Git. * <p> - * If user interactivity is required by SSH (e.g. to obtain a password) AWT is - * used to display a password input field to the end-user. + * If user interactivity is required by SSH (e.g. to obtain a password), the + * connection will immediately fail. */ class DefaultSshSessionFactory extends SshConfigSessionFactory { protected void configure(final OpenSshConfig.Host hc, final Session session) { - if (!hc.isBatchMode()) - session.setUserInfo(new AWT_UserInfo()); - } - - private static class AWT_UserInfo implements UserInfo, - UIKeyboardInteractive { - private String passwd; - - private String passphrase; - - public void showMessage(final String msg) { - JOptionPane.showMessageDialog(null, msg); - } - - public boolean promptYesNo(final String msg) { - return JOptionPane.showConfirmDialog(null, msg, "Warning", - JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; - } - - public boolean promptPassword(final String msg) { - passwd = null; - final JPasswordField passwordField = new JPasswordField(20); - final int result = JOptionPane.showConfirmDialog(null, - new Object[] { passwordField }, msg, - JOptionPane.OK_CANCEL_OPTION); - if (result == JOptionPane.OK_OPTION) { - passwd = new String(passwordField.getPassword()); - return true; - } - return false; - } - - public boolean promptPassphrase(final String msg) { - passphrase = null; - final JPasswordField passwordField = new JPasswordField(20); - final int result = JOptionPane.showConfirmDialog(null, - new Object[] { passwordField }, msg, - JOptionPane.OK_CANCEL_OPTION); - if (result == JOptionPane.OK_OPTION) { - passphrase = new String(passwordField.getPassword()); - return true; - } - return false; - } - - public String getPassword() { - return passwd; - } - - public String getPassphrase() { - return passphrase; - } - - public String[] promptKeyboardInteractive(final String destination, - final String name, final String instruction, - final String[] prompt, final boolean[] echo) { - final GridBagConstraints gbc = new GridBagConstraints(0, 0, 1, 1, - 1, 1, GridBagConstraints.NORTHWEST, - GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0); - final Container panel = new JPanel(); - panel.setLayout(new GridBagLayout()); - - gbc.weightx = 1.0; - gbc.gridwidth = GridBagConstraints.REMAINDER; - gbc.gridx = 0; - panel.add(new JLabel(instruction), gbc); - gbc.gridy++; - - gbc.gridwidth = GridBagConstraints.RELATIVE; - - final JTextField[] texts = new JTextField[prompt.length]; - for (int i = 0; i < prompt.length; i++) { - gbc.fill = GridBagConstraints.NONE; - gbc.gridx = 0; - gbc.weightx = 1; - panel.add(new JLabel(prompt[i]), gbc); - - gbc.gridx = 1; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbc.weighty = 1; - if (echo[i]) { - texts[i] = new JTextField(20); - } else { - texts[i] = new JPasswordField(20); - } - panel.add(texts[i], gbc); - gbc.gridy++; - } - - if (JOptionPane.showConfirmDialog(null, panel, destination + ": " - + name, JOptionPane.OK_CANCEL_OPTION, - JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION) { - String[] response = new String[prompt.length]; - for (int i = 0; i < prompt.length; i++) { - response[i] = texts[i].getText(); - } - return response; - } - return null; // cancel - } + // No additional configuration required. } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/CachedAuthenticator.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/CachedAuthenticator.java new file mode 100644 index 0000000000..6828185a8a --- /dev/null +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/CachedAuthenticator.java @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2009, Google Inc. + * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> + * and other copyright owners as documented in the project's IP log. + * + * This program and the accompanying materials are made available + * under the terms of the Eclipse Distribution License v1.0 which + * accompanies this distribution, is reproduced below, and is + * available at http://www.eclipse.org/org/documents/edl-v10.php + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * - Neither the name of the Eclipse Foundation, Inc. nor the + * names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.eclipse.jgit.util; + +import java.net.Authenticator; +import java.net.PasswordAuthentication; +import java.util.Collection; +import java.util.concurrent.CopyOnWriteArrayList; + +/** Abstract authenticator which remembers prior authentications. */ +public abstract class CachedAuthenticator extends Authenticator { + private static final Collection<CachedAuthentication> cached = new CopyOnWriteArrayList<CachedAuthentication>(); + + /** + * Add a cached authentication for future use. + * + * @param ca + * the information we should remember. + */ + public static void add(final CachedAuthentication ca) { + cached.add(ca); + } + + @Override + protected final PasswordAuthentication getPasswordAuthentication() { + final String host = getRequestingHost(); + final int port = getRequestingPort(); + for (final CachedAuthentication ca : cached) { + if (ca.host.equals(host) && ca.port == port) + return ca.toPasswordAuthentication(); + } + PasswordAuthentication pa = promptPasswordAuthentication(); + if (pa != null) { + CachedAuthentication ca = new CachedAuthentication(host, port, pa + .getUserName(), new String(pa.getPassword())); + add(ca); + return ca.toPasswordAuthentication(); + } + return null; + } + + /** + * Prompt for and request authentication from the end-user. + * + * @return the authentication data; null if the user canceled the request + * and does not want to continue. + */ + protected abstract PasswordAuthentication promptPasswordAuthentication(); + + /** Authentication data to remember and reuse. */ + public static class CachedAuthentication { + final String host; + + final int port; + + final String user; + + final String pass; + + /** + * Create a new cached authentication. + * + * @param aHost + * system this is for. + * @param aPort + * port number of the service. + * @param aUser + * username at the service. + * @param aPass + * password at the service. + */ + public CachedAuthentication(final String aHost, final int aPort, + final String aUser, final String aPass) { + host = aHost; + port = aPort; + user = aUser; + pass = aPass; + } + + PasswordAuthentication toPasswordAuthentication() { + return new PasswordAuthentication(user, pass.toCharArray()); + } + } +} diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000..974b58f93a --- /dev/null +++ b/pom.xml @@ -0,0 +1,256 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (C) 2009, Google Inc. + and other copyright owners as documented in the project's IP log. + + This program and the accompanying materials are made available + under the terms of the Eclipse Distribution License v1.0 which + accompanies this distribution, is reproduced below, and is + available at http://www.eclipse.org/org/documents/edl-v10.php + + All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, are permitted provided that the following + conditions are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + - Neither the name of the Eclipse Foundation, Inc. nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.eclipse.jgit</groupId> + <artifactId>jgit-parent</artifactId> + <packaging>pom</packaging> + <version>0.6.0-SNAPSHOT</version> + + <name>JGit - Parent</name> + <url>http://www.eclipse.org/egit/</url> + + <description> + Pure Java implementation of Git + </description> + + <mailingLists> + <mailingList> + <name>egit-dev Mailing List</name> + <post>egit-dev@eclipse.org</post> + <subscribe>https://dev.eclipse.org/mailman/listinfo/egit-dev</subscribe> + <unsubscribe>https://dev.eclipse.org/mailman/listinfo/egit-dev</unsubscribe> + <archive>http://dev.eclipse.org/mhonarc/lists/egit-dev</archive> + </mailingList> + + <mailingList> + <name>GIT Mailing List</name> + <post>git@vger.kernel.org</post> + <archive>http://marc.info/?l=git</archive> + </mailingList> + </mailingLists> + + <issueManagement> + <url>https://bugs.eclipse.org/bugs/</url> + <system>Bugzilla</system> + </issueManagement> + + <licenses> + <license> + <name>Eclipse Distribution License (New BSD License)</name> + <comments> + All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, are permitted provided that the following + conditions are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + - Neither the name of the Eclipse Foundation, Inc. nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + </comments> + </license> + </licenses> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + </properties> + + <build> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.0.2</version> + <configuration> + <source>1.5</source> + <target>1.5</target> + <encoding>UTF-8</encoding> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-source-plugin</artifactId> + <executions> + <execution> + <id>attach-sources</id> + <goals> + <goal>jar</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <configuration> + <encoding>${project.build.sourceEncoding}</encoding> + <quiet>true</quiet> + <links> + <link>http://java.sun.com/j2se/1.5.0/docs/api</link> + </links> + </configuration> + <executions> + <execution> + <id>attach-javadocs</id> + <goals> + <goal>jar</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <dependencyManagement> + <dependencies> + <dependency> + <!-- CQ 3493 --> + <groupId>com.jcraft</groupId> + <artifactId>jsch</artifactId> + <version>0.1.41</version> + </dependency> + + <dependency> + <!-- CQ 3454 --> + <groupId>args4j</groupId> + <artifactId>args4j</artifactId> + <version>2.0.12</version> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + </dependency> + + <dependency> + <groupId>org.eclipse.jgit</groupId> + <artifactId>org.eclipse.jgit</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.eclipse.jgit</groupId> + <artifactId>org.eclipse.jgit.junit</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.eclipse.jgit</groupId> + <artifactId>org.eclipse.jgit.ui</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + </dependencyManagement> + + <distributionManagement> + <snapshotRepository> + <id>jgit-maven-snapshot</id> + <name>JGit Maven Repository</name> + <url>dav:https://egit.googlecode.com/svn/maven/</url> + <uniqueVersion>true</uniqueVersion> + </snapshotRepository> + </distributionManagement> + + <profiles> + <!-- Set -Djgit.java6.skip=true to compile with only Java 5 --> + <profile> + <id>java6</id> + <activation> + <property> + <name>!jgit.java6.skip</name> + </property> + </activation> + <modules> + <module>org.eclipse.jgit.console</module> + </modules> + </profile> + </profiles> + + <modules> + <module>org.eclipse.jgit</module> + <module>org.eclipse.jgit.ui</module> + <module>org.eclipse.jgit.pgm</module> + <module>org.eclipse.jgit.junit</module> + <module>org.eclipse.jgit.test</module> + </modules> +</project> |