comparison src/org/tmatesoft/hg/core/HgOutgoingCommand.java @ 366:189dc6dc1c3e

Use exceptions to expose errors reading mercurial data
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 16 Dec 2011 04:43:18 +0100
parents 5f9073eabf06
children 9517df1ef7ec
comparison
equal deleted inserted replaced
365:3572fcb06473 366:189dc6dc1c3e
91 /** 91 /**
92 * Lightweight check for outgoing changes. 92 * Lightweight check for outgoing changes.
93 * Reported changes are from any branch (limits set by {@link #branch(String)} are not taken into account. 93 * Reported changes are from any branch (limits set by {@link #branch(String)} are not taken into account.
94 * 94 *
95 * @return list on local nodes known to be missing at remote server 95 * @return list on local nodes known to be missing at remote server
96 * @throws HgRemoteConnectionException FIXME
97 * @throws HgInvalidControlFileException FIXME
98 * @throws CancelledException FIXME
96 */ 99 */
97 public List<Nodeid> executeLite() throws HgRemoteConnectionException, CancelledException { 100 public List<Nodeid> executeLite() throws HgRemoteConnectionException, HgInvalidControlFileException, CancelledException {
98 final ProgressSupport ps = getProgressSupport(null); 101 final ProgressSupport ps = getProgressSupport(null);
99 try { 102 try {
100 ps.start(10); 103 ps.start(10);
101 return getComparator(new ProgressSupport.Sub(ps, 5), getCancelSupport(null, true)).getLocalOnlyRevisions(); 104 return getComparator(new ProgressSupport.Sub(ps, 5), getCancelSupport(null, true)).getLocalOnlyRevisions();
102 } finally { 105 } finally {
124 } finally { 127 } finally {
125 ps.done(); 128 ps.done();
126 } 129 }
127 } 130 }
128 131
129 private RepositoryComparator getComparator(ProgressSupport ps, CancelSupport cs) throws HgRemoteConnectionException, CancelledException { 132 private RepositoryComparator getComparator(ProgressSupport ps, CancelSupport cs) throws HgRemoteConnectionException, HgInvalidControlFileException, CancelledException {
130 if (remoteRepo == null) { 133 if (remoteRepo == null) {
131 throw new IllegalArgumentException("Shall specify remote repository to compare against"); 134 throw new IllegalArgumentException("Shall specify remote repository to compare against");
132 } 135 }
133 if (comparator == null) { 136 if (comparator == null) {
134 comparator = new RepositoryComparator(getParentHelper(), remoteRepo); 137 comparator = new RepositoryComparator(getParentHelper(), remoteRepo);
135 comparator.compare(ps, cs); 138 comparator.compare(ps, cs);
136 } 139 }
137 return comparator; 140 return comparator;
138 } 141 }
139 142
140 private HgChangelog.ParentWalker getParentHelper() { 143 private HgChangelog.ParentWalker getParentHelper() throws HgInvalidControlFileException {
141 if (parentHelper == null) { 144 if (parentHelper == null) {
142 parentHelper = localRepo.getChangelog().new ParentWalker(); 145 parentHelper = localRepo.getChangelog().new ParentWalker();
143 parentHelper.init(); 146 parentHelper.init();
144 } 147 }
145 return parentHelper; 148 return parentHelper;