Mercurial > jhg
annotate src/org/tmatesoft/hg/internal/RevisionSet.java @ 651:6e98d34eaca8
Push: tests (push to empty, push changes, respect secret)
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 01 Jul 2013 21:19:53 +0200 |
parents | 3b275cc2d2aa |
children | cd77bf51b562 |
rev | line source |
---|---|
648
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
1 /* |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2013 TMate Software Ltd |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
3 * |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
6 * the Free Software Foundation; version 2 of the License. |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
7 * |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
11 * GNU General Public License for more details. |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
12 * |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
13 * For information on how to redistribute this software under |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
14 * the terms of a license other than GNU General Public License |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
15 * contact TMate Software at support@hg4j.com |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 */ |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
17 package org.tmatesoft.hg.internal; |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
18 |
649
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
19 import java.util.ArrayList; |
648
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
20 import java.util.Collection; |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
21 import java.util.Collections; |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
22 import java.util.HashSet; |
649
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
23 import java.util.Iterator; |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
24 import java.util.List; |
648
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
25 import java.util.Set; |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
26 |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
27 import org.tmatesoft.hg.core.Nodeid; |
649
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
28 import org.tmatesoft.hg.repo.HgChangelog; |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
29 import org.tmatesoft.hg.repo.HgParentChildMap; |
648
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
30 |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
31 /** |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
32 * Unmodifiable collection of revisions with handy set operations |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
33 * |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
34 * @author Artem Tikhomirov |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
35 * @author TMate Software Ltd. |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
36 */ |
649
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
37 public final class RevisionSet implements Iterable<Nodeid> { |
648
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
38 |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
39 private final Set<Nodeid> elements; |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
40 |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
41 public RevisionSet(Collection<Nodeid> revisions) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
42 this(revisions == null ? new HashSet<Nodeid>() : new HashSet<Nodeid>(revisions)); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
43 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
44 |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
45 private RevisionSet(HashSet<Nodeid> revisions) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
46 if (revisions.isEmpty()) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
47 elements = Collections.<Nodeid>emptySet(); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
48 } else { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
49 elements = revisions; |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
50 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
51 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
52 |
649
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
53 /** |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
54 * elements of the set with no parents or parents not from the same set |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
55 */ |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
56 public RevisionSet roots(HgParentChildMap<HgChangelog> ph) { |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
57 HashSet<Nodeid> copy = new HashSet<Nodeid>(elements); |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
58 for (Nodeid n : elements) { |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
59 assert ph.knownNode(n); |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
60 Nodeid p1 = ph.firstParent(n); |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
61 if (p1 != null && elements.contains(p1)) { |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
62 copy.remove(n); |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
63 continue; |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
64 } |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
65 Nodeid p2 = ph.secondParent(n); |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
66 if (p2 != null && elements.contains(p2)) { |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
67 copy.remove(n); |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
68 continue; |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
69 } |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
70 } |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
71 return copy.size() == elements.size() ? this : new RevisionSet(copy); |
648
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
72 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
73 |
649
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
74 /** |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
75 * elements of the set that has no children in this set |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
76 */ |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
77 public RevisionSet heads(HgParentChildMap<HgChangelog> ph) { |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
78 HashSet<Nodeid> copy = new HashSet<Nodeid>(elements); |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
79 // can't do copy.removeAll(ph.childrenOf(asList())); as actual heads are indeed children of some other node |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
80 for (Nodeid n : elements) { |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
81 assert ph.knownNode(n); |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
82 Nodeid p1 = ph.firstParent(n); |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
83 Nodeid p2 = ph.secondParent(n); |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
84 if (p1 != null && elements.contains(p1)) { |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
85 copy.remove(p1); |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
86 } |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
87 if (p2 != null && elements.contains(p2)) { |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
88 copy.remove(p2); |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
89 } |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
90 } |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
91 return copy.size() == elements.size() ? this : new RevisionSet(copy); |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
92 } |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
93 |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
94 /** |
651
6e98d34eaca8
Push: tests (push to empty, push changes, respect secret)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
650
diff
changeset
|
95 * Any ancestor of an element from the supplied child set found in this one. |
6e98d34eaca8
Push: tests (push to empty, push changes, respect secret)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
650
diff
changeset
|
96 * Elements of the supplied child set are not part of return value. |
649
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
97 */ |
650
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
98 public RevisionSet ancestors(RevisionSet children, HgParentChildMap<HgChangelog> parentHelper) { |
649
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
99 if (isEmpty()) { |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
100 return this; |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
101 } |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
102 if (children.isEmpty()) { |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
103 return children; |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
104 } |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
105 RevisionSet chRoots = children.roots(parentHelper); |
650
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
106 HashSet<Nodeid> ancestors = new HashSet<Nodeid>(); |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
107 Set<Nodeid> childrenToCheck = chRoots.elements; |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
108 while (!childrenToCheck.isEmpty()) { |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
109 HashSet<Nodeid> nextRound = new HashSet<Nodeid>(); |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
110 for (Nodeid n : childrenToCheck) { |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
111 Nodeid p1 = parentHelper.firstParent(n); |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
112 Nodeid p2 = parentHelper.secondParent(n); |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
113 if (p1 != null && elements.contains(p1)) { |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
114 nextRound.add(p1); |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
115 } |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
116 if (p2 != null && elements.contains(p2)) { |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
117 nextRound.add(p2); |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
118 } |
649
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
119 } |
650
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
120 ancestors.addAll(nextRound); |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
121 childrenToCheck = nextRound; |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
122 } |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
123 return new RevisionSet(ancestors); |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
124 } |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
125 |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
126 /** |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
127 * Revisions that are both direct and indirect children of elements of this revision set |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
128 * as known in supplied parent-child map |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
129 */ |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
130 public RevisionSet children(HgParentChildMap<HgChangelog> parentHelper) { |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
131 if (isEmpty()) { |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
132 return this; |
649
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
133 } |
650
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
134 List<Nodeid> children = parentHelper.childrenOf(elements); |
3b275cc2d2aa
Push: phase4 - settle local and remote phases, push updated phases regardless of server publishing state, do not push secret changesets
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
649
diff
changeset
|
135 return new RevisionSet(new HashSet<Nodeid>(children)); |
648
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
136 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
137 |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
138 public RevisionSet intersect(RevisionSet other) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
139 if (isEmpty()) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
140 return this; |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
141 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
142 if (other.isEmpty()) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
143 return other; |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
144 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
145 HashSet<Nodeid> copy = new HashSet<Nodeid>(elements); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
146 copy.retainAll(other.elements); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
147 return copy.size() == elements.size() ? this : new RevisionSet(copy); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
148 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
149 |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
150 public RevisionSet subtract(RevisionSet other) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
151 if (isEmpty() || other.isEmpty()) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
152 return this; |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
153 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
154 HashSet<Nodeid> copy = new HashSet<Nodeid>(elements); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
155 copy.removeAll(other.elements); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
156 return copy.size() == elements.size() ? this : new RevisionSet(copy); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
157 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
158 |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
159 public RevisionSet union(RevisionSet other) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
160 if (isEmpty()) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
161 return other; |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
162 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
163 if (other.isEmpty()) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
164 return this; |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
165 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
166 HashSet<Nodeid> copy = new HashSet<Nodeid>(elements); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
167 copy.addAll(other.elements); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
168 return new RevisionSet(copy); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
169 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
170 |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
171 /** |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
172 * A ^ B := (A\B).union(B\A) |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
173 * A ^ B := A.union(B) \ A.intersect(B) |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
174 */ |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
175 public RevisionSet symmetricDifference(RevisionSet other) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
176 if (isEmpty()) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
177 return this; |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
178 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
179 if (other.isEmpty()) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
180 return other; |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
181 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
182 HashSet<Nodeid> copyA = new HashSet<Nodeid>(elements); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
183 HashSet<Nodeid> copyB = new HashSet<Nodeid>(other.elements); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
184 copyA.removeAll(other.elements); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
185 copyB.removeAll(elements); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
186 copyA.addAll(copyB); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
187 return new RevisionSet(copyA); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
188 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
189 |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
190 public boolean isEmpty() { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
191 return elements.isEmpty(); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
192 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
193 |
651
6e98d34eaca8
Push: tests (push to empty, push changes, respect secret)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
650
diff
changeset
|
194 public int size() { |
6e98d34eaca8
Push: tests (push to empty, push changes, respect secret)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
650
diff
changeset
|
195 return elements.size(); |
6e98d34eaca8
Push: tests (push to empty, push changes, respect secret)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
650
diff
changeset
|
196 } |
649
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
197 |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
198 public List<Nodeid> asList() { |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
199 return new ArrayList<Nodeid>(elements); |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
200 } |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
201 |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
202 public Iterator<Nodeid> iterator() { |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
203 return elements.iterator(); |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
204 } |
e79cf9a8130b
Push: phase4 - update local and remote phase information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
648
diff
changeset
|
205 |
648
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
206 @Override |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
207 public String toString() { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
208 StringBuilder sb = new StringBuilder(); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
209 sb.append('<'); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
210 if (!isEmpty()) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
211 sb.append(elements.size()); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
212 sb.append(':'); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
213 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
214 for (Nodeid n : elements) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
215 sb.append(n.shortNotation()); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
216 sb.append(','); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
217 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
218 if (sb.length() > 1) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
219 sb.setCharAt(sb.length() - 1, '>'); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
220 } else { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
221 sb.append('>'); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
222 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
223 return sb.toString(); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
224 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
225 |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
226 @Override |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
227 public boolean equals(Object obj) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
228 if (false == obj instanceof RevisionSet) { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
229 return false; |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
230 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
231 return elements.equals(((RevisionSet) obj).elements); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
232 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
233 |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
234 @Override |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
235 public int hashCode() { |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
236 return elements.hashCode(); |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
237 } |
690e71d29bf6
Introduced RevisionSet to ease update of phase roots on push
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
238 } |