• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ChangeLogSet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中hudson.scm.ChangeLogSet的典型用法代码示例。如果您正苦于以下问题:Java ChangeLogSet类的具体用法?Java ChangeLogSet怎么用?Java ChangeLogSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ChangeLogSet类属于hudson.scm包,在下文中一共展示了ChangeLogSet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getJiraIssuesFromChangeSet

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
/**
 * Parse a Jira ticket number, ie SSD-101, out of the given ChangeLogSet.Entry.
 *
 * Ticket number is assumed to be the first word of the commit message
 *
 * @param change - the change entry to
 * @return
 */
@Override
public List<JiraCommit> getJiraIssuesFromChangeSet(final ChangeLogSet.Entry change)
{
    String msg = change.getMsg();
    String firstWordOfTicket;
    firstWordOfTicket = msg.substring(0, (msg.contains(" ") ? StringUtils.indexOf(msg, " ") : msg.length()));

    for (String validJiraPrefix : Config.getGlobalConfig().getJiraTickets())
    {
        if (firstWordOfTicket.endsWith(":"))
        {
            firstWordOfTicket = firstWordOfTicket.substring(0, firstWordOfTicket.length() - 1);
        }
        if (firstWordOfTicket.startsWith(validJiraPrefix))
        {
            return Arrays.asList(new JiraCommit(firstWordOfTicket, change));
        }
    }

    return null;
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:30,代码来源:FirstWordOfCommitStrategy.java


示例2: testSimpleCase

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
@Test
public void testSimpleCase()
        throws Exception
{
    List<ChangeLogSet.Entry> validChanges = Arrays.asList(
            MockChangeLogUtil.mockChangeLogSetEntry("Hello World [FOO-101]"),
            MockChangeLogUtil.mockChangeLogSetEntry("FOO-101 ticket at start"),
            MockChangeLogUtil.mockChangeLogSetEntry("In the middle FOO-101 of the message"),
            MockChangeLogUtil.mockChangeLogSetEntry("Weird characters FOO-101: next to it"));
    for (ChangeLogSet.Entry change : validChanges)
    {
        assertThat(strategy.getJiraIssuesFromChangeSet(change).size(), equalTo(1));
        assertThat(strategy.getJiraIssuesFromChangeSet(change).get(0).getJiraTicket(), equalTo("FOO-101"));
    }

}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:17,代码来源:MentionedInCommitStrategyTest.java


示例3: testFirstWordOfCommit

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
@Test
public void testFirstWordOfCommit()
        throws Exception
{
    FirstWordOfCommitStrategy strategy = new FirstWordOfCommitStrategy();

    ChangeLogSet mockChangeSet = MockChangeLogUtil.mockChangeLogSet(
            new MockChangeLogUtil.MockChangeLog("FOO-101 first", "dalvizu"),
            new MockChangeLogUtil.MockChangeLog("BAR-102 again", "jsmith"),
            new MockChangeLogUtil.MockChangeLog("No Valid Ticket", "build robot"));
    AbstractBuild mockBuild = mock(AbstractBuild.class);
    when(mockBuild.getChangeSet()).thenReturn(mockChangeSet);
    List<JiraCommit> commits = strategy.getJiraCommits(mockBuild,
            new StreamBuildListener(System.out, Charset.defaultCharset()));
    assertEquals(commits.size(), 2);

    assertThat(commits, hasItem(Matchers.<JiraCommit>hasProperty("jiraTicket", equalTo("FOO-101"))));
    assertThat(commits, hasItem(Matchers.<JiraCommit>hasProperty("jiraTicket", equalTo("BAR-102"))));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:20,代码来源:FirstWordOfCommitStrategyTest.java


示例4: setContent

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
private void setContent() {
  if (build.getChangeSet().getItems().length == 0) {
    message.setContent(this.getResultString());
  } else {
    StringBuilder changes = new StringBuilder();

    for (Iterator<? extends ChangeLogSet.Entry> i = build.getChangeSet().iterator(); i.hasNext(); ) {
      ChangeLogSet.Entry change = i.next();
      changes.append("\n");
      changes.append(change.getMsg());
      changes.append(" - ");
      changes.append(change.getAuthor());
    }

    message.setContent(String.format("%s%n%s", this.getResultString(), changes.toString()));
  }
}
 
开发者ID:devnull-tools,项目名称:build-notifications-plugin,代码行数:18,代码来源:BuildNotifier.java


示例5: extractChangeLog

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
public static String extractChangeLog(EnvVars vars, final ChangeLogSet<?> changeSet, PrintStream logger) {

		String fileName = vars.expand("$JENKINS_HOME") + File.separator +
				    "jobs" + File.separator +
				    vars.expand("$JOB_NAME") + File.separator +
				    "builds" + File.separator +
				    vars.expand("$BUILD_ID") + File.separator +
				    "testfairy_change_log";

		String changeLog = getChangeLogFromFile(fileName);

		if (changeLog != null && !changeLog.isEmpty()) {
			logger.println("Loading custom changeLog from " + fileName);
			return changeLog;
		} else {
			logger.println("Loading changeLog from source control");
			return getChangeLogFromSourceControl(changeSet);
		}
	}
 
开发者ID:testfairy,项目名称:testfairy-jenkins-plugin,代码行数:20,代码来源:Utils.java


示例6: committers

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
@Override
public Set<String> committers() {
    return getUsers(new Reader() {
        @Override
        public Iterable<String> readUsersFrom(AbstractBuild<?, ?> jenkinsBuild) {
            return transform(nonNullIterable(jenkinsBuild.getChangeSet()), new Function<ChangeLogSet.Entry, String>() {
                @Override
                public String apply(ChangeLogSet.Entry entry) {
                    return entry.getAuthor().getFullName();
                }
            });
        }

        private <T> T nonNullIterable(T list) {
            return (T) getOrElse(list, newArrayList());
        }
    });
}
 
开发者ID:jan-molak,项目名称:jenkins-build-monitor-plugin,代码行数:19,代码来源:BuildView.java


示例7: getChanges

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
public static List<Change> getChanges(AbstractBuild<?, ?> build) {
    RepositoryBrowser repositoryBrowser = build.getProject().getScm().getBrowser();
    List<Change> result = new ArrayList<>();
    for (ChangeLogSet.Entry entry : build.getChangeSet()) {
        UserInfo user = UserInfo.getUser(entry.getAuthor());
        String changeLink = null;
        if (repositoryBrowser != null) {
            try {
                @SuppressWarnings("unchecked")
                URL link = repositoryBrowser.getChangeSetLink(entry);
                if (link != null) {
                    changeLink = link.toExternalForm();
                }
            } catch (IOException e) {
                LOG.log(Level.WARNING, "Could not get changeset link for: "
                        + build.getProject().getFullDisplayName() + " " + build.getDisplayName(), e);
            }
        }
        result.add(new Change(user, entry.getMsgAnnotated(), entry.getCommitId(), changeLink));
    }
    return result;
}
 
开发者ID:Diabol,项目名称:delivery-pipeline-plugin,代码行数:23,代码来源:Change.java


示例8: returnsAffectedFiles

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
@Test
public void returnsAffectedFiles() {
    entry.addPundle(addedPundle);
    entry.addPundle(editedPundle);

    final Collection<? extends ChangeLogSet.AffectedFile> affectedFiles = entry.getAffectedFiles();
    ChangeLogSet.AffectedFile[] files = new ChangeLogSet.AffectedFile[affectedFiles.size()];
    affectedFiles.toArray(files);

    assertEquals(2, files.length);
    ChangeLogSet.AffectedFile file1 = files[0];
    assertEquals(addedPundle.getDescriptor(), file1.getPath());
    assertEquals(EditType.ADD, file1.getEditType());

    ChangeLogSet.AffectedFile file2 = files[1];
    assertEquals(editedPundle.getDescriptor(), file2.getPath());
    assertEquals(EditType.EDIT, file2.getEditType());
}
 
开发者ID:randycoulman,项目名称:visualworks-store-plugin,代码行数:19,代码来源:StoreChangeLogEntryTest.java


示例9: getChanges

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
public Iterable<VcsModification> getChanges() {

    	List<VcsModification> supportedChanges = new LinkedList<VcsModification>();
        ChangeLogSet<ChangeLogSet.Entry> changeSet = build.getChangeSet();

        for(ChangeLogSet.Entry entry : changeSet) {
            if(VcsModificationWrapperFactory.getInstance().isSupported(entry)) {
            	logger.println("VersionOne: Using " + entry.getClass() + " which is supported");            	
                VcsModification wrapper = VcsModificationWrapperFactory.getInstance().createWrapper(entry);
                supportedChanges.add(wrapper);
            }
            else
            	logger.println("VersionOne: Tried to use " + entry.getClass() + " which is NOT supported");
        }

        return supportedChanges;
    }
 
开发者ID:versionone,项目名称:VersionOne.Integration.Jenkins,代码行数:18,代码来源:JenkinsBuildInfo.java


示例10: createWrapper

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
public VcsModification createWrapper(ChangeLogSet.Entry modification) {
    Class modificationType = modification.getClass();

    if(mappings.containsKey(modificationType)) {
        Class wrapperType = mappings.get(modificationType);

        try {
            Constructor constructor = wrapperType.getConstructor(modificationType);
            return (VcsModification) constructor.newInstance(modification);
        } catch(Exception ex) {
            throw new UnsupportedOperationException("Provided changeset type is not supported: " + modificationType);
        }
    }

    throw new UnsupportedOperationException("Provided changeset type is not supported: " + modificationType);
}
 
开发者ID:versionone,项目名称:VersionOne.Integration.Jenkins,代码行数:17,代码来源:VcsModificationWrapperFactory.java


示例11: generatedMessage

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
private String generatedMessage(AbstractBuild<?, ?> build) {
    
    final StringBuilder userBuilder = new StringBuilder();
    for(User user: build.getCulprits()) {
        userBuilder.append(user.getFullName() + " ");
    }
    
    final StringBuilder changeSetBuilder = new StringBuilder();
    for(ChangeLogSet.Entry entry: build.getChangeSet()) {
        changeSetBuilder.append(entry.getAuthor() + " : " + entry.getMsg() + "\n");
    }
    
    String replacedMessage = message.replace("${user}", userBuilder.toString());
    replacedMessage = replacedMessage.replace("${result}", build.getResult().toString());
    replacedMessage = replacedMessage.replace("${project}", build.getProject().getName());
    replacedMessage = replacedMessage.replace("${number}", String.valueOf(build.number));
    replacedMessage = replacedMessage.replace("${url}", JenkinsLocationConfiguration.get().getUrl() + build.getUrl());
    replacedMessage = replacedMessage.replace("${changeSet}", changeSetBuilder.toString());

    return replacedMessage;
}
 
开发者ID:Nkzn,项目名称:chatwork-plugin,代码行数:22,代码来源:ChatWorkNotifier.java


示例12: setCulprits

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
private void setCulprits(Run run) {

        List<String> culprits = new ArrayList<>(0);

        // Get culprits from the causes of the build
        run.getCauses().forEach((cause -> {
            switch (cause.getClass().getSimpleName()) {
                case "UserIdCause":
                    if (!culprits.contains(((UserIdCause) cause).getUserName())) {
                        culprits.add(((UserIdCause) cause).getUserName());
                    }
                    break;
            }
        }));

        // Use introspective class to avoid plugins compatibility problems
        try {
            Method method = run.getClass().getMethod("getChangeSets");
            method.setAccessible(true);
            ((List<ChangeLogSet>) method.invoke(run, new Object[]{})).forEach(cset -> {
                for (Object object : ((ChangeLogSet) cset).getItems()) {
                    ChangeLogSet.Entry change = (ChangeLogSet.Entry) object;
                    if (!culprits.contains(change.getAuthor().getFullName())) {
                        culprits.add(change.getAuthor().getFullName());
                    }
                }
            });
        } catch (SecurityException | IllegalAccessException |
                IllegalArgumentException | InvocationTargetException | NoSuchMethodException ex) {
            Logger.getLogger(MirrorGateRunListener.class.getName()).log(Level.SEVERE, null, ex);
        }

        request.setCulprits(culprits);
    }
 
开发者ID:BBVA,项目名称:mirrorgate-jenkins-builds-collector,代码行数:35,代码来源:BuildBuilder.java


示例13: getChangeSetLink

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
/**
 * Function to return a link to the changeset
 */
@Override
public URL getChangeSetLink(ChangeLogSet.Entry changeSet) throws IOException
{
    //Determines the link to the give changeset
    return null;
}
 
开发者ID:pason-systems,项目名称:jenkins-artifactory-polling-plugin,代码行数:10,代码来源:ArtifactoryBrowser.java


示例14: getChangeLog

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
public void getChangeLog(Run<?, ?> run) {
	this.affectedPaths = new StringBuilder();

	this.messages = new StringBuilder();

	this.culprits = new StringBuilder();

	AbstractBuild<?,?> abstractBuild = (AbstractBuild<?,?>) run;
	ChangeLogSet<? extends ChangeLogSet.Entry> changeset = abstractBuild.getChangeSet();
	Iterator<? extends ChangeLogSet.Entry> itrChangeSet = changeset.iterator();
	while (itrChangeSet.hasNext()) {
		ChangeLogSet.Entry str = itrChangeSet.next();
		Collection<? extends ChangeLogSet.AffectedFile> affectedFiles = str.getAffectedFiles();
		Iterator<? extends ChangeLogSet.AffectedFile> affectedFilesItr = affectedFiles.iterator();
		while (affectedFilesItr.hasNext()) {
			this.affectedPaths.append(affectedFilesItr.next().getPath());
			this.affectedPaths.append(", ");
		}
		this.messages.append(str.getMsg());
		this.messages.append(", ");
		
		this.culprits.append(str.getAuthor().getFullName());
		this.culprits.append(", ");
		
		this.commitCount += 1;
	}
       
}
 
开发者ID:jenkinsci,项目名称:influxdb-plugin,代码行数:29,代码来源:ChangeLogPointGenerator.java


示例15: perform

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
@Override
public void perform(List<JiraCommit> jiraCommitList,
                    AbstractBuild build, Launcher launcher, BuildListener listener)
{

    for (JiraCommit jiraCommit : filterJiraCommitList(jiraCommitList))
    {
        try
        {
            listener.getLogger().println("Updating ticket: " + jiraCommit.getJiraTicket());
            String comment;
            if (jiraCommit.getChangeSet().isPresent())
            {
                ChangeLogSet.Entry entry = jiraCommit.getChangeSet().get();
                listener.getLogger().println("\tchange.msg()\t" + entry.getMsgAnnotated());
                listener.getLogger().println("\tchange.getCommitId()\t" + entry.getCommitId());
                listener.getLogger().println("\tchange.getAuthor()\t" + entry.getAuthor());
            }
            getJiraClientSvc().addCommentToTicket(jiraCommit.getJiraTicket(),
                    buildComment(jiraCommit.getChangeSet(), build.getEnvironment(listener)));
        }
        catch (Throwable t)
        {
            listener.getLogger().println("ERROR Updating jira notifications");
            t.printStackTrace(listener.getLogger());
        }
    }
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:29,代码来源:AddComment.java


示例16: buildComment

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
private String buildComment(Optional<ChangeLogSet.Entry> change,
                            EnvVars environment)
{
    String finalComment = commentText;
    finalComment = environment.expand(finalComment);

    if (!change.isPresent())
    {
        return finalComment;
    }

    String message = "";
    ChangeLogSet.Entry entry = change.get();
    if (entry instanceof GitChangeSet)
    {
        message = ((GitChangeSet) entry).getComment();
    }
    else
    {
        message = entry.getMsg();
    }

    finalComment = StringUtils.replace(finalComment, "$AUTHOR", (entry.getAuthor() == null ? "null" : entry.getAuthor().getDisplayName()));
    finalComment = StringUtils.replace(finalComment, "$COMMIT_ID", entry.getCommitId());
    finalComment = StringUtils.replace(finalComment, "$COMMIT_DATE",
            DATE_FORMAT.format(new Date(entry.getTimestamp())));
    finalComment = StringUtils.replace(finalComment, "$COMMIT_MESSAGE", message);
    return finalComment;
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:30,代码来源:AddComment.java


示例17: JiraCommit

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
public JiraCommit(String jiraTicket, ChangeLogSet.Entry changeSet)
{
    this.jiraTicket = jiraTicket;
    if (changeSet == null)
    {
        this.changeSet = Optional.absent();
    }
    else
    {
        this.changeSet = Optional.of(changeSet);
    }
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:13,代码来源:JiraCommit.java


示例18: testNotFound

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
@Test
public void testNotFound()
        throws Exception
{
    ChangeLogSet.Entry entry = MockChangeLogUtil.mockChangeLogSetEntry("SSD-101 test");
    assertThat(strategy.getJiraIssuesFromChangeSet(entry).size(), equalTo(0));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:8,代码来源:MentionedInCommitStrategyTest.java


示例19: testMultipleTicketNames

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
@Test
public void testMultipleTicketNames()
{
    ChangeLogSet.Entry entry = MockChangeLogUtil.mockChangeLogSetEntry("FOO-101 and\n BAR-101 are both in the message");
    assertThat(strategy.getJiraIssuesFromChangeSet(entry).size(), equalTo(2));
    assertThat(strategy.getJiraIssuesFromChangeSet(entry),
            hasItem(Matchers.<JiraCommit>hasProperty("jiraTicket", equalTo("FOO-101"))));
    assertThat(strategy.getJiraIssuesFromChangeSet(entry),
            hasItem(Matchers.<JiraCommit>hasProperty("jiraTicket", equalTo("BAR-101"))));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:11,代码来源:MentionedInCommitStrategyTest.java


示例20: testTicketRepeatsItself

import hudson.scm.ChangeLogSet; //导入依赖的package包/类
@Test
public void testTicketRepeatsItself()
{
    ChangeLogSet.Entry entry = MockChangeLogUtil.mockChangeLogSetEntry("FOO-101 is in the message twice FOO-101");
    assertThat(strategy.getJiraIssuesFromChangeSet(entry).size(), equalTo(1));
    assertThat(strategy.getJiraIssuesFromChangeSet(entry),
            hasItem(Matchers.<JiraCommit>hasProperty("jiraTicket", equalTo("FOO-101"))));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:9,代码来源:MentionedInCommitStrategyTest.java



注:本文中的hudson.scm.ChangeLogSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EvaluatorUtil类代码示例发布时间:2022-05-21
下一篇:
Java Sound类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap