Mercurial > hg > mercurial
changeset 148:403d16397f5c
Initial implementation of BranchSupport interface
author | Dmitry Neverov <dmitry.neverov@jetbrains.com> |
---|---|
date | Tue, 11 Jan 2011 15:24:58 +0300 |
parents | 86d5b641ef63 |
children | 7f3c82f10119 |
files | mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java |
diffstat | 1 files changed, 20 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java Tue Jan 11 15:15:16 2011 +0300 +++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java Tue Jan 11 15:24:58 2011 +0300 @@ -52,7 +52,7 @@ * <p>Working copy of repository is created in the $TEAMCITY_DATA_PATH/system/caches/hg_<hash code> folder. * <p>Personal builds (remote runs) are not yet supported, they require corresponding functionality from the IDE. */ -public class MercurialVcsSupport extends ServerVcsSupport implements LabelingSupport, VcsFileContentProvider { +public class MercurialVcsSupport extends ServerVcsSupport implements LabelingSupport, VcsFileContentProvider, BranchSupport { private ConcurrentMap<String, Lock> myWorkDirLocks= new ConcurrentHashMap<String, Lock>(); private VcsManager myVcsManager; private File myDefaultWorkFolderParent; @@ -410,6 +410,25 @@ return this; } + public List<ModificationData> collectChanges(@NotNull VcsRoot fromRoot, @NotNull String fromRootRevision, + @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 + syncClonedRepository(fromRoot); + String branchPoint = getBranchPoint(fromRoot, fromRootRevision, toRootRevision); + return ((CollectChangesByCheckoutRules) getCollectChangesPolicy()).collectChanges(fromRoot, branchPoint, toRootRevision, checkoutRules); + } + + private String getBranchPoint(@NotNull VcsRoot root, String branchOneRev, String branchTwoRev) throws VcsException { + Settings settings = createSettings(root); + LogCommand lc = new LogCommand(settings); + lc.setFromRevId(new ChangeSetRevision(branchOneRev).getId()); + lc.setToRevId(new ChangeSetRevision(branchTwoRev).getId()); + lc.setLimit(1); + List<ChangeSet> changeSets = lc.execute(); + return changeSets.get(0).getParents().get(0).getId(); + } + @NotNull public CollectChangesPolicy getCollectChangesPolicy() { return new CollectChangesByCheckoutRules() {