Mercurial > jhg
diff src/org/tmatesoft/hg/core/HgOutgoingCommand.java @ 194:344e8d7e4d6e
Use common low to hi-level changeset api transformer
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 15 Apr 2011 03:35:08 +0200 |
parents | e5407b5a586a |
children | c9b305df0b89 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgOutgoingCommand.java Fri Apr 15 03:28:12 2011 +0200 +++ b/src/org/tmatesoft/hg/core/HgOutgoingCommand.java Fri Apr 15 03:35:08 2011 +0200 @@ -17,6 +17,8 @@ package org.tmatesoft.hg.core; import java.util.List; +import java.util.Set; +import java.util.TreeSet; import org.tmatesoft.hg.internal.RepositoryComparator; import org.tmatesoft.hg.repo.HgChangelog; @@ -36,6 +38,7 @@ private HgRemoteRepository remoteRepo; private boolean includeSubrepo; private RepositoryComparator comparator; + private Set<String> branches; public HgOutgoingCommand(HgRepository hgRepo) { localRepo = hgRepo; @@ -52,13 +55,23 @@ } /** - * PLACEHOLDER, NOT IMPLEMENTED YET. + * Select specific branch to pull. + * Multiple branch specification possible (changeset from any of these would be included in result). + * Note, {@link #executeLite(Object)} does not respect this setting. * - * Select specific branch to pull + * @param branch - branch name, case-sensitive, non-null. * @return <code>this</code> for convenience + * @throws IllegalArgumentException when branch argument is null */ public HgOutgoingCommand branch(String branch) { - throw HgRepository.notImplemented(); + if (branch == null) { + throw new IllegalArgumentException(); + } + if (branches == null) { + branches = new TreeSet<String>(); + } + branches.add(branch); + return this; } /** @@ -72,7 +85,8 @@ } /** - * Lightweight check for outgoing changes. + * Lightweight check for outgoing changes. + * Reported changes are from any branch (limits set by {@link #branch(String)} are not taken into account. * * @param context * @return list on local nodes known to be missing at remote server @@ -90,7 +104,9 @@ if (handler == null) { throw new IllegalArgumentException("Delegate can't be null"); } - getComparator(handler).visitLocalOnlyRevisions(new ChangesetTransformer(localRepo, handler)); + ChangesetTransformer inspector = new ChangesetTransformer(localRepo, handler); + inspector.limitBranches(branches); + getComparator(handler).visitLocalOnlyRevisions(inspector); } private RepositoryComparator getComparator(Object context) throws HgException, CancelledException {