comparison src/org/tmatesoft/hg/internal/RepositoryComparator.java @ 652:cd77bf51b562

Push: tests. Commit respects phases.new-commit setting. Fix outgoing when changes are not children of common (Issue 47)
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 02 Jul 2013 23:21:16 +0200
parents 14dac192aa26
children 629a7370554c
comparison
equal deleted inserted replaced
651:6e98d34eaca8 652:cd77bf51b562
93 public List<Nodeid> getLocalOnlyRevisions() { 93 public List<Nodeid> getLocalOnlyRevisions() {
94 final List<Nodeid> c = getCommon(); 94 final List<Nodeid> c = getCommon();
95 if (c.isEmpty()) { 95 if (c.isEmpty()) {
96 return localRepo.all(); 96 return localRepo.all();
97 } else { 97 } else {
98 return localRepo.childrenOf(c); 98 RevisionSet localHeads = new RevisionSet(localRepo.heads());
99 final List<Nodeid> commonChildren = localRepo.childrenOf(c);
100 final RevisionSet rsCommonChildren = new RevisionSet(commonChildren);
101 RevisionSet headsNotFromCommon = localHeads.subtract(rsCommonChildren);
102 if (headsNotFromCommon.isEmpty()) {
103 return commonChildren;
104 }
105 RevisionSet all = new RevisionSet(localRepo.all());
106 final RevisionSet rsCommon = new RevisionSet(c);
107 RevisionSet rsAncestors = all.ancestors(headsNotFromCommon, localRepo);
108 // #ancestors gives only parents, we need terminating children as well
109 rsAncestors = rsAncestors.union(headsNotFromCommon);
110 final RevisionSet rsAncestorsCommon = all.ancestors(rsCommon, localRepo);
111 RevisionSet outgoing = rsAncestors.subtract(rsAncestorsCommon).subtract(rsCommon);
112 return outgoing.union(rsCommonChildren).asList();
99 } 113 }
100 } 114 }
101 115
102 /** 116 /**
103 * Similar to @link {@link #getLocalOnlyRevisions()}, use this one if you need access to changelog entry content, not 117 * Similar to @link {@link #getLocalOnlyRevisions()}, use this one if you need access to changelog entry content, not