Mercurial > hg > mercurial
changeset 242:e62ba1023e2c
Use settings instead of VcsRoot as argument to syncRepository methods
author | Dmitry Neverov <dmitry.neverov@jetbrains.com> |
---|---|
date | Tue, 19 Apr 2011 16:45:01 +0400 |
parents | ffd7234f9d1f |
children | 68e2df92f629 |
files | mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java |
diffstat | 1 files changed, 11 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java Tue Apr 19 16:34:32 2011 +0400 +++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java Tue Apr 19 16:45:01 2011 +0400 @@ -141,8 +141,8 @@ @NotNull public byte[] getContent(@NotNull final String filePath, @NotNull final VcsRoot vcsRoot, @NotNull final String version) throws VcsException { ChangeSet cset = new ChangeSet(version); - syncRepository(vcsRoot, cset); Settings settings = createSettings(vcsRoot); + syncRepository(settings, cset); File workingDir = getWorkingDir(settings); CatCommand cc = new CatCommand(settings, workingDir); cc.setRevId(cset.getId()); @@ -198,9 +198,8 @@ @NotNull public String getCurrentVersion(@NotNull final VcsRoot root) throws VcsException { - // we will return full version of the most recent change as current version - syncRepository(root); Settings settings = createSettings(root); + syncRepository(settings); File workingDir = getWorkingDir(settings); BranchesCommand branches = new BranchesCommand(settings, workingDir); Map<String, ChangeSet> result = branches.execute(); @@ -387,8 +386,7 @@ /** * clone the repo if it doesn't exist, pull the repo if it doesn't contain specified changeSet */ - private void syncRepository(final VcsRoot root, final ChangeSet cset) throws VcsException { - Settings settings = createSettings(root); + private void syncRepository(final Settings settings, final ChangeSet cset) throws VcsException { File workingDir = getWorkingDir(settings); lockWorkDir(workingDir); try { @@ -407,9 +405,7 @@ } } - // updates current working copy of repository by pulling changes from the repository specified in VCS root - private void syncRepository(final VcsRoot root) throws VcsException { - Settings settings = createSettings(root); + private void syncRepository(final Settings settings) throws VcsException { File workingDir = getWorkingDir(settings); lockWorkDir(workingDir); try { @@ -461,8 +457,8 @@ @NotNull public Map<String, String> getBranchesRevisions(@NotNull VcsRoot root) throws VcsException { - syncRepository(root); Settings settings = createSettings(root); + syncRepository(settings); File workingDir = getWorkingDir(settings); BranchesCommand branches = new BranchesCommand(settings, workingDir); Map<String, String> result = new HashMap<String, String>(); @@ -483,7 +479,8 @@ @NotNull VcsRoot toRoot, @Nullable String toRootRevision, @NotNull CheckoutRules checkoutRules) throws VcsException { //we get all branches while clone, if vcs roots are related it is doesn't matter in which one search for branch point - syncRepository(fromRoot); + Settings settings = createSettings(fromRoot); + syncRepository(settings); String branchPoint = getBranchPoint(fromRoot, fromRootRevision, toRootRevision); return ((CollectChangesByCheckoutRules) getCollectChangesPolicy()).collectChanges(toRoot, branchPoint, toRootRevision, checkoutRules); } @@ -508,13 +505,13 @@ public CollectChangesPolicy getCollectChangesPolicy() { return new CollectChangesByCheckoutRules() { public List<ModificationData> collectChanges(@NotNull VcsRoot root, @NotNull String fromVersion, @Nullable String currentVersion, @NotNull CheckoutRules checkoutRules) throws VcsException { - syncRepository(root); + Settings settings = createSettings(root); + syncRepository(settings); // first obtain changes between specified versions List<ModificationData> result = new ArrayList<ModificationData>(); if (currentVersion == null) return result; - Settings settings = createSettings(root); File workingDir = getWorkingDir(settings); LogCommand lc = new LogCommand(settings, workingDir); String fromId = new ChangeSetRevision(fromVersion).getId(); @@ -572,8 +569,8 @@ @NotNull final String toVersion, @NotNull final PatchBuilder builder, @NotNull final CheckoutRules checkoutRules) throws IOException, VcsException { - syncRepository(root); Settings settings = createSettings(root); + syncRepository(settings); if (fromVersion == null) { buildFullPatch(settings, new ChangeSet(toVersion), builder, checkoutRules); } else { @@ -638,8 +635,8 @@ } public String label(@NotNull String label, @NotNull String version, @NotNull VcsRoot root, @NotNull CheckoutRules checkoutRules) throws VcsException { - syncRepository(root); Settings settings = createSettings(root); + syncRepository(settings); 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