Mercurial > hg4j
comparison src/org/tmatesoft/hg/core/HgPushCommand.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 | 46b56864b483 |
comparison
equal
deleted
inserted
replaced
653:629a7370554c | 654:12a4f60ea972 |
---|---|
17 package org.tmatesoft.hg.core; | 17 package org.tmatesoft.hg.core; |
18 | 18 |
19 import java.io.File; | 19 import java.io.File; |
20 import java.io.IOException; | 20 import java.io.IOException; |
21 import java.util.ArrayList; | 21 import java.util.ArrayList; |
22 import java.util.Collection; | |
23 import java.util.Collections; | |
22 import java.util.List; | 24 import java.util.List; |
23 | 25 |
24 import org.tmatesoft.hg.internal.BundleGenerator; | 26 import org.tmatesoft.hg.internal.BundleGenerator; |
25 import org.tmatesoft.hg.internal.Internals; | 27 import org.tmatesoft.hg.internal.Internals; |
26 import org.tmatesoft.hg.internal.PhasesHelper; | 28 import org.tmatesoft.hg.internal.PhasesHelper; |
50 */ | 52 */ |
51 public class HgPushCommand extends HgAbstractCommand<HgPushCommand> { | 53 public class HgPushCommand extends HgAbstractCommand<HgPushCommand> { |
52 | 54 |
53 private final HgRepository repo; | 55 private final HgRepository repo; |
54 private HgRemoteRepository remoteRepo; | 56 private HgRemoteRepository remoteRepo; |
57 private RevisionSet outgoing; | |
55 | 58 |
56 public HgPushCommand(HgRepository hgRepo) { | 59 public HgPushCommand(HgRepository hgRepo) { |
57 repo = hgRepo; | 60 repo = hgRepo; |
58 } | 61 } |
59 | 62 |
75 final Internals implRepo = HgInternals.getImplementationRepo(repo); | 78 final Internals implRepo = HgInternals.getImplementationRepo(repo); |
76 final PhasesHelper phaseHelper = new PhasesHelper(implRepo, parentHelper); | 79 final PhasesHelper phaseHelper = new PhasesHelper(implRepo, parentHelper); |
77 final RepositoryComparator comparator = new RepositoryComparator(parentHelper, remoteRepo); | 80 final RepositoryComparator comparator = new RepositoryComparator(parentHelper, remoteRepo); |
78 comparator.compare(new ProgressSupport.Sub(progress, 50), getCancelSupport(null, true)); | 81 comparator.compare(new ProgressSupport.Sub(progress, 50), getCancelSupport(null, true)); |
79 List<Nodeid> l = comparator.getLocalOnlyRevisions(); | 82 List<Nodeid> l = comparator.getLocalOnlyRevisions(); |
80 final RevisionSet outgoing; | |
81 if (phaseHelper.isCapableOfPhases() && phaseHelper.withSecretRoots()) { | 83 if (phaseHelper.isCapableOfPhases() && phaseHelper.withSecretRoots()) { |
82 RevisionSet secret = phaseHelper.allSecret(); | 84 RevisionSet secret = phaseHelper.allSecret(); |
83 outgoing = new RevisionSet(l).subtract(secret); | 85 outgoing = new RevisionSet(l).subtract(secret); |
84 } else { | 86 } else { |
85 outgoing = new RevisionSet(l); | 87 outgoing = new RevisionSet(l); |
195 } finally { | 197 } finally { |
196 progress.done(); | 198 progress.done(); |
197 } | 199 } |
198 } | 200 } |
199 | 201 |
202 public Collection<Nodeid> getPushedRevisions() { | |
203 return outgoing == null ? Collections.<Nodeid>emptyList() : outgoing.asList(); | |
204 } | |
205 | |
200 private RevisionSet knownRemoteDrafts(HgRemoteRepository.Phases remotePhases, HgParentChildMap<HgChangelog> parentHelper, RevisionSet outgoing, RevisionSet localSecret) { | 206 private RevisionSet knownRemoteDrafts(HgRemoteRepository.Phases remotePhases, HgParentChildMap<HgChangelog> parentHelper, RevisionSet outgoing, RevisionSet localSecret) { |
201 ArrayList<Nodeid> knownRemoteDraftRoots = new ArrayList<Nodeid>(); | 207 ArrayList<Nodeid> knownRemoteDraftRoots = new ArrayList<Nodeid>(); |
202 for (Nodeid rdr : remotePhases.draftRoots()) { | 208 for (Nodeid rdr : remotePhases.draftRoots()) { |
203 if (parentHelper.knownNode(rdr)) { | 209 if (parentHelper.knownNode(rdr)) { |
204 knownRemoteDraftRoots.add(rdr); | 210 knownRemoteDraftRoots.add(rdr); |