# HG changeset patch # User Artem Tikhomirov # Date 1332942135 -7200 # Node ID 6437d261048a63400f4005fd419b5988cb1bd12e # Parent 9c9c442b5f2ec67e2e5da4161338600daef34ada Deprecated code removed diff -r 9c9c442b5f2e -r 6437d261048a cmdline/org/tmatesoft/hg/console/Main.java --- a/cmdline/org/tmatesoft/hg/console/Main.java Fri Mar 23 22:51:18 2012 +0100 +++ b/cmdline/org/tmatesoft/hg/console/Main.java Wed Mar 28 15:42:15 2012 +0200 @@ -495,15 +495,12 @@ hgRepo.getManifest().walk(0, TIP, new ManifestDump()); } - public static final class ManifestDump implements HgManifest.Inspector2 { + public static final class ManifestDump implements HgManifest.Inspector { public boolean begin(int manifestRevision, Nodeid nid, int changelogRevision) { System.out.printf("%d : %s\n", manifestRevision, nid); return true; } - public boolean next(Nodeid nid, String fname, String flags) { - throw new IllegalStateException(HgManifest.Inspector2.class.getName()); - } public boolean next(Nodeid nid, Path fname, Flags flags) { System.out.println(nid + "\t" + fname + "\t\t" + flags); return true; diff -r 9c9c442b5f2e -r 6437d261048a cmdline/org/tmatesoft/hg/console/Tags.java --- a/cmdline/org/tmatesoft/hg/console/Tags.java Fri Mar 23 22:51:18 2012 +0100 +++ b/cmdline/org/tmatesoft/hg/console/Tags.java Wed Mar 28 15:42:15 2012 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 TMate Software Ltd + * Copyright (c) 2011-2012 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 @@ -54,7 +54,7 @@ return x1 < x2 ? 1 : -1; } }); - for (TagInfo ti : tags.getTags().values()) { + for (TagInfo ti : tags.getAllTags().values()) { int x = clog.getRevisionIndex(ti.revision()); // XXX in fact, performance hog. Need batch revisionIndex or another improvement ti2index.put(ti, x); sorted.add(ti); diff -r 9c9c442b5f2e -r 6437d261048a src/org/tmatesoft/hg/core/HgChangeset.java --- a/src/org/tmatesoft/hg/core/HgChangeset.java Fri Mar 23 22:51:18 2012 +0100 +++ b/src/org/tmatesoft/hg/core/HgChangeset.java Wed Mar 28 15:42:15 2012 +0200 @@ -93,14 +93,6 @@ } /** - * @deprecated use {@link #getRevisionIndex()} - */ - @Deprecated - public int getRevision() { - return revNumber; - } - - /** * Unique identity of this changeset revision * @return revision identifier, never null */ diff -r 9c9c442b5f2e -r 6437d261048a src/org/tmatesoft/hg/core/HgException.java --- a/src/org/tmatesoft/hg/core/HgException.java Fri Mar 23 22:51:18 2012 +0100 +++ b/src/org/tmatesoft/hg/core/HgException.java Wed Mar 28 15:42:15 2012 +0200 @@ -50,14 +50,6 @@ return extras.getRevisionIndex(); } - /** - * @deprecated use {@link #getRevisionIndex()} - */ - @Deprecated - public int getRevisionNumber() { - return getRevisionIndex(); - } - public HgException setRevisionIndex(int rev) { return extras.setRevisionIndex(rev); } @@ -67,14 +59,6 @@ } /** - * @deprecated use {@link #setRevisionIndex(int)} - */ - @Deprecated - public final HgException setRevisionNumber(int rev) { - return setRevisionIndex(rev); - } - - /** * @return non-null only when revision was supplied at construction time */ public Nodeid getRevision() { diff -r 9c9c442b5f2e -r 6437d261048a src/org/tmatesoft/hg/core/HgFileInformer.java --- a/src/org/tmatesoft/hg/core/HgFileInformer.java Fri Mar 23 22:51:18 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2011-2012 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; - -import org.tmatesoft.hg.repo.HgRepository; - - -/** - * @deprecated Use {@link HgChangesetFileSneaker} directly - * @author Artem Tikhomirov - * @author TMate Software Ltd. - */ -@Deprecated -public class HgFileInformer extends HgChangesetFileSneaker { - - public HgFileInformer(HgRepository hgRepo) { - super(hgRepo); - } -} diff -r 9c9c442b5f2e -r 6437d261048a src/org/tmatesoft/hg/core/HgLogCommand.java --- a/src/org/tmatesoft/hg/core/HgLogCommand.java Fri Mar 23 22:51:18 2012 +0100 +++ b/src/org/tmatesoft/hg/core/HgLogCommand.java Wed Mar 28 15:42:15 2012 +0200 @@ -263,6 +263,8 @@ } while (followHistory && fileNode.isCopy()); } } +// } catch (HgRuntimeException ex) { +// FIXME wrap with checked HgRuntime subclass } finally { csetTransform = null; progressHelper.done(); diff -r 9c9c442b5f2e -r 6437d261048a src/org/tmatesoft/hg/core/HgManifestCommand.java --- a/src/org/tmatesoft/hg/core/HgManifestCommand.java Fri Mar 23 22:51:18 2012 +0100 +++ b/src/org/tmatesoft/hg/core/HgManifestCommand.java Wed Mar 28 15:42:15 2012 +0200 @@ -131,7 +131,7 @@ } // I'd rather let HgManifestCommand implement HgManifest.Inspector directly, but this pollutes API alot - private class Mediator implements HgManifest.Inspector2 { + private class Mediator implements HgManifest.Inspector { // file names are likely to repeat in each revision, hence caching of Paths. // However, once HgManifest.Inspector switches to Path objects, perhaps global Path pool // might be more effective? @@ -181,9 +181,6 @@ manifestNodeid = null; return true; } - public boolean next(Nodeid nid, String fname, String flags) { - throw new IllegalStateException(HgManifest.Inspector2.class.getName()); - } public boolean next(Nodeid nid, Path fname, Flags flags) { if (matcher != null && !matcher.accept(fname)) { diff -r 9c9c442b5f2e -r 6437d261048a src/org/tmatesoft/hg/core/HgStatusCommand.java --- a/src/org/tmatesoft/hg/core/HgStatusCommand.java Fri Mar 23 22:51:18 2012 +0100 +++ b/src/org/tmatesoft/hg/core/HgStatusCommand.java Wed Mar 28 15:42:15 2012 +0200 @@ -202,14 +202,6 @@ } } - /** - * @deprecated replaced with {@link HgStatusHandler} - */ - @Deprecated - public interface Handler extends HgStatusHandler{ - void handleStatus(HgStatus s); - } - private class Mediator implements HgStatusInspector, CancelSupport { boolean needModified; boolean needAdded; diff -r 9c9c442b5f2e -r 6437d261048a src/org/tmatesoft/hg/internal/ManifestRevision.java --- a/src/org/tmatesoft/hg/internal/ManifestRevision.java Fri Mar 23 22:51:18 2012 +0100 +++ b/src/org/tmatesoft/hg/internal/ManifestRevision.java Wed Mar 28 15:42:15 2012 +0200 @@ -30,7 +30,7 @@ * @author Artem Tikhomirov * @author TMate Software Ltd. */ -public final class ManifestRevision implements HgManifest.Inspector2 { +public final class ManifestRevision implements HgManifest.Inspector { private final TreeMap idsMap; private final TreeMap flagsMap; private final Pool idsPool; @@ -73,10 +73,6 @@ // - public boolean next(Nodeid nid, String fname, String flags) { - throw new IllegalStateException(HgManifest.Inspector2.class.getName()); - } - public boolean next(Nodeid nid, Path fname, HgManifest.Flags flags) { if (namesPool != null) { fname = namesPool.unify(fname); diff -r 9c9c442b5f2e -r 6437d261048a src/org/tmatesoft/hg/repo/HgChangelog.java --- a/src/org/tmatesoft/hg/repo/HgChangelog.java Fri Mar 23 22:51:18 2012 +0100 +++ b/src/org/tmatesoft/hg/repo/HgChangelog.java Wed Mar 28 15:42:15 2012 +0200 @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; -import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.Formatter; @@ -40,7 +39,6 @@ import org.tmatesoft.hg.internal.Pool; import org.tmatesoft.hg.internal.RevlogStream; import org.tmatesoft.hg.util.CancelSupport; -import org.tmatesoft.hg.util.Pair; import org.tmatesoft.hg.util.ProgressSupport; /** @@ -119,21 +117,6 @@ } /** - * Unlike regular {@link Inspector}, this one supplies changeset revision along with its parents and children according - * to parent information of the revlog this inspector visits. - * @see HgDataFile#history(HgChangelog.TreeInspector) - * @deprecated use {@link org.tmatesoft.hg.core.HgChangesetTreeHandler} and HgLogCommand#execute(org.tmatesoft.hg.core.HgChangesetTreeHandler)} - */ - @Deprecated - public interface TreeInspector { - // the reason TreeInsector is in HgChangelog, not in Revlog, because despite the fact it can - // be applied to any revlog, it's not meant to provide revisions of any revlog it's beeing applied to, - // but changeset revisions always. - // TODO HgChangelog.walk(TreeInspector) - void next(Nodeid changesetRevision, Pair parentChangesets, Collection childChangesets); - } - - /** * Entry in the Changelog */ public static class RawChangeset implements Cloneable /* for those that would like to keep a copy */{ diff -r 9c9c442b5f2e -r 6437d261048a src/org/tmatesoft/hg/repo/HgDataFile.java --- a/src/org/tmatesoft/hg/repo/HgDataFile.java Fri Mar 23 22:51:18 2012 +0100 +++ b/src/org/tmatesoft/hg/repo/HgDataFile.java Wed Mar 28 15:42:15 2012 +0200 @@ -28,11 +28,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; -import java.util.List; import org.tmatesoft.hg.core.HgException; -import org.tmatesoft.hg.core.HgLogCommand; import org.tmatesoft.hg.core.Nodeid; import org.tmatesoft.hg.internal.DataAccess; import org.tmatesoft.hg.internal.FilterByteChannel; @@ -105,14 +102,6 @@ } /** - * @deprecated Use {@link #getLength(Nodeid)} instead - */ - @Deprecated - public int length(Nodeid nodeid) throws HgInvalidControlFileException, HgInvalidRevisionException { - return getLength(nodeid); - } - - /** * @param fileRevisionIndex - revision local index, non-negative. From predefined constants, only {@link HgRepository#TIP} makes sense. * @return size of the file content at the revision identified by local revision number. * @throws HgInvalidRevisionException if supplied argument doesn't represent revision index in this revlog (runtime exception) @@ -147,14 +136,6 @@ } /** - * @deprecated Use {@link #getLength(int)} instead - */ - @Deprecated - public int length(int fileRevisionIndex) throws HgInvalidControlFileException, HgInvalidRevisionException { - return getLength(fileRevisionIndex); - } - - /** * Reads content of the file from working directory. If file present in the working directory, its actual content without * any filters is supplied through the sink. If file does not exist in the working dir, this method provides content of a file * as if it would be refreshed in the working copy, i.e. its corresponding revision (according to dirstate) is read from the @@ -326,123 +307,7 @@ } } - private static class HistoryNode { - int changeset; - Nodeid cset; - HistoryNode parent1, parent2; - List children; - - HistoryNode(int cs, HistoryNode p1, HistoryNode p2) { - changeset = cs; - parent1 = p1; - parent2 = p2; - if (p1 != null) { - p1.addChild(this); - } - if (p2 != null) { - p2.addChild(this); - } - } - - Nodeid changesetRevision() { - assert cset != null : "we initialize all csets prior to use"; - return cset; - } - - void addChild(HistoryNode child) { - if (children == null) { - children = new ArrayList(2); - } - children.add(child); - } - } - - /** - * @deprecated use {@link HgLogCommand#execute(org.tmatesoft.hg.core.HgChangesetTreeHandler)} instead - */ - @Deprecated - public void history(HgChangelog.TreeInspector inspector) throws HgInvalidControlFileException{ - final CancelSupport cancelSupport = CancelSupport.Factory.get(inspector); - try { - final boolean[] needsSorting = { false }; - final HistoryNode[] completeHistory = new HistoryNode[getRevisionCount()]; - final int[] commitRevisions = new int[completeHistory.length]; - RevlogStream.Inspector insp = new RevlogStream.Inspector() { - public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess data) { - if (revisionNumber > 0) { - if (commitRevisions[revisionNumber-1] > linkRevision) { - needsSorting[0] = true; - } - } - commitRevisions[revisionNumber] = linkRevision; - HistoryNode p1 = null, p2 = null; - if (parent1Revision != -1) { - p1 = completeHistory[parent1Revision]; - } - if (parent2Revision != -1) { - p2 = completeHistory[parent2Revision]; - } - completeHistory[revisionNumber] = new HistoryNode(linkRevision, p1, p2); - } - }; - content.iterate(0, getLastRevision(), false, insp); - cancelSupport.checkCancelled(); - if (needsSorting[0]) { - Arrays.sort(commitRevisions); - } - // read changeset revisions at once (to avoid numerous changelog.getRevision reads) - // but just nodeids, not RawChangeset (changelog.iterate(data=false) - ArrayList changesetRevisions = new ArrayList(commitRevisions.length); - getRepo().getChangelog().getRevisionsInternal(changesetRevisions, commitRevisions); - cancelSupport.checkCancelled(); - // assign them to corresponding HistoryNodes - for (int i = 0; i < completeHistory.length; i++ ) { - final HistoryNode n = completeHistory[i]; - if (needsSorting[0]) { - int x = Arrays.binarySearch(commitRevisions, n.changeset); - assert x >= 0; - n.cset = changesetRevisions.get(x); - } else { - // commit revisions were not sorted, may use original index directly - n.cset = changesetRevisions.get(i); - } - } - cancelSupport.checkCancelled(); - // XXX shall sort completeHistory according to changeset numbers? - for (int i = 0; i < completeHistory.length; i++ ) { - final HistoryNode n = completeHistory[i]; - HistoryNode p; - Nodeid p1, p2; - if ((p = n.parent1) != null) { - p1 = p.changesetRevision(); - } else { - p1 = Nodeid.NULL; - } - if ((p= n.parent2) != null) { - p2 = p.changesetRevision(); - } else { - p2 = Nodeid.NULL; - } - final Pair parentChangesets = new Pair(p1, p2); - final List childChangesets; - if (n.children == null) { - childChangesets = Collections.emptyList(); - } else { - Nodeid[] revisions = new Nodeid[n.children.size()]; - int j = 0; - for (HistoryNode hn : n.children) { - revisions[j++] = hn.changesetRevision(); - } - childChangesets = Arrays.asList(revisions); - } - inspector.next(n.changesetRevision(), parentChangesets, childChangesets); - cancelSupport.checkCancelled(); - } - } catch (CancelledException ex) { - return; - } - } - + // FIXME is that still needed? public void history(HgChangelog.Inspector inspector) throws HgInvalidControlFileException { history(0, getLastRevision(), inspector); } @@ -502,13 +367,6 @@ public int getChangesetRevisionIndex(int revision) throws HgInvalidControlFileException, HgInvalidRevisionException { return content.linkRevision(revision); } - /** - * @deprecated use {@link #getChangesetRevisionIndex(int)} instead - */ - @Deprecated - public int getChangesetLocalRevision(int revision) throws HgInvalidControlFileException, HgInvalidRevisionException { - return getChangesetRevisionIndex(revision); - } /** * Complements {@link #getChangesetRevisionIndex(int)} to get changeset revision that corresponds to supplied file revision diff -r 9c9c442b5f2e -r 6437d261048a src/org/tmatesoft/hg/repo/HgManifest.java --- a/src/org/tmatesoft/hg/repo/HgManifest.java Fri Mar 23 22:51:18 2012 +0100 +++ b/src/org/tmatesoft/hg/repo/HgManifest.java Wed Mar 28 15:42:15 2012 +0200 @@ -337,25 +337,15 @@ public interface Inspector { boolean begin(int mainfestRevision, Nodeid nid, int changelogRevision); /** - * @deprecated switch to {@link HgManifest.Inspector2#next(Nodeid, Path, HgManifest.Flags)} - */ - @Deprecated - boolean next(Nodeid nid, String fname, String flags); - boolean end(int manifestRevision); - } - - @Experimental(reason="Explore Path alternative for filenames and enum for flags") - @Callback - public interface Inspector2 extends Inspector { - /** * @param nid file revision * @param fname file name * @param flags one of {@link HgManifest.Flags} constants, not null * @return true to continue iteration, false to stop */ boolean next(Nodeid nid, Path fname, Flags flags); + boolean end(int manifestRevision); } - + /** * When Pool uses Strings directly, * ManifestParser creates new String instance with new char[] value, and does byte->char conversion. @@ -429,7 +419,6 @@ private static class ManifestParser implements RevlogStream.Inspector, Lifecycle { private final Inspector inspector; - private final Inspector2 inspector2; private Pool2 nodeidPool, thisRevPool; private final Pool2 fnamePool; private byte[] nodeidLookupBuffer = new byte[20]; // get reassigned each time new Nodeid is added to pool @@ -440,7 +429,6 @@ public ManifestParser(Inspector delegate, EncodingHelper eh) { assert delegate != null; inspector = delegate; - inspector2 = delegate instanceof Inspector2 ? (Inspector2) delegate : null; encHelper = eh; nodeidPool = new Pool2(); fnamePool = new Pool2(); @@ -493,13 +481,7 @@ } else { flags = Flags.RegularFile; } - boolean good2go; - if (inspector2 == null) { - String flagString = flags == Flags.RegularFile ? null : flags.nativeString(); - good2go = inspector.next(nid, fname.toString(), flagString); - } else { - good2go = inspector2.next(nid, fname, flags); - } + boolean good2go = inspector.next(nid, fname, flags); if (!good2go) { iterateControl.stop(); return; diff -r 9c9c442b5f2e -r 6437d261048a src/org/tmatesoft/hg/repo/HgStatusCollector.java --- a/src/org/tmatesoft/hg/repo/HgStatusCollector.java Fri Mar 23 22:51:18 2012 +0100 +++ b/src/org/tmatesoft/hg/repo/HgStatusCollector.java Wed Mar 28 15:42:15 2012 +0200 @@ -110,7 +110,7 @@ for (int x = minRev, i = 0; x <= maxRev; i++, x++) { revisionsToCollect[i] = x; } - repo.getManifest().walk(new HgManifest.Inspector2() { + repo.getManifest().walk(new HgManifest.Inspector() { private ManifestRevision delegate; private boolean cacheHit; // range may include revisions we already know about, do not re-create them @@ -128,10 +128,6 @@ return true; } - public boolean next(Nodeid nid, String fname, String flags) { - throw new IllegalStateException(HgManifest.Inspector2.class.getName()); - } - public boolean next(Nodeid nid, Path fname, HgManifest.Flags flags) { if (!cacheHit) { delegate.next(nid, fname, flags); diff -r 9c9c442b5f2e -r 6437d261048a src/org/tmatesoft/hg/repo/HgTags.java --- a/src/org/tmatesoft/hg/repo/HgTags.java Fri Mar 23 22:51:18 2012 +0100 +++ b/src/org/tmatesoft/hg/repo/HgTags.java Wed Mar 28 15:42:15 2012 +0200 @@ -183,14 +183,6 @@ } return rv; } - - /** - * @deprecated use {@link #getAllTags()} instead - */ - @Deprecated - public Map getTags() { - return getAllTags(); - } /** * All tag entries from the repository, for both active and removed tags diff -r 9c9c442b5f2e -r 6437d261048a src/org/tmatesoft/hg/repo/Revlog.java --- a/src/org/tmatesoft/hg/repo/Revlog.java Fri Mar 23 22:51:18 2012 +0100 +++ b/src/org/tmatesoft/hg/repo/Revlog.java Wed Mar 28 15:42:15 2012 +0200 @@ -147,15 +147,6 @@ } /** - * @deprecated use {@link #getRevisionIndex(Nodeid)} instead - */ - @Deprecated - public final int getLocalRevision(Nodeid nid) throws HgInvalidControlFileException, HgInvalidRevisionException { - return getRevisionIndex(nid); - } - - - /** * Note, {@link Nodeid#NULL} nodeid is not reported as known in any revlog. * * @param nodeid @@ -591,13 +582,6 @@ } return sorted2natural[x]-1; } - /** - * @deprecated use {@link #revisionIndex(Nodeid)} instead - */ - @Deprecated - public int localRevision(Nodeid revision) { - return revisionIndex(revision); - } } protected abstract static class ErrorHandlingInspector implements RevlogStream.Inspector, CancelSupport { diff -r 9c9c442b5f2e -r 6437d261048a test/org/tmatesoft/hg/test/MapTagsToFileRevisions.java --- a/test/org/tmatesoft/hg/test/MapTagsToFileRevisions.java Fri Mar 23 22:51:18 2012 +0100 +++ b/test/org/tmatesoft/hg/test/MapTagsToFileRevisions.java Wed Mar 28 15:42:15 2012 +0200 @@ -265,7 +265,7 @@ // file2rev2tag value is array of revisions, always of allTags.length. Revision index in the array // is index of corresponding TagInfo in allTags; final Map file2rev2tag = new HashMap(); - repository.getManifest().walk(new HgManifest.Inspector2() { + repository.getManifest().walk(new HgManifest.Inspector() { private int[] tagIndexAtRev = new int[4]; // it's unlikely there would be a lot of tags associated with a given cset public boolean begin(int mainfestRevision, Nodeid nid, int changelogRevision) { @@ -289,10 +289,6 @@ } return true; } - - public boolean next(Nodeid nid, String fname, String flags) { - throw new IllegalStateException(HgManifest.Inspector2.class.getName()); - } public boolean next(Nodeid nid, Path fname, HgManifest.Flags flags) { Nodeid[] m = file2rev2tag.get(fname); @@ -370,13 +366,10 @@ System.out.printf("Free mem: %,d\n", Runtime.getRuntime().freeMemory()); } - static class DoNothingManifestInspector implements HgManifest.Inspector2 { + static class DoNothingManifestInspector implements HgManifest.Inspector { public boolean begin(int mainfestRevision, Nodeid nid, int changelogRevision) { return true; } - public boolean next(Nodeid nid, String fname, String flags) { - throw new IllegalStateException(HgManifest.Inspector2.class.getName()); - } public boolean next(Nodeid nid, Path fname, Flags flags) { return true; } diff -r 9c9c442b5f2e -r 6437d261048a test/org/tmatesoft/hg/test/TestAuxUtilities.java --- a/test/org/tmatesoft/hg/test/TestAuxUtilities.java Fri Mar 23 22:51:18 2012 +0100 +++ b/test/org/tmatesoft/hg/test/TestAuxUtilities.java Wed Mar 28 15:42:15 2012 +0200 @@ -151,7 +151,7 @@ @Test public void testManifestCancelSupport() throws Exception { HgRepository repository = Configuration.get().find("branches-1"); // any repo with as many revisions as possible - class InspectorImplementsAdaptable implements HgManifest.Inspector2, Adaptable { + class InspectorImplementsAdaptable implements HgManifest.Inspector, Adaptable { public final int when2stop; public int lastVisitet = 0; private final CancelImpl cancelImpl = new CancelImpl(); @@ -167,10 +167,6 @@ return true; } - public boolean next(Nodeid nid, String fname, String flags) { - return true; - } - public boolean end(int manifestRevision) { return true; }