diff --git a/.gitignore b/.gitignore deleted file mode 100644 index d73c6106c..000000000 --- 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 eb5a316cb..000000000 --- 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 5f30afbfb..000000000 --- a/jgit-maven/jgit/pom.xml +++ /dev/null @@ -1,226 +0,0 @@ - - - - - 4.0.0 - org.eclipse - jgit - jar - 0.6.0-SNAPSHOT - jgit - http://repo.or.cz/w/jgit.git - - - GIT Mailing List - git@vger.kernel.org - http://marc.info/?l=git - - - Pure Java implementation of Git - - - Shawn O. Pearce - spearce@spearce.org - - Maintainer - - - - Robin Rosenberg - robin.rosenberg@dewire.com - - Maintainer - - - - Dave Watson - dwatson@mimvista.com - - Developer - - - - Roger C. Soares - rogersoares@intelinet.com.br - - Developer - - - - Marek Zawirski - marek.zawirski@gmail.com - - Developer - - - - Charles O'Farrell - charleso@charleso.org - - Contributor - - - - Imran M Yousuf - imyousuf@smartitengineering.com - Smart IT Engineering - - Contributor - - - - - - Eclipse Distribution License (New BSD License) - - 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. - - - - - ../../org.eclipse.jgit/src/ - - - ../../org.eclipse.jgit.test/tst-rsrc/ - - - ../../org.eclipse.jgit.test/tst/ - - - maven-compiler-plugin - 2.0.2 - - 1.5 - 1.5 - UTF-8 - - - - maven-surefire-plugin - 2.4.2 - - - **/*Test.java - **/*TestCase.java - **/T000*.java - - - - - maven-source-plugin - - - - jar - - - - - - maven-javadoc-plugin - - - - jar - - - - - - - - - junit - junit - 3.8.1 - test - - - com.jcraft - jsch - 0.1.41 - compile - - - - - jgit-maven-snapshot-repository - JGit Maven Snapshot Repository - dav:https://egit.googlecode.com/svn/maven/snapshot-repository/ - true - - - diff --git a/make_jgit.sh b/make_jgit.sh deleted file mode 100644 index f7363f9f4..000000000 --- a/make_jgit.sh +++ /dev/null @@ -1,181 +0,0 @@ -#!/bin/sh -# Copyright (C) 2009, Christian Halstrick -# Copyright (C) 2008-2009, Google Inc. -# Copyright (C) 2009, Johannes Schindelin -# Copyright (C) 2008, Mike Ralphson -# Copyright (C) 2009, Mykola Nikishov -# Copyright (C) 2009, Nicholas Campbell -# Copyright (C) 2009, Robin Rosenberg -# Copyright (C) 2008, Shawn O. Pearce -# 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 000000000..ad32c83a7 --- /dev/null +++ b/org.eclipse.jgit.console/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.eclipse.jgit.console/.gitignore b/org.eclipse.jgit.console/.gitignore new file mode 100644 index 000000000..934e0e06f --- /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 000000000..4f272a7cc --- /dev/null +++ b/org.eclipse.jgit.console/.project @@ -0,0 +1,34 @@ + + + org.eclipse.jgit.console + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.pde.api.tools.apiAnalysisBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + org.eclipse.pde.api.tools.apiAnalysisNature + + 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 000000000..190e5c57d --- /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/=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 000000000..dc570415b --- /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 000000000..214c48957 --- /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 000000000..ccd15c232 --- /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= +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 000000000..948274574 --- /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 000000000..ed12693f0 --- /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 000000000..aa1a00826 --- /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 000000000..a86bcd86b --- /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 000000000..98b1511ec --- /dev/null +++ b/org.eclipse.jgit.console/pom.xml @@ -0,0 +1,105 @@ + + + + + 4.0.0 + + + org.eclipse.jgit + jgit-parent + 0.6.0-SNAPSHOT + + + org.eclipse.jgit.console + JGit - Console User Interface + + + Console based user interface + + + + + org.eclipse.jgit + org.eclipse.jgit + + + + + src/ + + + + . + + plugin.properties + + + + + + + maven-compiler-plugin + 2.0.2 + + 1.6 + 1.6 + UTF-8 + + + + + org.apache.maven.plugins + maven-jar-plugin + + + META-INF/MANIFEST.MF + + + + + + 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 000000000..84fd520f7 --- /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 + * 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 000000000..7d36dded4 --- /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 + * Copyright (C) 2008, Shawn O. Pearce + * 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 $HOME/.ssh. + *

+ * 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. + *

+ * 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 000000000..64c5e31b7 --- /dev/null +++ b/org.eclipse.jgit.junit/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.eclipse.jgit.junit/.gitignore b/org.eclipse.jgit.junit/.gitignore new file mode 100644 index 000000000..934e0e06f --- /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 000000000..90325d8fa --- /dev/null +++ b/org.eclipse.jgit.junit/.project @@ -0,0 +1,28 @@ + + + org.eclipse.jgit.junit + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + 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 000000000..6a9621db1 --- /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/=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 000000000..9f733eeea --- /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 000000000..8bfa5f141 --- /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 000000000..9adc9b1d3 --- /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= +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 000000000..0ff1c0f96 --- /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 000000000..aa1a00826 --- /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 000000000..d137bd498 --- /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 000000000..d38764a1f --- /dev/null +++ b/org.eclipse.jgit.junit/pom.xml @@ -0,0 +1,101 @@ + + + + + 4.0.0 + + + org.eclipse.jgit + jgit-parent + 0.6.0-SNAPSHOT + + + org.eclipse.jgit.junit + JGit - JUnit Utility Classes + + + Utility classes to support JUnit testing of JGit applications. + + + + + org.eclipse.jgit + org.eclipse.jgit + + + + junit + junit + provided + + + + + src/ + + + + . + + plugin.properties + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + META-INF/MANIFEST.MF + + + + + + 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 000000000..5c8935c49 --- /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 + * Copyright (C) 2007, Shawn O. Pearce + * 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. + *

+ * 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. + *

+ * Callers should not use {@link RepositoryCache} from within these tests as it + * may wedge file descriptors open past the end of the test. + *

+ * 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 toClose = new ArrayList(); + + 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 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 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 env) { + final String[] envp = new String[env.size()]; + int i = 0; + for (Map.Entry e : env.entrySet()) { + envp[i++] = e.getKey() + "=" + e.getValue(); + } + return envp; + } + + private static HashMap cloneEnv() { + return new HashMap(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 similarity index 86% rename from org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/MockSystemReader.java rename to org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java index 2e94632ce..87125d280 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 * Copyright (C) 2009, Yann Simon * 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 values = new HashMap(); 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 @@ public long getCurrentTime() { @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 058848cf2..304e86186 100644 --- a/org.eclipse.jgit.pgm/.classpath +++ b/org.eclipse.jgit.pgm/.classpath @@ -2,8 +2,6 @@ - - - + diff --git a/org.eclipse.jgit.pgm/.gitignore b/org.eclipse.jgit.pgm/.gitignore index 5e56e040e..934e0e06f 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 bbaafc261..6fc89ae5e 100644 --- a/org.eclipse.jgit.pgm/.project +++ b/org.eclipse.jgit.pgm/.project @@ -10,8 +10,19 @@ + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature 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 000000000..75c779a48 --- /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 000000000..fe59357ab --- /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 similarity index 100% rename from org.eclipse.jgit.pgm/src/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin rename to 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 000000000..aa1a00826 --- /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 similarity index 86% rename from jgit.sh rename to org.eclipse.jgit.pgm/jgit.sh index 76b582919..e6a2119ef 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 000000000..f8fbd725c --- /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 000000000..e06dbc2d0 --- /dev/null +++ b/org.eclipse.jgit.pgm/pom.xml @@ -0,0 +1,186 @@ + + + + + 4.0.0 + + + org.eclipse.jgit + jgit-parent + 0.6.0-SNAPSHOT + + + org.eclipse.jgit.pgm + JGit - Command Line Interface + + + Command line client tools built on top of JGit. + + + + + args4j + args4j + + + + org.eclipse.jgit + org.eclipse.jgit + + + + org.eclipse.jgit + org.eclipse.jgit.ui + + + + + + java6 + + true + + + + org.eclipse.jgit + org.eclipse.jgit.console + ${project.version} + + + + + + + src/ + + + + . + + META-INF/services/org.eclipse.jgit.pgm.TextBuiltin + + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 1.2 + + + package + + shade + + + jgit-cli + false + + + + + org.eclipse.jgit.pgm.Main + JGit Command Line Interface + ${project.version} + + + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.3 + + + create_jgit + package + + + + + + + + + + + run + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.3 + + + attach_jgit + package + + attach-artifact + + + + + ${basedir}/target/jgit + sh + + + + + + + + + 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 281e2f389..18cf8be46 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 @@ private static File findGitDir() { 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 http_proxy. *

@@ -215,8 +260,9 @@ private static void configureHttpProxy() throws MalformedURLException { 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 e63f39c01..000000000 --- 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 - * 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. - *

- * 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. - *

- * 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 includes = new ArrayList(); - - @Option(name = "-file", handler = MapOptionHandler.class) - private Map files = new HashMap(); - - private final Map chosenSources = new HashMap(); - - 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 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 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 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 3c42728db..ea4128577 100644 --- a/org.eclipse.jgit.test/.classpath +++ b/org.eclipse.jgit.test/.classpath @@ -4,7 +4,6 @@ - diff --git a/org.eclipse.jgit.test/.gitignore b/org.eclipse.jgit.test/.gitignore index 9d7d1382b..b5bbb0ab8 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 8c89f045c..32d5efdfc 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 similarity index 96% rename from org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0007_Index.java rename to org.eclipse.jgit.test/exttst/org/eclipse/jgit/lib/T0007_GitIndexTest.java index ca2400cfb..21dcdffbf 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 + * Copyright (C) 2007, Robin Rosenberg * Copyright (C) 2008, Shawn O. Pearce * 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 void run() { } } + 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 void testCheckout() throws Exception { "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 void test031_executeBit_coreModeFalse() throws IllegalArgumentException, } } - 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 000000000..6938ea60a --- /dev/null +++ b/org.eclipse.jgit.test/pom.xml @@ -0,0 +1,100 @@ + + + + + 4.0.0 + + + org.eclipse.jgit + jgit-parent + 0.6.0-SNAPSHOT + + + org.eclipse.jgit.test + JGit - Core Tests + + + JUnit tests for the core library. + + + + + org.eclipse.jgit + org.eclipse.jgit + + + + org.eclipse.jgit + org.eclipse.jgit.junit + + + + + tst/ + + + + tst-rsrc/ + + + + + + maven-surefire-plugin + 2.4.2 + + + **/*Test.java + **/*TestCase.java + **/T000*.java + + + + + + 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 644c7b366..9e83aa0e1 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 void testObjectInNewPack() throws IncorrectObjectTypeException, 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 void testObjectMovedToNewPack1() // 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 void testObjectMovedWithinPack() 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 void testObjectMovedToNewPack2() // 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 703290749..ca626d4db 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.transport.IndexPack; import org.eclipse.jgit.util.JGitTestUtil; -public class PackWriterTest extends RepositoryTestCase { +public class PackWriterTest extends SampleDataRepositoryTestCase { private static final List EMPTY_LIST_OBJECT = Collections . 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 d7b6193ce..67ed6abb2 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 @@ * 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 3704c5617..fa77c6a8d 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.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 e72b7e215..8e5f6fc83 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 * 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 void testlogAllRefUpdates() throws Exception { // 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 void testlogAllRefUpdates() throws Exception { // 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 void testlogAllRefUpdates() throws Exception { // 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 1f2f25d5e..6144851fc 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 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 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 c0591755f..f05889308 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 void testNonBareFileKey() { } 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 void testFileKeyOpenExisting() throws IOException { } 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 08e701ab5..2cbfc682c 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 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 void test007_readUserConfig() { 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 void test007_readUserConfig() { 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 void test007_readUserConfig() { } // 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 ac8881b1f..c5c6d998b 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 - * Copyright (C) 2007, Shawn O. Pearce + * Copyright (C) 2009, Google Inc. + * Copyright (C) 2007-2008, Robin Rosenberg + * Copyright (C) 2006-2007, Shawn O. Pearce + * Copyright (C) 2009, Yann Simon * 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.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 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 they mapped arrays have not - * been reclaimed by the garbage collector. The programmer cannot control this - * with precision, though hinting using {@link java.lang.System#gc} - * 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 @@ protected static void copyFile(final File src, final File dst) 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 @@ protected static void checkFile(File f, final String checkData) } } + /** Test repository, initialized for this test case. */ protected Repository db; - private static Thread shutdownhook; - private static List shutDownCleanups = new ArrayList(); - private static int testcount; + /** Working directory of {@link #db}. */ + protected File trash; - private ArrayList repositoriesToClose = new ArrayList(); - - 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 000000000..10c005679 --- /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 + * Copyright (C) 2007-2009, Robin Rosenberg + * Copyright (C) 2006-2007, Shawn O. Pearce + * 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 66c3c75f1..7731880fd 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.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 74e98f1d8..d1dfdf4fa 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 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 void test002_WriteEmptyTree() throws IOException { // 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 void test002_WriteEmptyTree2() throws IOException { 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 void test003_WriteShouldBeEmptyTree() throws IOException { .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 void test009_CreateCommitOldFormat() throws IOException, 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 void test020_createBlobTag() throws IOException { 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 void test020_createBlobTag() throws IOException { 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 void test021_createTreeTag() throws IOException { 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 void test021_createTreeTag() throws IOException { 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 void test022_createCommitTag() throws IOException { 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 void test022_createCommitTag() throws IOException { 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 void test022_createCommitTag() throws IOException { 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 void test025_packedRefs() throws IOException { 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 void test026_CreateCommitMultipleparents() throws IOException { 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 void test026_CreateCommitMultipleparents() throws IOException { 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 void test026_CreateCommitMultipleparents() throws IOException { 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 void test026_CreateCommitMultipleparents() throws IOException { 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 be801e494..b78b7b855 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 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 ac730ff6a..ba8dbdb7b 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 * Copyright (C) 2007-2008, Robin Rosenberg * Copyright (C) 2006, Shawn O. Pearce @@ -47,7 +48,7 @@ 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 55b568d8f..8ff022ddc 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.util.JGitTestUtil; import org.eclipse.jgit.util.MutableInteger; -public class WindowCacheGetTest extends RepositoryTestCase { +public class WindowCacheGetTest extends SampleDataRepositoryTestCase { private List 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 0e5022006..690b166cb 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.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 50fbce41a..312fc00b1 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 @@ protected RevCommit commit(final int secDelta, final RevTree tree, 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 @@ protected RevTag tag(final String name, final RevObject dst) 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 6a6b63cab..2d6aa28d5 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 * Copyright (C) 2008, Robin Rosenberg * and other copyright owners as documented in the project's IP log. @@ -60,11 +60,11 @@ 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 void testWrite0() throws Exception { // 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 void testWrite1() throws Exception { // 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 void testWrite1() throws Exception { 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 4a47456f6..8e997e3f8 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.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 75e661bcf..e3518251f 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.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 5e56e040e..934e0e06f 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 a2c17a6a2..a6710cd52 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 e6c6c0865..b9acc5151 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 000000000..f77a143cb --- /dev/null +++ b/org.eclipse.jgit.ui/pom.xml @@ -0,0 +1,95 @@ + + + + + 4.0.0 + + + org.eclipse.jgit + jgit-parent + 0.6.0-SNAPSHOT + + + org.eclipse.jgit.ui + JGit - AWT User Interface + + + AWT/Swing based UI + + + + + org.eclipse.jgit + org.eclipse.jgit + + + + + src/ + + + + . + + plugin.properties + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + META-INF/MANIFEST.MF + + + + + + 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 995fe9a93..1d2f9d765 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 * and other copyright owners as documented in the project's IP log. * @@ -47,10 +48,7 @@ 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.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); + setDefault(new AwtAuthenticator()); } - /** - * 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); - } - } - - private final Collection cached = new ArrayList(); - @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 @@ protected PasswordAuthentication getPasswordAuthentication() { 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 000000000..f6710854b --- /dev/null +++ b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtSshSessionFactory.java @@ -0,0 +1,185 @@ +/* + * Copyright (C) 2008, Robin Rosenberg + * Copyright (C) 2008, Shawn O. Pearce + * 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 $HOME/.ssh. + *

+ * 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. + *

+ * 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 ba077a403..934e0e06f 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 000000000..e0359398b --- /dev/null +++ b/org.eclipse.jgit/pom.xml @@ -0,0 +1,95 @@ + + + + + 4.0.0 + + + org.eclipse.jgit + jgit-parent + 0.6.0-SNAPSHOT + + + org.eclipse.jgit + JGit - Core + + + Repository access and algorithms + + + + + com.jcraft + jsch + + + + + src/ + + + + . + + plugin.properties + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + META-INF/MANIFEST.MF + + + + + + 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 6ff3d4b2f..53c1a2ce3 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 + * Copyright (C) 2009, Google Inc. * Copyright (C) 2008, Robin Rosenberg * Copyright (C) 2008, Shawn O. Pearce * 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 $HOME/.ssh. @@ -66,110 +55,11 @@ * compatibility necessary to match OpenSSH, a popular implementation of SSH * used by C Git. *

- * 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 000000000..6828185a8 --- /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 + * 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 cached = new CopyOnWriteArrayList(); + + /** + * 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 000000000..974b58f93 --- /dev/null +++ b/pom.xml @@ -0,0 +1,256 @@ + + + + + 4.0.0 + + org.eclipse.jgit + jgit-parent + pom + 0.6.0-SNAPSHOT + + JGit - Parent + http://www.eclipse.org/egit/ + + + Pure Java implementation of Git + + + + + egit-dev Mailing List + egit-dev@eclipse.org + https://dev.eclipse.org/mailman/listinfo/egit-dev + https://dev.eclipse.org/mailman/listinfo/egit-dev + http://dev.eclipse.org/mhonarc/lists/egit-dev + + + + GIT Mailing List + git@vger.kernel.org + http://marc.info/?l=git + + + + + https://bugs.eclipse.org/bugs/ + Bugzilla + + + + + Eclipse Distribution License (New BSD License) + + 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. + + + + + + UTF-8 + UTF-8 + + + + + + maven-compiler-plugin + 2.0.2 + + 1.5 + 1.5 + UTF-8 + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + ${project.build.sourceEncoding} + true + + http://java.sun.com/j2se/1.5.0/docs/api + + + + + attach-javadocs + + jar + + + + + + + + + + junit + junit + test + + + + + + + + com.jcraft + jsch + 0.1.41 + + + + + args4j + args4j + 2.0.12 + + + + junit + junit + 3.8.1 + + + + org.eclipse.jgit + org.eclipse.jgit + ${project.version} + + + + org.eclipse.jgit + org.eclipse.jgit.junit + ${project.version} + + + + org.eclipse.jgit + org.eclipse.jgit.ui + ${project.version} + + + + + + + jgit-maven-snapshot + JGit Maven Repository + dav:https://egit.googlecode.com/svn/maven/ + true + + + + + + + java6 + + + !jgit.java6.skip + + + + org.eclipse.jgit.console + + + + + + org.eclipse.jgit + org.eclipse.jgit.ui + org.eclipse.jgit.pgm + org.eclipse.jgit.junit + org.eclipse.jgit.test + +