comparison src/org/tmatesoft/hg/internal/RepositoryComparator.java @ 654:12a4f60ea972

1) Console push tool. 2) Pass class to blame into FileUtils
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 03 Jul 2013 15:11:40 +0200
parents 629a7370554c
children 822f3a83ff57
comparison
equal deleted inserted replaced
653:629a7370554c 654:12a4f60ea972
92 public List<Nodeid> getLocalOnlyRevisions() { 92 public List<Nodeid> getLocalOnlyRevisions() {
93 final List<Nodeid> c = getCommon(); 93 final List<Nodeid> c = getCommon();
94 if (c.isEmpty()) { 94 if (c.isEmpty()) {
95 return localRepo.all(); 95 return localRepo.all();
96 } else { 96 } else {
97 RevisionSet localHeads = new RevisionSet(localRepo.heads()); 97 final RevisionSet rsCommon = new RevisionSet(c);
98 final RevisionSet localHeads = new RevisionSet(localRepo.heads());
98 final List<Nodeid> commonChildren = localRepo.childrenOf(c); 99 final List<Nodeid> commonChildren = localRepo.childrenOf(c);
99 final RevisionSet rsCommonChildren = new RevisionSet(commonChildren); 100 final RevisionSet rsCommonChildren = new RevisionSet(commonChildren);
100 RevisionSet headsNotFromCommon = localHeads.subtract(rsCommonChildren); 101 // check if there's any revision in the repository that doesn't trace to common
102 // e.g. branches from one of common ancestors
103 RevisionSet headsNotFromCommon = localHeads.subtract(rsCommonChildren).subtract(rsCommon);
101 if (headsNotFromCommon.isEmpty()) { 104 if (headsNotFromCommon.isEmpty()) {
102 return commonChildren; 105 return commonChildren;
103 } 106 }
104 RevisionSet all = new RevisionSet(localRepo.all()); 107 RevisionSet all = new RevisionSet(localRepo.all());
105 final RevisionSet rsCommon = new RevisionSet(c); 108 // need outgoing := ancestors(missing) - ancestors(common):
106 RevisionSet rsAncestors = all.ancestors(headsNotFromCommon, localRepo); 109 RevisionSet rsAncestors = all.ancestors(headsNotFromCommon, localRepo);
107 // #ancestors gives only parents, we need terminating children as well 110 // #ancestors gives only parents, we need terminating children as well
108 rsAncestors = rsAncestors.union(headsNotFromCommon); 111 rsAncestors = rsAncestors.union(headsNotFromCommon);
109 final RevisionSet rsAncestorsCommon = all.ancestors(rsCommon, localRepo); 112 final RevisionSet rsAncestorsCommon = all.ancestors(rsCommon, localRepo);
110 RevisionSet outgoing = rsAncestors.subtract(rsAncestorsCommon).subtract(rsCommon); 113 RevisionSet outgoing = rsAncestors.subtract(rsAncestorsCommon).subtract(rsCommon);
114 // outgoing keeps children that spined off prior to common revisions
111 return outgoing.union(rsCommonChildren).asList(); 115 return outgoing.union(rsCommonChildren).asList();
112 } 116 }
113 } 117 }
114 118
115 private List<Nodeid> findCommonWithRemote() throws HgRemoteConnectionException { 119 private List<Nodeid> findCommonWithRemote() throws HgRemoteConnectionException {