Mercurial > jhg
changeset 205:ffc5f6d59f7e
HgLogCommand.Handler is used in few places, pull up to top-level class, HgChangesetHandler
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 28 Apr 2011 02:00:42 +0200 |
parents | 883f1efbcf27 |
children | 63c9fed4369e |
files | TODO design.txt src/org/tmatesoft/hg/core/ChangesetTransformer.java src/org/tmatesoft/hg/core/HgChangesetHandler.java src/org/tmatesoft/hg/core/HgIncomingCommand.java src/org/tmatesoft/hg/core/HgLogCommand.java src/org/tmatesoft/hg/core/HgOutgoingCommand.java |
diffstat | 7 files changed, 68 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/TODO Tue Apr 26 23:58:15 2011 +0200 +++ b/TODO Thu Apr 28 02:00:42 2011 +0200 @@ -20,15 +20,15 @@ * hg cat + CatCommand. File, revision. - - Cat command line client + + Cat command line client + hgignore + glob + pattern + Tests with JUnit - - allow to specify repo location (system property) - - keep a .zip of repo along with tests + + allow to specify repo location (system property) + + keep a .zip of repo along with tests * tags * Tags are read and can be queried (cmdline Log does) @@ -43,7 +43,7 @@ * API - CommandContext - - Data access - not bytes, but ByteChannel + + Data access - not bytes, but ByteChannel - HgRepository constants (TIP, BAD, WC) to HgRevisions enum Proposed: @@ -52,15 +52,29 @@ - LogCommand.match() to specify pattern, no selected file()s only? * RepositoryFacade and CommandContext - hgignore: read extra ignore files from config file (ui.ignore) +- Revlog iteration in reversed order (either support internally in RevlogStream or externally, windowed access) Read-only support, version 1.1 ============================== Committed: -* http, https and ssh connections: +* Network protocol/connections: + + http + * https (respects no certificates) + - ssh * incoming + + 'lite' (revisions only) + + 'full' (complete changelog) + * branches (no tests) + - subrepositories * outgoing + + 'lite' (revisions only) + + 'full' (complete changelog access) + * branches (no tests) + - subrepositories -- clone remote repo +* clone remote repo + + into new or empty directory + - populate working copy
--- a/design.txt Tue Apr 26 23:58:15 2011 +0200 +++ b/design.txt Thu Apr 28 02:00:42 2011 +0200 @@ -65,6 +65,9 @@ Commands to get CommandContext where they may share various caches (e.g. StatusCollector) Perhaps, abstract classes for all Inspectors (i.e. StatusCollector.Inspector) for users to use as base classes to protect from change? +-cancellation and progress support +-timestamp check for revlog to recognize external changes + >>>> Effective file read/data access ReadOperation, Revlog does: repo.getFileSystem().run(this.file, new ReadOperation(), long start=0, long end = -1) ReadOperation gets buffer (of whatever size, as decided by FS impl), parses it and then reports if needs more data.
--- a/src/org/tmatesoft/hg/core/ChangesetTransformer.java Tue Apr 26 23:58:15 2011 +0200 +++ b/src/org/tmatesoft/hg/core/ChangesetTransformer.java Thu Apr 28 02:00:42 2011 +0200 @@ -19,9 +19,9 @@ import java.util.Set; import org.tmatesoft.hg.repo.HgChangelog; +import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; import org.tmatesoft.hg.repo.HgRepository; import org.tmatesoft.hg.repo.HgStatusCollector; -import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; import org.tmatesoft.hg.util.PathPool; import org.tmatesoft.hg.util.PathRewrite; @@ -32,12 +32,12 @@ * @author TMate Software Ltd. */ /*package-local*/ class ChangesetTransformer implements HgChangelog.Inspector { - private final HgLogCommand.Handler handler; + private final HgChangesetHandler handler; private final HgChangeset changeset; private Set<String> branches; // repo and delegate can't be null, parent walker can - public ChangesetTransformer(HgRepository hgRepo, HgLogCommand.Handler delegate, HgChangelog.ParentWalker pw) { + public ChangesetTransformer(HgRepository hgRepo, HgChangesetHandler delegate, HgChangelog.ParentWalker pw) { if (hgRepo == null || delegate == null) { throw new IllegalArgumentException(); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/org/tmatesoft/hg/core/HgChangesetHandler.java Thu Apr 28 02:00:42 2011 +0200 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2011 TMate Software Ltd + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * For information on how to redistribute this software under + * the terms of a license other than GNU General Public License + * contact TMate Software at support@hg4j.com + */ +package org.tmatesoft.hg.core; + +/** + * Callback to process {@link HgChangeset changesets}. + * + * @author Artem Tikhomirov + * @author TMate Software Ltd. + */ +public interface HgChangesetHandler { + /** + * @param changeset not necessarily a distinct instance each time, {@link HgChangeset#clone() clone()} if need a copy. + */ + void next(HgChangeset changeset); +}
--- a/src/org/tmatesoft/hg/core/HgIncomingCommand.java Tue Apr 26 23:58:15 2011 +0200 +++ b/src/org/tmatesoft/hg/core/HgIncomingCommand.java Thu Apr 28 02:00:42 2011 +0200 @@ -124,7 +124,7 @@ * @throws HgException * @throws CancelledException */ - public void executeFull(final HgLogCommand.Handler handler) throws HgException, CancelledException { + public void executeFull(final HgChangesetHandler handler) throws HgException, CancelledException { if (handler == null) { throw new IllegalArgumentException("Delegate can't be null"); }
--- a/src/org/tmatesoft/hg/core/HgLogCommand.java Tue Apr 26 23:58:15 2011 +0200 +++ b/src/org/tmatesoft/hg/core/HgLogCommand.java Thu Apr 28 02:00:42 2011 +0200 @@ -172,11 +172,11 @@ /** * - * @param inspector + * @param handler callback to process changesets. * @throws IllegalArgumentException when inspector argument is null * @throws ConcurrentModificationException if this log command instance is already running */ - public void execute(Handler handler) throws HgException { + public void execute(HgChangesetHandler handler) throws HgException { if (handler == null) { throw new IllegalArgumentException(); } @@ -259,15 +259,15 @@ } - public interface Handler { - /** - * @param changeset not necessarily a distinct instance each time, {@link HgChangeset#clone() clone()} if need a copy. - */ - void next(HgChangeset changeset); + /** + * @deprecated Use {@link HgChangesetHandler} instead. This interface is left temporarily for compatibility. + */ + @Deprecated() + public interface Handler extends HgChangesetHandler { } /** - * When {@link HgLogCommand} is executed against file, handler passed to {@link HgLogCommand#execute(Handler)} may optionally + * When {@link HgLogCommand} is executed against file, handler passed to {@link HgLogCommand#execute(HgChangesetHandler)} may optionally * implement this interface to get information about file renames. Method {@link #copy(FileRevision, FileRevision)} would * get invoked prior any changeset of the original file (if file history being followed) is reported via {@link #next(HgChangeset)}. * @@ -278,12 +278,12 @@ * @author Artem Tikhomirov * @author TMate Software Ltd. */ - public interface FileHistoryHandler extends Handler { + public interface FileHistoryHandler extends HgChangesetHandler { // XXX perhaps, should distinguish copy from rename? And what about merged revisions and following them? void copy(FileRevision from, FileRevision to); } - public static class CollectHandler implements Handler { + public static class CollectHandler implements HgChangesetHandler { private final List<HgChangeset> result = new LinkedList<HgChangeset>(); public List<HgChangeset> getChanges() {
--- a/src/org/tmatesoft/hg/core/HgOutgoingCommand.java Tue Apr 26 23:58:15 2011 +0200 +++ b/src/org/tmatesoft/hg/core/HgOutgoingCommand.java Thu Apr 28 02:00:42 2011 +0200 @@ -101,7 +101,7 @@ * * @param handler delegate to process changes */ - public void executeFull(final HgLogCommand.Handler handler) throws HgException, CancelledException { + public void executeFull(final HgChangesetHandler handler) throws HgException, CancelledException { if (handler == null) { throw new IllegalArgumentException("Delegate can't be null"); }