# HG changeset patch # User Dmitry Neverov # Date 1299846886 -10800 # Node ID ce19924b4a7a00ded92c883e3a0c0d12bb9c1a47 # Parent c6de9e0767659ab7c2802f0f7b7f3f2c837d70c5 Use getWorkingDir() everythere diff -r c6de9e076765 -r ce19924b4a7a mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java --- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java Fri Mar 11 15:29:46 2011 +0300 +++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java Fri Mar 11 15:34:46 2011 +0300 @@ -100,7 +100,7 @@ } private Collection computeModifiedFilesForMergeCommit(final Settings settings, final ChangeSet cur) throws VcsException { - File workingDir = myMirrorManager.getMirrorDir(settings.getRepositoryUrl()); + File workingDir = getWorkingDir(settings); ChangedFilesCommand cfc = new ChangedFilesCommand(settings, workingDir); cfc.setRevId(cur.getId()); return cfc.execute(); @@ -143,7 +143,7 @@ public byte[] getContent(@NotNull final String filePath, @NotNull final VcsRoot vcsRoot, @NotNull final String version) throws VcsException { syncClonedRepository(vcsRoot); Settings settings = createSettings(vcsRoot); - File workingDir = myMirrorManager.getMirrorDir(settings.getRepositoryUrl()); + File workingDir = getWorkingDir(settings); CatCommand cc = new CatCommand(settings, workingDir); cc.setRevId(new ChangeSet(version).getId()); File parentDir = cc.execute(Collections.singletonList(filePath)); @@ -201,7 +201,7 @@ // we will return full version of the most recent change as current version syncClonedRepository(root); Settings settings = createSettings(root); - File workingDir = myMirrorManager.getMirrorDir(settings.getRepositoryUrl()); + File workingDir = getWorkingDir(settings); BranchesCommand branches = new BranchesCommand(settings, workingDir); Map result = branches.execute(); if (!result.containsKey(settings.getBranchName())) { @@ -225,7 +225,7 @@ return new TestConnectionSupport() { public String testConnection(@NotNull final VcsRoot vcsRoot) throws VcsException { Settings settings = createSettings(vcsRoot); - File workingDir = myMirrorManager.getMirrorDir(settings.getRepositoryUrl()); + File workingDir = getWorkingDir(settings); IdentifyCommand id = new IdentifyCommand(settings, workingDir); StringBuilder res = new StringBuilder(); res.append(quoteIfNeeded(settings.getHgCommandPath())); @@ -277,7 +277,7 @@ // builds patch from version to version private void buildIncrementalPatch(final Settings settings, @NotNull final ChangeSet fromVer, @NotNull final ChangeSet toVer, final PatchBuilder builder, final CheckoutRules checkoutRules) throws VcsException, IOException { - File workingDir = myMirrorManager.getMirrorDir(settings.getRepositoryUrl()); + File workingDir = getWorkingDir(settings); StatusCommand st = new StatusCommand(settings, workingDir); st.setFromRevId(fromVer.getId()); st.setToRevId(toVer.getId()); @@ -329,8 +329,7 @@ throws IOException, VcsException { File tempDir = FileUtil.createTempDirectory("mercurial", toVer.getId()); try { - File customRepositoryDir = settings.getCustomWorkingDir(); - File mirrorDir = customRepositoryDir != null ? customRepositoryDir : myMirrorManager.getMirrorDir(settings.getRepositoryUrl()); + File mirrorDir = getWorkingDir(settings); final File repRoot = new File(tempDir, "rep"); CloneCommand cl = new CloneCommand(settings, repRoot); // clone from the local repository @@ -388,8 +387,7 @@ // updates current working copy of repository by pulling changes from the repository specified in VCS root private void syncClonedRepository(final VcsRoot root) throws VcsException { Settings settings = createSettings(root); - File customRepositoryDir = settings.getCustomWorkingDir(); - File workingDir = customRepositoryDir != null ? customRepositoryDir : myMirrorManager.getMirrorDir(settings.getRepositoryUrl()); + File workingDir = getWorkingDir(settings); lockWorkDir(workingDir); try { if (Settings.isValidRepository(workingDir)) { @@ -424,7 +422,7 @@ public Map getBranchesRevisions(@NotNull VcsRoot root) throws VcsException { syncClonedRepository(root); Settings settings = createSettings(root); - File workingDir = myMirrorManager.getMirrorDir(settings.getRepositoryUrl()); + File workingDir = getWorkingDir(settings); BranchesCommand branches = new BranchesCommand(settings, workingDir); Map result = new HashMap(); for (Map.Entry entry : branches.execute().entrySet()) { @@ -451,7 +449,7 @@ private String getBranchPoint(@NotNull VcsRoot root, String branchOneRev, String branchTwoRev) throws VcsException { Settings settings = createSettings(root); - File workingDir = myMirrorManager.getMirrorDir(settings.getRepositoryUrl()); + File workingDir = getWorkingDir(settings); LogCommand lc = new LogCommand(settings, workingDir); lc.setFromRevId(new ChangeSetRevision(branchOneRev).getId()); lc.setToRevId(new ChangeSetRevision(branchTwoRev).getId()); @@ -476,7 +474,7 @@ if (currentVersion == null) return result; Settings settings = createSettings(root); - File workingDir = myMirrorManager.getMirrorDir(settings.getRepositoryUrl()); + File workingDir = getWorkingDir(settings); LogCommand lc = new LogCommand(settings, workingDir); String fromId = new ChangeSetRevision(fromVersion).getId(); lc.setFromRevId(fromId); @@ -578,8 +576,7 @@ for (VcsRoot vcsRoot: getMercurialVcsRoots()) { try { Settings s = createSettings(vcsRoot); - File customWorkingDir = s.getCustomWorkingDir(); - File workingDir = customWorkingDir != null ? customWorkingDir : myMirrorManager.getMirrorDir(s.getRepositoryUrl()); + File workingDir = getWorkingDir(s); workDirs.remove(PathUtil.getCanonicalFile(workingDir)); } catch (VcsException e) { Loggers.VCS.error(e); @@ -603,7 +600,7 @@ syncClonedRepository(root); Settings settings = createSettings(root); - File workingDir = myMirrorManager.getMirrorDir(settings.getRepositoryUrl()); + File workingDir = getWorkingDir(settings); // I do not know why but hg tag does not work correctly if // update command was not invoked for the current repo // in such case if there were no tags before Mercurial attempts to