Mercurial > hg4j
changeset 424:6437d261048a
Deprecated code removed
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 28 Mar 2012 15:42:15 +0200 |
parents | 9c9c442b5f2e |
children | 48f993aa2f41 |
files | cmdline/org/tmatesoft/hg/console/Main.java cmdline/org/tmatesoft/hg/console/Tags.java src/org/tmatesoft/hg/core/HgChangeset.java src/org/tmatesoft/hg/core/HgException.java src/org/tmatesoft/hg/core/HgFileInformer.java src/org/tmatesoft/hg/core/HgLogCommand.java src/org/tmatesoft/hg/core/HgManifestCommand.java src/org/tmatesoft/hg/core/HgStatusCommand.java src/org/tmatesoft/hg/internal/ManifestRevision.java src/org/tmatesoft/hg/repo/HgChangelog.java src/org/tmatesoft/hg/repo/HgDataFile.java src/org/tmatesoft/hg/repo/HgManifest.java src/org/tmatesoft/hg/repo/HgStatusCollector.java src/org/tmatesoft/hg/repo/HgTags.java src/org/tmatesoft/hg/repo/Revlog.java test/org/tmatesoft/hg/test/MapTagsToFileRevisions.java test/org/tmatesoft/hg/test/TestAuxUtilities.java |
diffstat | 17 files changed, 15 insertions(+), 304 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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);
--- 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 <code>null</code> */
--- 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() {
--- 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); - } -}
--- 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();
--- 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)) {
--- 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;
--- 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<Path, Nodeid> idsMap; private final TreeMap<Path, HgManifest.Flags> flagsMap; private final Pool<Nodeid> 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);
--- 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<Nodeid, Nodeid> parentChangesets, Collection<Nodeid> childChangesets); - } - - /** * Entry in the Changelog */ public static class RawChangeset implements Cloneable /* for those that would like to keep a copy */{
--- 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 (<em>runtime exception</em>) @@ -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<HistoryNode> 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<HistoryNode>(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<Nodeid> changesetRevisions = new ArrayList<Nodeid>(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<Nodeid, Nodeid> parentChangesets = new Pair<Nodeid, Nodeid>(p1, p2); - final List<Nodeid> 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
--- 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 <code>null</code> * @return <code>true</code> to continue iteration, <code>false</code> 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<Nodeid> nodeidPool, thisRevPool; private final Pool2<PathProxy> 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<Nodeid>(); fnamePool = new Pool2<PathProxy>(); @@ -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;
--- 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);
--- 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<String, TagInfo> getTags() { - return getAllTags(); - } /** * All tag entries from the repository, for both active and removed tags
--- 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 {
--- 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<Path, Nodeid[]> file2rev2tag = new HashMap<Path, Nodeid[]>(); - 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; }
--- 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; }