You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm-users@maven.apache.org by Patrick Bergner <pa...@software-friends.de> on 2010/05/05 11:13:17 UTC

Howto determine if a directory is a valid working set of an SCM URL

Hi there. I'm using the SCM Plugin from within a Mojo and am trying to 
figure out how to determine if a given directory (D) is a working set of 
a given SCM URL (U).

The context is that I need to check out U or update it if it exists.
The plan is to
- check out U to D if D does not exist,
- update D if D is a valid working directory of U,
- display an error if D exists and is not a valid working directory of U.

What I tried is to call ScmManager.status(...), ScmManager.list(...) and 
ScmManager.changelog(...) and try to guess something from their results 
but that didn't work. The results from status() and changelog() always 
return something positive (isSuccess() = true, getChangedFiles() = valid 
List, no exceptions to catch), whereas list() throws an exception for me 
in any case.

The ideal solution would be independent of the actual SCM system and a 
specific ScmVersion.

Thanks for your help!

Patrick