annotate mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java @ 169:6105c009955e

By default - use compressed transfer - as before
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Wed, 09 Feb 2011 13:50:58 +0300
parents 5198b02fc5e9
children c3157374a356
rev   line source
25
7047f643747f license added, preamble added to source code
Pavel.Sher
parents: 23
diff changeset
1 /*
160
5198b02fc5e9 Update copyrights
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 157
diff changeset
2 * Copyright 2000-2011 JetBrains s.r.o.
25
7047f643747f license added, preamble added to source code
Pavel.Sher
parents: 23
diff changeset
3 *
7047f643747f license added, preamble added to source code
Pavel.Sher
parents: 23
diff changeset
4 * Licensed under the Apache License, Version 2.0 (the "License");
7047f643747f license added, preamble added to source code
Pavel.Sher
parents: 23
diff changeset
5 * you may not use this file except in compliance with the License.
7047f643747f license added, preamble added to source code
Pavel.Sher
parents: 23
diff changeset
6 * You may obtain a copy of the License at
7047f643747f license added, preamble added to source code
Pavel.Sher
parents: 23
diff changeset
7 *
7047f643747f license added, preamble added to source code
Pavel.Sher
parents: 23
diff changeset
8 * http://www.apache.org/licenses/LICENSE-2.0
7047f643747f license added, preamble added to source code
Pavel.Sher
parents: 23
diff changeset
9 *
7047f643747f license added, preamble added to source code
Pavel.Sher
parents: 23
diff changeset
10 * Unless required by applicable law or agreed to in writing, software
7047f643747f license added, preamble added to source code
Pavel.Sher
parents: 23
diff changeset
11 * distributed under the License is distributed on an "AS IS" BASIS,
7047f643747f license added, preamble added to source code
Pavel.Sher
parents: 23
diff changeset
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7047f643747f license added, preamble added to source code
Pavel.Sher
parents: 23
diff changeset
13 * See the License for the specific language governing permissions and
7047f643747f license added, preamble added to source code
Pavel.Sher
parents: 23
diff changeset
14 * limitations under the License.
7047f643747f license added, preamble added to source code
Pavel.Sher
parents: 23
diff changeset
15 */
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
16 package jetbrains.buildServer.buildTriggers.vcs.mercurial;
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
17
103
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
18 import jetbrains.buildServer.BuildAgent;
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
19 import jetbrains.buildServer.Used;
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
20 import jetbrains.buildServer.buildTriggers.vcs.AbstractVcsPropertiesProcessor;
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
21 import jetbrains.buildServer.buildTriggers.vcs.mercurial.command.*;
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
22 import jetbrains.buildServer.log.Loggers;
103
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
23 import jetbrains.buildServer.serverSide.*;
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
24 import jetbrains.buildServer.util.EventDispatcher;
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
25 import jetbrains.buildServer.util.FileUtil;
62
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
26 import jetbrains.buildServer.util.StringUtil;
103
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
27 import jetbrains.buildServer.util.filters.Filter;
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
28 import jetbrains.buildServer.util.filters.FilterUtil;
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
29 import jetbrains.buildServer.vcs.*;
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
30 import jetbrains.buildServer.vcs.patches.PatchBuilder;
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
31 import org.jetbrains.annotations.NotNull;
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
32 import org.jetbrains.annotations.Nullable;
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
33
1
56e7f34ca887 added TeamCity libs, fix tests
Pavel.Sher
parents: 0
diff changeset
34 import java.io.File;
56e7f34ca887 added TeamCity libs, fix tests
Pavel.Sher
parents: 0
diff changeset
35 import java.io.FileFilter;
56e7f34ca887 added TeamCity libs, fix tests
Pavel.Sher
parents: 0
diff changeset
36 import java.io.FileInputStream;
56e7f34ca887 added TeamCity libs, fix tests
Pavel.Sher
parents: 0
diff changeset
37 import java.io.IOException;
56e7f34ca887 added TeamCity libs, fix tests
Pavel.Sher
parents: 0
diff changeset
38 import java.util.*;
21
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
39 import java.util.concurrent.ConcurrentHashMap;
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
40 import java.util.concurrent.ConcurrentMap;
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
41 import java.util.concurrent.locks.Lock;
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
42 import java.util.concurrent.locks.ReentrantLock;
1
56e7f34ca887 added TeamCity libs, fix tests
Pavel.Sher
parents: 0
diff changeset
43
19
40b2cf04cd4b some comments added
Pavel.Sher
parents: 18
diff changeset
44 /**
40b2cf04cd4b some comments added
Pavel.Sher
parents: 18
diff changeset
45 * Mercurial VCS plugin for TeamCity works as follows:
40b2cf04cd4b some comments added
Pavel.Sher
parents: 18
diff changeset
46 * <ul>
40b2cf04cd4b some comments added
Pavel.Sher
parents: 18
diff changeset
47 * <li>clones repository to internal storage
40b2cf04cd4b some comments added
Pavel.Sher
parents: 18
diff changeset
48 * <li>before any operation with working copy of repository pulls changes from the original repository
40b2cf04cd4b some comments added
Pavel.Sher
parents: 18
diff changeset
49 * <li>executes corresponding hg command
40b2cf04cd4b some comments added
Pavel.Sher
parents: 18
diff changeset
50 * </ul>
40b2cf04cd4b some comments added
Pavel.Sher
parents: 18
diff changeset
51 *
57
99e757f2527b branches support
Pavel.Sher
parents: 56
diff changeset
52 * <p>Working copy of repository is created in the $TEAMCITY_DATA_PATH/system/caches/hg_&lt;hash code> folder.
19
40b2cf04cd4b some comments added
Pavel.Sher
parents: 18
diff changeset
53 * <p>Personal builds (remote runs) are not yet supported, they require corresponding functionality from the IDE.
40b2cf04cd4b some comments added
Pavel.Sher
parents: 18
diff changeset
54 */
148
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
55 public class MercurialVcsSupport extends ServerVcsSupport implements LabelingSupport, VcsFileContentProvider, BranchSupport {
21
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
56 private ConcurrentMap<String, Lock> myWorkDirLocks= new ConcurrentHashMap<String, Lock>();
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
57 private VcsManager myVcsManager;
27
7944e8985ebd prepare modules structure for agent side checkout
Pavel.Sher
parents: 25
diff changeset
58 private File myDefaultWorkFolderParent;
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
59
21
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
60 public MercurialVcsSupport(@NotNull final VcsManager vcsManager,
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
61 @NotNull ServerPaths paths,
103
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
62 @NotNull final SBuildServer server,
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
63 @NotNull EventDispatcher<BuildServerListener> dispatcher) {
21
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
64 myVcsManager = vcsManager;
62
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
65 myDefaultWorkFolderParent = new File(paths.getCachesDir(), "mercurial");
103
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
66 dispatcher.addListener(new BuildServerAdapter() {
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
67 @Override
121
e8125034f6a9 fix cleanup
Pavel.Sher
parents: 106
diff changeset
68 public void cleanupFinished() {
e8125034f6a9 fix cleanup
Pavel.Sher
parents: 106
diff changeset
69 super.cleanupFinished();
e8125034f6a9 fix cleanup
Pavel.Sher
parents: 106
diff changeset
70 server.getExecutor().submit(new Runnable() {
e8125034f6a9 fix cleanup
Pavel.Sher
parents: 106
diff changeset
71 public void run() {
e8125034f6a9 fix cleanup
Pavel.Sher
parents: 106
diff changeset
72 removeOldWorkFolders();
e8125034f6a9 fix cleanup
Pavel.Sher
parents: 106
diff changeset
73 }
e8125034f6a9 fix cleanup
Pavel.Sher
parents: 106
diff changeset
74 });
e8125034f6a9 fix cleanup
Pavel.Sher
parents: 106
diff changeset
75 }
e8125034f6a9 fix cleanup
Pavel.Sher
parents: 106
diff changeset
76
e8125034f6a9 fix cleanup
Pavel.Sher
parents: 106
diff changeset
77 @Override
103
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
78 public void sourcesVersionReleased(@NotNull final BuildAgent agent) {
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
79 super.sourcesVersionReleased(agent);
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
80 server.getExecutor().submit(new Runnable() {
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
81 public void run() {
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
82 Set<File> clonedRepos = getAllClonedRepos();
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
83 if (clonedRepos == null) return;
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
84 for (File f: clonedRepos) {
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
85 lockWorkDir(f);
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
86 try {
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
87 FileUtil.delete(f);
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
88 } finally {
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
89 unlockWorkDir(f);
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
90 }
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
91 }
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
92 }
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
93 });
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
94 }
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
95 });
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
96 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
97
90
5d9c34cb543a improving merge commits reporting
Pavel.Sher
parents: 86
diff changeset
98 private Collection<ModifiedFile> computeModifiedFilesForMergeCommit(final Settings settings, final ChangeSet cur) throws VcsException {
5d9c34cb543a improving merge commits reporting
Pavel.Sher
parents: 86
diff changeset
99 ChangedFilesCommand cfc = new ChangedFilesCommand(settings);
5d9c34cb543a improving merge commits reporting
Pavel.Sher
parents: 86
diff changeset
100 cfc.setRevId(cur.getId());
5d9c34cb543a improving merge commits reporting
Pavel.Sher
parents: 86
diff changeset
101 return cfc.execute();
5d9c34cb543a improving merge commits reporting
Pavel.Sher
parents: 86
diff changeset
102 }
5d9c34cb543a improving merge commits reporting
Pavel.Sher
parents: 86
diff changeset
103
145
3a8af53dea6b Normilize file separators and map paths when collect changes
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
104 private List<VcsChange> toVcsChanges(final List<ModifiedFile> modifiedFiles, String prevVer, String curVer, CheckoutRules rules) {
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
105 List<VcsChange> files = new ArrayList<VcsChange>();
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
106 for (ModifiedFile mf: modifiedFiles) {
145
3a8af53dea6b Normilize file separators and map paths when collect changes
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
107 String normalizedPath = PathUtil.normalizeSeparator(mf.getPath());
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
108 VcsChangeInfo.Type changeType = getChangeType(mf.getStatus());
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
109 if (changeType == null) {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
110 Loggers.VCS.warn("Unable to convert status: " + mf.getStatus() + " to VCS change type");
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
111 changeType = VcsChangeInfo.Type.NOT_CHANGED;
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
112 }
145
3a8af53dea6b Normilize file separators and map paths when collect changes
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
113 files.add(new VcsChange(changeType, mf.getStatus().getName(), normalizedPath, rules.map(mf.getPath()), prevVer, curVer));
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
114 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
115 return files;
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
116 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
117
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
118 private VcsChangeInfo.Type getChangeType(final ModifiedFile.Status status) {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
119 switch (status) {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
120 case ADDED:return VcsChangeInfo.Type.ADDED;
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
121 case MODIFIED:return VcsChangeInfo.Type.CHANGED;
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
122 case REMOVED:return VcsChangeInfo.Type.REMOVED;
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
123 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
124 return null;
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
125 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
126
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
127 @NotNull
86
948a35b430e1 report parent changesets
Pavel.Sher
parents: 79
diff changeset
128 public byte[] getContent(@NotNull final VcsModification vcsModification,
948a35b430e1 report parent changesets
Pavel.Sher
parents: 79
diff changeset
129 @NotNull final VcsChangeInfo change,
948a35b430e1 report parent changesets
Pavel.Sher
parents: 79
diff changeset
130 @NotNull final VcsChangeInfo.ContentType contentType,
948a35b430e1 report parent changesets
Pavel.Sher
parents: 79
diff changeset
131 @NotNull final VcsRoot vcsRoot) throws VcsException {
44
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
132 syncClonedRepository(vcsRoot);
12
6989ac0f8cac getContent supported
Pavel.Sher
parents: 11
diff changeset
133 String version = contentType == VcsChangeInfo.ContentType.AFTER_CHANGE ? change.getAfterChangeRevisionNumber() : change.getBeforeChangeRevisionNumber();
6989ac0f8cac getContent supported
Pavel.Sher
parents: 11
diff changeset
134 return getContent(change.getRelativeFileName(), vcsRoot, version);
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
135 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
136
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
137 @NotNull
86
948a35b430e1 report parent changesets
Pavel.Sher
parents: 79
diff changeset
138 public byte[] getContent(@NotNull final String filePath, @NotNull final VcsRoot vcsRoot, @NotNull final String version) throws VcsException {
44
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
139 syncClonedRepository(vcsRoot);
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
140 Settings settings = createSettings(vcsRoot);
12
6989ac0f8cac getContent supported
Pavel.Sher
parents: 11
diff changeset
141 CatCommand cc = new CatCommand(settings);
59
30cc10fe9479 accept version in two formats: with rev number and without
Pavel.Sher
parents: 58
diff changeset
142 cc.setRevId(new ChangeSet(version).getId());
12
6989ac0f8cac getContent supported
Pavel.Sher
parents: 11
diff changeset
143 File parentDir = cc.execute(Collections.singletonList(filePath));
30
007c63ae45b0 delete temp dir after getContent call
Pavel.Sher
parents: 29
diff changeset
144 try {
007c63ae45b0 delete temp dir after getContent call
Pavel.Sher
parents: 29
diff changeset
145 File file = new File(parentDir, filePath);
007c63ae45b0 delete temp dir after getContent call
Pavel.Sher
parents: 29
diff changeset
146 if (file.isFile()) {
007c63ae45b0 delete temp dir after getContent call
Pavel.Sher
parents: 29
diff changeset
147 try {
007c63ae45b0 delete temp dir after getContent call
Pavel.Sher
parents: 29
diff changeset
148 return FileUtil.loadFileBytes(file);
007c63ae45b0 delete temp dir after getContent call
Pavel.Sher
parents: 29
diff changeset
149 } catch (IOException e) {
007c63ae45b0 delete temp dir after getContent call
Pavel.Sher
parents: 29
diff changeset
150 throw new VcsException("Failed to load content of file: " + file.getAbsolutePath(), e);
007c63ae45b0 delete temp dir after getContent call
Pavel.Sher
parents: 29
diff changeset
151 }
007c63ae45b0 delete temp dir after getContent call
Pavel.Sher
parents: 29
diff changeset
152 } else {
007c63ae45b0 delete temp dir after getContent call
Pavel.Sher
parents: 29
diff changeset
153 Loggers.VCS.warn("Unable to obtain content of the file: " + filePath);
12
6989ac0f8cac getContent supported
Pavel.Sher
parents: 11
diff changeset
154 }
30
007c63ae45b0 delete temp dir after getContent call
Pavel.Sher
parents: 29
diff changeset
155 } finally {
118
80eb7fdc4de0 Add logging for deleting tmp directories
nd@localhost.localdomain
parents: 106
diff changeset
156 deleteTmpDir(parentDir);
12
6989ac0f8cac getContent supported
Pavel.Sher
parents: 11
diff changeset
157 }
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
158 return new byte[0];
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
159 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
160
86
948a35b430e1 report parent changesets
Pavel.Sher
parents: 79
diff changeset
161 @NotNull
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
162 public String getName() {
28
a7cab5083ada libraries moved on top level, dummy implementation of agent side checkout interface
Pavel.Sher
parents: 27
diff changeset
163 return Constants.VCS_NAME;
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
164 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
165
86
948a35b430e1 report parent changesets
Pavel.Sher
parents: 79
diff changeset
166 @NotNull
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
167 @Used("jsp")
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
168 public String getDisplayName() {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
169 return "Mercurial";
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
170 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
171
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
172 @Nullable
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
173 public PropertiesProcessor getVcsPropertiesProcessor() {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
174 return new AbstractVcsPropertiesProcessor() {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
175 public Collection<InvalidProperty> process(final Map<String, String> properties) {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
176 List<InvalidProperty> result = new ArrayList<InvalidProperty>();
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
177 if (isEmpty(properties.get(Constants.HG_COMMAND_PATH_PROP))) {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
178 result.add(new InvalidProperty(Constants.HG_COMMAND_PATH_PROP, "Path to 'hg' command must be specified"));
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
179 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
180 if (isEmpty(properties.get(Constants.REPOSITORY_PROP))) {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
181 result.add(new InvalidProperty(Constants.REPOSITORY_PROP, "Repository must be specified"));
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
182 }
62
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
183 if (isEmpty(properties.get(Constants.SERVER_CLONE_PATH_PROP))) {
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
184 properties.put(Constants.SERVER_CLONE_PATH_PROP, myDefaultWorkFolderParent.getAbsolutePath());
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
185 }
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
186 return result;
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
187 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
188 };
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
189 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
190
86
948a35b430e1 report parent changesets
Pavel.Sher
parents: 79
diff changeset
191 @NotNull
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
192 public String getVcsSettingsJspFilePath() {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
193 return "mercurialSettings.jsp";
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
194 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
195
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
196 @NotNull
86
948a35b430e1 report parent changesets
Pavel.Sher
parents: 79
diff changeset
197 public String getCurrentVersion(@NotNull final VcsRoot root) throws VcsException {
19
40b2cf04cd4b some comments added
Pavel.Sher
parents: 18
diff changeset
198 // we will return full version of the most recent change as current version
44
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
199 syncClonedRepository(root);
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
200 Settings settings = createSettings(root);
57
99e757f2527b branches support
Pavel.Sher
parents: 56
diff changeset
201 BranchesCommand branches = new BranchesCommand(settings);
99e757f2527b branches support
Pavel.Sher
parents: 56
diff changeset
202 Map<String, ChangeSet> result = branches.execute();
99e757f2527b branches support
Pavel.Sher
parents: 56
diff changeset
203 if (!result.containsKey(settings.getBranchName())) {
99e757f2527b branches support
Pavel.Sher
parents: 56
diff changeset
204 throw new VcsException("Unable to find current version for the branch: " + settings.getBranchName());
99e757f2527b branches support
Pavel.Sher
parents: 56
diff changeset
205 }
99e757f2527b branches support
Pavel.Sher
parents: 56
diff changeset
206
99e757f2527b branches support
Pavel.Sher
parents: 56
diff changeset
207 return result.get(settings.getBranchName()).getFullVersion();
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
208 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
209
106
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
210 public boolean sourcesUpdatePossibleIfChangesNotFound(@NotNull final VcsRoot root) {
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
211 return false;
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
212 }
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
213
86
948a35b430e1 report parent changesets
Pavel.Sher
parents: 79
diff changeset
214 @NotNull
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
215 public String describeVcsRoot(final VcsRoot vcsRoot) {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
216 return "mercurial: " + vcsRoot.getProperty(Constants.REPOSITORY_PROP);
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
217 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
218
106
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
219 @Override
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
220 public TestConnectionSupport getTestConnectionSupport() {
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
221 return new TestConnectionSupport() {
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
222 public String testConnection(@NotNull final VcsRoot vcsRoot) throws VcsException {
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
223 Settings settings = createSettings(vcsRoot);
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
224 IdentifyCommand id = new IdentifyCommand(settings);
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
225 StringBuilder res = new StringBuilder();
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
226 res.append(quoteIfNeeded(settings.getHgCommandPath()));
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
227 res.append(" identify ");
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
228 final String obfuscatedUrl = CommandUtil.removePrivateData(settings.getRepositoryUrl(), Collections.singleton(settings.getPassword()));
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
229 res.append(quoteIfNeeded(obfuscatedUrl));
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
230 res.append('\n').append(id.execute());
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
231 return res.toString();
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
232 }
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
233 };
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
234 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
235
17
21b5b1c5dd74 test connection minor fix
Pavel.Sher
parents: 16
diff changeset
236 private String quoteIfNeeded(@NotNull String str) {
21b5b1c5dd74 test connection minor fix
Pavel.Sher
parents: 16
diff changeset
237 if (str.indexOf(' ') != -1) {
21b5b1c5dd74 test connection minor fix
Pavel.Sher
parents: 16
diff changeset
238 return "\"" + str + "\"";
21b5b1c5dd74 test connection minor fix
Pavel.Sher
parents: 16
diff changeset
239 }
21b5b1c5dd74 test connection minor fix
Pavel.Sher
parents: 16
diff changeset
240
21b5b1c5dd74 test connection minor fix
Pavel.Sher
parents: 16
diff changeset
241 return str;
21b5b1c5dd74 test connection minor fix
Pavel.Sher
parents: 16
diff changeset
242 }
21b5b1c5dd74 test connection minor fix
Pavel.Sher
parents: 16
diff changeset
243
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
244 @Nullable
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
245 public Map<String, String> getDefaultVcsProperties() {
62
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
246 Map<String, String> defaults = new HashMap<String, String>();
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
247 defaults.put(Constants.HG_COMMAND_PATH_PROP, "hg");
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
248 defaults.put(Constants.SERVER_CLONE_PATH_PROP, myDefaultWorkFolderParent.getAbsolutePath());
169
6105c009955e By default - use compressed transfer - as before
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 160
diff changeset
249 defaults.put(Constants.UNCOMPRESSED_TRANSFER, "false");
62
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
250 return defaults;
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
251 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
252
86
948a35b430e1 report parent changesets
Pavel.Sher
parents: 79
diff changeset
253 public String getVersionDisplayName(@NotNull final String version, @NotNull final VcsRoot root) throws VcsException {
59
30cc10fe9479 accept version in two formats: with rev number and without
Pavel.Sher
parents: 58
diff changeset
254 return new ChangeSet(version).getId();
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
255 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
256
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
257 @NotNull
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
258 public Comparator<String> getVersionComparator() {
19
40b2cf04cd4b some comments added
Pavel.Sher
parents: 18
diff changeset
259 // comparator is called when TeamCity needs to sort modifications in the order of their appearance,
40b2cf04cd4b some comments added
Pavel.Sher
parents: 18
diff changeset
260 // currently we sort changes by revision number, not sure however that this is a good idea,
40b2cf04cd4b some comments added
Pavel.Sher
parents: 18
diff changeset
261 // probably it would be better to sort them by timestamp (and to add timestamp into the version).
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
262 return new Comparator<String>() {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
263 public int compare(final String o1, final String o2) {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
264 try {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
265 return new ChangeSet(o1).getRevNumber() - new ChangeSet(o2).getRevNumber();
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
266 } catch (Exception e) {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
267 return 1;
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
268 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
269 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
270 };
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
271 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
272
19
40b2cf04cd4b some comments added
Pavel.Sher
parents: 18
diff changeset
273 // builds patch from version to version
79
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
274 private void buildIncrementalPatch(final Settings settings, @NotNull final ChangeSet fromVer, @NotNull final ChangeSet toVer, final PatchBuilder builder, final CheckoutRules checkoutRules)
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
275 throws VcsException, IOException {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
276 StatusCommand st = new StatusCommand(settings);
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
277 st.setFromRevId(fromVer.getId());
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
278 st.setToRevId(toVer.getId());
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
279 List<ModifiedFile> modifiedFiles = st.execute();
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
280 List<String> notDeletedFiles = new ArrayList<String>();
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
281 for (ModifiedFile f: modifiedFiles) {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
282 if (f.getStatus() != ModifiedFile.Status.REMOVED) {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
283 notDeletedFiles.add(f.getPath());
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
284 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
285 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
286
47
c785bc4c5f39 minor fix: do not call cat command if there are no files to export
Pavel.Sher
parents: 46
diff changeset
287 if (notDeletedFiles.isEmpty()) return;
c785bc4c5f39 minor fix: do not call cat command if there are no files to export
Pavel.Sher
parents: 46
diff changeset
288
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
289 CatCommand cc = new CatCommand(settings);
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
290 cc.setRevId(toVer.getId());
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
291 File parentDir = cc.execute(notDeletedFiles);
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
292
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
293 try {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
294 for (ModifiedFile f: modifiedFiles) {
79
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
295 String mappedPath = checkoutRules.map(f.getPath());
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
296 if (mappedPath == null) continue; // skip
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
297 final File virtualFile = new File(mappedPath);
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
298 if (f.getStatus() == ModifiedFile.Status.REMOVED) {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
299 builder.deleteFile(virtualFile, true);
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
300 } else {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
301 File realFile = new File(parentDir, f.getPath());
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
302 FileInputStream is = new FileInputStream(realFile);
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
303 try {
11
568707240741 fix patch
Pavel.Sher
parents: 9
diff changeset
304 builder.changeOrCreateBinaryFile(virtualFile, null, is, realFile.length());
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
305 } finally {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
306 is.close();
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
307 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
308 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
309 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
310 } finally {
118
80eb7fdc4de0 Add logging for deleting tmp directories
nd@localhost.localdomain
parents: 106
diff changeset
311 deleteTmpDir(parentDir);
80eb7fdc4de0 Add logging for deleting tmp directories
nd@localhost.localdomain
parents: 106
diff changeset
312 }
80eb7fdc4de0 Add logging for deleting tmp directories
nd@localhost.localdomain
parents: 106
diff changeset
313 }
80eb7fdc4de0 Add logging for deleting tmp directories
nd@localhost.localdomain
parents: 106
diff changeset
314
80eb7fdc4de0 Add logging for deleting tmp directories
nd@localhost.localdomain
parents: 106
diff changeset
315 private void deleteTmpDir(File parentDir) {
80eb7fdc4de0 Add logging for deleting tmp directories
nd@localhost.localdomain
parents: 106
diff changeset
316 boolean dirDeleted = FileUtil.delete(parentDir);
80eb7fdc4de0 Add logging for deleting tmp directories
nd@localhost.localdomain
parents: 106
diff changeset
317 if (!dirDeleted) {
80eb7fdc4de0 Add logging for deleting tmp directories
nd@localhost.localdomain
parents: 106
diff changeset
318 Loggers.VCS.warn("Can not delete directory \"" + parentDir.getAbsolutePath() + "\"");
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
319 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
320 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
321
19
40b2cf04cd4b some comments added
Pavel.Sher
parents: 18
diff changeset
322 // builds patch by exporting files using specified version
79
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
323 private void buildFullPatch(final Settings settings, @NotNull final ChangeSet toVer, final PatchBuilder builder, final CheckoutRules checkoutRules)
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
324 throws IOException, VcsException {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
325 CloneCommand cl = new CloneCommand(settings);
57
99e757f2527b branches support
Pavel.Sher
parents: 56
diff changeset
326 // clone from the local repository
67
e6971dc6b17c always use url with credentials if username/password are specified
Pavel.Sher
parents: 62
diff changeset
327 cl.setRepository(settings.getLocalRepositoryDir().getAbsolutePath());
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
328 cl.setToId(toVer.getId());
57
99e757f2527b branches support
Pavel.Sher
parents: 56
diff changeset
329 cl.setUpdateWorkingDir(false);
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
330 File tempDir = FileUtil.createTempDirectory("mercurial", toVer.getId());
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
331 try {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
332 final File repRoot = new File(tempDir, "rep");
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
333 cl.setDestDir(repRoot.getAbsolutePath());
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
334 cl.execute();
57
99e757f2527b branches support
Pavel.Sher
parents: 56
diff changeset
335
99e757f2527b branches support
Pavel.Sher
parents: 56
diff changeset
336 UpdateCommand up = new UpdateCommand(settings);
99e757f2527b branches support
Pavel.Sher
parents: 56
diff changeset
337 up.setWorkDirectory(repRoot.getAbsolutePath());
99e757f2527b branches support
Pavel.Sher
parents: 56
diff changeset
338 up.setToId(toVer.getId());
99e757f2527b branches support
Pavel.Sher
parents: 56
diff changeset
339 up.execute();
99e757f2527b branches support
Pavel.Sher
parents: 56
diff changeset
340
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
341 buildPatchFromDirectory(builder, repRoot, new FileFilter() {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
342 public boolean accept(final File file) {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
343 return !(file.isDirectory() && ".hg".equals(file.getName()));
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
344 }
79
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
345 }, checkoutRules);
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
346 } finally {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
347 FileUtil.delete(tempDir);
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
348 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
349 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
350
79
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
351 private void buildPatchFromDirectory(final PatchBuilder builder, final File repRoot, final FileFilter filter, final CheckoutRules checkoutRules) throws IOException {
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
352 buildPatchFromDirectory(repRoot, builder, repRoot, filter, checkoutRules);
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
353 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
354
79
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
355 private void buildPatchFromDirectory(File curDir, final PatchBuilder builder, final File repRoot, final FileFilter filter, final CheckoutRules checkoutRules) throws IOException {
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
356 File[] files = curDir.listFiles(filter);
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
357 if (files != null) {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
358 for (File realFile: files) {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
359 String relPath = realFile.getAbsolutePath().substring(repRoot.getAbsolutePath().length());
79
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
360 String mappedPath = checkoutRules.map(relPath);
97
3ac056b1932e TW-10928
Pavel.Sher
parents: 95
diff changeset
361 if (mappedPath != null && mappedPath.length() > 0) {
79
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
362 final File virtualFile = new File(mappedPath);
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
363 if (realFile.isDirectory()) {
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
364 builder.createDirectory(virtualFile);
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
365 buildPatchFromDirectory(realFile, builder, repRoot, filter, checkoutRules);
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
366 } else {
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
367 final FileInputStream is = new FileInputStream(realFile);
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
368 try {
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
369 builder.createBinaryFile(virtualFile, null, is, realFile.length());
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
370 } finally {
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
371 is.close();
2e57d4e3f7b7 support checkout rules for server side patch
Pavel.Sher
parents: 71
diff changeset
372 }
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
373 }
97
3ac056b1932e TW-10928
Pavel.Sher
parents: 95
diff changeset
374 } else {
3ac056b1932e TW-10928
Pavel.Sher
parents: 95
diff changeset
375 if (realFile.isDirectory()) {
3ac056b1932e TW-10928
Pavel.Sher
parents: 95
diff changeset
376 buildPatchFromDirectory(realFile, builder, repRoot, filter, checkoutRules);
3ac056b1932e TW-10928
Pavel.Sher
parents: 95
diff changeset
377 }
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
378 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
379 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
380 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
381 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
382
19
40b2cf04cd4b some comments added
Pavel.Sher
parents: 18
diff changeset
383 // updates current working copy of repository by pulling changes from the repository specified in VCS root
44
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
384 private void syncClonedRepository(final VcsRoot root) throws VcsException {
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
385 Settings settings = createSettings(root);
57
99e757f2527b branches support
Pavel.Sher
parents: 56
diff changeset
386 File workDir = settings.getLocalRepositoryDir();
21
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
387 lockWorkDir(workDir);
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
388 try {
29
798e750e4f26 first version of agent side checkout
Pavel.Sher
parents: 28
diff changeset
389 if (settings.hasCopyOfRepository()) {
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
390 // update
8
2cb2df5a0dcd fix working directory update (use pull command)
Pavel.Sher
parents: 1
diff changeset
391 PullCommand pull = new PullCommand(settings);
2cb2df5a0dcd fix working directory update (use pull command)
Pavel.Sher
parents: 1
diff changeset
392 pull.execute();
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
393 } else {
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
394 // clone
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
395 CloneCommand cl = new CloneCommand(settings);
22
0d6f27953b30 synchronization fixes
Pavel.Sher
parents: 21
diff changeset
396 cl.setDestDir(workDir.getAbsolutePath());
18
d787c696225c do not update local working directory
Pavel.Sher
parents: 17
diff changeset
397 cl.setUpdateWorkingDir(false);
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
398 cl.execute();
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
399 }
21
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
400 } finally {
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
401 unlockWorkDir(workDir);
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
402 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
403 }
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
404
44
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
405 @Override
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
406 public LabelingSupport getLabelingSupport() {
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
407 return this;
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
408 }
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
409
106
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
410 @NotNull
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
411 public VcsFileContentProvider getContentProvider() {
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
412 return this;
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
413 }
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
414
156
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
415 @NotNull
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
416 public String getRemoteRunOnBranchPattern() {
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
417 return "remote-run/{teamcity.user}/.+";
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
418 }
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
419
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
420 @NotNull
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
421 public Map<String, String> getBranchesRevisions(@NotNull VcsRoot root) throws VcsException {
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
422 syncClonedRepository(root);
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
423 Settings settings = createSettings(root);
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
424 BranchesCommand branches = new BranchesCommand(settings);
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
425 Map<String, String> result = new HashMap<String, String>();
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
426 for (Map.Entry<String, ChangeSet> entry : branches.execute().entrySet()) {
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
427 result.put(entry.getKey(), entry.getValue().getId());
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
428 }
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
429 return result;
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
430 }
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
431
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
432 @NotNull
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
433 public Map<String, String> getBranchRootOptions(@NotNull VcsRoot root, @NotNull String branchName) {
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
434 final Map<String, String> options = new HashMap<String, String>(root.getProperties());
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
435 options.put(Constants.BRANCH_NAME_PROP, branchName);
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
436 return options;
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
437 }
7e36394a9c00 Implement new methods from BranchSupport
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 155
diff changeset
438
148
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
439 public List<ModificationData> collectChanges(@NotNull VcsRoot fromRoot, @NotNull String fromRootRevision,
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
440 @NotNull VcsRoot toRoot, @Nullable String toRootRevision,
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
441 @NotNull CheckoutRules checkoutRules) throws VcsException {
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
442 //we get all branches while clone, if vcs roots are related it is doesn't matter in which one search for branch point
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
443 syncClonedRepository(fromRoot);
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
444 String branchPoint = getBranchPoint(fromRoot, fromRootRevision, toRootRevision);
155
b71e3e8fc990 We should collect changes in the 'toRoot'
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 151
diff changeset
445 return ((CollectChangesByCheckoutRules) getCollectChangesPolicy()).collectChanges(toRoot, branchPoint, toRootRevision, checkoutRules);
148
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
446 }
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
447
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
448 private String getBranchPoint(@NotNull VcsRoot root, String branchOneRev, String branchTwoRev) throws VcsException {
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
449 Settings settings = createSettings(root);
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
450 LogCommand lc = new LogCommand(settings);
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
451 lc.setFromRevId(new ChangeSetRevision(branchOneRev).getId());
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
452 lc.setToRevId(new ChangeSetRevision(branchTwoRev).getId());
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
453 lc.setLimit(1);
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
454 List<ChangeSet> changeSets = lc.execute();
151
97da90dac992 If branch point is initial cset - do no try to find its parents
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 148
diff changeset
455 ChangeSet cs = changeSets.get(0);
97da90dac992 If branch point is initial cset - do no try to find its parents
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 148
diff changeset
456 if (cs.isInitial()) {
97da90dac992 If branch point is initial cset - do no try to find its parents
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 148
diff changeset
457 return cs.getId();
97da90dac992 If branch point is initial cset - do no try to find its parents
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 148
diff changeset
458 } else {
97da90dac992 If branch point is initial cset - do no try to find its parents
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 148
diff changeset
459 return cs.getParents().get(0).getId();
97da90dac992 If branch point is initial cset - do no try to find its parents
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 148
diff changeset
460 }
148
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
461 }
403d16397f5c Initial implementation of BranchSupport interface
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
462
106
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
463 @NotNull
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
464 public CollectChangesPolicy getCollectChangesPolicy() {
144
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
465 return new CollectChangesByCheckoutRules() {
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
466 public List<ModificationData> collectChanges(@NotNull VcsRoot root, @NotNull String fromVersion, @Nullable String currentVersion, @NotNull CheckoutRules checkoutRules) throws VcsException {
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
467 syncClonedRepository(root);
106
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
468
144
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
469 // first obtain changes between specified versions
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
470 List<ModificationData> result = new ArrayList<ModificationData>();
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
471 if (currentVersion == null) return result;
106
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
472
144
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
473 Settings settings = createSettings(root);
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
474 LogCommand lc = new LogCommand(settings);
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
475 String fromId = new ChangeSetRevision(fromVersion).getId();
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
476 lc.setFromRevId(fromId);
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
477 lc.setToRevId(new ChangeSetRevision(currentVersion).getId());
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
478 List<ChangeSet> changeSets = lc.execute();
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
479 if (changeSets.isEmpty()) {
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
480 return result;
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
481 }
106
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
482
144
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
483 // invoke status command for each changeset and determine what files were modified in these changesets
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
484 StatusCommand st = new StatusCommand(settings);
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
485 ChangeSet prev = new ChangeSet(fromVersion);
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
486 for (ChangeSet cur : changeSets) {
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
487 if (cur.getId().equals(fromId)) continue; // skip already reported changeset
106
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
488
144
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
489 String prevId = prev.getId();
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
490 List<ChangeSetRevision> curParents = cur.getParents();
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
491 boolean merge = curParents != null && curParents.size() > 1;
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
492 if (curParents != null && !merge) {
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
493 prevId = curParents.get(0).getId();
106
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
494 }
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
495
144
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
496 List<ModifiedFile> modifiedFiles = new ArrayList<ModifiedFile>();
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
497 if (merge) {
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
498 modifiedFiles.addAll(computeModifiedFilesForMergeCommit(settings, cur));
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
499 } else {
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
500 st.setFromRevId(prevId);
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
501 st.setToRevId(cur.getId());
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
502 modifiedFiles = st.execute();
106
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
503 }
144
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
504
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
505 // changeset full version will be set into VcsChange structure and
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
506 // stored in database (note that getContent method will be invoked with this version)
145
3a8af53dea6b Normilize file separators and map paths when collect changes
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 144
diff changeset
507 List<VcsChange> files = toVcsChanges(modifiedFiles, prev.getFullVersion(), cur.getFullVersion(), checkoutRules);
144
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
508 if (files.isEmpty() && !merge) continue;
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
509 ModificationData md = new ModificationData(cur.getTimestamp(), files, cur.getDescription(), cur.getUser(), root, cur.getFullVersion(), cur.getId());
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
510 if (merge) {
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
511 md.setCanBeIgnored(false);
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
512 }
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
513 result.add(md);
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
514 prev = cur;
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
515 }
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
516
2e90ef872b68 Collect changes using CheckoutRules.
Dmitry Neverov <dmitry.neverov@jetbrains.com>
parents: 142
diff changeset
517 return result;
106
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
518 }
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
519 };
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
520 }
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
521
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
522 @NotNull
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
523 public BuildPatchPolicy getBuildPatchPolicy() {
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
524 return new BuildPatchByCheckoutRules() {
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
525 public void buildPatch(@NotNull final VcsRoot root,
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
526 @Nullable final String fromVersion,
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
527 @NotNull final String toVersion,
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
528 @NotNull final PatchBuilder builder,
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
529 @NotNull final CheckoutRules checkoutRules) throws IOException, VcsException {
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
530 syncClonedRepository(root);
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
531 Settings settings = createSettings(root);
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
532 if (fromVersion == null) {
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
533 buildFullPatch(settings, new ChangeSet(toVersion), builder, checkoutRules);
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
534 } else {
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
535 buildIncrementalPatch(settings, new ChangeSet(fromVersion), new ChangeSet(toVersion), builder, checkoutRules);
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
536 }
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
537 }
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
538 };
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
539 }
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
540
22
0d6f27953b30 synchronization fixes
Pavel.Sher
parents: 21
diff changeset
541 private void lockWorkDir(@NotNull File workDir) {
21
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
542 getWorkDirLock(workDir).lock();
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
543 }
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
544
22
0d6f27953b30 synchronization fixes
Pavel.Sher
parents: 21
diff changeset
545 private void unlockWorkDir(@NotNull File workDir) {
21
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
546 getWorkDirLock(workDir).unlock();
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
547 }
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
548
31
1c11478f515b disable cache
Pavel.Sher
parents: 30
diff changeset
549 @Override
106
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
550 public boolean allowSourceCaching() {
31
1c11478f515b disable cache
Pavel.Sher
parents: 30
diff changeset
551 // since a copy of repository for each VCS root is already stored on disk
106
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
552 // we do not need separate cache for our patches
8587a9c22d55 switch to new API
Pavel.Sher
parents: 103
diff changeset
553 return false;
31
1c11478f515b disable cache
Pavel.Sher
parents: 30
diff changeset
554 }
1c11478f515b disable cache
Pavel.Sher
parents: 30
diff changeset
555
22
0d6f27953b30 synchronization fixes
Pavel.Sher
parents: 21
diff changeset
556 private Lock getWorkDirLock(final File workDir) {
0d6f27953b30 synchronization fixes
Pavel.Sher
parents: 21
diff changeset
557 String path = workDir.getAbsolutePath();
0d6f27953b30 synchronization fixes
Pavel.Sher
parents: 21
diff changeset
558 Lock lock = myWorkDirLocks.get(path);
21
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
559 if (lock == null) {
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
560 lock = new ReentrantLock();
22
0d6f27953b30 synchronization fixes
Pavel.Sher
parents: 21
diff changeset
561 Lock curLock = myWorkDirLocks.putIfAbsent(path, lock);
21
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
562 if (curLock != null) {
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
563 lock = curLock;
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
564 }
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
565 }
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
566 return lock;
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
567 }
c76d6a2b27f6 proper synchronization for working directories
Pavel.Sher
parents: 20
diff changeset
568
23
3ddf410c2fd6 minor change
Pavel.Sher
parents: 22
diff changeset
569 private void removeOldWorkFolders() {
103
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
570 Set<File> workDirs = getAllClonedRepos();
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
571 if (workDirs == null) return;
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
572
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
573 for (VcsRoot vcsRoot: getMercurialVcsRoots()) {
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
574 try {
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
575 Settings s = createSettings(vcsRoot);
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
576 workDirs.remove(PathUtil.getCanonicalFile(s.getLocalRepositoryDir()));
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
577 } catch (VcsException e) {
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
578 Loggers.VCS.error(e);
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
579 }
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
580 }
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
581
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
582 for (File f: workDirs) {
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
583 lockWorkDir(f);
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
584 try {
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
585 FileUtil.delete(f);
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
586 } finally {
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
587 unlockWorkDir(f);
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
588 }
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
589 }
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
590 }
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
591
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
592 private Collection<VcsRoot> getMercurialVcsRoots() {
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
593 List<VcsRoot> res = new ArrayList<VcsRoot>(myVcsManager.getAllRegisteredVcsRoots());
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
594 FilterUtil.filterCollection(res, new Filter<VcsRoot>() {
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
595 public boolean accept(@NotNull final VcsRoot data) {
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
596 return getName().equals(data.getVcsName());
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
597 }
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
598 });
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
599 return res;
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
600 }
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
601
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
602 @Nullable
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
603 private Set<File> getAllClonedRepos() {
62
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
604 File workFoldersParent = myDefaultWorkFolderParent;
103
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
605 if (!workFoldersParent.isDirectory()) return null;
23
3ddf410c2fd6 minor change
Pavel.Sher
parents: 22
diff changeset
606
3ddf410c2fd6 minor change
Pavel.Sher
parents: 22
diff changeset
607 Set<File> workDirs = new HashSet<File>();
3ddf410c2fd6 minor change
Pavel.Sher
parents: 22
diff changeset
608 File[] files = workFoldersParent.listFiles(new FileFilter() {
3ddf410c2fd6 minor change
Pavel.Sher
parents: 22
diff changeset
609 public boolean accept(final File file) {
3ddf410c2fd6 minor change
Pavel.Sher
parents: 22
diff changeset
610 return file.isDirectory() && file.getName().startsWith(Settings.DEFAULT_WORK_DIR_PREFIX);
3ddf410c2fd6 minor change
Pavel.Sher
parents: 22
diff changeset
611 }
3ddf410c2fd6 minor change
Pavel.Sher
parents: 22
diff changeset
612 });
3ddf410c2fd6 minor change
Pavel.Sher
parents: 22
diff changeset
613 if (files != null) {
3ddf410c2fd6 minor change
Pavel.Sher
parents: 22
diff changeset
614 for (File f: files) {
46
13d5f0f56e70 compatibility with TeamCity 3.x
Pavel.Sher
parents: 44
diff changeset
615 workDirs.add(PathUtil.getCanonicalFile(f));
23
3ddf410c2fd6 minor change
Pavel.Sher
parents: 22
diff changeset
616 }
3ddf410c2fd6 minor change
Pavel.Sher
parents: 22
diff changeset
617 }
103
1b80570ddadf TW-10150
Pavel.Sher
parents: 101
diff changeset
618 return workDirs;
23
3ddf410c2fd6 minor change
Pavel.Sher
parents: 22
diff changeset
619 }
44
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
620
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
621 public String label(@NotNull String label, @NotNull String version, @NotNull VcsRoot root, @NotNull CheckoutRules checkoutRules) throws VcsException {
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
622 syncClonedRepository(root);
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
623
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
624 Settings settings = createSettings(root);
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
625
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
626 // I do not know why but hg tag does not work correctly if
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
627 // update command was not invoked for the current repo
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
628 // in such case if there were no tags before Mercurial attempts to
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
629 // create new head when tag is pushed to the parent repository
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
630 UpdateCommand uc = new UpdateCommand(settings);
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
631 uc.execute();
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
632
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
633 String fixedTagname = fixTagName(label);
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
634 TagCommand tc = new TagCommand(settings);
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
635 tc.setRevId(new ChangeSet(version).getId());
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
636 tc.setTag(fixedTagname);
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
637 tc.execute();
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
638
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
639 PushCommand pc = new PushCommand(settings);
101
95c28c14b26e TW-10075
Pavel.Sher
parents: 97
diff changeset
640 // pc.setForce(true);
44
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
641 pc.execute();
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
642 return fixedTagname;
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
643 }
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
644
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
645 private String fixTagName(final String label) {
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
646 // according to Mercurial documentation http://hgbook.red-bean.com/hgbookch8.html#x12-1570008
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
647 // tag name must not contain:
118
80eb7fdc4de0 Add logging for deleting tmp directories
nd@localhost.localdomain
parents: 106
diff changeset
648 // Colon (ASCII 58, �:�)
80eb7fdc4de0 Add logging for deleting tmp directories
nd@localhost.localdomain
parents: 106
diff changeset
649 // Carriage return (ASCII 13, �\r�)
80eb7fdc4de0 Add logging for deleting tmp directories
nd@localhost.localdomain
parents: 106
diff changeset
650 // Newline (ASCII 10, �\n�)
44
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
651 // all these characters will be replaced with _ (underscore)
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
652 return label.replace(':', '_').replace('\r', '_').replace('\n', '_');
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
653 }
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
654
62
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
655 private Settings createSettings(final VcsRoot root) throws VcsException {
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
656 Settings settings = new Settings(myDefaultWorkFolderParent, root);
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
657 String customClonePath = root.getProperty(Constants.SERVER_CLONE_PATH_PROP);
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
658 if (!StringUtil.isEmptyOrSpaces(customClonePath) && !myDefaultWorkFolderParent.equals(new File(customClonePath).getAbsoluteFile())) {
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
659 File parentDir = new File(customClonePath);
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
660 createClonedRepositoryParentDir(parentDir);
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
661
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
662 // take last part of repository path
67
e6971dc6b17c always use url with credentials if username/password are specified
Pavel.Sher
parents: 62
diff changeset
663 String repPath = settings.getRepositoryUrl();
62
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
664 String[] splitted = repPath.split("[/\\\\]");
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
665 if (splitted.length > 0) {
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
666 repPath = splitted[splitted.length-1];
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
667 }
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
668
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
669 File customWorkingDir = new File(parentDir, repPath);
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
670 settings.setWorkingDir(customWorkingDir);
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
671 } else {
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
672 createClonedRepositoryParentDir(myDefaultWorkFolderParent);
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
673 }
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
674 return settings;
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
675 }
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
676
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
677 private void createClonedRepositoryParentDir(final File parentDir) throws VcsException {
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
678 if (!parentDir.exists() && !parentDir.mkdirs()) {
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
679 throw new VcsException("Failed to create parent directory for cloned repository: " + parentDir.getAbsolutePath());
b328c6b6526d TW-5636: Mercurial plugin can easilly hit Windows MAX_PATH limitations
Pavel.Sher
parents: 59
diff changeset
680 }
44
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 31
diff changeset
681 }
48
8665bfa3e03a enable agent side checkout
Pavel.Sher
parents: 47
diff changeset
682
8665bfa3e03a enable agent side checkout
Pavel.Sher
parents: 47
diff changeset
683 public boolean isAgentSideCheckoutAvailable() {
8665bfa3e03a enable agent side checkout
Pavel.Sher
parents: 47
diff changeset
684 return true;
8665bfa3e03a enable agent side checkout
Pavel.Sher
parents: 47
diff changeset
685 }
0
a530ea876f55 mercurial support sources added
Pavel.Sher
parents:
diff changeset
686 }