Mercurial > jhg
annotate src/org/tmatesoft/hg/core/HgPullCommand.java @ 669:b1a3a056d7e6
Pull: sample command-line utility
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 11 Jul 2013 20:49:33 +0200 |
parents | d25f0324a27a |
children | d2552e6a5af6 |
rev | line source |
---|---|
660
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
1 /* |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2013 TMate Software Ltd |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
3 * |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
6 * the Free Software Foundation; version 2 of the License. |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
7 * |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
11 * GNU General Public License for more details. |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
12 * |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
13 * For information on how to redistribute this software under |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
14 * the terms of a license other than GNU General Public License |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
15 * contact TMate Software at support@hg4j.com |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 */ |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
17 package org.tmatesoft.hg.core; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
18 |
663
46b56864b483
Pull: phase2 - update phases from remote, fncache with added files. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
660
diff
changeset
|
19 import java.util.Collection; |
46b56864b483
Pull: phase2 - update phases from remote, fncache with added files. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
660
diff
changeset
|
20 import java.util.Collections; |
660
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
21 import java.util.List; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
22 |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
23 import org.tmatesoft.hg.internal.AddRevInspector; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
24 import org.tmatesoft.hg.internal.COWTransaction; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
25 import org.tmatesoft.hg.internal.Internals; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
26 import org.tmatesoft.hg.internal.PhasesHelper; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
27 import org.tmatesoft.hg.internal.RepositoryComparator; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
28 import org.tmatesoft.hg.internal.RevisionSet; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
29 import org.tmatesoft.hg.internal.Transaction; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
30 import org.tmatesoft.hg.repo.HgBundle; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
31 import org.tmatesoft.hg.repo.HgChangelog; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
32 import org.tmatesoft.hg.repo.HgInternals; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
33 import org.tmatesoft.hg.repo.HgParentChildMap; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
34 import org.tmatesoft.hg.repo.HgRemoteRepository; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
35 import org.tmatesoft.hg.repo.HgRepository; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
36 import org.tmatesoft.hg.repo.HgRuntimeException; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
37 import org.tmatesoft.hg.util.CancelledException; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
38 import org.tmatesoft.hg.util.ProgressSupport; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
39 |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
40 /** |
664
ae2d439fbed3
Utilize transaction when writing fncache. Better HgIOException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
663
diff
changeset
|
41 * 'hg pull <remote>' counterpart, get remote changes to local repository |
660
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
42 * |
664
ae2d439fbed3
Utilize transaction when writing fncache. Better HgIOException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
663
diff
changeset
|
43 * @since 1.2 |
660
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
44 * @author Artem Tikhomirov |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
45 * @author TMate Software Ltd. |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
46 */ |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
47 public class HgPullCommand extends HgAbstractCommand<HgPullCommand> { |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
48 |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
49 private final HgRepository repo; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
50 private HgRemoteRepository remote; |
663
46b56864b483
Pull: phase2 - update phases from remote, fncache with added files. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
660
diff
changeset
|
51 private RevisionSet added; |
660
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
52 |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
53 public HgPullCommand(HgRepository hgRepo) { |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
54 repo = hgRepo; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
55 } |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
56 |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
57 public HgPullCommand source(HgRemoteRepository hgRemote) { |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
58 remote = hgRemote; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
59 return this; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
60 } |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
61 |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
62 public void execute() throws HgRemoteConnectionException, HgIOException, HgLibraryFailureException, CancelledException { |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
63 final ProgressSupport progress = getProgressSupport(null); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
64 try { |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
65 progress.start(100); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
66 // TODO refactor same code in HgIncomingCommand #getComparator and #getParentHelper |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
67 final HgChangelog clog = repo.getChangelog(); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
68 final HgParentChildMap<HgChangelog> parentHelper = new HgParentChildMap<HgChangelog>(clog); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
69 parentHelper.init(); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
70 final RepositoryComparator comparator = new RepositoryComparator(parentHelper, remote); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
71 // get incoming revisions |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
72 comparator.compare(new ProgressSupport.Sub(progress, 50), getCancelSupport(null, true)); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
73 final List<Nodeid> common = comparator.getCommon(); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
74 // get bundle with changes from remote |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
75 HgBundle incoming = remote.getChanges(common); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
76 // |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
77 // add revisions to changelog, manifest, files |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
78 final Internals implRepo = HgInternals.getImplementationRepo(repo); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
79 final AddRevInspector insp; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
80 Transaction.Factory trFactory = new COWTransaction.Factory(); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
81 Transaction tr = trFactory.create(repo); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
82 try { |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
83 incoming.inspectAll(insp = new AddRevInspector(implRepo, tr)); |
663
46b56864b483
Pull: phase2 - update phases from remote, fncache with added files. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
660
diff
changeset
|
84 insp.done(); |
660
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
85 tr.commit(); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
86 } catch (HgRuntimeException ex) { |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
87 tr.rollback(); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
88 throw ex; |
664
ae2d439fbed3
Utilize transaction when writing fncache. Better HgIOException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
663
diff
changeset
|
89 } catch (HgIOException ex) { |
663
46b56864b483
Pull: phase2 - update phases from remote, fncache with added files. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
660
diff
changeset
|
90 tr.rollback(); |
664
ae2d439fbed3
Utilize transaction when writing fncache. Better HgIOException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
663
diff
changeset
|
91 throw ex; |
660
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
92 } catch (RuntimeException ex) { |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
93 tr.rollback(); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
94 throw ex; |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
95 } |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
96 progress.worked(45); |
663
46b56864b483
Pull: phase2 - update phases from remote, fncache with added files. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
660
diff
changeset
|
97 added = insp.addedChangesets(); |
660
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
98 |
663
46b56864b483
Pull: phase2 - update phases from remote, fncache with added files. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
660
diff
changeset
|
99 if (!added.isEmpty()) { |
46b56864b483
Pull: phase2 - update phases from remote, fncache with added files. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
660
diff
changeset
|
100 // FIXME refresh parentHelper with newly added revisions in effective way |
46b56864b483
Pull: phase2 - update phases from remote, fncache with added files. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
660
diff
changeset
|
101 parentHelper.init(); |
46b56864b483
Pull: phase2 - update phases from remote, fncache with added files. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
660
diff
changeset
|
102 } |
660
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
103 // get remote phases, update local phases to match that of remote |
663
46b56864b483
Pull: phase2 - update phases from remote, fncache with added files. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
660
diff
changeset
|
104 // do not update any remote phase (it's pull, after all) |
660
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
105 final PhasesHelper phaseHelper = new PhasesHelper(implRepo, parentHelper); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
106 if (phaseHelper.isCapableOfPhases()) { |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
107 RevisionSet rsCommon = new RevisionSet(common); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
108 HgRemoteRepository.Phases remotePhases = remote.getPhases(); |
663
46b56864b483
Pull: phase2 - update phases from remote, fncache with added files. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
660
diff
changeset
|
109 phaseHelper.synchronizeWithRemote(remotePhases, rsCommon.union(added)); |
660
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
110 } |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
111 progress.worked(5); |
668
d25f0324a27a
Delete bundle with push/pull changes once command completes successfully. Test for bundle generator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
664
diff
changeset
|
112 incoming.unlink(); // keep the file only in case of failure |
660
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
113 } catch (HgRuntimeException ex) { |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
114 throw new HgLibraryFailureException(ex); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
115 } finally { |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
116 progress.done(); |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
117 } |
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
118 } |
663
46b56864b483
Pull: phase2 - update phases from remote, fncache with added files. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
660
diff
changeset
|
119 |
46b56864b483
Pull: phase2 - update phases from remote, fncache with added files. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
660
diff
changeset
|
120 public Collection<Nodeid> getPulledRevisions() { |
46b56864b483
Pull: phase2 - update phases from remote, fncache with added files. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
660
diff
changeset
|
121 return added == null ? Collections.<Nodeid>emptyList() : added.asList(); |
46b56864b483
Pull: phase2 - update phases from remote, fncache with added files. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
660
diff
changeset
|
122 } |
660
4fd317a2fecf
Pull: phase1 get remote changes and add local revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
123 } |