1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.idea.svn.update;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.update.UpdatedFiles;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.idea.svn.SvnWCRootCrawler;
import org.tmatesoft.svn.core.SVNErrorCode;
import org.tmatesoft.svn.core.SVNErrorMessage;
import org.tmatesoft.svn.core.SVNException;
import java.io.File;
import java.util.Collection;
public abstract class AbstractUpdateIntegrateCrawler implements SvnWCRootCrawler {
protected final SvnVcs myVcs;
protected final UpdateEventHandler myHandler;
protected final Collection<VcsException> myExceptions;
protected final UpdatedFiles myPostUpdateFiles;
protected final boolean myIsTotalUpdate;
private final static Logger LOG = Logger.getInstance("#org.jetbrains.idea.svn.update.AbstractUpdateIntegrateCrawler");
protected AbstractUpdateIntegrateCrawler(
final boolean isTotalUpdate,
final UpdatedFiles postUpdateFiles,
final Collection<VcsException> exceptions,
final UpdateEventHandler handler,
final SvnVcs vcs) {
myIsTotalUpdate = isTotalUpdate;
myPostUpdateFiles = postUpdateFiles;
myExceptions = exceptions;
myHandler = handler;
myVcs = vcs;
}
public void handleWorkingCopyRoot(File root, ProgressIndicator progress) {
if (progress != null) {
showProgressMessage(progress, root);
}
try {
long rev = doUpdate(root);
if (rev < 0 && !isMerge()) {
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.UNKNOWN, SvnBundle.message("exception.text.root.was.not.properly.updated", root)));
}
}
catch (SVNException e) {
LOG.info(e);
myExceptions.add(new VcsException(e));
}
catch (VcsException e) {
LOG.info(e);
myExceptions.add(e);
}
}
protected abstract void showProgressMessage(ProgressIndicator progress, File root);
protected abstract long doUpdate(File root) throws SVNException, VcsException;
protected abstract boolean isMerge();
}
|