Mercurial > hg > mercurial
changeset 804:578eab848c5d
@NotNull
author | eugene.petrenko@jetbrains.com |
---|---|
date | Fri, 30 May 2014 10:29:34 +0200 |
parents | 99f99dcd2fce |
children | 526d69ae50ec |
files | mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CatCommand.java |
diffstat | 1 files changed, 17 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CatCommand.java Fri May 30 10:26:36 2014 +0200 +++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CatCommand.java Fri May 30 10:29:34 2014 +0200 @@ -44,40 +44,48 @@ super(commandSettings, hgPath, workingDir, authSettings); } + @NotNull public CatCommand files(@NotNull String relativePath) { myRelativePaths = singletonList(relativePath); return this; } + @NotNull public CatCommand files(@NotNull List<String> relativePaths) { myRelativePaths = relativePaths; return this; } + @NotNull public CatCommand setRevId(final String revId) { myRevId = revId; return this; } + @NotNull public CatCommand atRevision(@NotNull ChangeSet cset) { myRevId = cset.getId(); return this; } + @NotNull public CatCommand checkForFailure(boolean doCheckForFailure) { myCheckForFailure = doCheckForFailure; return this; } + @NotNull public File call() throws VcsException { return execute(myRelativePaths, myCheckForFailure); } + @NotNull public File execute(List<String> relPaths) throws VcsException { return execute(relPaths, true); } - public File execute(List<String> relPaths, boolean checkFailure) throws VcsException { + @NotNull + public File execute(@NotNull final List<String> relPaths, final boolean checkFailure) throws VcsException { File tempDir = null; try { tempDir = createTmpDir(); @@ -90,6 +98,7 @@ } } + @NotNull private File createTmpDir() throws VcsException { try { return HgFileUtil.createTempDir(); @@ -98,7 +107,7 @@ } } - private void createDirectories(List<String> relPaths, File tempDir) throws VcsException { + private void createDirectories(@NotNull final List<String> relPaths, @NotNull final File tempDir) throws VcsException { for (String path: relPaths) { File parentFile = new File(tempDir, path).getParentFile(); if (!parentFile.isDirectory() && !parentFile.mkdirs()) @@ -106,8 +115,10 @@ } } - private void catFiles(List<String> relPaths, boolean checkFailure, File tempDir) throws VcsException { - Queue<String> paths = new LinkedList<String>(relPaths); + private void catFiles(@NotNull final List<String> relPaths, + final boolean checkFailure, + @NotNull final File tempDir) throws VcsException { + final Queue<String> paths = new LinkedList<String>(relPaths); while (!paths.isEmpty()) { MercurialCommandLine cli = createCommandLine(tempDir); int cmdSize = cli.getCommandLineString().length() + 42; @@ -122,8 +133,9 @@ } } + @NotNull private MercurialCommandLine createCommandLine(@NotNull final File tempDir) { - MercurialCommandLine cli = createCommandLine(); + final MercurialCommandLine cli = createCommandLine(); addHttpAuthParams(cli); cli.addParameter("cat"); cli.addParameter("-o");