Mercurial > jhg
comparison src/org/tmatesoft/hg/core/HgOutgoingCommand.java @ 427:31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 29 Mar 2012 17:14:35 +0200 |
parents | 9c9c442b5f2e |
children | 1fc0da631200 |
comparison
equal
deleted
inserted
replaced
426:063b0663495a | 427:31a89587eb04 |
---|---|
23 import org.tmatesoft.hg.internal.RepositoryComparator; | 23 import org.tmatesoft.hg.internal.RepositoryComparator; |
24 import org.tmatesoft.hg.repo.HgChangelog; | 24 import org.tmatesoft.hg.repo.HgChangelog; |
25 import org.tmatesoft.hg.repo.HgInvalidControlFileException; | 25 import org.tmatesoft.hg.repo.HgInvalidControlFileException; |
26 import org.tmatesoft.hg.repo.HgRemoteRepository; | 26 import org.tmatesoft.hg.repo.HgRemoteRepository; |
27 import org.tmatesoft.hg.repo.HgRepository; | 27 import org.tmatesoft.hg.repo.HgRepository; |
28 import org.tmatesoft.hg.repo.HgRuntimeException; | |
28 import org.tmatesoft.hg.util.CancelSupport; | 29 import org.tmatesoft.hg.util.CancelSupport; |
29 import org.tmatesoft.hg.util.CancelledException; | 30 import org.tmatesoft.hg.util.CancelledException; |
30 import org.tmatesoft.hg.util.ProgressSupport; | 31 import org.tmatesoft.hg.util.ProgressSupport; |
31 | 32 |
32 /** | 33 /** |
93 * Lightweight check for outgoing changes. | 94 * Lightweight check for outgoing changes. |
94 * Reported changes are from any branch (limits set by {@link #branch(String)} are not taken into account. | 95 * Reported changes are from any branch (limits set by {@link #branch(String)} are not taken into account. |
95 * | 96 * |
96 * @return list on local nodes known to be missing at remote server | 97 * @return list on local nodes known to be missing at remote server |
97 * @throws HgRemoteConnectionException when failed to communicate with remote repository | 98 * @throws HgRemoteConnectionException when failed to communicate with remote repository |
98 * @throws HgInvalidControlFileException if access to revlog index/data entry failed | 99 * @throws HgException subclass thereof to indicate specific issue with the command arguments or repository state |
99 * @throws CancelledException if execution of the command was cancelled | 100 * @throws CancelledException if execution of the command was cancelled |
100 */ | 101 */ |
101 public List<Nodeid> executeLite() throws HgRemoteConnectionException, HgInvalidControlFileException, CancelledException { | 102 public List<Nodeid> executeLite() throws HgRemoteConnectionException, HgException, CancelledException { |
102 final ProgressSupport ps = getProgressSupport(null); | 103 final ProgressSupport ps = getProgressSupport(null); |
103 try { | 104 try { |
104 ps.start(10); | 105 ps.start(10); |
105 return getComparator(new ProgressSupport.Sub(ps, 5), getCancelSupport(null, true)).getLocalOnlyRevisions(); | 106 return getComparator(new ProgressSupport.Sub(ps, 5), getCancelSupport(null, true)).getLocalOnlyRevisions(); |
107 } catch (HgRuntimeException ex) { | |
108 throw new HgLibraryFailureException(ex); | |
106 } finally { | 109 } finally { |
107 ps.done(); | 110 ps.done(); |
108 } | 111 } |
109 } | 112 } |
110 | 113 |
111 /** | 114 /** |
112 * Complete information about outgoing changes | 115 * Complete information about outgoing changes |
113 * | 116 * |
114 * @param handler delegate to process changes | 117 * @param handler delegate to process changes |
118 * @throws HgCallbackTargetException propagated exception from the handler | |
115 * @throws HgRemoteConnectionException when failed to communicate with remote repository | 119 * @throws HgRemoteConnectionException when failed to communicate with remote repository |
116 * @throws HgInvalidControlFileException if access to revlog index/data entry failed | 120 * @throws HgException subclass thereof to indicate specific issue with the command arguments or repository state |
117 * @throws HgCallbackTargetException to re-throw exception from the handler | |
118 * @throws CancelledException if execution of the command was cancelled | 121 * @throws CancelledException if execution of the command was cancelled |
119 */ | 122 */ |
120 public void executeFull(final HgChangesetHandler handler) throws HgRemoteConnectionException, HgInvalidControlFileException, HgCallbackTargetException, CancelledException { | 123 public void executeFull(final HgChangesetHandler handler) throws HgCallbackTargetException, HgException, CancelledException { |
121 if (handler == null) { | 124 if (handler == null) { |
122 throw new IllegalArgumentException("Delegate can't be null"); | 125 throw new IllegalArgumentException("Delegate can't be null"); |
123 } | 126 } |
124 final ProgressSupport ps = getProgressSupport(handler); | 127 final ProgressSupport ps = getProgressSupport(handler); |
125 final CancelSupport cs = getCancelSupport(handler, true); | 128 final CancelSupport cs = getCancelSupport(handler, true); |
127 ps.start(-1); | 130 ps.start(-1); |
128 ChangesetTransformer inspector = new ChangesetTransformer(localRepo, handler, getParentHelper(), ps, cs); | 131 ChangesetTransformer inspector = new ChangesetTransformer(localRepo, handler, getParentHelper(), ps, cs); |
129 inspector.limitBranches(branches); | 132 inspector.limitBranches(branches); |
130 getComparator(new ProgressSupport.Sub(ps, 1), cs).visitLocalOnlyRevisions(inspector); | 133 getComparator(new ProgressSupport.Sub(ps, 1), cs).visitLocalOnlyRevisions(inspector); |
131 inspector.checkFailure(); | 134 inspector.checkFailure(); |
135 } catch (HgRuntimeException ex) { | |
136 throw new HgLibraryFailureException(ex); | |
132 } finally { | 137 } finally { |
133 ps.done(); | 138 ps.done(); |
134 } | 139 } |
135 } | 140 } |
136 | 141 |