Mercurial > hg4j
annotate src/org/tmatesoft/hg/core/HgIncomingCommand.java @ 430:d280759c2a3f
branch information is not directly related to dirstate, clean API from this dependency
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 29 Mar 2012 18:48:23 +0200 |
parents | 31a89587eb04 |
children | 1fc0da631200 |
rev | line source |
---|---|
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
1 /* |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
2 * Copyright (c) 2011-2012 TMate Software Ltd |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
3 * |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
6 * the Free Software Foundation; version 2 of the License. |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
7 * |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
11 * GNU General Public License for more details. |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
12 * |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
13 * For information on how to redistribute this software under |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
14 * the terms of a license other than GNU General Public License |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
15 * contact TMate Software at support@hg4j.com |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 */ |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
17 package org.tmatesoft.hg.core; |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
18 |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
19 import java.util.ArrayList; |
202
706bcc7cfee4
Basic test for HgIncomingCommand. Fix RepositoryComparator for cases when whole repository is unknown. Respect freshly initialized (empty) repositories in general.
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
195
diff
changeset
|
20 import java.util.HashSet; |
706bcc7cfee4
Basic test for HgIncomingCommand. Fix RepositoryComparator for cases when whole repository is unknown. Respect freshly initialized (empty) repositories in general.
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
195
diff
changeset
|
21 import java.util.Iterator; |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
22 import java.util.LinkedHashSet; |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
23 import java.util.LinkedList; |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
24 import java.util.List; |
194
344e8d7e4d6e
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
25 import java.util.Set; |
344e8d7e4d6e
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
26 import java.util.TreeSet; |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
27 |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
28 import org.tmatesoft.hg.internal.RepositoryComparator; |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
29 import org.tmatesoft.hg.internal.RepositoryComparator.BranchChain; |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
30 import org.tmatesoft.hg.repo.HgBundle; |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
31 import org.tmatesoft.hg.repo.HgChangelog; |
427
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
32 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
33 import org.tmatesoft.hg.repo.HgInvalidControlFileException; |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
34 import org.tmatesoft.hg.repo.HgInvalidStateException; |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
35 import org.tmatesoft.hg.repo.HgRemoteRepository; |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
36 import org.tmatesoft.hg.repo.HgRepository; |
427
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
37 import org.tmatesoft.hg.repo.HgRuntimeException; |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
38 import org.tmatesoft.hg.util.CancelledException; |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
208
diff
changeset
|
39 import org.tmatesoft.hg.util.ProgressSupport; |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
40 |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
41 /** |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
42 * Command to find out changes available in a remote repository, missing locally. |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
43 * |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
44 * @author Artem Tikhomirov |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
45 * @author TMate Software Ltd. |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
46 */ |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
208
diff
changeset
|
47 public class HgIncomingCommand extends HgAbstractCommand<HgIncomingCommand> { |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
48 |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
49 private final HgRepository localRepo; |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
50 private HgRemoteRepository remoteRepo; |
202
706bcc7cfee4
Basic test for HgIncomingCommand. Fix RepositoryComparator for cases when whole repository is unknown. Respect freshly initialized (empty) repositories in general.
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
195
diff
changeset
|
51 @SuppressWarnings("unused") |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
52 private boolean includeSubrepo; |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
53 private RepositoryComparator comparator; |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
54 private List<BranchChain> missingBranches; |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
55 private HgChangelog.ParentWalker parentHelper; |
194
344e8d7e4d6e
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
56 private Set<String> branches; |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
57 |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
58 public HgIncomingCommand(HgRepository hgRepo) { |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
59 localRepo = hgRepo; |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
60 } |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
61 |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
62 public HgIncomingCommand against(HgRemoteRepository hgRemote) { |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
63 remoteRepo = hgRemote; |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
64 comparator = null; |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
65 missingBranches = null; |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
66 return this; |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
67 } |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
68 |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
69 /** |
194
344e8d7e4d6e
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
70 * Select specific branch to push. |
344e8d7e4d6e
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
71 * Multiple branch specification possible (changeset from any of these would be included in result). |
419
7f136a3fa671
Clean javadoc to fix obvious warnings
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
72 * Note, {@link #executeLite()} does not respect this setting. |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
73 * |
194
344e8d7e4d6e
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
74 * @param branch - branch name, case-sensitive, non-null. |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
75 * @return <code>this</code> for convenience |
194
344e8d7e4d6e
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
76 * @throws IllegalArgumentException when branch argument is null |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
77 */ |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
78 public HgIncomingCommand branch(String branch) { |
194
344e8d7e4d6e
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
79 if (branch == null) { |
344e8d7e4d6e
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
80 throw new IllegalArgumentException(); |
344e8d7e4d6e
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
81 } |
344e8d7e4d6e
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
82 if (branches == null) { |
344e8d7e4d6e
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
83 branches = new TreeSet<String>(); |
344e8d7e4d6e
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
84 } |
344e8d7e4d6e
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
85 branches.add(branch); |
344e8d7e4d6e
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
86 return this; |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
87 } |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
88 |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
89 /** |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
90 * PLACEHOLDER, NOT IMPLEMENTED YET. |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
91 * |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
92 * Whether to include sub-repositories when collecting changes, default is <code>true</code> XXX or false? |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
93 * @return <code>this</code> for convenience |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
94 */ |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
95 public HgIncomingCommand subrepo(boolean include) { |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
96 includeSubrepo = include; |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
97 throw HgRepository.notImplemented(); |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
98 } |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
99 |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
100 /** |
194
344e8d7e4d6e
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
101 * Lightweight check for incoming changes, gives only list of revisions to pull. |
344e8d7e4d6e
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
102 * Reported changes are from any branch (limits set by {@link #branch(String)} are not taken into account. |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
103 * |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
104 * @return list of nodes present at remote and missing locally |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
275
diff
changeset
|
105 * @throws HgRemoteConnectionException when failed to communicate with remote repository |
427
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
106 * @throws HgException subclass thereof to indicate specific issue with the command arguments or repository state |
380
9517df1ef7ec
Comments/javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
366
diff
changeset
|
107 * @throws CancelledException if execution of the command was cancelled |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
108 */ |
427
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
109 public List<Nodeid> executeLite() throws HgException, CancelledException { |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
110 try { |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
111 LinkedHashSet<Nodeid> result = new LinkedHashSet<Nodeid>(); |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
112 RepositoryComparator repoCompare = getComparator(); |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
113 for (BranchChain bc : getMissingBranches()) { |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
114 List<Nodeid> missing = repoCompare.visitBranches(bc); |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
115 HashSet<Nodeid> common = new HashSet<Nodeid>(); // ordering is irrelevant |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
116 repoCompare.collectKnownRoots(bc, common); |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
117 // missing could only start with common elements. Once non-common, rest is just distinct branch revision trails. |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
118 for (Iterator<Nodeid> it = missing.iterator(); it.hasNext() && common.contains(it.next()); it.remove()) ; |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
119 result.addAll(missing); |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
120 } |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
121 ArrayList<Nodeid> rv = new ArrayList<Nodeid>(result); |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
122 return rv; |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
123 } catch (HgRuntimeException ex) { |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
124 throw new HgLibraryFailureException(ex); |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
125 } |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
126 } |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
127 |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
128 /** |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
129 * Full information about incoming changes |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
130 * |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
275
diff
changeset
|
131 * @throws HgCallbackTargetException to re-throw exception from the handler |
427
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
132 * @throws HgException subclass thereof to indicate specific issue with the command arguments or repository state |
380
9517df1ef7ec
Comments/javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
366
diff
changeset
|
133 * @throws CancelledException if execution of the command was cancelled |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
134 */ |
427
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
135 public void executeFull(final HgChangesetHandler handler) throws HgCallbackTargetException, HgException, CancelledException { |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
136 if (handler == null) { |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
137 throw new IllegalArgumentException("Delegate can't be null"); |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
138 } |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
208
diff
changeset
|
139 final List<Nodeid> common = getCommon(); |
202
706bcc7cfee4
Basic test for HgIncomingCommand. Fix RepositoryComparator for cases when whole repository is unknown. Respect freshly initialized (empty) repositories in general.
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
195
diff
changeset
|
140 HgBundle changegroup = remoteRepo.getChanges(common); |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
208
diff
changeset
|
141 final ProgressSupport ps = getProgressSupport(handler); |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
142 try { |
322
d68dcb3b5f49
Propagate command's CancelSupport to low-level API. CancelSupport from context got priority over one from command
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
143 final ChangesetTransformer transformer = new ChangesetTransformer(localRepo, handler, getParentHelper(), ps, getCancelSupport(handler, true)); |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
208
diff
changeset
|
144 transformer.limitBranches(branches); |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
145 changegroup.changes(localRepo, new HgChangelog.Inspector() { |
208
ef8eba4aa215
Correct index of revisions to be added into a repository
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
146 private int localIndex; |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
147 private final HgChangelog.ParentWalker parentHelper; |
208
ef8eba4aa215
Correct index of revisions to be added into a repository
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
148 |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
149 { |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
150 parentHelper = getParentHelper(); |
208
ef8eba4aa215
Correct index of revisions to be added into a repository
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
151 // new revisions, if any, would be added after all existing, and would get numbered started with last+1 |
ef8eba4aa215
Correct index of revisions to be added into a repository
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
152 localIndex = localRepo.getChangelog().getRevisionCount(); |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
153 } |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
154 |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
155 public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) { |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
156 if (parentHelper.knownNode(nodeid)) { |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
157 if (!common.contains(nodeid)) { |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
158 throw new HgInvalidStateException("Bundle shall not report known nodes other than roots we've supplied"); |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
159 } |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
160 return; |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
161 } |
208
ef8eba4aa215
Correct index of revisions to be added into a repository
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
162 transformer.next(localIndex++, nodeid, cset); |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
163 } |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
164 }); |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
208
diff
changeset
|
165 transformer.checkFailure(); |
427
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
166 } catch (HgRuntimeException ex) { |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
167 throw new HgLibraryFailureException(ex); |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
208
diff
changeset
|
168 } finally { |
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
208
diff
changeset
|
169 ps.done(); |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
170 } |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
171 } |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
172 |
366
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
322
diff
changeset
|
173 private RepositoryComparator getComparator() throws HgInvalidControlFileException, CancelledException { |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
174 if (remoteRepo == null) { |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
208
diff
changeset
|
175 throw new IllegalArgumentException("Shall specify remote repository to compare against", null); |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
176 } |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
177 if (comparator == null) { |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
178 comparator = new RepositoryComparator(getParentHelper(), remoteRepo); |
202
706bcc7cfee4
Basic test for HgIncomingCommand. Fix RepositoryComparator for cases when whole repository is unknown. Respect freshly initialized (empty) repositories in general.
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
195
diff
changeset
|
179 // comparator.compare(context); // XXX meanwhile we use distinct path to calculate common |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
180 } |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
181 return comparator; |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
182 } |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
183 |
366
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
322
diff
changeset
|
184 private HgChangelog.ParentWalker getParentHelper() throws HgInvalidControlFileException { |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
185 if (parentHelper == null) { |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
186 parentHelper = localRepo.getChangelog().new ParentWalker(); |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
187 parentHelper.init(); |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
188 } |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
189 return parentHelper; |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
190 } |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
191 |
366
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
322
diff
changeset
|
192 private List<BranchChain> getMissingBranches() throws HgRemoteConnectionException, HgInvalidControlFileException, CancelledException { |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
193 if (missingBranches == null) { |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
208
diff
changeset
|
194 missingBranches = getComparator().calculateMissingBranches(); |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
195 } |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
196 return missingBranches; |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
197 } |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
198 |
366
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
322
diff
changeset
|
199 private List<Nodeid> getCommon() throws HgRemoteConnectionException, HgInvalidControlFileException, CancelledException { |
202
706bcc7cfee4
Basic test for HgIncomingCommand. Fix RepositoryComparator for cases when whole repository is unknown. Respect freshly initialized (empty) repositories in general.
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
195
diff
changeset
|
200 // return getComparator(context).getCommon(); |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
201 final LinkedHashSet<Nodeid> common = new LinkedHashSet<Nodeid>(); |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
202 // XXX common can be obtained from repoCompare, but at the moment it would almost duplicate work of calculateMissingBranches |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
203 // once I refactor latter, common shall be taken from repoCompare. |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
208
diff
changeset
|
204 RepositoryComparator repoCompare = getComparator(); |
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
208
diff
changeset
|
205 for (BranchChain bc : getMissingBranches()) { |
202
706bcc7cfee4
Basic test for HgIncomingCommand. Fix RepositoryComparator for cases when whole repository is unknown. Respect freshly initialized (empty) repositories in general.
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
195
diff
changeset
|
206 repoCompare.collectKnownRoots(bc, common); |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
207 } |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
181
diff
changeset
|
208 return new LinkedList<Nodeid>(common); |
181
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
209 } |
cd3371670f0b
Refactor incoming and outgoing code to be shared with RepositoryComparator. Placeholders for in/out commands. Refactor common remote lookup code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
210 } |