svnkit 9084 + cleanup of 1.7 working copies on startup

This commit is contained in:
irengrig
2012-03-30 14:13:11 +04:00
parent 42efcb6dc3
commit 212121e370
7 changed files with 49 additions and 0 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -76,6 +76,7 @@ public class SvnConfiguration implements PersistentStateComponent<Element> {
public static final String UPGRADE_AUTO_16 = "auto1.6";
public static final String UPGRADE_AUTO_17 = "auto1.7";
public static final String UPGRADE_NONE = "none";
public static final String CLEANUP_ON_START_RUN = "cleanupOnStartRun";
public String USER = "";
public String PASSWORD = "";
@@ -93,6 +94,7 @@ public class SvnConfiguration implements PersistentStateComponent<Element> {
private SvnAuthenticationManager myInteractiveManager;
private String myUpgradeMode;
private SvnSupportOptions mySupportOptions;
private boolean myCleanupRun;
private int myMaxAnnotateRevisions = ourMaxAnnotateRevisionsDefault;
private final static long DEFAULT_SSH_TIMEOUT = 30 * 1000;
public long mySSHConnectionTimeout = DEFAULT_SSH_TIMEOUT;
@@ -405,6 +407,10 @@ public class SvnConfiguration implements PersistentStateComponent<Element> {
if (autoUpdateAfterCommit != null) {
myAutoUpdateAfterCommit = Boolean.parseBoolean(autoUpdateAfterCommit.getValue());
}
final Attribute cleanupRun = element.getAttribute(CLEANUP_ON_START_RUN);
if (cleanupRun != null) {
myCleanupRun = Boolean.parseBoolean(cleanupRun.getValue());
}
}
@SuppressWarnings({"HardCodedStringLiteral"})
@@ -439,6 +445,7 @@ public class SvnConfiguration implements PersistentStateComponent<Element> {
element.setAttribute("maxAnnotateRevisions", "" + myMaxAnnotateRevisions);
element.setAttribute("myUseAcceleration", "" + myUseAcceleration);
element.setAttribute("myAutoUpdateAfterCommit", "" + myAutoUpdateAfterCommit);
element.setAttribute(CLEANUP_ON_START_RUN, "" + myCleanupRun);
}
public boolean isAutoUpdateAfterCommit() {
@@ -567,4 +574,12 @@ public class SvnConfiguration implements PersistentStateComponent<Element> {
commandLine,
nothing
}
public boolean isCleanupRun() {
return myCleanupRun;
}
public void setCleanupRun(boolean cleanupRun) {
myCleanupRun = cleanupRun;
}
}
@@ -260,11 +260,45 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
public void postStartup() {
if (myProject.isDefault()) return;
myCopiesRefreshManager = new SvnCopiesRefreshManager(myProject, (SvnFileUrlMappingImpl) getSvnFileUrlMapping());
if (! myConfiguration.isCleanupRun()) {
if (cleanup17copies()) {
myConfiguration.setCleanupRun(true);
}
}
invokeRefreshSvnRoots(true);
myWorkingCopiesContent.activate();
}
private boolean cleanup17copies() {
final boolean[] result = new boolean[1];
result[0] = true;
final Runnable runnable = new Runnable() {
public void run() {
myCopiesRefreshManager.getCopiesRefresh().synchRequest();
final List<WCInfo> infos = getAllWcInfos();
for (WCInfo info : infos) {
if (WorkingCopyFormat.ONE_DOT_SEVEN.equals(info.getFormat())) {
try {
createWCClient().doCleanup(new File(info.getPath()));
}
catch (SVNException e) {
LOG.info(e);
result[0] = false; }
}
}
}
};
if (ApplicationManager.getApplication().isDispatchThread()) {
ProgressManager.getInstance().runProcessWithProgressSynchronously(runnable,
"Cleanup working copies", true, myProject);
} else {
runnable.run();
}
return result[0];
}
public void invokeRefreshSvnRoots(final boolean asynchronous) {
REFRESH_LOG.debug("refresh: ", new Throwable());
if (myCopiesRefreshManager != null) {