comparison src/org/tmatesoft/hg/core/ChangesetTransformer.java @ 192:e5407b5a586a

Incoming and Outgoing commands are alive
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 15 Apr 2011 03:17:03 +0200
parents
children 37f3d4a596e4
comparison
equal deleted inserted replaced
191:b777502a06f5 192:e5407b5a586a
1 /*
2 * Copyright (c) 2011 TMate Software Ltd
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * For information on how to redistribute this software under
14 * the terms of a license other than GNU General Public License
15 * contact TMate Software at support@hg4j.com
16 */
17 package org.tmatesoft.hg.core;
18
19 import org.tmatesoft.hg.repo.HgChangelog;
20 import org.tmatesoft.hg.repo.HgRepository;
21 import org.tmatesoft.hg.repo.HgStatusCollector;
22 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
23 import org.tmatesoft.hg.util.PathPool;
24 import org.tmatesoft.hg.util.PathRewrite;
25
26 /**
27 * Bridges {@link HgChangelog.RawChangeset} with high-level {@link HgChangeset} API
28 *
29 * @author Artem Tikhomirov
30 * @author TMate Software Ltd.
31 */
32 /*package-local*/ class ChangesetTransformer implements HgChangelog.Inspector {
33 private final HgLogCommand.Handler handler;
34 private final HgChangeset changeset;
35
36 public ChangesetTransformer(HgRepository hgRepo, HgLogCommand.Handler delegate) {
37 if (hgRepo == null || delegate == null) {
38 throw new IllegalArgumentException();
39 }
40 HgStatusCollector statusCollector = new HgStatusCollector(hgRepo);
41 PathPool pp = new PathPool(new PathRewrite.Empty());
42 statusCollector.setPathPool(pp);
43 changeset = new HgChangeset(statusCollector, pp);
44 handler = delegate;
45 }
46
47 public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) {
48 changeset.init(revisionNumber, nodeid, cset);
49 handler.next(changeset);
50 }
51 }