Mercurial > jhg
comparison src/org/tmatesoft/hg/core/HgOutgoingCommand.java @ 195:c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Fri, 15 Apr 2011 05:17:44 +0200 |
| parents | 344e8d7e4d6e |
| children | ffc5f6d59f7e |
comparison
equal
deleted
inserted
replaced
| 194:344e8d7e4d6e | 195:c9b305df0b89 |
|---|---|
| 36 | 36 |
| 37 private final HgRepository localRepo; | 37 private final HgRepository localRepo; |
| 38 private HgRemoteRepository remoteRepo; | 38 private HgRemoteRepository remoteRepo; |
| 39 private boolean includeSubrepo; | 39 private boolean includeSubrepo; |
| 40 private RepositoryComparator comparator; | 40 private RepositoryComparator comparator; |
| 41 private HgChangelog.ParentWalker parentHelper; | |
| 41 private Set<String> branches; | 42 private Set<String> branches; |
| 42 | 43 |
| 43 public HgOutgoingCommand(HgRepository hgRepo) { | 44 public HgOutgoingCommand(HgRepository hgRepo) { |
| 44 localRepo = hgRepo; | 45 localRepo = hgRepo; |
| 45 } | 46 } |
| 102 */ | 103 */ |
| 103 public void executeFull(final HgLogCommand.Handler handler) throws HgException, CancelledException { | 104 public void executeFull(final HgLogCommand.Handler handler) throws HgException, CancelledException { |
| 104 if (handler == null) { | 105 if (handler == null) { |
| 105 throw new IllegalArgumentException("Delegate can't be null"); | 106 throw new IllegalArgumentException("Delegate can't be null"); |
| 106 } | 107 } |
| 107 ChangesetTransformer inspector = new ChangesetTransformer(localRepo, handler); | 108 ChangesetTransformer inspector = new ChangesetTransformer(localRepo, handler, getParentHelper()); |
| 108 inspector.limitBranches(branches); | 109 inspector.limitBranches(branches); |
| 109 getComparator(handler).visitLocalOnlyRevisions(inspector); | 110 getComparator(handler).visitLocalOnlyRevisions(inspector); |
| 110 } | 111 } |
| 111 | 112 |
| 112 private RepositoryComparator getComparator(Object context) throws HgException, CancelledException { | 113 private RepositoryComparator getComparator(Object context) throws HgException, CancelledException { |
| 113 if (remoteRepo == null) { | 114 if (remoteRepo == null) { |
| 114 throw new IllegalArgumentException("Shall specify remote repository to compare against"); | 115 throw new IllegalArgumentException("Shall specify remote repository to compare against"); |
| 115 } | 116 } |
| 116 if (comparator == null) { | 117 if (comparator == null) { |
| 117 HgChangelog.ParentWalker pw = localRepo.getChangelog().new ParentWalker(); | 118 comparator = new RepositoryComparator(getParentHelper(), remoteRepo); |
| 118 pw.init(); | |
| 119 comparator = new RepositoryComparator(pw, remoteRepo); | |
| 120 comparator.compare(context); | 119 comparator.compare(context); |
| 121 } | 120 } |
| 122 return comparator; | 121 return comparator; |
| 123 } | 122 } |
| 123 | |
| 124 private HgChangelog.ParentWalker getParentHelper() { | |
| 125 if (parentHelper == null) { | |
| 126 parentHelper = localRepo.getChangelog().new ParentWalker(); | |
| 127 parentHelper.init(); | |
| 128 } | |
| 129 return parentHelper; | |
| 130 } | |
| 131 | |
| 124 } | 132 } |
