Best way to pull source from Stash using Ant


We are listing our options to migrate from SVN to Stash. One of the biggest challenges is to cover all the ways that we are using the SVN repository and make sure that they are still possible after the migration.

One of these potentially problematic usages is a set of Ant scripts which dont run on our CI server (Bamboo) and thus need to obtain the sources 'manually'.

We where wondering what the best practice would be here, is there some API available to facilitate this or would we be needing to execute the git commands by means of the Ant 'exec' task.

All thoughts are very welcome.

1 answer

1 accepted

0 votes
Accepted answer
Seb Ruiz Atlassian Team Mar 07, 2013

I guess it depends on what your ant tasks do. If you want to retrieve "information" about your Git repositories, then you can use the Stash REST apis to retrieve changeset history etc. You will only be able to use the Stash Java APIs in the process of a Stash instance (as a plugin in the app), but I don't think this would be useful to you if you are in an Ant task.

Alternatively, you can of course use Ant's exec task to run arbitrary git commands, but you will need to first clone the repository which may not be necessary, depending on your requirements.

If you could provide more information on what your Ant tasks do or what they are used for, we might be able to provide a more relevant set of suggestions!

Sure, I ran trough the scripts and we would basically need a replacement for the following SVN operations available used as Ant task today:

  • checkout
  • revert
  • export
  • switch
  • info
  • update

It looks like my best bet would be invoking the git command directly, I assume that the Bamboo Git integration does someting similar?

Seb Ruiz Atlassian Team Mar 08, 2013

Bamboo's git integration only clones repositories so that it can run tests against the source. If you need to perform repository modifications, then you'd need to execute your own git commands.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

1,906 views 7 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you