Mercurial > hg4j
comparison src/org/tmatesoft/hg/core/HgPushCommand.java @ 646:3b7d51ed4c65
Push: phase3 - update matching remote bookmarks
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Fri, 21 Jun 2013 18:30:35 +0200 |
| parents | 14dac192aa26 |
| children | e79cf9a8130b |
comparison
equal
deleted
inserted
replaced
| 645:14dac192aa26 | 646:3b7d51ed4c65 |
|---|---|
| 21 import java.net.URL; | 21 import java.net.URL; |
| 22 import java.util.List; | 22 import java.util.List; |
| 23 | 23 |
| 24 import org.tmatesoft.hg.internal.BundleGenerator; | 24 import org.tmatesoft.hg.internal.BundleGenerator; |
| 25 import org.tmatesoft.hg.internal.RepositoryComparator; | 25 import org.tmatesoft.hg.internal.RepositoryComparator; |
| 26 import org.tmatesoft.hg.repo.HgBookmarks; | |
| 26 import org.tmatesoft.hg.repo.HgBundle; | 27 import org.tmatesoft.hg.repo.HgBundle; |
| 27 import org.tmatesoft.hg.repo.HgChangelog; | 28 import org.tmatesoft.hg.repo.HgChangelog; |
| 28 import org.tmatesoft.hg.repo.HgInternals; | 29 import org.tmatesoft.hg.repo.HgInternals; |
| 29 import org.tmatesoft.hg.repo.HgInvalidStateException; | 30 import org.tmatesoft.hg.repo.HgInvalidStateException; |
| 30 import org.tmatesoft.hg.repo.HgLookup; | 31 import org.tmatesoft.hg.repo.HgLookup; |
| 31 import org.tmatesoft.hg.repo.HgParentChildMap; | 32 import org.tmatesoft.hg.repo.HgParentChildMap; |
| 32 import org.tmatesoft.hg.repo.HgRemoteRepository; | 33 import org.tmatesoft.hg.repo.HgRemoteRepository; |
| 33 import org.tmatesoft.hg.repo.HgRepository; | 34 import org.tmatesoft.hg.repo.HgRepository; |
| 34 import org.tmatesoft.hg.repo.HgRuntimeException; | 35 import org.tmatesoft.hg.repo.HgRuntimeException; |
| 35 import org.tmatesoft.hg.util.CancelledException; | 36 import org.tmatesoft.hg.util.CancelledException; |
| 37 import org.tmatesoft.hg.util.Pair; | |
| 36 import org.tmatesoft.hg.util.ProgressSupport; | 38 import org.tmatesoft.hg.util.ProgressSupport; |
| 37 | 39 |
| 38 /** | 40 /** |
| 39 * | 41 * |
| 40 * @author Artem Tikhomirov | 42 * @author Artem Tikhomirov |
| 79 // | 81 // |
| 80 // FIXME update phase information | 82 // FIXME update phase information |
| 81 // remote.listkeys("phases"); | 83 // remote.listkeys("phases"); |
| 82 progress.worked(5); | 84 progress.worked(5); |
| 83 // | 85 // |
| 84 // FIXME update bookmark information | 86 // update bookmark information |
| 87 HgBookmarks localBookmarks = repo.getBookmarks(); | |
| 88 if (!localBookmarks.getAllBookmarks().isEmpty()) { | |
| 89 for (Pair<String,Nodeid> bm : remoteRepo.bookmarks()) { | |
| 90 Nodeid localRevision = localBookmarks.getRevision(bm.first()); | |
| 91 if (localRevision == null || !parentHelper.knownNode(bm.second())) { | |
| 92 continue; | |
| 93 } | |
| 94 // we know both localRevision and revision of remote bookmark, | |
| 95 // need to make sure we don't push older revision than it's at the server | |
| 96 if (parentHelper.isChild(bm.second(), localRevision)) { | |
| 97 remoteRepo.updateBookmark(bm.first(), bm.second(), localRevision); | |
| 98 } | |
| 99 } | |
| 100 } | |
| 85 // remote.listkeys("bookmarks"); | 101 // remote.listkeys("bookmarks"); |
| 102 // XXX WTF is obsolete in namespaces key?? | |
| 86 progress.worked(5); | 103 progress.worked(5); |
| 87 } catch (IOException ex) { | 104 } catch (IOException ex) { |
| 88 throw new HgIOException(ex.getMessage(), null); // XXX not a nice idea to throw IOException from BundleGenerator#create | 105 throw new HgIOException(ex.getMessage(), null); // XXX not a nice idea to throw IOException from BundleGenerator#create |
| 89 } catch (HgRepositoryNotFoundException ex) { | 106 } catch (HgRepositoryNotFoundException ex) { |
| 90 final HgInvalidStateException e = new HgInvalidStateException("Failed to load a just-created bundle"); | 107 final HgInvalidStateException e = new HgInvalidStateException("Failed to load a just-created bundle"); |
