tikhomirov@328: /* tikhomirov@403: * Copyright (c) 2011-2012 TMate Software Ltd tikhomirov@328: * tikhomirov@328: * This program is free software; you can redistribute it and/or modify tikhomirov@328: * it under the terms of the GNU General Public License as published by tikhomirov@328: * the Free Software Foundation; version 2 of the License. tikhomirov@328: * tikhomirov@328: * This program is distributed in the hope that it will be useful, tikhomirov@328: * but WITHOUT ANY WARRANTY; without even the implied warranty of tikhomirov@328: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the tikhomirov@328: * GNU General Public License for more details. tikhomirov@328: * tikhomirov@328: * For information on how to redistribute this software under tikhomirov@328: * the terms of a license other than GNU General Public License tikhomirov@328: * contact TMate Software at support@hg4j.com tikhomirov@328: */ tikhomirov@328: package org.tmatesoft.hg.core; tikhomirov@328: tikhomirov@328: import java.util.Collection; tikhomirov@328: tikhomirov@423: import org.tmatesoft.hg.internal.Callback; tikhomirov@328: import org.tmatesoft.hg.util.Pair; tikhomirov@328: tikhomirov@328: /** tikhomirov@403: * Handler to iterate file history (generally, any revlog) with access to parent-child relations between changesets. tikhomirov@403: * tikhomirov@403: * @see HgLogCommand#execute(HgChangesetTreeHandler) tikhomirov@403: * tikhomirov@328: * @author Artem Tikhomirov tikhomirov@328: * @author TMate Software Ltd. tikhomirov@328: */ tikhomirov@423: @Callback tikhomirov@328: public interface HgChangesetTreeHandler { tikhomirov@328: /** tikhomirov@328: * @param entry access to various pieces of information about current tree node. Instances might be tikhomirov@370: * reused across calls and shall not be kept by client's code tikhomirov@423: * @throws HgCallbackTargetException wrapper for any exception user code may produce tikhomirov@328: */ tikhomirov@427: public void treeElement(HgChangesetTreeHandler.TreeElement entry) throws HgCallbackTargetException; tikhomirov@328: tikhomirov@328: interface TreeElement { tikhomirov@328: /** tikhomirov@328: * Revision of the revlog being iterated. For example, when walking file history, return value represents file revisions. tikhomirov@328: * tikhomirov@328: * @return revision of the revlog being iterated. tikhomirov@328: */ tikhomirov@423: public Nodeid fileRevision(); tikhomirov@366: tikhomirov@328: /** tikhomirov@507: * @return changeset associated with the current file revision tikhomirov@328: */ tikhomirov@423: public HgChangeset changeset(); tikhomirov@328: tikhomirov@328: /** tikhomirov@328: * Lightweight alternative to {@link #changeset()}, identifies changeset in which current file node has been modified tikhomirov@403: * @return changeset {@link Nodeid revision} tikhomirov@328: */ tikhomirov@423: public Nodeid changesetRevision(); tikhomirov@328: tikhomirov@328: /** tikhomirov@507: * Identifies parent changes, changesets where file/revlog in question was modified prior to change being visited. tikhomirov@507: * tikhomirov@507: * Note, these are not necessarily in direct relation to parents of changeset from {@link #changeset()} tikhomirov@507: * tikhomirov@507: * Imagine next history (grows from bottom to top): tikhomirov@507: *
tikhomirov@507: * o A o tikhomirov@507: * | \ | tikhomirov@507: * o B \/ tikhomirov@507: * | o C tikhomirov@507: * | / tikhomirov@507: * o / tikhomirov@507: * | / tikhomirov@507: * o D tikhomirov@507: *tikhomirov@507: * tikhomirov@507: * When we are at {@link TreeElement} for
A
, B
and C
are changeset parents, naturally. However
tikhomirov@507: * if the file/revlog we've been walking has not been changed in B
and C
, but e.g. in D
only,
tikhomirov@507: * then this {@link #parents()} call would return pair with single element only, pointing to D
tikhomirov@507: *
tikhomirov@328: * @return changesets that correspond to parents of the current file node, either pair element may be null
.
tikhomirov@328: */
tikhomirov@423: public Pairnull
, use {@link Nodeid#isNull()} to identify parent not set
tikhomirov@328: */
tikhomirov@423: public Pairnull
tikhomirov@328: */
tikhomirov@423: public Collection