Mercurial > hg > mercurial
changeset 806:8aeb65cb8ca6
final + invert if
author | eugene.petrenko@jetbrains.com |
---|---|
date | Fri, 30 May 2014 10:35:28 +0200 |
parents | 526d69ae50ec |
children | 4af42f0e4f59 |
files | mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java |
diffstat | 1 files changed, 26 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java Fri May 30 10:33:30 2014 +0200 +++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java Fri May 30 10:35:28 2014 +0200 @@ -627,31 +627,39 @@ return this; } - public void buildPatch(@NotNull VcsRoot root, @Nullable String fromVersion, @NotNull String toVersion, @NotNull PatchBuilder builder, @NotNull CheckoutRules checkoutRules) throws IOException, VcsException { - HgVcsRoot hgRoot = getHgRoot(root); + public void buildPatch(@NotNull final VcsRoot root, + @Nullable final String fromVersion, + @NotNull final String toVersion, + @NotNull final PatchBuilder builder, + @NotNull final CheckoutRules checkoutRules) throws IOException, VcsException { + final HgVcsRoot hgRoot = getHgRoot(root); buildPatch(hgRoot, fromVersion, toVersion, builder, checkoutRules); } - public void buildPatch(@NotNull HgVcsRoot hgRoot, - @Nullable String fromVersion, - @NotNull String toVersion, - @NotNull PatchBuilder builder, - @NotNull CheckoutRules checkoutRules) throws IOException, VcsException { + public void buildPatch(@NotNull final HgVcsRoot hgRoot, + @Nullable final String fromVersion, + @NotNull final String toVersion, + @NotNull final PatchBuilder builder, + @NotNull final CheckoutRules checkoutRules) throws IOException, VcsException { syncRepository(hgRoot); - ChangeSet to = new ChangeSet(toVersion); + + final ChangeSet to = new ChangeSet(toVersion); + if (fromVersion == null) { buildFullPatch(hgRoot, to, builder, checkoutRules); - } else { - ChangeSet from = new ChangeSet(fromVersion); - HgRepo repo = createRepo(hgRoot); - if (!repo.containsRevision(from)) { - Loggers.VCS.info("Cannot find revision " + fromVersion + " in repository " + hgRoot.getRepository() + ", will build a full patch"); - cleanCheckoutDir(builder, checkoutRules); - buildFullPatch(hgRoot, to, builder, checkoutRules); - } else { - buildIncrementalPatch(hgRoot, from, to, builder, checkoutRules); - } + return; } + + final ChangeSet from = new ChangeSet(fromVersion); + final HgRepo repo = createRepo(hgRoot); + if (repo.containsRevision(from)) { + buildIncrementalPatch(hgRoot, from, to, builder, checkoutRules); + return; + } + + Loggers.VCS.info("Cannot find revision " + fromVersion + " in repository " + hgRoot.getRepository() + ", will build a full patch"); + cleanCheckoutDir(builder, checkoutRules); + buildFullPatch(hgRoot, to, builder, checkoutRules); } private void cleanCheckoutDir(@NotNull PatchBuilder builder, @NotNull CheckoutRules checkoutRules) throws IOException {