Mercurial > jhg
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 193:37f3d4a596e4 | 194:344e8d7e4d6e |
|---|---|
| 15 * contact TMate Software at support@hg4j.com | 15 * contact TMate Software at support@hg4j.com |
| 16 */ | 16 */ |
| 17 package org.tmatesoft.hg.core; | 17 package org.tmatesoft.hg.core; |
| 18 | 18 |
| 19 import java.util.List; | 19 import java.util.List; |
| 20 import java.util.Set; | |
| 21 import java.util.TreeSet; | |
| 20 | 22 |
| 21 import org.tmatesoft.hg.internal.RepositoryComparator; | 23 import org.tmatesoft.hg.internal.RepositoryComparator; |
| 22 import org.tmatesoft.hg.repo.HgChangelog; | 24 import org.tmatesoft.hg.repo.HgChangelog; |
| 23 import org.tmatesoft.hg.repo.HgRemoteRepository; | 25 import org.tmatesoft.hg.repo.HgRemoteRepository; |
| 24 import org.tmatesoft.hg.repo.HgRepository; | 26 import org.tmatesoft.hg.repo.HgRepository; |
| 34 | 36 |
| 35 private final HgRepository localRepo; | 37 private final HgRepository localRepo; |
| 36 private HgRemoteRepository remoteRepo; | 38 private HgRemoteRepository remoteRepo; |
| 37 private boolean includeSubrepo; | 39 private boolean includeSubrepo; |
| 38 private RepositoryComparator comparator; | 40 private RepositoryComparator comparator; |
| 41 private Set<String> branches; | |
| 39 | 42 |
| 40 public HgOutgoingCommand(HgRepository hgRepo) { | 43 public HgOutgoingCommand(HgRepository hgRepo) { |
| 41 localRepo = hgRepo; | 44 localRepo = hgRepo; |
| 42 } | 45 } |
| 43 | 46 |
| 50 comparator = null; | 53 comparator = null; |
| 51 return this; | 54 return this; |
| 52 } | 55 } |
| 53 | 56 |
| 54 /** | 57 /** |
| 55 * PLACEHOLDER, NOT IMPLEMENTED YET. | 58 * Select specific branch to pull. |
| 59 * Multiple branch specification possible (changeset from any of these would be included in result). | |
| 60 * Note, {@link #executeLite(Object)} does not respect this setting. | |
| 56 * | 61 * |
| 57 * Select specific branch to pull | 62 * @param branch - branch name, case-sensitive, non-null. |
| 58 * @return <code>this</code> for convenience | 63 * @return <code>this</code> for convenience |
| 64 * @throws IllegalArgumentException when branch argument is null | |
| 59 */ | 65 */ |
| 60 public HgOutgoingCommand branch(String branch) { | 66 public HgOutgoingCommand branch(String branch) { |
| 61 throw HgRepository.notImplemented(); | 67 if (branch == null) { |
| 68 throw new IllegalArgumentException(); | |
| 69 } | |
| 70 if (branches == null) { | |
| 71 branches = new TreeSet<String>(); | |
| 72 } | |
| 73 branches.add(branch); | |
| 74 return this; | |
| 62 } | 75 } |
| 63 | 76 |
| 64 /** | 77 /** |
| 65 * PLACEHOLDER, NOT IMPLEMENTED YET. | 78 * PLACEHOLDER, NOT IMPLEMENTED YET. |
| 66 * | 79 * |
| 70 includeSubrepo = include; | 83 includeSubrepo = include; |
| 71 throw HgRepository.notImplemented(); | 84 throw HgRepository.notImplemented(); |
| 72 } | 85 } |
| 73 | 86 |
| 74 /** | 87 /** |
| 75 * Lightweight check for outgoing changes. | 88 * Lightweight check for outgoing changes. |
| 89 * Reported changes are from any branch (limits set by {@link #branch(String)} are not taken into account. | |
| 76 * | 90 * |
| 77 * @param context | 91 * @param context |
| 78 * @return list on local nodes known to be missing at remote server | 92 * @return list on local nodes known to be missing at remote server |
| 79 */ | 93 */ |
| 80 public List<Nodeid> executeLite(Object context) throws HgException, CancelledException { | 94 public List<Nodeid> executeLite(Object context) throws HgException, CancelledException { |
| 88 */ | 102 */ |
| 89 public void executeFull(final HgLogCommand.Handler handler) throws HgException, CancelledException { | 103 public void executeFull(final HgLogCommand.Handler handler) throws HgException, CancelledException { |
| 90 if (handler == null) { | 104 if (handler == null) { |
| 91 throw new IllegalArgumentException("Delegate can't be null"); | 105 throw new IllegalArgumentException("Delegate can't be null"); |
| 92 } | 106 } |
| 93 getComparator(handler).visitLocalOnlyRevisions(new ChangesetTransformer(localRepo, handler)); | 107 ChangesetTransformer inspector = new ChangesetTransformer(localRepo, handler); |
| 108 inspector.limitBranches(branches); | |
| 109 getComparator(handler).visitLocalOnlyRevisions(inspector); | |
| 94 } | 110 } |
| 95 | 111 |
| 96 private RepositoryComparator getComparator(Object context) throws HgException, CancelledException { | 112 private RepositoryComparator getComparator(Object context) throws HgException, CancelledException { |
| 97 if (remoteRepo == null) { | 113 if (remoteRepo == null) { |
| 98 throw new IllegalArgumentException("Shall specify remote repository to compare against"); | 114 throw new IllegalArgumentException("Shall specify remote repository to compare against"); |
