org.apache.maven.scm.provider.git.repository.GitScmProviderRepository Java Examples
The following examples show how to use
org.apache.maven.scm.provider.git.repository.GitScmProviderRepository.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractScmMojo.java From buildnumber-maven-plugin with MIT License | 6 votes |
/** * Get info from scm. * * @param repository * @param fileSet * @return * @throws ScmException * @todo this should be rolled into org.apache.maven.scm.provider.ScmProvider and * org.apache.maven.scm.provider.svn.SvnScmProvider */ protected InfoScmResult info( ScmRepository repository, ScmFileSet fileSet ) throws ScmException { CommandParameters commandParameters = new CommandParameters(); // only for Git, we will make a test for shortRevisionLength parameter if ( GitScmProviderRepository.PROTOCOL_GIT.equals( scmManager.getProviderByRepository( repository ).getScmType() ) && this.shortRevisionLength > 0 ) { getLog().info( "ShortRevision tag detected. The value is '" + this.shortRevisionLength + "'." ); if ( shortRevisionLength >= 0 && shortRevisionLength < 4 ) { getLog().warn( "shortRevision parameter less then 4. ShortRevisionLength is relaying on 'git rev-parese --short=LENGTH' command, accordingly to Git rev-parse specification the LENGTH value is miminum 4. " ); } commandParameters.setInt( CommandParameter.SCM_SHORT_REVISION_LENGTH, this.shortRevisionLength ); } if ( !StringUtils.isBlank( scmTag ) && !"HEAD".equals( scmTag ) ) { commandParameters.setScmVersion( CommandParameter.SCM_VERSION, new ScmTag( scmTag ) ); } return scmManager.getProviderByRepository( repository ).info( repository.getProviderRepository(), fileSet, commandParameters ); }
Example #2
Source File: ScmRenderer.java From maven-confluence-plugin with Apache License 2.0 | 5 votes |
/** * Render the anonymous access section depending the repository. * <p> * Note: ClearCase, Starteam et Perforce seems to have no anonymous access. * </p> * * @param anonymousRepository the anonymous repository */ private void renderAnonymousAccessSection(ScmRepository anonymousRepository) { if (isScmSystem(anonymousRepository, "clearcase") || isScmSystem(anonymousRepository, "perforce") || isScmSystem(anonymousRepository, "starteam") || StringUtils.isEmpty(anonymousConnection)) { return; } startSection(getI18nString("anonymousaccess.title")); if (anonymousRepository != null && isScmSystem(anonymousRepository, "cvs")) { CvsScmProviderRepository cvsRepo = (CvsScmProviderRepository) anonymousRepository.getProviderRepository(); anonymousAccessCVS(cvsRepo); } else if (anonymousRepository != null && isScmSystem(anonymousRepository, "git")) { GitScmProviderRepository gitRepo = (GitScmProviderRepository) anonymousRepository.getProviderRepository(); anonymousAccessGit(gitRepo); } else if (anonymousRepository != null && isScmSystem(anonymousRepository, "hg")) { HgScmProviderRepository hgRepo = (HgScmProviderRepository) anonymousRepository.getProviderRepository(); anonymousAccessMercurial(hgRepo); } else if (anonymousRepository != null && isScmSystem(anonymousRepository, "svn")) { SvnScmProviderRepository svnRepo = (SvnScmProviderRepository) anonymousRepository.getProviderRepository(); anonymousAccessSubversion(svnRepo); } else { paragraph(getI18nString("anonymousaccess.general.intro")); verbatimText(anonymousConnection.substring(4)); } endSection(); }
Example #3
Source File: CreateMojo.java From buildnumber-maven-plugin with MIT License | 5 votes |
/** * Get the branch info for this revision from the repository. For svn, it is in svn info. * * @return * @throws MojoExecutionException * @throws MojoExecutionException */ public String getScmBranch() throws MojoExecutionException { try { ScmRepository repository = getScmRepository(); ScmProvider provider = scmManager.getProviderByRepository( repository ); /* git branch can be obtained directly by a command */ if ( GitScmProviderRepository.PROTOCOL_GIT.equals( provider.getScmType() ) ) { ScmFileSet fileSet = new ScmFileSet( scmDirectory ); return GitBranchCommand.getCurrentBranch( getLogger(), (GitScmProviderRepository) repository.getProviderRepository(), fileSet ); } else if ( provider instanceof HgScmProvider ) { /* hg branch can be obtained directly by a command */ HgOutputConsumer consumer = new HgOutputConsumer( getLogger() ); ScmResult result = HgUtils.execute( consumer, logger, scmDirectory, new String[] { "id", "-b" } ); checkResult( result ); if ( StringUtils.isNotEmpty( consumer.getOutput() ) ) { return consumer.getOutput(); } } } catch ( ScmException e ) { getLog().warn( "Cannot get the branch information from the git repository: \n" + e.getLocalizedMessage() ); } return getScmBranchFromUrl(); }
Example #4
Source File: ScmRenderer.java From maven-confluence-plugin with Apache License 2.0 | 4 votes |
/** * Render the developer access section * * @param devRepository the dev repository */ private void renderDeveloperAccessSection(ScmRepository devRepository) { if (StringUtils.isEmpty(devConnection)) { return; } startSection(getI18nString("devaccess.title")); if (devRepository != null && isScmSystem(devRepository, "clearcase")) { developerAccessClearCase(); } else if (devRepository != null && isScmSystem(devRepository, "cvs")) { CvsScmProviderRepository cvsRepo = (CvsScmProviderRepository) devRepository.getProviderRepository(); developerAccessCVS(cvsRepo); } else if (devRepository != null && isScmSystem(devRepository, "git")) { GitScmProviderRepository gitRepo = (GitScmProviderRepository) devRepository.getProviderRepository(); developerAccessGit(gitRepo); } else if (devRepository != null && isScmSystem(devRepository, "hg")) { HgScmProviderRepository hgRepo = (HgScmProviderRepository) devRepository.getProviderRepository(); developerAccessMercurial(hgRepo); } else if (devRepository != null && isScmSystem(devRepository, "perforce")) { PerforceScmProviderRepository perforceRepo = (PerforceScmProviderRepository) devRepository.getProviderRepository(); developerAccessPerforce(perforceRepo); } else if (devRepository != null && isScmSystem(devRepository, "starteam")) { StarteamScmProviderRepository starteamRepo = (StarteamScmProviderRepository) devRepository.getProviderRepository(); developerAccessStarteam(starteamRepo); } else if (devRepository != null && isScmSystem(devRepository, "svn")) { SvnScmProviderRepository svnRepo = (SvnScmProviderRepository) devRepository.getProviderRepository(); developerAccessSubversion(svnRepo); } else { paragraph(getI18nString("devaccess.general.intro")); verbatimText(devConnection.substring(4)); } endSection(); }
Example #5
Source File: ScmRenderer.java From maven-confluence-plugin with Apache License 2.0 | 3 votes |
/** * Create the documentation to provide an anonymous access with a * <code>Git</code> SCM. For example, generate the following command line: * <p> * git clone uri * </p> * * @param gitRepo */ private void anonymousAccessGit(GitScmProviderRepository gitRepo) { sink.paragraph(); linkPatternedText(getI18nString("anonymousaccess.git.intro")); sink.paragraph_(); gitClone(gitRepo.getFetchUrl()); }
Example #6
Source File: ScmRenderer.java From maven-confluence-plugin with Apache License 2.0 | 3 votes |
/** * Create the documentation to provide an developer access with a * <code>Git</code> SCM. For example, generate the following command line: * <p> * git clone repo * </p> * * @param gitRepo */ private void developerAccessGit(GitScmProviderRepository gitRepo) { sink.paragraph(); linkPatternedText(getI18nString("devaccess.git.intro")); sink.paragraph_(); gitClone(gitRepo.getPushUrl()); }