rimerosolutions / ant-git-tasks Goto Github PK
View Code? Open in Web Editor NEWAnt tasks for Git with JGit
License: Apache License 2.0
Ant tasks for Git with JGit
License: Apache License 2.0
The PushTask uses the hard-coded refspec currentBranch + ":" + currentBranch
. It would be great if we could specify the refspecs for the task, like:
<push refspec="master:staging" />
What do you think? Thanks!
AntUnit integration tests are currently broken.
ant test
Investigate and fix
Add new test in src/test/resources/integration-tests.xml for the newly contributed merge task.
Summary
It is not possible to commit a specific set of changes among all possible git tree changes.
Details
The JGit API supports adding multiple specific paths by calling the setOnly method multiple times. http://download.eclipse.org/jgit/docs/jgit-3.2.0.201312181205-r/apidocs/org/eclipse/jgit/api/CommitCommand.html#setOnly(java.lang.String)
However, there's no fileset like support in the Ant Git tasks commit task. Fileset support should be implement in a similar way than in the AddCommand task.
Sample use case
Using this:
<git:commit message="auto commit" revCommitIdProperty="testAdd.revcommit" brandedMessage="false"/>
Gives this:
git:commit doesn't support the "brandedMessage" attribute
Some Git Push failures occur when no push URI is set as part of the Ant push task.
The push task should delegate to the default JGit push URI resolution and NOT set a null URI!
Suggestion for an enhancement: as far as I can see there is no support for git describe with its variants. That would help us in our automated builds.
I don't know if this issue tracker is still active, but I'm getting the error from the title. This is my config
<project name="Test" default="init" basedir="."
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:git="antlib:com.rimerosolutions.ant.git">
<target name="init">
<ivy:cachepath pathid="ant.git.tasks.classpath" conf="compile"/>
<taskdef uri="antlib:com.rimerosolutions.ant.git"
resource="com/rimerosolutions/ant/git/jgit-ant-lib.xml">
<classpath>
<path refid="ant.git.tasks.classpath"/>
</classpath>
</taskdef>
<!-- Install repositories -->
<git:git directory=".">
<git:clone uri="someuri"/>
</git:git>
</target>
</project>
<ivy-module version="2.0">
<info organisation="Test GmbH" module="Test"/>
<configurations>
<conf name="compile"/>
</configurations>
<dependencies>
<dependency org="org.eclipse.jgit"
name="org.eclipse.jgit.ant"
rev="4.7.0.201704051617-r" conf="compile"/>
<dependency org="org.eclipse.jgit"
name="org.eclipse.jgit"
rev="4.7.0.201704051617-r" conf="compile"/>
<dependency org="com.jcraft"
name="jsch"
rev="0.1.54" conf="compile"/>
<dependency org="com.rimerosolutions.ant"
name="ant-git-tasks"
rev="1.3.2"
changing="true" conf="compile"/>
</dependencies>
</ivy-module>
<ivysettings>
<settings defaultResolver="central"/>
<resolvers>
<url name="sonatype-snapshots" m2compatible="true">
<artifact pattern="https://oss.sonatype.org/content/repositories/snapshots/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
</url>
<ibiblio name="central" m2compatible="true"/>
</resolvers>
</ivysettings>
And this is the error output
Buildfile: /home/tzfrs/dev/Test/TestAnt/build.xml
init:
[ivy:cachepath] :: Apache Ivy 2.4.0 - 20141213170938 :: http://ant.apache.org/ivy/ ::
[ivy:cachepath] :: loading settings :: file = /home/tzfrs/dev/Test/TestAnt/ivysettings.xml
[ivy:cachepath] :: resolving dependencies :: Test GmbH#Test;working@tzfrs-home
[ivy:cachepath] confs: [compile]
[ivy:cachepath] found org.eclipse.jgit#org.eclipse.jgit.ant;4.7.0.201704051617-r in central
[ivy:cachepath] found org.eclipse.jgit#org.eclipse.jgit;4.7.0.201704051617-r in central
[ivy:cachepath] found com.jcraft#jsch;0.1.54 in central
[ivy:cachepath] found com.googlecode.javaewah#JavaEWAH;1.1.6 in central
[ivy:cachepath] found org.apache.httpcomponents#httpclient;4.3.6 in central
[ivy:cachepath] found org.apache.httpcomponents#httpcore;4.3.3 in central
[ivy:cachepath] found commons-logging#commons-logging;1.1.3 in central
[ivy:cachepath] found commons-codec#commons-codec;1.6 in central
[ivy:cachepath] found org.slf4j#slf4j-api;1.7.2 in central
[ivy:cachepath] found org.apache.ant#ant;1.9.6 in central
[ivy:cachepath] found org.apache.ant#ant-launcher;1.9.6 in central
[ivy:cachepath] found com.rimerosolutions.ant#ant-git-tasks;1.3.2 in central
[ivy:cachepath] downloading https://repo1.maven.org/maven2/org/eclipse/jgit/org.eclipse.jgit.ant/4.7.0.201704051617-r/org.eclipse.jgit.ant-4.7.0.201704051617-r.jar ...
[ivy:cachepath] ......... (18kB)
[ivy:cachepath] .. (0kB)
[ivy:cachepath] [SUCCESSFUL ] org.eclipse.jgit#org.eclipse.jgit.ant;4.7.0.201704051617-r!org.eclipse.jgit.ant.jar (58ms)
[ivy:cachepath] downloading https://repo1.maven.org/maven2/org/eclipse/jgit/org.eclipse.jgit/4.7.0.201704051617-r/org.eclipse.jgit-4.7.0.201704051617-r.jar ...
[ivy:cachepath] .................................................................................................................................................................. (2397kB)
[ivy:cachepath] .. (0kB)
[ivy:cachepath] [SUCCESSFUL ] org.eclipse.jgit#org.eclipse.jgit;4.7.0.201704051617-r!org.eclipse.jgit.jar (298ms)
[ivy:cachepath] downloading https://repo1.maven.org/maven2/com/jcraft/jsch/0.1.54/jsch-0.1.54.jar ...
[ivy:cachepath] ............................. (273kB)
[ivy:cachepath] .. (0kB)
[ivy:cachepath] [SUCCESSFUL ] com.jcraft#jsch;0.1.54!jsch.jar (71ms)
[ivy:cachepath] downloading https://repo1.maven.org/maven2/org/apache/ant/ant/1.9.6/ant-1.9.6.jar ...
[ivy:cachepath] ........................................................................................................................................ (1982kB)
[ivy:cachepath] .. (0kB)
[ivy:cachepath] [SUCCESSFUL ] org.apache.ant#ant;1.9.6!ant.jar (208ms)
[ivy:cachepath] downloading https://repo1.maven.org/maven2/com/googlecode/javaewah/JavaEWAH/1.1.6/JavaEWAH-1.1.6.jar ...
[ivy:cachepath] ...................... (161kB)
[ivy:cachepath] .. (0kB)
[ivy:cachepath] [SUCCESSFUL ] com.googlecode.javaewah#JavaEWAH;1.1.6!JavaEWAH.jar(bundle) (68ms)
[ivy:cachepath] downloading https://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar ...
[ivy:cachepath] ................................................ (578kB)
[ivy:cachepath] .. (0kB)
[ivy:cachepath] [SUCCESSFUL ] org.apache.httpcomponents#httpclient;4.3.6!httpclient.jar (96ms)
[ivy:cachepath] downloading https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.2/slf4j-api-1.7.2.jar ...
[ivy:cachepath] ............... (25kB)
[ivy:cachepath] .. (0kB)
[ivy:cachepath] [SUCCESSFUL ] org.slf4j#slf4j-api;1.7.2!slf4j-api.jar (59ms)
[ivy:cachepath] downloading https://repo1.maven.org/maven2/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar ...
[ivy:cachepath] ............................. (276kB)
[ivy:cachepath] .. (0kB)
[ivy:cachepath] [SUCCESSFUL ] org.apache.httpcomponents#httpcore;4.3.3!httpcore.jar (69ms)
[ivy:cachepath] downloading https://repo1.maven.org/maven2/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar ...
[ivy:cachepath] ............... (60kB)
[ivy:cachepath] .. (0kB)
[ivy:cachepath] [SUCCESSFUL ] commons-logging#commons-logging;1.1.3!commons-logging.jar (82ms)
[ivy:cachepath] downloading https://repo1.maven.org/maven2/commons-codec/commons-codec/1.6/commons-codec-1.6.jar ...
[ivy:cachepath] .......................... (227kB)
[ivy:cachepath] .. (0kB)
[ivy:cachepath] [SUCCESSFUL ] commons-codec#commons-codec;1.6!commons-codec.jar (80ms)
[ivy:cachepath] downloading https://repo1.maven.org/maven2/org/apache/ant/ant-launcher/1.9.6/ant-launcher-1.9.6.jar ...
[ivy:cachepath] ........ (17kB)
[ivy:cachepath] .. (0kB)
[ivy:cachepath] [SUCCESSFUL ] org.apache.ant#ant-launcher;1.9.6!ant-launcher.jar (67ms)
[ivy:cachepath] :: resolution report :: resolve 2941ms :: artifacts dl 1170ms
[ivy:cachepath] :: evicted modules:
[ivy:cachepath] org.eclipse.jgit#org.eclipse.jgit.ant;3.0.0.201306101825-r by [org.eclipse.jgit#org.eclipse.jgit.ant;4.7.0.201704051617-r] in [compile]
[ivy:cachepath] org.eclipse.jgit#org.eclipse.jgit;3.0.0.201306101825-r by [org.eclipse.jgit#org.eclipse.jgit;4.7.0.201704051617-r] in [compile]
[ivy:cachepath] com.jcraft#jsch;0.1.50 by [com.jcraft#jsch;0.1.54] in [compile]
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| compile | 15 | 12 | 12 | 3 || 11 | 11 |
---------------------------------------------------------------------
[taskdef] Could not load definitions from resource com/rimerosolutions/ant/git/jgit-ant-lib.xml. It could not be found.
BUILD FAILED
/home/tzfrs/dev/Test/TestAnt/build.xml:15: Problem: failed to create task or type antlib:com.rimerosolutions.ant.git:git
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
No types or tasks have been defined in this namespace yet
This appears to be an antlib declaration.
Action: Check that the implementing library exists in one of:
-/usr/share/ant/lib
-/home/tzfrs/.ant/lib
-a directory added on the command line with the -lib argument
Total time: 4 seconds
Improve detection of failed pushed commits without grepping the messages sent by the server.
Is this possible, or are there any drawbacks which should be considered while updating JGit? Is supporting Java versions < 7 an issue for ant-git tasks?
From email:
I have a real quick question regarding how to checkout branch tags from an exisiting repository using your custom ant task.
<git:git directory="${library.directory}" verbose="true" settingsRef="git.refID">
<git:clone uri="<url>.git"/>
<git:checkout branchName="origin/master" createBranch="true"/>
</git:git>
Answer/Possible workaround:
I think that I should expose the setStartPoint method from JGit:
http://download.eclipse.org/jgit/docs/jgit-2.3.1.201302201838-r/apidocs/org/eclipse/jgit/api/CheckoutCommand.html#setStartPoint(java.lang.String)
Alternatively, you should be might able to get away with it by doing the following:
<git:git ...>
<git checkout yourtag/>
<git checkout your branch create=true/>
</git:git>
I've found the merge task to fail without any reason being logged. There must be more information in MergeResult that we're not looking at.
Trying to get pull / push / clone working. Local repo work seems to be running fine.
However, remote raises vague error about that it failed. Unclear whether it is due to authorization issues (tried ssh, https, key, user/pwd combination) or something else:
For instance:
<git:clone uri="https://github.com/rimerosolutions/playground-repo.git"/>
BUILD FAILED
E:\ws\itgen\build-itgen.xml:5246: Could not clone URL 'https://github.com/rimerosolutions/playground-repo.git'.
Suggested change:
Improve clarity of error message with a cause and maybe even a recommended action.
Would it be possible to package this library as an Eclipse plugin using the Task extension point and dependencies to the other plugins (JGit is already part of eclipse). Anything else could go to the Extra Classpath-Entry extension point.
Maybe you could even publish a feature and a site to marketplace?
This would really ease the use from within Eclipse itself.
Timeouts while fetching dependencies cause the build to fail on travis-ci.
Locally it is still pretty fast with a blank ivy cache.
Using travis_wait is probably not the best solution as well as outputting some garbage so that travis-ci doesn't kill the build.
Maybe there are some better alternatives... http://www.quora.com/What-are-the-alternatives-to-Travis-CI
It would be great if we could addgit show
like in this example code
. git-show
is broken in the main git distro when exporting files via stdout.
Tagger was not set from git:settings (same as with committer previously) and I added detection of "Push rejected." in the push messages to fail the push (it's what we see in Stash when a server-side hook fails and for some reason the returned result does not trigger a fail by itself).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.