annotate mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/Settings.java @ 93:a0aea01c32b0

improve repository url parsing
author Pavel.Sher
date Tue, 19 Jan 2010 22:23:15 +0300
parents e6971dc6b17c
children 6c1cff1f61cc
rev   line source
27
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
1 /*
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
2 * Copyright 2000-2007 JetBrains s.r.o.
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
3 *
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
4 * Licensed under the Apache License, Version 2.0 (the "License");
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
5 * you may not use this file except in compliance with the License.
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
6 * You may obtain a copy of the License at
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
7 *
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
8 * http://www.apache.org/licenses/LICENSE-2.0
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
9 *
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
10 * Unless required by applicable law or agreed to in writing, software
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
11 * distributed under the License is distributed on an "AS IS" BASIS,
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
13 * See the License for the specific language governing permissions and
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
14 * limitations under the License.
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
15 */
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
16 package jetbrains.buildServer.buildTriggers.vcs.mercurial.command;
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
17
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
18 import jetbrains.buildServer.buildTriggers.vcs.mercurial.Constants;
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
19 import jetbrains.buildServer.buildTriggers.vcs.mercurial.PathUtil;
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
20 import jetbrains.buildServer.util.Hash;
44
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 29
diff changeset
21 import jetbrains.buildServer.util.StringUtil;
45
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
22 import jetbrains.buildServer.vcs.VcsRoot;
27
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
23 import org.jetbrains.annotations.NotNull;
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
24
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
25 import java.io.File;
46
13d5f0f56e70 compatibility with TeamCity 3.x
Pavel.Sher
parents: 45
diff changeset
26 import java.util.HashSet;
45
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
27 import java.util.Set;
27
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
28
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
29 /**
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
30 * Represents Mercurial repository settings
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
31 */
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
32 public class Settings {
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
33 private String myRepository;
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
34 private String myHgCommandPath;
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
35 private File myWorkingDir;
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
36 private File myWorkFolderParentDir;
45
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
37 private String myUsername;
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
38 private String myPassword;
57
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
39 private String myBranchName;
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
40 private static final String DEFAULT_BRANCH_NAME = "default";
27
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
41
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
42 public Settings(@NotNull File workFolderParentDir, @NotNull VcsRoot vcsRoot) {
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
43 myWorkFolderParentDir = workFolderParentDir;
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
44 setRepository(vcsRoot.getProperty(Constants.REPOSITORY_PROP));
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
45 setHgCommandPath(vcsRoot.getProperty(Constants.HG_COMMAND_PATH_PROP));
57
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
46 myBranchName = vcsRoot.getProperty(Constants.BRANCH_NAME_PROP);
45
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
47
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
48 myUsername = vcsRoot.getProperty(Constants.USERNAME);
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
49 myPassword = vcsRoot.getProperty(Constants.PASSWORD);
27
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
50 }
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
51
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
52 public Settings() {
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
53 }
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
54
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
55 public void setRepository(@NotNull final String repository) {
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
56 myRepository = repository;
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
57 }
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
58
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
59 /**
57
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
60 * Returns name of the branch to use (returns 'default' if no branch specified)
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
61 * @return see above
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
62 */
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
63 @NotNull
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
64 public String getBranchName() {
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
65 return StringUtil.isEmpty(myBranchName) ? DEFAULT_BRANCH_NAME : myBranchName;
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
66 }
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
67
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
68 /**
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
69 * Returns true if current branch is default branch
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
70 * @return see above
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
71 */
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
72 public boolean isDefaultBranch() {
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
73 return getBranchName().equals(DEFAULT_BRANCH_NAME);
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
74 }
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
75
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
76 /**
27
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
77 * Returns path to hg command
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
78 * @return path to hg command
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
79 */
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
80 @NotNull
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
81 public String getHgCommandPath() {
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
82 return myHgCommandPath;
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
83 }
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
84
65
3cb4f95a4f6f do not show credentials in the error messages
Pavel.Sher
parents: 64
diff changeset
85 public String getUsername() {
3cb4f95a4f6f do not show credentials in the error messages
Pavel.Sher
parents: 64
diff changeset
86 return myUsername;
3cb4f95a4f6f do not show credentials in the error messages
Pavel.Sher
parents: 64
diff changeset
87 }
3cb4f95a4f6f do not show credentials in the error messages
Pavel.Sher
parents: 64
diff changeset
88
3cb4f95a4f6f do not show credentials in the error messages
Pavel.Sher
parents: 64
diff changeset
89 public String getPassword() {
3cb4f95a4f6f do not show credentials in the error messages
Pavel.Sher
parents: 64
diff changeset
90 return myPassword;
3cb4f95a4f6f do not show credentials in the error messages
Pavel.Sher
parents: 64
diff changeset
91 }
3cb4f95a4f6f do not show credentials in the error messages
Pavel.Sher
parents: 64
diff changeset
92
45
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
93 private final static Set<String> AUTH_PROTOS = new HashSet<String>();
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
94 static {
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
95 AUTH_PROTOS.add("http://");
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
96 AUTH_PROTOS.add("https://");
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
97 AUTH_PROTOS.add("ssh://");
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
98 }
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
99
44
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 29
diff changeset
100 /**
45
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
101 * Returns URL to use for push command
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
102 * @return URL to use for push command
44
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 29
diff changeset
103 */
67
e6971dc6b17c always use url with credentials if username/password are specified
Pavel.Sher
parents: 65
diff changeset
104 public String getRepositoryUrl() {
63
cef5cfe52e3e do not set credentials in the url if url already has them
C:\Documents and Settings\pavel.sher\Application Data\The Bat!
parents: 57
diff changeset
105 if (containsCredentials(myRepository)) return myRepository;
cef5cfe52e3e do not set credentials in the url if url already has them
C:\Documents and Settings\pavel.sher\Application Data\The Bat!
parents: 57
diff changeset
106
45
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
107 for (String proto: AUTH_PROTOS) {
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
108 if (myRepository.startsWith(proto)) {
93
a0aea01c32b0 improve repository url parsing
Pavel.Sher
parents: 67
diff changeset
109 String repoUrl = myRepository.substring(proto.length());
a0aea01c32b0 improve repository url parsing
Pavel.Sher
parents: 67
diff changeset
110 int endIdx = repoUrl.indexOf('@');
a0aea01c32b0 improve repository url parsing
Pavel.Sher
parents: 67
diff changeset
111 int slashIdx = repoUrl.indexOf('/');
a0aea01c32b0 improve repository url parsing
Pavel.Sher
parents: 67
diff changeset
112 if (endIdx != -1 && slashIdx > endIdx) {
a0aea01c32b0 improve repository url parsing
Pavel.Sher
parents: 67
diff changeset
113 repoUrl = repoUrl.substring(endIdx+1);
a0aea01c32b0 improve repository url parsing
Pavel.Sher
parents: 67
diff changeset
114 }
a0aea01c32b0 improve repository url parsing
Pavel.Sher
parents: 67
diff changeset
115
a0aea01c32b0 improve repository url parsing
Pavel.Sher
parents: 67
diff changeset
116 String cre = "";
a0aea01c32b0 improve repository url parsing
Pavel.Sher
parents: 67
diff changeset
117 if (!StringUtil.isEmpty(myUsername)) {
a0aea01c32b0 improve repository url parsing
Pavel.Sher
parents: 67
diff changeset
118 cre += myUsername;
a0aea01c32b0 improve repository url parsing
Pavel.Sher
parents: 67
diff changeset
119 if (!StringUtil.isEmpty(myPassword)) {
a0aea01c32b0 improve repository url parsing
Pavel.Sher
parents: 67
diff changeset
120 cre += ":" + myPassword;
a0aea01c32b0 improve repository url parsing
Pavel.Sher
parents: 67
diff changeset
121 }
a0aea01c32b0 improve repository url parsing
Pavel.Sher
parents: 67
diff changeset
122 cre += "@";
a0aea01c32b0 improve repository url parsing
Pavel.Sher
parents: 67
diff changeset
123 }
a0aea01c32b0 improve repository url parsing
Pavel.Sher
parents: 67
diff changeset
124
a0aea01c32b0 improve repository url parsing
Pavel.Sher
parents: 67
diff changeset
125 return proto + cre + repoUrl;
45
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
126 }
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
127 }
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
128
4059fcc5473e ask for credentials on mercurial settings page
Pavel.Sher
parents: 44
diff changeset
129 return myRepository;
44
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 29
diff changeset
130 }
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 29
diff changeset
131
63
cef5cfe52e3e do not set credentials in the url if url already has them
C:\Documents and Settings\pavel.sher\Application Data\The Bat!
parents: 57
diff changeset
132 private boolean containsCredentials(final String repository) {
cef5cfe52e3e do not set credentials in the url if url already has them
C:\Documents and Settings\pavel.sher\Application Data\The Bat!
parents: 57
diff changeset
133 for (String proto: AUTH_PROTOS) {
64
c9f14e3ef86d minor fix
Pavel.Sher
parents: 63
diff changeset
134 if (repository.startsWith(proto)) {
c9f14e3ef86d minor fix
Pavel.Sher
parents: 63
diff changeset
135 String withoutProto = repository.substring(proto.length());
63
cef5cfe52e3e do not set credentials in the url if url already has them
C:\Documents and Settings\pavel.sher\Application Data\The Bat!
parents: 57
diff changeset
136 int comma = withoutProto.indexOf(':');
cef5cfe52e3e do not set credentials in the url if url already has them
C:\Documents and Settings\pavel.sher\Application Data\The Bat!
parents: 57
diff changeset
137 int at = withoutProto.indexOf('@');
cef5cfe52e3e do not set credentials in the url if url already has them
C:\Documents and Settings\pavel.sher\Application Data\The Bat!
parents: 57
diff changeset
138 if (at != -1 && comma != -1 && at > comma) return true;
cef5cfe52e3e do not set credentials in the url if url already has them
C:\Documents and Settings\pavel.sher\Application Data\The Bat!
parents: 57
diff changeset
139 }
cef5cfe52e3e do not set credentials in the url if url already has them
C:\Documents and Settings\pavel.sher\Application Data\The Bat!
parents: 57
diff changeset
140 }
cef5cfe52e3e do not set credentials in the url if url already has them
C:\Documents and Settings\pavel.sher\Application Data\The Bat!
parents: 57
diff changeset
141 return false;
cef5cfe52e3e do not set credentials in the url if url already has them
C:\Documents and Settings\pavel.sher\Application Data\The Bat!
parents: 57
diff changeset
142 }
cef5cfe52e3e do not set credentials in the url if url already has them
C:\Documents and Settings\pavel.sher\Application Data\The Bat!
parents: 57
diff changeset
143
27
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
144 public void setHgCommandPath(@NotNull final String hgCommandPath) {
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
145 myHgCommandPath = hgCommandPath;
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
146 }
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
147
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
148 public void setWorkingDir(@NotNull final File workingDir) {
46
13d5f0f56e70 compatibility with TeamCity 3.x
Pavel.Sher
parents: 45
diff changeset
149 myWorkingDir = PathUtil.getCanonicalFile(workingDir);
27
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
150 }
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
151
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
152 /**
57
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
153 * Returns directory where repository is supposed to be cloned, i.e. working directory of cloned repository
27
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
154 * @return repository working directory
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
155 */
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
156 @NotNull
57
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
157 public File getLocalRepositoryDir() {
27
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
158 if (myWorkingDir != null) {
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
159 return myWorkingDir;
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
160 }
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
161
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
162 return getDefaultWorkDir(myWorkFolderParentDir, myRepository);
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
163 }
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
164
29
798e750e4f26 first version of agent side checkout
Pavel.Sher
parents: 27
diff changeset
165 /**
798e750e4f26 first version of agent side checkout
Pavel.Sher
parents: 27
diff changeset
166 * Returns true if current working directory contains copy of repository (contains .hg directory)
798e750e4f26 first version of agent side checkout
Pavel.Sher
parents: 27
diff changeset
167 * @return see above
798e750e4f26 first version of agent side checkout
Pavel.Sher
parents: 27
diff changeset
168 */
798e750e4f26 first version of agent side checkout
Pavel.Sher
parents: 27
diff changeset
169 public boolean hasCopyOfRepository() {
798e750e4f26 first version of agent side checkout
Pavel.Sher
parents: 27
diff changeset
170 // need better way to check that repository copy is ok
57
99e757f2527b branches support
Pavel.Sher
parents: 46
diff changeset
171 return getLocalRepositoryDir().isDirectory() && new File(getLocalRepositoryDir(), ".hg").isDirectory();
29
798e750e4f26 first version of agent side checkout
Pavel.Sher
parents: 27
diff changeset
172 }
798e750e4f26 first version of agent side checkout
Pavel.Sher
parents: 27
diff changeset
173
27
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
174 public static String DEFAULT_WORK_DIR_PREFIX = "hg_";
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
175
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
176 private static File getDefaultWorkDir(@NotNull File workFolderParentDir, @NotNull String repPath) {
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
177 String workingDirname = DEFAULT_WORK_DIR_PREFIX + String.valueOf(Hash.calc(normalize(repPath)));
46
13d5f0f56e70 compatibility with TeamCity 3.x
Pavel.Sher
parents: 45
diff changeset
178 return PathUtil.getCanonicalFile(new File(workFolderParentDir, workingDirname));
27
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
179 }
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
180
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
181 private static String normalize(final String path) {
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
182 String normalized = PathUtil.normalizeSeparator(path);
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
183 if (path.endsWith("/")) {
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
184 return normalized.substring(0, normalized.length()-1);
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
185 }
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
186 return normalized;
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
187 }
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents:
diff changeset
188 }