Mercurial > hg4j
annotate src/org/tmatesoft/hg/core/HgChangeset.java @ 493:ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 18 Oct 2012 18:36:13 +0200 |
parents | 7bcfbc255f48 |
children | 934037edbea0 |
rev | line source |
---|---|
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
1 /* |
445
d0e5dc3cae6e
Support for phases functionality from Mercurial 2.1
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
2 * Copyright (c) 2011-2012 TMate Software Ltd |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
3 * |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
6 * the Free Software Foundation; version 2 of the License. |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
7 * |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
11 * GNU General Public License for more details. |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
12 * |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
13 * For information on how to redistribute this software under |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
14 * the terms of a license other than GNU General Public License |
102
a3a2e5deb320
Updated contact address to support@hg4j.com
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
94
diff
changeset
|
15 * contact TMate Software at support@hg4j.com |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 */ |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
17 package org.tmatesoft.hg.core; |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
18 |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
19 import java.util.ArrayList; |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
20 import java.util.Collections; |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
21 import java.util.List; |
316
ee6b467c1a5f
Supply HGFileRevision with copy information when possible, calculate it otherwise
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
274
diff
changeset
|
22 import java.util.Map; |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
23 |
445
d0e5dc3cae6e
Support for phases functionality from Mercurial 2.1
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
24 import org.tmatesoft.hg.internal.PhasesHelper; |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
25 import org.tmatesoft.hg.repo.HgChangelog; |
154
ba2bf656f00f
Changeset => RawChangeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
148
diff
changeset
|
26 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; |
493
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
27 import org.tmatesoft.hg.repo.HgInternals; |
445
d0e5dc3cae6e
Support for phases functionality from Mercurial 2.1
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
28 import org.tmatesoft.hg.repo.HgPhase; |
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:
415
diff
changeset
|
29 import org.tmatesoft.hg.repo.HgInvalidStateException; |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
65
diff
changeset
|
30 import org.tmatesoft.hg.repo.HgRepository; |
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:
415
diff
changeset
|
31 import org.tmatesoft.hg.repo.HgRuntimeException; |
94
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
93
diff
changeset
|
32 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:
427
diff
changeset
|
33 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:
415
diff
changeset
|
34 import org.tmatesoft.hg.util.CancelledException; |
133
4a948ec83980
core.Path to util.Path as it's not Hg repo dependant
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
131
diff
changeset
|
35 import org.tmatesoft.hg.util.Path; |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
36 |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
37 |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
38 /** |
131
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
129
diff
changeset
|
39 * Record in the Mercurial changelog, describing single commit. |
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
129
diff
changeset
|
40 * |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
41 * Not thread-safe, don't try to read from different threads |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
42 * |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
43 * @author Artem Tikhomirov |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
44 * @author TMate Software Ltd. |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
45 */ |
129
645829962785
core.Cset renamed to HgChangeset; repo.Changeset moved into HgChangelog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
125
diff
changeset
|
46 public class HgChangeset implements Cloneable { |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
47 |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
48 // these get initialized |
154
ba2bf656f00f
Changeset => RawChangeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
148
diff
changeset
|
49 private RawChangeset changeset; |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
50 private int revNumber; |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
51 private Nodeid nodeid; |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
52 |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
53 class ShareDataStruct { |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
54 ShareDataStruct(HgStatusCollector statusCollector, Path.Source pathFactory) { |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
55 statusHelper = statusCollector; |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
56 pathHelper = pathFactory; |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
57 } |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
58 public final HgStatusCollector statusHelper; |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
59 public final Path.Source pathHelper; |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
60 |
471
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
Artem Tikhomirov <tikhomirov.artem@gmail.com>
diff
changeset
|
61 public HgParentChildMap<HgChangelog> parentHelper; |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
62 public PhasesHelper phaseHelper; |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
63 }; |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
64 |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
65 // Helpers/utilities shared among few instances of HgChangeset |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
66 private final ShareDataStruct shared; |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
67 |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
68 // these are built on demand |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
211
diff
changeset
|
69 private List<HgFileRevision> modifiedFiles, addedFiles; |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
70 private List<Path> deletedFiles; |
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:
154
diff
changeset
|
71 private byte[] parent1, parent2; |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
72 |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
73 |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
74 // XXX consider CommandContext with StatusCollector, PathPool etc. Commands optionally get CC through a cons or create new |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
75 // and pass it around |
142
37a34044e6bd
More reasonable use of path normalizer and path.source
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
76 /*package-local*/HgChangeset(HgStatusCollector statusCollector, Path.Source pathFactory) { |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
77 shared = new ShareDataStruct(statusCollector, pathFactory); |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
78 } |
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:
154
diff
changeset
|
79 |
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:
154
diff
changeset
|
80 /*package-local*/ void init(int localRevNumber, Nodeid nid, RawChangeset rawChangeset) { |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
81 revNumber = localRevNumber; |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
82 nodeid = nid; |
196
e2115da4cf6a
Pool objects to avoid memory polution with duplicates
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
195
diff
changeset
|
83 changeset = rawChangeset.clone(); |
65
e21df6259f83
Log commandline sample updated to use LogCommand
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
84 modifiedFiles = addedFiles = null; |
e21df6259f83
Log commandline sample updated to use LogCommand
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
85 deletedFiles = null; |
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:
154
diff
changeset
|
86 parent1 = parent2 = null; |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
87 // keep references to shared (and everything in there: parentHelper, statusHelper, phaseHelper and pathHelper) |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
88 } |
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:
154
diff
changeset
|
89 |
432
1fc0da631200
Revlog.ParentWalker helper class got promoted as TLC, renamed to HgParentChildMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
427
diff
changeset
|
90 /*package-local*/ void setParentHelper(HgParentChildMap<HgChangelog> pw) { |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
91 if (pw != null) { |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
92 if (pw.getRepo() != shared.statusHelper.getRepo()) { |
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:
154
diff
changeset
|
93 throw new IllegalArgumentException(); |
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:
154
diff
changeset
|
94 } |
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:
154
diff
changeset
|
95 } |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
96 shared.parentHelper = pw; |
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:
154
diff
changeset
|
97 } |
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:
154
diff
changeset
|
98 |
403
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
99 /** |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
100 * Index of the changeset in local repository. Note, this number is relevant only for local repositories/operations, use |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
101 * {@link Nodeid nodeid} to uniquely identify a revision. |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
102 * |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
103 * @return index of the changeset revision |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
104 */ |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
105 public int getRevisionIndex() { |
65
e21df6259f83
Log commandline sample updated to use LogCommand
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
106 return revNumber; |
e21df6259f83
Log commandline sample updated to use LogCommand
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
107 } |
403
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
108 |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
109 /** |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
110 * Unique identity of this changeset revision |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
111 * @return revision identifier, never <code>null</code> |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
112 */ |
65
e21df6259f83
Log commandline sample updated to use LogCommand
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
113 public Nodeid getNodeid() { |
e21df6259f83
Log commandline sample updated to use LogCommand
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
114 return nodeid; |
e21df6259f83
Log commandline sample updated to use LogCommand
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
115 } |
403
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
116 |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
117 /** |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
118 * Name of the user who made this commit |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
119 * @return author of the commit, never <code>null</code> |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
120 */ |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
121 public String getUser() { |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
122 return changeset.user(); |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
123 } |
403
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
124 |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
125 /** |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
126 * Commit description |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
127 * @return content of the corresponding field in changeset record; empty string if none specified. |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
128 */ |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
129 public String getComment() { |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
130 return changeset.comment(); |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
131 } |
403
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
132 |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
133 /** |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
134 * Name of the branch this commit was made in. Returns "default" for main branch. |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
135 * @return name of the branch, non-empty string |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
136 */ |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
137 public String getBranch() { |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
138 return changeset.branch(); |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
139 } |
211
644ee58c9f16
Compound HgDate object to provide flexible access to change date/time information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
196
diff
changeset
|
140 |
644ee58c9f16
Compound HgDate object to provide flexible access to change date/time information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
196
diff
changeset
|
141 /** |
644ee58c9f16
Compound HgDate object to provide flexible access to change date/time information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
196
diff
changeset
|
142 * @return used to be String, now {@link HgDate}, use {@link HgDate#toString()} to get same result as before |
644ee58c9f16
Compound HgDate object to provide flexible access to change date/time information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
196
diff
changeset
|
143 */ |
644ee58c9f16
Compound HgDate object to provide flexible access to change date/time information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
196
diff
changeset
|
144 public HgDate getDate() { |
644ee58c9f16
Compound HgDate object to provide flexible access to change date/time information
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
196
diff
changeset
|
145 return new HgDate(changeset.date().getTime(), changeset.timezone()); |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
146 } |
403
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
147 |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
148 /** |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
149 * Indicates revision of manifest that tracks state of repository at the moment of this commit. |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
150 * Note, may be {@link Nodeid#NULL} in certain scenarios (e.g. first changeset in an empty repository, usually by bogus tools) |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
151 * |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
152 * @return revision identifier, never <code>null</code> |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
153 */ |
65
e21df6259f83
Log commandline sample updated to use LogCommand
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
154 public Nodeid getManifestRevision() { |
e21df6259f83
Log commandline sample updated to use LogCommand
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
155 return changeset.manifest(); |
e21df6259f83
Log commandline sample updated to use LogCommand
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
156 } |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
157 |
403
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
158 /** |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
159 * Lists names of files affected by this commit, as recorded in the changeset itself. Unlike {@link #getAddedFiles()}, |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
160 * {@link #getModifiedFiles()} and {@link #getRemovedFiles()}, this method doesn't analyze actual changes done |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
161 * in the commit, rather extracts value from the changeset record. |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
162 * |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
163 * List returned by this method may be empty, while aforementioned methods may produce non-empty result. |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
164 * |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
165 * @return list of filenames, never <code>null</code> |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
166 */ |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
167 public List<Path> getAffectedFiles() { |
87
25f2e5d1cd8b
Fix IAE when changeset has no files listed (merged revision)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
168 // reports files as recorded in changelog. Note, merge revisions may have no |
25f2e5d1cd8b
Fix IAE when changeset has no files listed (merged revision)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
169 // files listed, and thus this method would return empty list, while |
25f2e5d1cd8b
Fix IAE when changeset has no files listed (merged revision)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
170 // #getModifiedFiles() would return list with merged file(s) (because it uses status to get 'em, not |
25f2e5d1cd8b
Fix IAE when changeset has no files listed (merged revision)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
171 // what #files() gives). |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
172 ArrayList<Path> rv = new ArrayList<Path>(changeset.files().size()); |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
173 for (String name : changeset.files()) { |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
174 rv.add(shared.pathHelper.path(name)); |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
175 } |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
176 return rv; |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
177 } |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
178 |
403
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
179 /** |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
180 * Figures out files and specific revisions thereof that were modified in this commit |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
181 * |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
182 * @return revisions of files modified in this commit |
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:
415
diff
changeset
|
183 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> |
403
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
184 */ |
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:
415
diff
changeset
|
185 public List<HgFileRevision> getModifiedFiles() throws HgRuntimeException { |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
186 if (modifiedFiles == null) { |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
187 initFileChanges(); |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
188 } |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
189 return modifiedFiles; |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
190 } |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
191 |
403
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
192 /** |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
193 * Figures out files added in this commit |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
194 * |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
195 * @return revisions of files added in this commit |
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:
415
diff
changeset
|
196 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> |
403
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
197 */ |
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:
415
diff
changeset
|
198 public List<HgFileRevision> getAddedFiles() throws HgRuntimeException { |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
199 if (addedFiles == null) { |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
200 initFileChanges(); |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
201 } |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
202 return addedFiles; |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
203 } |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
204 |
403
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
205 /** |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
206 * Figures out files that were deleted as part of this commit |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
207 * |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
208 * @return revisions of files deleted in this commit |
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:
415
diff
changeset
|
209 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> |
403
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
210 */ |
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:
415
diff
changeset
|
211 public List<Path> getRemovedFiles() throws HgRuntimeException { |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
212 if (deletedFiles == null) { |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
213 initFileChanges(); |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
214 } |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
215 return deletedFiles; |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
216 } |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
217 |
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:
424
diff
changeset
|
218 public boolean isMerge() throws HgRuntimeException { |
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:
154
diff
changeset
|
219 // p1 == -1 and p2 != -1 is legitimate case |
274
9fb50c04f03c
Use Nodeid.isNull check instead of NULL.equals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
220 return !(getFirstParentRevision().isNull() || getSecondParentRevision().isNull()); |
125
26ad21b250e4
Explicit op to tell merge revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
124
diff
changeset
|
221 } |
124
cea84c5995e6
Changeset to access parent nodeids
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
222 |
274
9fb50c04f03c
Use Nodeid.isNull check instead of NULL.equals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
223 /** |
9fb50c04f03c
Use Nodeid.isNull check instead of NULL.equals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
224 * @return never <code>null</code> |
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:
415
diff
changeset
|
225 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> |
274
9fb50c04f03c
Use Nodeid.isNull check instead of NULL.equals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
226 */ |
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:
415
diff
changeset
|
227 public Nodeid getFirstParentRevision() throws HgRuntimeException { |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
228 if (shared.parentHelper != null) { |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
229 return shared.parentHelper.safeFirstParent(nodeid); |
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:
154
diff
changeset
|
230 } |
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:
154
diff
changeset
|
231 // read once for both p1 and p2 |
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:
154
diff
changeset
|
232 if (parent1 == null) { |
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:
154
diff
changeset
|
233 parent1 = new byte[20]; |
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:
154
diff
changeset
|
234 parent2 = new byte[20]; |
445
d0e5dc3cae6e
Support for phases functionality from Mercurial 2.1
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
235 getRepo().getChangelog().parents(revNumber, new int[2], parent1, parent2); |
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:
154
diff
changeset
|
236 } |
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:
154
diff
changeset
|
237 return Nodeid.fromBinary(parent1, 0); |
124
cea84c5995e6
Changeset to access parent nodeids
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
238 } |
cea84c5995e6
Changeset to access parent nodeids
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
239 |
274
9fb50c04f03c
Use Nodeid.isNull check instead of NULL.equals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
240 /** |
9fb50c04f03c
Use Nodeid.isNull check instead of NULL.equals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
241 * @return never <code>null</code> |
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:
415
diff
changeset
|
242 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> |
274
9fb50c04f03c
Use Nodeid.isNull check instead of NULL.equals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
243 */ |
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:
415
diff
changeset
|
244 public Nodeid getSecondParentRevision() throws HgRuntimeException { |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
245 if (shared.parentHelper != null) { |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
246 return shared.parentHelper.safeSecondParent(nodeid); |
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:
154
diff
changeset
|
247 } |
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:
154
diff
changeset
|
248 if (parent2 == null) { |
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:
154
diff
changeset
|
249 parent1 = new byte[20]; |
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:
154
diff
changeset
|
250 parent2 = new byte[20]; |
445
d0e5dc3cae6e
Support for phases functionality from Mercurial 2.1
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
251 getRepo().getChangelog().parents(revNumber, new int[2], parent1, parent2); |
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:
154
diff
changeset
|
252 } |
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:
154
diff
changeset
|
253 return Nodeid.fromBinary(parent2, 0); |
124
cea84c5995e6
Changeset to access parent nodeids
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
254 } |
cea84c5995e6
Changeset to access parent nodeids
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
255 |
471
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
Artem Tikhomirov <tikhomirov.artem@gmail.com>
diff
changeset
|
256 /** |
445
d0e5dc3cae6e
Support for phases functionality from Mercurial 2.1
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
257 * Tells the phase this changeset belongs to. |
d0e5dc3cae6e
Support for phases functionality from Mercurial 2.1
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
258 * @return one of {@link HgPhase} values |
471
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
Artem Tikhomirov <tikhomirov.artem@gmail.com>
diff
changeset
|
259 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> |
445
d0e5dc3cae6e
Support for phases functionality from Mercurial 2.1
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
260 */ |
471
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
Artem Tikhomirov <tikhomirov.artem@gmail.com>
diff
changeset
|
261 public HgPhase getPhase() throws HgRuntimeException { |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
262 if (shared.phaseHelper == null) { |
445
d0e5dc3cae6e
Support for phases functionality from Mercurial 2.1
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
263 // XXX would be handy to obtain ProgressSupport (perhaps, from statusHelper?) |
d0e5dc3cae6e
Support for phases functionality from Mercurial 2.1
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
264 // and pass it to #init(), so that there could be indication of file being read and cache being built |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
265 synchronized (shared) { |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
266 // ensure field is initialized only once |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
267 if (shared.phaseHelper == null) { |
493
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
268 shared.phaseHelper = new PhasesHelper(HgInternals.getImplementationRepo(getRepo()), shared.parentHelper); |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
269 } |
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
270 } |
445
d0e5dc3cae6e
Support for phases functionality from Mercurial 2.1
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
271 } |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
272 return shared.phaseHelper.getPhase(this); |
445
d0e5dc3cae6e
Support for phases functionality from Mercurial 2.1
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
273 } |
124
cea84c5995e6
Changeset to access parent nodeids
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
274 |
403
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
275 /** |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
276 * Create a copy of this changeset |
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
277 */ |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
278 @Override |
129
645829962785
core.Cset renamed to HgChangeset; repo.Changeset moved into HgChangelog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
125
diff
changeset
|
279 public HgChangeset clone() { |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
280 try { |
129
645829962785
core.Cset renamed to HgChangeset; repo.Changeset moved into HgChangelog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
125
diff
changeset
|
281 HgChangeset copy = (HgChangeset) super.clone(); |
196
e2115da4cf6a
Pool objects to avoid memory polution with duplicates
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
195
diff
changeset
|
282 // copy.changeset references this.changeset, doesn't need own copy |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
283 return copy; |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
284 } catch (CloneNotSupportedException ex) { |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
285 throw new InternalError(ex.toString()); |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
286 } |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
287 } |
445
d0e5dc3cae6e
Support for phases functionality from Mercurial 2.1
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
288 |
d0e5dc3cae6e
Support for phases functionality from Mercurial 2.1
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
289 private HgRepository getRepo() { |
450
03fd8d079e9c
Share PhasesHelper instance among few HgChangesets (mostly affects HgChangesetTreeHandler case)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
445
diff
changeset
|
290 return shared.statusHelper.getRepo(); |
445
d0e5dc3cae6e
Support for phases functionality from Mercurial 2.1
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
291 } |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
292 |
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:
415
diff
changeset
|
293 private /*synchronized*/ void initFileChanges() throws HgRuntimeException { |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
294 ArrayList<Path> deleted = new ArrayList<Path>(); |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
211
diff
changeset
|
295 ArrayList<HgFileRevision> modified = new ArrayList<HgFileRevision>(); |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
211
diff
changeset
|
296 ArrayList<HgFileRevision> added = new ArrayList<HgFileRevision>(); |
94
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
93
diff
changeset
|
297 HgStatusCollector.Record r = new HgStatusCollector.Record(); |
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:
415
diff
changeset
|
298 try { |
471
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
Artem Tikhomirov <tikhomirov.artem@gmail.com>
diff
changeset
|
299 shared.statusHelper.change(revNumber, r); |
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:
415
diff
changeset
|
300 } catch (CancelledException 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:
415
diff
changeset
|
301 // Record can't cancel |
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:
415
diff
changeset
|
302 throw new HgInvalidStateException("Internal error"); |
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:
415
diff
changeset
|
303 } |
445
d0e5dc3cae6e
Support for phases functionality from Mercurial 2.1
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
380
diff
changeset
|
304 final HgRepository repo = getRepo(); |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
87
diff
changeset
|
305 for (Path s : r.getModified()) { |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
306 Nodeid nid = r.nodeidAfterChange(s); |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
307 if (nid == 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:
415
diff
changeset
|
308 throw new HgInvalidStateException(String.format("For the file %s recorded as modified in changeset %d couldn't find revision after change", s, revNumber)); |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
309 } |
415
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
310 modified.add(new HgFileRevision(repo, nid, null, s, null)); |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
311 } |
316
ee6b467c1a5f
Supply HGFileRevision with copy information when possible, calculate it otherwise
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
274
diff
changeset
|
312 final Map<Path, Path> copied = r.getCopied(); |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
87
diff
changeset
|
313 for (Path s : r.getAdded()) { |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
314 Nodeid nid = r.nodeidAfterChange(s); |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
315 if (nid == 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:
415
diff
changeset
|
316 throw new HgInvalidStateException(String.format("For the file %s recorded as added in changeset %d couldn't find revision after change", s, revNumber)); |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
317 } |
415
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
318 added.add(new HgFileRevision(repo, nid, null, s, copied.get(s))); |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
319 } |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
87
diff
changeset
|
320 for (Path s : r.getRemoved()) { |
124
cea84c5995e6
Changeset to access parent nodeids
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
321 // with Path from getRemoved, may just copy |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
87
diff
changeset
|
322 deleted.add(s); |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
323 } |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
324 modified.trimToSize(); |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
325 added.trimToSize(); |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
326 deleted.trimToSize(); |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
327 modifiedFiles = Collections.unmodifiableList(modified); |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
328 addedFiles = Collections.unmodifiableList(added); |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
329 deletedFiles = Collections.unmodifiableList(deleted); |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
330 } |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
331 } |