comparison src/org/tmatesoft/hg/core/HgIncomingCommand.java @ 295:981f9f50bb6c

Issue 11: Error log facility. SessionContext to share common facilities
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 16 Sep 2011 05:35:32 +0200
parents 6d1804fe0ed7
children d68dcb3b5f49
comparison
equal deleted inserted replaced
294:32890bab7209 295:981f9f50bb6c
14 * the terms of a license other than GNU General Public License 14 * the terms of a license other than GNU General Public License
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.io.IOException;
20 import java.util.ArrayList; 19 import java.util.ArrayList;
21 import java.util.HashSet; 20 import java.util.HashSet;
22 import java.util.Iterator; 21 import java.util.Iterator;
23 import java.util.LinkedHashSet; 22 import java.util.LinkedHashSet;
24 import java.util.LinkedList; 23 import java.util.LinkedList;
98 /** 97 /**
99 * Lightweight check for incoming changes, gives only list of revisions to pull. 98 * Lightweight check for incoming changes, gives only list of revisions to pull.
100 * Reported changes are from any branch (limits set by {@link #branch(String)} are not taken into account. 99 * Reported changes are from any branch (limits set by {@link #branch(String)} are not taken into account.
101 * 100 *
102 * @return list of nodes present at remote and missing locally 101 * @return list of nodes present at remote and missing locally
103 * @throws HgException 102 * @throws HgRemoteConnectionException when failed to communicate with remote repository
104 * @throws CancelledException 103 * @throws CancelledException
105 */ 104 */
106 public List<Nodeid> executeLite() throws HgException, CancelledException { 105 public List<Nodeid> executeLite() throws HgRemoteConnectionException, CancelledException {
107 LinkedHashSet<Nodeid> result = new LinkedHashSet<Nodeid>(); 106 LinkedHashSet<Nodeid> result = new LinkedHashSet<Nodeid>();
108 RepositoryComparator repoCompare = getComparator(); 107 RepositoryComparator repoCompare = getComparator();
109 for (BranchChain bc : getMissingBranches()) { 108 for (BranchChain bc : getMissingBranches()) {
110 List<Nodeid> missing = repoCompare.visitBranches(bc); 109 List<Nodeid> missing = repoCompare.visitBranches(bc);
111 HashSet<Nodeid> common = new HashSet<Nodeid>(); // ordering is irrelevant 110 HashSet<Nodeid> common = new HashSet<Nodeid>(); // ordering is irrelevant
119 } 118 }
120 119
121 /** 120 /**
122 * Full information about incoming changes 121 * Full information about incoming changes
123 * 122 *
124 * @throws HgException 123 * @throws HgRemoteConnectionException when failed to communicate with remote repository
124 * @throws HgInvalidFileException to indicate failure working with locally downloaded changes in a bundle file
125 * @throws HgCallbackTargetException to re-throw exception from the handler
125 * @throws CancelledException 126 * @throws CancelledException
126 */ 127 */
127 public void executeFull(final HgChangesetHandler handler) throws HgException/*FIXME specific type*/, HgException, CancelledException { 128 public void executeFull(final HgChangesetHandler handler) throws HgRemoteConnectionException, HgInvalidFileException, HgCallbackTargetException, CancelledException {
128 if (handler == null) { 129 if (handler == null) {
129 throw new IllegalArgumentException("Delegate can't be null"); 130 throw new IllegalArgumentException("Delegate can't be null");
130 } 131 }
131 final List<Nodeid> common = getCommon(); 132 final List<Nodeid> common = getCommon();
132 HgBundle changegroup = remoteRepo.getChanges(common); 133 HgBundle changegroup = remoteRepo.getChanges(common);
153 } 154 }
154 transformer.next(localIndex++, nodeid, cset); 155 transformer.next(localIndex++, nodeid, cset);
155 } 156 }
156 }); 157 });
157 transformer.checkFailure(); 158 transformer.checkFailure();
158 } catch (IOException ex) {
159 throw new HgException(ex);
160 } finally { 159 } finally {
161 ps.done(); 160 ps.done();
162 } 161 }
163 } 162 }
164 163