Mercurial > hg4j
annotate src/org/tmatesoft/hg/core/ChangesetTransformer.java @ 628:6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 22 May 2013 15:52:31 +0200 |
parents | 1ee452f31187 |
children |
rev | line source |
---|---|
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
1 /* |
628
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
520
diff
changeset
|
2 * Copyright (c) 2011-2013 TMate Software Ltd |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
3 * |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
6 * the Free Software Foundation; version 2 of the License. |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
7 * |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
11 * GNU General Public License for more details. |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
12 * |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
13 * For information on how to redistribute this software under |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
14 * the terms of a license other than GNU General Public License |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
15 * contact TMate Software at support@hg4j.com |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 */ |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
17 package org.tmatesoft.hg.core; |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
18 |
193
37f3d4a596e4
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
19 import java.util.Set; |
37f3d4a596e4
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
20 |
520
1ee452f31187
Experimental support for inverse direction history walking. Refactored/streamlined cancellation in HgLogCommand and down the stack
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
432
diff
changeset
|
21 import org.tmatesoft.hg.internal.Lifecycle; |
1ee452f31187
Experimental support for inverse direction history walking. Refactored/streamlined cancellation in HgLogCommand and down the stack
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
432
diff
changeset
|
22 import org.tmatesoft.hg.internal.LifecycleBridge; |
431
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
427
diff
changeset
|
23 import org.tmatesoft.hg.internal.PathPool; |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
24 import org.tmatesoft.hg.repo.HgChangelog; |
205
ffc5f6d59f7e
HgLogCommand.Handler is used in few places, pull up to top-level class, HgChangesetHandler
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
195
diff
changeset
|
25 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
26 import org.tmatesoft.hg.repo.HgRepository; |
628
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
520
diff
changeset
|
27 import org.tmatesoft.hg.repo.HgRuntimeException; |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
28 import org.tmatesoft.hg.repo.HgStatusCollector; |
432
1fc0da631200
Revlog.ParentWalker helper class got promoted as TLC, renamed to HgParentChildMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
29 import org.tmatesoft.hg.repo.HgParentChildMap; |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
418
diff
changeset
|
30 import org.tmatesoft.hg.util.Adaptable; |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
31 import org.tmatesoft.hg.util.CancelSupport; |
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
32 import org.tmatesoft.hg.util.CancelledException; |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
33 import org.tmatesoft.hg.util.PathRewrite; |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
34 import org.tmatesoft.hg.util.ProgressSupport; |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
35 |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
36 /** |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
37 * Bridges {@link HgChangelog.RawChangeset} with high-level {@link HgChangeset} API |
418
528b6780a8bd
A bit of FIXME cleanup (mostly degraded to TODO post 1.0), comments and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
38 * TODO post-1.0 Move to .internal once access to package-local HgChangeset cons is resolved. For 1.0, enough it's package-local |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
39 * |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
40 * @author Artem Tikhomirov |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
41 * @author TMate Software Ltd. |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
42 */ |
520
1ee452f31187
Experimental support for inverse direction history walking. Refactored/streamlined cancellation in HgLogCommand and down the stack
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
432
diff
changeset
|
43 /*package-local*/ class ChangesetTransformer implements HgChangelog.Inspector, Adaptable { |
205
ffc5f6d59f7e
HgLogCommand.Handler is used in few places, pull up to top-level class, HgChangesetHandler
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
195
diff
changeset
|
44 private final HgChangesetHandler handler; |
520
1ee452f31187
Experimental support for inverse direction history walking. Refactored/streamlined cancellation in HgLogCommand and down the stack
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
432
diff
changeset
|
45 private final LifecycleBridge lifecycleBridge; |
328
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
46 private final Transformation t; |
193
37f3d4a596e4
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
47 private Set<String> branches; |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
48 private HgCallbackTargetException failure; |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
49 |
195
c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
193
diff
changeset
|
50 // repo and delegate can't be null, parent walker can |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
51 // ps and cs can't be null |
432
1fc0da631200
Revlog.ParentWalker helper class got promoted as TLC, renamed to HgParentChildMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
52 public ChangesetTransformer(HgRepository hgRepo, HgChangesetHandler delegate, HgParentChildMap<HgChangelog> pw, ProgressSupport ps, CancelSupport cs) { |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
53 if (hgRepo == null || delegate == null) { |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
54 throw new IllegalArgumentException(); |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
55 } |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
56 if (ps == null || cs == null) { |
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
57 throw new IllegalArgumentException(); |
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
58 } |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
59 HgStatusCollector statusCollector = new HgStatusCollector(hgRepo); |
328
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
60 t = new Transformation(statusCollector, pw); |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
61 handler = delegate; |
520
1ee452f31187
Experimental support for inverse direction history walking. Refactored/streamlined cancellation in HgLogCommand and down the stack
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
432
diff
changeset
|
62 // lifecycleBridge takes care of progress and cancellation, plus |
1ee452f31187
Experimental support for inverse direction history walking. Refactored/streamlined cancellation in HgLogCommand and down the stack
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
432
diff
changeset
|
63 // gives us explicit way to stop iteration (once HgCallbackTargetException) comes. |
1ee452f31187
Experimental support for inverse direction history walking. Refactored/streamlined cancellation in HgLogCommand and down the stack
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
432
diff
changeset
|
64 lifecycleBridge = new LifecycleBridge(ps, cs); |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
65 } |
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
66 |
628
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
520
diff
changeset
|
67 public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) throws HgRuntimeException { |
193
37f3d4a596e4
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
68 if (branches != null && !branches.contains(cset.branch())) { |
37f3d4a596e4
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
69 return; |
37f3d4a596e4
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
70 } |
37f3d4a596e4
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
71 |
328
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
72 HgChangeset changeset = t.handle(revisionNumber, nodeid, cset); |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
73 try { |
427
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
74 handler.cset(changeset); |
520
1ee452f31187
Experimental support for inverse direction history walking. Refactored/streamlined cancellation in HgLogCommand and down the stack
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
432
diff
changeset
|
75 lifecycleBridge.nextStep(); |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
418
diff
changeset
|
76 } catch (HgCallbackTargetException ex) { |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
418
diff
changeset
|
77 failure = ex.setRevision(nodeid).setRevisionIndex(revisionNumber); |
520
1ee452f31187
Experimental support for inverse direction history walking. Refactored/streamlined cancellation in HgLogCommand and down the stack
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
432
diff
changeset
|
78 lifecycleBridge.stop(); |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
79 } |
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
80 } |
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
81 |
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
82 public void checkFailure() throws HgCallbackTargetException, CancelledException { |
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
83 if (failure != null) { |
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
84 HgCallbackTargetException toThrow = failure; |
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
85 throw toThrow; |
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
86 } |
520
1ee452f31187
Experimental support for inverse direction history walking. Refactored/streamlined cancellation in HgLogCommand and down the stack
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
432
diff
changeset
|
87 if (lifecycleBridge.isCancelled()) { |
1ee452f31187
Experimental support for inverse direction history walking. Refactored/streamlined cancellation in HgLogCommand and down the stack
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
432
diff
changeset
|
88 CancelledException toThrow = lifecycleBridge.getCancelOrigin(); |
1ee452f31187
Experimental support for inverse direction history walking. Refactored/streamlined cancellation in HgLogCommand and down the stack
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
432
diff
changeset
|
89 assert toThrow != null; |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
90 throw toThrow; |
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
205
diff
changeset
|
91 } |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
92 } |
193
37f3d4a596e4
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
93 |
37f3d4a596e4
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
94 public void limitBranches(Set<String> branches) { |
37f3d4a596e4
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
95 this.branches = branches; |
37f3d4a596e4
Use common low to hi-level changeset api transformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
192
diff
changeset
|
96 } |
328
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
97 |
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
98 // part relevant to RawChangeset->HgChangeset transformation |
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
99 static class Transformation { |
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
100 private final HgChangeset changeset; |
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
101 |
432
1fc0da631200
Revlog.ParentWalker helper class got promoted as TLC, renamed to HgParentChildMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
102 public Transformation(HgStatusCollector statusCollector, HgParentChildMap<HgChangelog> pw) { |
328
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
103 // files listed in a changeset don't need their names to be rewritten (they are normalized already) |
431
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
427
diff
changeset
|
104 // pp serves as a cache for all filenames encountered and as a source for Path listed in the changeset |
328
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
105 PathPool pp = new PathPool(new PathRewrite.Empty()); |
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
106 statusCollector.setPathPool(pp); |
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
107 changeset = new HgChangeset(statusCollector, pp); |
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
108 changeset.setParentHelper(pw); |
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
109 } |
403
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
110 |
418
528b6780a8bd
A bit of FIXME cleanup (mostly degraded to TODO post 1.0), comments and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
111 /** |
528b6780a8bd
A bit of FIXME cleanup (mostly degraded to TODO post 1.0), comments and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
112 * Callers shall not assume they get new HgChangeset instance each time, implementation may reuse instances. |
528b6780a8bd
A bit of FIXME cleanup (mostly degraded to TODO post 1.0), comments and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
113 * @return hi-level changeset description |
528b6780a8bd
A bit of FIXME cleanup (mostly degraded to TODO post 1.0), comments and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
114 */ |
328
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
115 HgChangeset handle(int revisionNumber, Nodeid nodeid, RawChangeset cset) { |
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
116 changeset.init(revisionNumber, nodeid, cset); |
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
117 return changeset; |
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
118 } |
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
119 } |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
418
diff
changeset
|
120 |
520
1ee452f31187
Experimental support for inverse direction history walking. Refactored/streamlined cancellation in HgLogCommand and down the stack
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
432
diff
changeset
|
121 public <T> T getAdapter(Class<T> adapterClass) { |
1ee452f31187
Experimental support for inverse direction history walking. Refactored/streamlined cancellation in HgLogCommand and down the stack
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
432
diff
changeset
|
122 if (adapterClass == Lifecycle.class) { |
1ee452f31187
Experimental support for inverse direction history walking. Refactored/streamlined cancellation in HgLogCommand and down the stack
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
432
diff
changeset
|
123 return adapterClass.cast(lifecycleBridge); |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
418
diff
changeset
|
124 } |
520
1ee452f31187
Experimental support for inverse direction history walking. Refactored/streamlined cancellation in HgLogCommand and down the stack
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
432
diff
changeset
|
125 // just in case there are more adapters in future |
1ee452f31187
Experimental support for inverse direction history walking. Refactored/streamlined cancellation in HgLogCommand and down the stack
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
432
diff
changeset
|
126 return Adaptable.Factory.getAdapter(handler, adapterClass, null); |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
418
diff
changeset
|
127 } |
192
e5407b5a586a
Incoming and Outgoing commands are alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
128 } |