annotate src/org/tmatesoft/hg/core/HgChangesetTreeHandler.java @ 417:ccd7d25e5aea

New and better name for HgFileInformer - HgChangesetFileSneaker. Explain (comments) ties between HgManifest, HgDataFile, HgChangesetFileSneaker and reasons for method placement
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 22 Mar 2012 20:14:06 +0100
parents 2747b0723867
children 9c9c442b5f2e
rev   line source
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
1 /*
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
2 * Copyright (c) 2011-2012 TMate Software Ltd
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
3 *
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
6 * the Free Software Foundation; version 2 of the License.
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
7 *
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
8 * This program is distributed in the hope that it will be useful,
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
11 * GNU General Public License for more details.
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
12 *
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
13 * For information on how to redistribute this software under
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
14 * the terms of a license other than GNU General Public License
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
15 * contact TMate Software at support@hg4j.com
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
16 */
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
17 package org.tmatesoft.hg.core;
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
18
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
19 import java.util.Collection;
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
20
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
21 import org.tmatesoft.hg.util.CancelledException;
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
22 import org.tmatesoft.hg.util.Pair;
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
23
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
24 /**
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
25 * Handler to iterate file history (generally, any revlog) with access to parent-child relations between changesets.
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
26 *
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
27 * @see HgLogCommand#execute(HgChangesetTreeHandler)
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
28 *
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
29 * @author Artem Tikhomirov
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
30 * @author TMate Software Ltd.
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
31 */
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
32 public interface HgChangesetTreeHandler {
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
33 /**
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
34 * @param entry access to various pieces of information about current tree node. Instances might be
370
a2341e761609 Let callback implementations deliver errors (e,g. own exceptions) to client code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 366
diff changeset
35 * reused across calls and shall not be kept by client's code
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
36 * @throws HgException allows implementers propagate errors from {@link TreeElement} or other parts of the library.
370
a2341e761609 Let callback implementations deliver errors (e,g. own exceptions) to client code
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 366
diff changeset
37 * @throws HgCallbackTargetException.Wrap wrapper object for any exception user code may produce. Wrapped exception would get re-thrown with {@link HgCallbackTargetException}
383
994b5813a925 Few comments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 370
diff changeset
38 * @throws CancelledException if execution of the operation was cancelled
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
39 */
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
40 public void next(HgChangesetTreeHandler.TreeElement entry) throws HgException, HgCallbackTargetException.Wrap, CancelledException;
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
41
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
42 interface TreeElement {
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
43 /**
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
44 * Revision of the revlog being iterated. For example, when walking file history, return value represents file revisions.
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
45 *
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
46 * @return revision of the revlog being iterated.
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
47 * @throws HgException to indicate failure dealing with Mercurial data
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
48 */
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
49 public Nodeid fileRevision() throws HgException;
366
189dc6dc1c3e Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 328
diff changeset
50
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
51 /**
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
52 * @return changeset associated with the current revision
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
53 * @throws HgException to indicate failure dealing with Mercurial data
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
54 */
366
189dc6dc1c3e Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 328
diff changeset
55 public HgChangeset changeset() throws HgException;
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
56
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
57 /**
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
58 * Lightweight alternative to {@link #changeset()}, identifies changeset in which current file node has been modified
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
59 * @return changeset {@link Nodeid revision}
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
60 * @throws HgException to indicate failure dealing with Mercurial data
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
61 */
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
62 public Nodeid changesetRevision() throws HgException;
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
63
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
64 /**
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
65 * Node, these are not necessarily in direct relation to parents of changeset from {@link #changeset()}
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
66 * @return changesets that correspond to parents of the current file node, either pair element may be <code>null</code>.
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
67 * @throws HgException to indicate failure dealing with Mercurial data
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
68 */
366
189dc6dc1c3e Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 328
diff changeset
69 public Pair<HgChangeset, HgChangeset> parents() throws HgException;
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
70
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
71 /**
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
72 * Lightweight alternative to {@link #parents()}, give {@link Nodeid nodeids} only
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
73 * @return two values, neither is <code>null</code>, use {@link Nodeid#isNull()} to identify parent not set
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
74 * @throws HgException to indicate failure dealing with Mercurial data
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
75 */
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
76 public Pair<Nodeid, Nodeid> parentRevisions() throws HgException;
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
77
366
189dc6dc1c3e Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 328
diff changeset
78 /**
189dc6dc1c3e Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 328
diff changeset
79 * Changes that originate from the given change and bear it as their parent.
189dc6dc1c3e Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 328
diff changeset
80 * @return collection (possibly empty) of immediate children of the change
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
81 * @throws HgException to indicate failure dealing with Mercurial data
366
189dc6dc1c3e Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 328
diff changeset
82 */
189dc6dc1c3e Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 328
diff changeset
83 public Collection<HgChangeset> children() throws HgException;
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
84
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
85 /**
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
86 * Lightweight alternative to {@link #children()}.
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
87 * @return never <code>null</code>
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
88 * @throws HgException to indicate failure dealing with Mercurial data
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
89 */
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 383
diff changeset
90 public Collection<Nodeid> childRevisions() throws HgException;
328
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
91 }
a674b8590362 Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
92 }