Initial commit of a GIT fetch factory
PDE Build uses fetch factories for fetching code from SCM to local discs
for building. This implements a fetch factory which is able to clone Git
repos into a local cache location and checkout projects from there.
Bug: 289838
Change-Id: Ieccc97fc8b368b9d8e0555e5c1dd32e21ed12f9a
Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
diff --git a/org.eclipse.egit.fetchfactory/.classpath b/org.eclipse.egit.fetchfactory/.classpath
new file mode 100644
index 0000000..8a8f166
--- /dev/null
+++ b/org.eclipse.egit.fetchfactory/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.egit.fetchfactory/.gitignore b/org.eclipse.egit.fetchfactory/.gitignore
new file mode 100644
index 0000000..5e56e04
--- /dev/null
+++ b/org.eclipse.egit.fetchfactory/.gitignore
@@ -0,0 +1 @@
+/bin
diff --git a/org.eclipse.egit.fetchfactory/.project b/org.eclipse.egit.fetchfactory/.project
new file mode 100644
index 0000000..c6327c1
--- /dev/null
+++ b/org.eclipse.egit.fetchfactory/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.egit.fetchfactory</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.egit.fetchfactory/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.egit.fetchfactory/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..23a3bc1
--- /dev/null
+++ b/org.eclipse.egit.fetchfactory/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,276 @@
+#Thu Oct 14 11:01:27 CEST 2010
+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.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=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_annotation=0
+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_method_declaration=0
+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.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+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.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+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_label=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.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+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_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/org.eclipse.egit.fetchfactory/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.egit.fetchfactory/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..9db4ad5
--- /dev/null
+++ b/org.eclipse.egit.fetchfactory/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,114 @@
+#Thu Oct 14 11:19:18 CEST 2010
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=false
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=false
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_JGit Clean-Up
+cleanup_settings_version=2
+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
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+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_missing_override_annotations_interface_methods=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=true
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=true
+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=true
+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=true
+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=true
+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.egit.fetchfactory/META-INF/MANIFEST.MF b/org.eclipse.egit.fetchfactory/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..a5eb876
--- /dev/null
+++ b/org.eclipse.egit.fetchfactory/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.egit.fetchfactory;singleton:=true
+Bundle-Version: 0.10.0.qualifier
+Bundle-Vendor: %Bundle-Vendor
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.eclipse.pde.build;bundle-version="3.6.1",
+ org.eclipse.equinox.common;bundle-version="3.6.0"
diff --git a/org.eclipse.egit.fetchfactory/OSGI-INF/l10n/bundle.properties b/org.eclipse.egit.fetchfactory/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 0000000..4497005
--- /dev/null
+++ b/org.eclipse.egit.fetchfactory/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,14 @@
+###############################################################################
+# Copyright (c) 2010 AGETO Service GmbH and others.
+# All rights reserved.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v1.0 which accompanies this distribution,
+# and is available at http://www.eclipse.org/legal/epl-v10.html.
+#
+# Contributors:
+# Gunnar Wagenknecht - initial API and implementation
+###############################################################################
+#Properties file for org.eclipse.egit.fetchfactory
+Bundle-Vendor = Eclipse EGit
+Bundle-Name = Git Fetch Factory for PDE Build (Incubation)
\ No newline at end of file
diff --git a/org.eclipse.egit.fetchfactory/build.properties b/org.eclipse.egit.fetchfactory/build.properties
new file mode 100644
index 0000000..df700ef
--- /dev/null
+++ b/org.eclipse.egit.fetchfactory/build.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright (c) 2010 AGETO Service GmbH and others.
+# All rights reserved.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v1.0 which accompanies this distribution,
+# and is available at http://www.eclipse.org/legal/epl-v10.html.
+#
+# Contributors:
+# Gunnar Wagenknecht - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ OSGI-INF/l10n/bundle.properties
+additional.bundles = org.eclipse.osgi
diff --git a/org.eclipse.egit.fetchfactory/plugin.xml b/org.eclipse.egit.fetchfactory/plugin.xml
new file mode 100644
index 0000000..8f41a30
--- /dev/null
+++ b/org.eclipse.egit.fetchfactory/plugin.xml
Binary files differ
diff --git a/org.eclipse.egit.fetchfactory/pom.xml b/org.eclipse.egit.fetchfactory/pom.xml
new file mode 100644
index 0000000..2ed7020
--- /dev/null
+++ b/org.eclipse.egit.fetchfactory/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2010 AGETO Service GmbH and others.
+ All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html.
+
+ Contributors:
+ Gunnar Wagenknecht - initial API and implementation
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.egit</groupId>
+ <artifactId>egit-parent</artifactId>
+ <version>0.10.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.eclipse.egit.fetchfactory</artifactId>
+ <packaging>eclipse-plugin</packaging>
+
+ <name>Git Fetch Factory for PDE Build (Incubation)</name>
+
+ <!-- workaround for https://issues.sonatype.org/browse/TYCHO-168 -->
+ <build>
+ <resources>
+ <resource>
+ <directory>src</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.sonatype.tycho</groupId>
+ <artifactId>maven-osgi-source-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/org.eclipse.egit.fetchfactory/src/org/eclipse/egit/fetchfactory/internal/GITFetchTaskFactory.java b/org.eclipse.egit.fetchfactory/src/org/eclipse/egit/fetchfactory/internal/GITFetchTaskFactory.java
new file mode 100644
index 0000000..98432c5
--- /dev/null
+++ b/org.eclipse.egit.fetchfactory/src/org/eclipse/egit/fetchfactory/internal/GITFetchTaskFactory.java
@@ -0,0 +1,567 @@
+/*******************************************************************************
+ * Copyright (c) 2010 AGETO Service GmbH and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation of CVS factory
+ * Gunnar Wagenknecht - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.egit.fetchfactory.internal;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.pde.build.Constants;
+import org.eclipse.pde.build.IAntScript;
+import org.eclipse.pde.build.IFetchFactory;
+import org.eclipse.pde.internal.build.IPDEBuildConstants;
+import org.eclipse.pde.internal.build.Utils;
+
+/**
+ * An <code>FetchTaskFactory</code> for building fetch scripts that will fetch
+ * content from a Git repository (id: <code>GIT</code>).
+ * <p>
+ * Map file format: <code><pre>
+ * type@id,[version]=GIT,args
+ * </pre></code> <code>args</code> is a comma-separated list of key/value pairs
+ * Accepted args include:
+ * <ul>
+ * <li><code>tag</code> - mandatory Git tag</li>
+ * <li><code>repo</code> - mandatory repo location</li>
+ * <li><code>path</code> - optional path relative to <code>repo</code> which
+ * points to the element (otherwise it's assumed that the element is at the repo
+ * root)</li>
+ * <li><code>prebuilt</code> - optional boolean value indicating that the path
+ * points to a pre-built bundle in the repository</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Fetching is implemented as a three-step process.
+ * <ol>
+ * <li>The repository is cloned to local disc. If it already exists, it is
+ * assumed that it was previously cloned and just new commits will be fetched.</li>
+ * <li>The specified tag will be checked out in the local clone.</li>
+ * <li>The content of the path will be copied to the final build location.</li>
+ * </ol>
+ * </p>
+ */
+@SuppressWarnings("restriction")
+public class GITFetchTaskFactory implements IFetchFactory {
+
+ public static final String ID = "GIT"; //$NON-NLS-1$
+
+ public static final String OVERRIDE_TAG = ID;
+
+ private static final String TARGET_GET_ELEMENT_FROM_REPO = "GitFetchElementFromLocalRepo"; //$NON-NLS-1$
+
+ private static final String TARGET_GET_FILE_FROM_REPO = "GitFetchFileFromLocalRepo"; //$NON-NLS-1$
+
+ private static final String TARGET_CLONE_REPO = "GitCloneRepoToLocalRepo"; //$NON-NLS-1$
+
+ private static final String TARGET_UPDATE_REPO = "GitUpdateLocalRepo"; //$NON-NLS-1$
+
+ private static final String TARGET_CHECKOUT_TAG = "GitCheckoutTagInLocalRepo"; //$NON-NLS-1$
+
+ private static final String SEPARATOR = ","; //$NON-NLS-1$
+
+ // Git specific keys used in the map being passed around.
+ private static final String KEY_REPO = "repo"; //$NON-NLS-1$
+
+ private static final String KEY_PATH = "path"; //$NON-NLS-1$
+
+ private static final String KEY_PREBUILT = "prebuilt"; //$NON-NLS-1$
+
+ // Properties used in the Git part of the scripts
+ private static final String PROP_DESTINATIONFOLDER = "destinationFolder"; //$NON-NLS-1$
+
+ private static final String PROP_GITREPO = "gitRepo"; //$NON-NLS-1$
+
+ private static final String PROP_GITREPO_LOCAL_PATH = "gitRepoLocalPath"; //$NON-NLS-1$
+
+ private static final String PROP_PATH = "path"; //$NON-NLS-1$
+
+ private static final String PROP_FILE = "file"; //$NON-NLS-1$
+
+ private static final String PROP_TAG = "tag"; //$NON-NLS-1$
+
+ private static final String PROP_FILETOCHECK = "fileToCheck"; //$NON-NLS-1$
+
+ // copied from FetchScriptGenerator to be independent from changes there
+ public static String PROP_FETCH_CACHE_LOCATION = "fetchCacheLocation"; //$NON-NLS-1$
+
+ public static String DEFAULT_FETCH_CACHE_LOCATION = "${basedir}/scmCache"; //$NON-NLS-1$
+
+ private static void printArg(IAntScript script, String value) {
+ final Map<String, String> params = new HashMap<String, String>(1);
+ params.put("value", value); //$NON-NLS-1$
+ script.printElement("arg", params); //$NON-NLS-1$
+ }
+
+ private void addProjectReference(Map<String, String> entryInfos) {
+ final String repoLocation = entryInfos.get(KEY_REPO);
+ final String path = entryInfos.get(KEY_PATH);
+ final String projectName = entryInfos.get(KEY_ELEMENT_NAME);
+ final String tag = entryInfos.get(IFetchFactory.KEY_ELEMENT_TAG);
+
+ if (repoLocation != null && projectName != null) {
+ final String sourceUrl = asReference(repoLocation, path,
+ projectName, tag);
+ if (sourceUrl != null) {
+ entryInfos.put(Constants.KEY_SOURCE_REFERENCES, sourceUrl);
+ }
+ }
+ }
+
+ @Override
+ public void addTargets(IAntScript script) {
+ final Map<String, String> params = new HashMap<String, String>(3);
+ final List<String> args = new ArrayList<String>(5);
+
+ script.printComment("Start of common Git fetch factory targets."); //$NON-NLS-1$
+
+ // determine if clone git operation should be skipped
+ script.printTargetDeclaration(
+ "GitCheckSkipClone", null, null, null, null); //$NON-NLS-1$
+ printGitRepoBaseLocationDefault(script);
+ printConditionStart(script, "skipClone", null, null); //$NON-NLS-1$
+ script.printStartTag("or"); //$NON-NLS-1$
+ script.incrementIdent();
+ printAvailableFile(script,
+ Utils.getPropertyFormat(PROP_GITREPO_LOCAL_PATH));
+ printAvailableFile(script, Utils.getPropertyFormat(PROP_FILETOCHECK));
+ script.decrementIdent();
+ script.printEndTag("or"); //$NON-NLS-1$
+ printConditionEnd(script);
+ script.printTargetEnd();
+
+ // clone repo task
+ script.printTargetDeclaration(TARGET_CLONE_REPO,
+ "GitCheckSkipClone", null, "skipClone", null); //$NON-NLS-1$ //$NON-NLS-2$
+ printGitRepoBaseLocationDefault(script);
+ params.put("dir", Utils.getPropertyFormat(PROP_GITREPO_LOCAL_PATH)); //$NON-NLS-1$
+ script.printElement("mkdir", params); //$NON-NLS-1$
+ args.add(Utils.getPropertyFormat(PROP_GITREPO));
+ args.add("."); //$NON-NLS-1$
+ printGitTask(script, "clone", args); //$NON-NLS-1$
+ script.printTargetEnd();
+
+ // pull repo task
+ script.printTargetDeclaration(TARGET_UPDATE_REPO, null,
+ Utils.getPropertyFormat(PROP_GITREPO_LOCAL_PATH),
+ "${fileToCheck}", null); //$NON-NLS-1$
+ printGitRepoBaseLocationDefault(script);
+ args.clear();
+ args.add("--all"); //$NON-NLS-1$
+ printGitTask(script, "fetch", null); //$NON-NLS-1$
+ script.printTargetEnd();
+
+ // checkout tag task
+ script.printTargetDeclaration(TARGET_CHECKOUT_TAG, null,
+ Utils.getPropertyFormat(PROP_GITREPO_LOCAL_PATH),
+ "${fileToCheck}", null); //$NON-NLS-1$
+ printGitRepoBaseLocationDefault(script);
+ args.clear();
+ args.add("--force"); //$NON-NLS-1$
+ args.add(Utils.getPropertyFormat(PROP_TAG));
+ printGitTask(script, "checkout", args); //$NON-NLS-1$
+ script.printTargetEnd();
+
+ // copy an elements from repo to the destination
+ script.printTargetDeclaration(TARGET_GET_ELEMENT_FROM_REPO, null,
+ Utils.getPropertyFormat(PROP_GITREPO_LOCAL_PATH),
+ "${fileToCheck}", null); //$NON-NLS-1$
+ printGitRepoBaseLocationDefault(script);
+ params.clear();
+ params.put("todir", Utils.getPropertyFormat(PROP_DESTINATIONFOLDER)); //$NON-NLS-1$
+ script.printStartTag("copy", params); //$NON-NLS-1$
+ script.incrementIdent();
+ params.clear();
+ params.put(
+ "dir", Utils.getPropertyFormat(PROP_GITREPO_LOCAL_PATH) + "/" + Utils.getPropertyFormat(PROP_PATH)); //$NON-NLS-1$ //$NON-NLS-2$
+ script.printElement("fileset", params); //$NON-NLS-1$
+ script.decrementIdent();
+ script.printEndTag("copy"); //$NON-NLS-1$
+ script.printTargetEnd();
+
+ // copy a file from repo to the destination
+ script.printTargetDeclaration(TARGET_GET_FILE_FROM_REPO, null,
+ Utils.getPropertyFormat(PROP_GITREPO_LOCAL_PATH),
+ "${fileToCheck}", null); //$NON-NLS-1$
+ printGitRepoBaseLocationDefault(script);
+ params.clear();
+ params.put(
+ "file", Utils.getPropertyFormat(PROP_GITREPO_LOCAL_PATH) + "/" + Utils.getPropertyFormat(PROP_PATH)); //$NON-NLS-1$ //$NON-NLS-2$
+ params.put(
+ "tofile", Utils.getPropertyFormat(PROP_DESTINATIONFOLDER) + "/" + Utils.getPropertyFormat(PROP_FILE)); //$NON-NLS-1$ //$NON-NLS-2$
+ params.put("failOnError", "false"); //$NON-NLS-1$ //$NON-NLS-2$
+ script.printElement("copy", params); //$NON-NLS-1$
+ script.printTargetEnd();
+
+ script.printComment("End of common Git fetch factory targets."); //$NON-NLS-1$
+ }
+
+ /**
+ * Generates a path where the specified repository should be cloned to.
+ *
+ * @param repoLocation
+ * @return local file system path
+ */
+ private String asLocalRepo(String repoLocation) {
+ final StringBuffer b = new StringBuffer(repoLocation.length());
+ b.append(Utils.getPropertyFormat(PROP_FETCH_CACHE_LOCATION))
+ .append('/');
+ for (int i = 0; i < repoLocation.length(); i++) {
+ final char c = repoLocation.charAt(i);
+ if (Character.isLetterOrDigit(c)) {
+ b.append(c);
+ } else {
+ // replace with '_'
+ b.append('_');
+ }
+ }
+ if (b.charAt(b.length() - 1) == '/')
+ return b.substring(0, b.length() - 1);
+ return b.toString();
+ }
+
+ /**
+ * Creates an SCMURL reference to the associated source.
+ *
+ * @param repoLocation
+ * @param path
+ * @param projectName
+ * @return project reference string or <code>null</code> if none
+ */
+ private String asReference(String repoLocation, String path,
+ String projectName, String tagName) {
+ final StringBuffer buffer = new StringBuffer();
+ buffer.append("scm:git:"); //$NON-NLS-1$
+
+ // use repoLocation as is (Git support many URLs)
+ buffer.append(repoLocation);
+
+ // path
+ if (path != null) {
+ final Path projectPath = new Path(path);
+
+ buffer.append(";path=\""); //$NON-NLS-1$
+ buffer.append(projectPath.toString());
+ buffer.append('"');
+
+ // project name if different then last path segment
+ if (!projectPath.lastSegment().equals(projectName)) {
+ buffer.append(";project=\""); //$NON-NLS-1$
+ buffer.append(projectName);
+ buffer.append('"');
+ }
+ }
+
+ if (tagName != null && !tagName.equals("master")) { //$NON-NLS-1$
+ buffer.append(";tag="); //$NON-NLS-1$
+ buffer.append(tagName);
+ }
+ return buffer.toString();
+ }
+
+ @Override
+ public void generateRetrieveElementCall(Map entryInfos, IPath destination,
+ IAntScript script) {
+ final String type = (String) entryInfos.get(KEY_ELEMENT_TYPE);
+ final boolean prebuilt = Boolean.valueOf(
+ (String) entryInfos.get(KEY_PREBUILT)).booleanValue();
+ final String gitRepo = (String) entryInfos.get(KEY_REPO);
+ final String localGitRepo = asLocalRepo(gitRepo);
+ final String path = (String) entryInfos.get(KEY_PATH);
+ final String tag = (String) entryInfos
+ .get(IFetchFactory.KEY_ELEMENT_TAG);
+
+ // set required property defaults
+ printGitRepoBaseLocationDefault(script);
+
+ final String gitCopyTarget;
+ IPath locationToCheck = null;
+ final Map<String, String> params = new HashMap<String, String>(5);
+ params.put(PROP_GITREPO_LOCAL_PATH, localGitRepo);
+ if (prebuilt) {
+ // if we have a pre-built JAR then we want to put it right in the
+ // plugins/features directory
+ // and not a sub-directory so strip off last segment
+ params.put(PROP_DESTINATIONFOLDER, destination
+ .removeLastSegments(1).toString());
+ params.put(PROP_PATH, path);
+
+ // extract file name from path
+ final String prebuiltJarFile = new Path(path).lastSegment();
+ params.put(PROP_FILE, prebuiltJarFile);
+
+ // if we have a pre-built plug-in then we want to check the
+ // existence of the JAR file
+ // rather than the plug-in manifest.
+ locationToCheck = destination.removeLastSegments(1).append(
+ prebuiltJarFile);
+
+ // get single file
+ gitCopyTarget = TARGET_GET_FILE_FROM_REPO;
+ } else {
+ params.put(PROP_DESTINATIONFOLDER, destination.toString());
+ if (path != null) {
+ params.put(PROP_PATH, new Path(path).makeRelative().toString());
+ }
+
+ // check for existence of element descriptor
+ if (type.equals(ELEMENT_TYPE_FEATURE)) {
+ locationToCheck = destination
+ .append(Constants.FEATURE_FILENAME_DESCRIPTOR);
+ } else if (type.equals(ELEMENT_TYPE_PLUGIN)) {
+ locationToCheck = destination
+ .append(Constants.PLUGIN_FILENAME_DESCRIPTOR);
+ } else if (type.equals(ELEMENT_TYPE_FRAGMENT)) {
+ locationToCheck = destination
+ .append(Constants.FRAGMENT_FILENAME_DESCRIPTOR);
+ } else if (type.equals(ELEMENT_TYPE_BUNDLE)) {
+ locationToCheck = destination
+ .append(Constants.BUNDLE_FILENAME_DESCRIPTOR);
+ }
+
+ // copy complete element
+ gitCopyTarget = TARGET_GET_ELEMENT_FROM_REPO;
+ }
+
+ // check for availability of element in destination
+ if (locationToCheck != null) {
+ params.put(PROP_FILETOCHECK, locationToCheck.toString());
+ printAvailableTask(locationToCheck.toString(),
+ locationToCheck.toString(), script);
+ // plug-ins/fragments may not have an xml descriptor anymore, thus
+ // also check for MANIFEST.MF
+ if (!prebuilt
+ && (type.equals(IFetchFactory.ELEMENT_TYPE_PLUGIN) || type
+ .equals(IFetchFactory.ELEMENT_TYPE_FRAGMENT))) {
+ printAvailableTask(locationToCheck.toString(), destination
+ .append(Constants.BUNDLE_FILENAME_DESCRIPTOR)
+ .toString(), script);
+ }
+ }
+
+ // clone the Git repo to a local repo and checkout the tag
+ printCloneRepoAndCheckoutTagTasks(script, gitRepo, localGitRepo, tag,
+ locationToCheck);
+
+ // copy the content into the destination
+ script.printAntCallTask(gitCopyTarget, true, params);
+ }
+
+ @Override
+ public void generateRetrieveFilesCall(final Map entryInfos,
+ IPath destination, final String[] files, IAntScript script) {
+ final String gitRepo = (String) entryInfos.get(KEY_REPO);
+ final String localGitRepo = asLocalRepo(gitRepo);
+ final String path = (String) entryInfos.get(KEY_PATH);
+ final String tag = (String) entryInfos
+ .get(IFetchFactory.KEY_ELEMENT_TAG);
+
+ // set required property defaults
+ printGitRepoBaseLocationDefault(script);
+
+ // clone the Git repo to a local repo and checkout the tag
+ printCloneRepoAndCheckoutTagTasks(script, gitRepo, localGitRepo, tag,
+ null);
+
+ // copy files to destination
+ final Map<String, String> params = new HashMap<String, String>(4);
+ for (int i = 0; i < files.length; i++) {
+ final String file = files[i];
+ IPath filePath;
+ if (path != null) {
+ filePath = new Path(path).append(file);
+ } else {
+ filePath = new Path((String) entryInfos.get(KEY_ELEMENT_NAME))
+ .append(file);
+ }
+
+ params.clear();
+ params.put(PROP_GITREPO_LOCAL_PATH, localGitRepo);
+ params.put(PROP_DESTINATIONFOLDER, destination.toString());
+ params.put(PROP_PATH, filePath.toString());
+ params.put(PROP_FILE, file);
+ script.printAntCallTask(TARGET_GET_FILE_FROM_REPO, true, params);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void parseMapFileEntry(String repoSpecificentry,
+ Properties overrideTags, Map entryInfos) throws CoreException {
+ // build up the table of arguments in the map file entry
+ final String[] arguments = Utils.getArrayFromStringWithBlank(
+ repoSpecificentry, SEPARATOR);
+ final Map<String, String> table = new HashMap<String, String>();
+ for (int i = 0; i < arguments.length; i++) {
+ final String arg = arguments[i];
+ // if we have at least one arg without an equals sign, then
+ // revert back to the legacy parsing
+ final int index = arg.indexOf('=');
+ if (index == -1) {
+ final String message = NLS.bind(
+ Messages.error_incorrectDirectoryEntryKeyValue,
+ entryInfos.get(KEY_ELEMENT_NAME));
+ throw new CoreException(new Status(IStatus.ERROR,
+ IPDEBuildConstants.PI_PDEBUILD, 1, message, null));
+ }
+ final String key = arg.substring(0, index);
+ final String value = arg.substring(index + 1);
+ table.put(key, value);
+ }
+
+ // sanity check that all required attributes are present
+ if (!table.containsKey(KEY_REPO)) {
+ final String message = NLS.bind(
+ Messages.error_directoryEntryRequiresRepo,
+ entryInfos.get(KEY_ELEMENT_NAME));
+ throw new CoreException(new Status(IStatus.ERROR,
+ IPDEBuildConstants.PI_PDEBUILD, 1, message, null));
+ }
+
+ // add entries to the entryInfo map here instead of inside the loop
+ // to avoid contaminating entryInfos
+ final String overrideTag = overrideTags != null ? overrideTags
+ .getProperty(OVERRIDE_TAG) : null;
+ entryInfos
+ .put(IFetchFactory.KEY_ELEMENT_TAG, (overrideTag != null
+ && overrideTag.trim().length() != 0 ? overrideTag
+ : table.get(IFetchFactory.KEY_ELEMENT_TAG)));
+ entryInfos.put(KEY_REPO, table.get(KEY_REPO));
+ if (table.get(KEY_PATH) != null)
+ entryInfos.put(KEY_PATH, new Path(table.get(KEY_PATH))
+ .makeRelative().removeTrailingSeparator().toString()); // sanitize
+ // path
+ entryInfos.put(KEY_PREBUILT, table.get(KEY_PREBUILT));
+ addProjectReference(entryInfos);
+ }
+
+ private void printAvailableFile(IAntScript script, String file) {
+ script.println("<available file=\"" + file + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Print the <code>available</code> Ant task to this script. This task sets
+ * a property value if the given file exists at runtime.
+ *
+ * @param property
+ * the property to set
+ * @param file
+ * the file to look for
+ */
+ private void printAvailableTask(String property, String file,
+ IAntScript script) {
+ final Map<String, String> params = new HashMap<String, String>(2);
+ params.put("property", property); //$NON-NLS-1$
+ params.put("file", file); //$NON-NLS-1$
+ script.printElement("available", params); //$NON-NLS-1$
+ }
+
+ private void printCloneRepoAndCheckoutTagTasks(IAntScript script,
+ String gitRepo, String localGitRepo, String tag,
+ IPath locationToCheckIfPluginLocal) {
+ // determine availability of local repo (done to avoid unnecessary Git
+ // operations)
+ printAvailableTask(localGitRepo, localGitRepo, script);
+
+ // pull if already cloned
+ final Map<String, String> params = new HashMap<String, String>(5);
+ params.put(PROP_GITREPO_LOCAL_PATH, localGitRepo);
+ if (locationToCheckIfPluginLocal != null)
+ params.put(PROP_FILETOCHECK,
+ locationToCheckIfPluginLocal.toString());
+ script.printAntCallTask(TARGET_UPDATE_REPO, true, params);
+
+ // clone if not cloned
+ params.put(PROP_GITREPO, gitRepo);
+ params.put(PROP_GITREPO_LOCAL_PATH, localGitRepo);
+ if (locationToCheckIfPluginLocal != null)
+ params.put(PROP_FILETOCHECK,
+ locationToCheckIfPluginLocal.toString());
+ script.printAntCallTask(TARGET_CLONE_REPO, true, params);
+
+ // checkout the tag
+ params.clear();
+ params.put(PROP_GITREPO_LOCAL_PATH, localGitRepo);
+ params.put(PROP_TAG, tag);
+ if (locationToCheckIfPluginLocal != null)
+ params.put(PROP_FILETOCHECK,
+ locationToCheckIfPluginLocal.toString());
+ script.printAntCallTask(TARGET_CHECKOUT_TAG, true, params);
+
+ // re-determine availability of local repo (done to avoid unnecessary
+ // Git operations)
+ printAvailableTask(localGitRepo, localGitRepo, script);
+ }
+
+ private void printConditionEnd(IAntScript script) {
+ script.decrementIdent();
+ script.printEndTag("condition"); //$NON-NLS-1$
+ }
+
+ private void printConditionStart(IAntScript script, String property,
+ String value, String elseValue) {
+ script.printTabs();
+ script.print("<condition"); //$NON-NLS-1$
+ script.printAttribute("property", property, true); //$NON-NLS-1$
+ script.printAttribute("value", value, false); //$NON-NLS-1$
+ script.printAttribute("else", elseValue, false); //$NON-NLS-1$
+ script.print(">"); //$NON-NLS-1$
+ script.println();
+ script.incrementIdent();
+ }
+
+ private void printGitRepoBaseLocationDefault(IAntScript script) {
+ script.println("<property name=\"" + PROP_FETCH_CACHE_LOCATION + "\" value=\"" + DEFAULT_FETCH_CACHE_LOCATION + "\" />"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ private void printGitTask(IAntScript script, String commandName, List args) {
+ // print command
+ final StringBuffer m = new StringBuffer();
+ m.append("[GIT] "); //$NON-NLS-1$
+ m.append(Utils.getPropertyFormat(PROP_GITREPO_LOCAL_PATH));
+ m.append(" >> git ").append(commandName); //$NON-NLS-1$
+ if (args != null) {
+ for (int i = 0; i < args.size(); i++) {
+ m.append(" ").append(args.get(i)); //$NON-NLS-1$
+ }
+ }
+ script.printEchoTask(null, m.toString(), "info"); //$NON-NLS-1$
+
+ final Map<String, String> params = new HashMap<String, String>(3);
+ params.put("executable", "git"); //$NON-NLS-1$ //$NON-NLS-2$
+ params.put("dir", Utils.getPropertyFormat(PROP_GITREPO_LOCAL_PATH)); //$NON-NLS-1$
+ params.put("failOnError", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+ script.printStartTag("exec", params); //$NON-NLS-1$
+ script.incrementIdent();
+
+ // cmd
+ printArg(script, commandName);
+
+ // append arguments
+ if (args != null) {
+ for (int i = 0; i < args.size(); i++) {
+ final String arg = (String) args.get(i);
+ printArg(script, arg);
+ }
+ }
+
+ script.decrementIdent();
+ script.printEndTag("exec"); //$NON-NLS-1$
+ }
+}
diff --git a/org.eclipse.egit.fetchfactory/src/org/eclipse/egit/fetchfactory/internal/Messages.java b/org.eclipse.egit.fetchfactory/src/org/eclipse/egit/fetchfactory/internal/Messages.java
new file mode 100644
index 0000000..2bfbb6b
--- /dev/null
+++ b/org.eclipse.egit.fetchfactory/src/org/eclipse/egit/fetchfactory/internal/Messages.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2010 AGETO Service GmbH and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Gunnar Wagenknecht - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.egit.fetchfactory.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.releng.git.fetch.internal.messages";//$NON-NLS-1$
+
+ public static String error_incorrectDirectoryEntry;
+
+ public static String error_incorrectDirectoryEntryKeyValue;
+
+ public static String error_directoryEntryRequiresRepo;
+
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+}
\ No newline at end of file
diff --git a/org.eclipse.egit.fetchfactory/src/org/eclipse/egit/fetchfactory/internal/messages.properties b/org.eclipse.egit.fetchfactory/src/org/eclipse/egit/fetchfactory/internal/messages.properties
new file mode 100644
index 0000000..847f8df
--- /dev/null
+++ b/org.eclipse.egit.fetchfactory/src/org/eclipse/egit/fetchfactory/internal/messages.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2010 AGETO Service GmbH and others.
+# All rights reserved.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v1.0 which accompanies this distribution,
+# and is available at http://www.eclipse.org/legal/epl-v10.html.
+#
+# Contributors:
+# IBM Corporation - initial API and implementation of PDE Build
+# Gunnar Wagenknecht - initial API and implementation
+###############################################################################
+
+error_incorrectDirectoryEntry = Incorrect directory entry: {0}.
+error_incorrectDirectoryEntryKeyValue = Incorrect directory entry for {0}, any argument must be in key=value format.
+error_directoryEntryRequiresRepo = Incorrect directory entry for {0}, a repository is required.