Mercurial > jhg
annotate src/org/tmatesoft/hg/repo/ext/MqManager.java @ 602:e3717fc7d26f
Refactor metadata parsing in HgDataFile, moved to standalone class
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 06 May 2013 17:11:29 +0200 |
parents | d2f6ab541330 |
children | 507602cb4fb3 |
rev | line source |
---|---|
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
1 /* |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012 TMate Software Ltd |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
3 * |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
6 * the Free Software Foundation; version 2 of the License. |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
7 * |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
11 * GNU General Public License for more details. |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
12 * |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
13 * For information on how to redistribute this software under |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
14 * the terms of a license other than GNU General Public License |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
15 * contact TMate Software at support@hg4j.com |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 */ |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
17 package org.tmatesoft.hg.repo.ext; |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
18 |
471
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
465
diff
changeset
|
19 import static org.tmatesoft.hg.util.LogFacility.Severity.Warn; |
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
465
diff
changeset
|
20 |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
21 import java.io.File; |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
22 import java.io.IOException; |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
23 import java.util.ArrayList; |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
24 import java.util.Collections; |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
25 import java.util.HashMap; |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
26 import java.util.LinkedList; |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
27 import java.util.List; |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
28 import java.util.Map; |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
29 |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
30 import org.tmatesoft.hg.core.Nodeid; |
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:
490
diff
changeset
|
31 import org.tmatesoft.hg.internal.Internals; |
480
f3fab7a20841
Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
475
diff
changeset
|
32 import org.tmatesoft.hg.internal.LineReader; |
471
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
465
diff
changeset
|
33 import org.tmatesoft.hg.repo.HgInvalidControlFileException; |
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
465
diff
changeset
|
34 import org.tmatesoft.hg.repo.HgInvalidFileException; |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
35 import org.tmatesoft.hg.util.LogFacility; |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
36 import org.tmatesoft.hg.util.Path; |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
37 |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
38 /** |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
39 * Mercurial Queues Support. |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
40 * Access to MqExtension functionality. |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
41 * |
501
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
42 * FIXME check we don't hold any mq files for too long, close them, use |
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
43 * the same lock mechanism as mq does (if any). Check if MQ uses Mercurial's store lock |
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
44 * |
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
45 * @since 1.1 |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
46 * @author Artem Tikhomirov |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
47 * @author TMate Software Ltd. |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
48 */ |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
49 public class MqManager { |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
50 |
465
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
51 private static final String PATCHES_DIR = "patches"; |
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
52 |
501
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
53 private final Internals repo; |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
54 private List<PatchRecord> applied = Collections.emptyList(); |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
55 private List<PatchRecord> allKnown = Collections.emptyList(); |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
56 private List<String> queueNames = Collections.emptyList(); |
465
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
57 private String activeQueue = PATCHES_DIR; |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
58 |
501
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
59 /*package-local*/ MqManager(Internals internalRepo) { |
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
60 repo = internalRepo; |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
61 } |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
62 |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
63 /** |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
64 * Updates manager with up-to-date state of the mercurial queues. |
501
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
65 * @return <code>this</code> for convenience |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
66 */ |
501
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
67 public MqManager refresh() throws HgInvalidControlFileException { |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
68 applied = allKnown = Collections.emptyList(); |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
69 queueNames = Collections.emptyList(); |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
480
diff
changeset
|
70 final LogFacility log = repo.getSessionContext().getLog(); |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
71 try { |
501
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
72 File queues = repo.getFileFromRepoDir("patches.queues"); |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
73 if (queues.isFile()) { |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
74 LineReader lr = new LineReader(queues, log).trimLines(true).skipEmpty(true); |
480
f3fab7a20841
Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
475
diff
changeset
|
75 lr.read(new LineReader.SimpleLineCollector(), queueNames = new LinkedList<String>()); |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
76 } |
465
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
77 final String queueLocation; // path under .hg to patch queue information (status, series and diff files) |
501
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
78 File activeQueueFile = repo.getFileFromRepoDir("patches.queue"); |
465
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
79 // file is there only if it's not default queue ('patches') that is active |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
80 if (activeQueueFile.isFile()) { |
465
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
81 ArrayList<String> contents = new ArrayList<String>(); |
480
f3fab7a20841
Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
475
diff
changeset
|
82 new LineReader(activeQueueFile, log).read(new LineReader.SimpleLineCollector(), contents); |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
83 if (contents.isEmpty()) { |
471
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
465
diff
changeset
|
84 log.dump(getClass(), Warn, "File %s with active queue name is empty", activeQueueFile.getName()); |
465
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
85 activeQueue = PATCHES_DIR; |
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
86 queueLocation = PATCHES_DIR + '/'; |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
87 } else { |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
88 activeQueue = contents.get(0); |
465
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
89 queueLocation = PATCHES_DIR + '-' + activeQueue + '/'; |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
90 } |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
91 } else { |
465
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
92 activeQueue = PATCHES_DIR; |
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
93 queueLocation = PATCHES_DIR + '/'; |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
94 } |
465
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
95 final Path.Source patchLocation = new Path.Source() { |
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
96 |
471
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
465
diff
changeset
|
97 public Path path(CharSequence p) { |
465
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
98 StringBuilder sb = new StringBuilder(64); |
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
99 sb.append(".hg/"); |
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
100 sb.append(queueLocation); |
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
101 sb.append(p); |
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
102 return Path.create(sb); |
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
103 } |
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
104 }; |
501
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
105 final File fileStatus = repo.getFileFromRepoDir(queueLocation + "status"); |
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
106 final File fileSeries = repo.getFileFromRepoDir(queueLocation + "series"); |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
107 if (fileStatus.isFile()) { |
480
f3fab7a20841
Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
475
diff
changeset
|
108 new LineReader(fileStatus, log).read(new LineReader.LineConsumer<List<PatchRecord>>() { |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
109 |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
110 public boolean consume(String line, List<PatchRecord> result) throws IOException { |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
111 int sep = line.indexOf(':'); |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
112 if (sep == -1) { |
471
7bcfbc255f48
Merge changes from smartgit3 branch into 1.1 stream
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
465
diff
changeset
|
113 log.dump(MqManager.class, Warn, "Bad line in %s:%s", fileStatus.getPath(), line); |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
114 return true; |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
115 } |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
116 Nodeid nid = Nodeid.fromAscii(line.substring(0, sep)); |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
117 String name = new String(line.substring(sep+1)); |
465
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
118 result.add(new PatchRecord(nid, name, patchLocation.path(name))); |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
119 return true; |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
120 } |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
121 }, applied = new LinkedList<PatchRecord>()); |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
122 } |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
123 if (fileSeries.isFile()) { |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
124 final Map<String,PatchRecord> name2patch = new HashMap<String, PatchRecord>(); |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
125 for (PatchRecord pr : applied) { |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
126 name2patch.put(pr.getName(), pr); |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
127 } |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
128 LinkedList<String> knownPatchNames = new LinkedList<String>(); |
480
f3fab7a20841
Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
475
diff
changeset
|
129 new LineReader(fileSeries, log).read(new LineReader.SimpleLineCollector(), knownPatchNames); |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
130 // XXX read other queues? |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
131 allKnown = new ArrayList<PatchRecord>(knownPatchNames.size()); |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
132 for (String name : knownPatchNames) { |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
133 PatchRecord pr = name2patch.get(name); |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
134 if (pr == null) { |
465
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
135 pr = new PatchRecord(null, name, patchLocation.path(name)); |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
136 } |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
137 allKnown.add(pr); |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
138 } |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
139 } |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
140 } catch (HgInvalidFileException ex) { |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
141 HgInvalidControlFileException th = new HgInvalidControlFileException(ex.getMessage(), ex.getCause(), ex.getFile()); |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
142 th.setStackTrace(ex.getStackTrace()); |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
143 throw th; |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
144 } |
501
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
145 return this; |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
146 } |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
147 |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
148 /** |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
149 * Number of patches not yet applied |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
150 * @return positive value when there are |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
151 */ |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
152 public int getQueueSize() { |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
153 return getAllKnownPatches().size() - getAppliedPatches().size(); |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
154 } |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
155 |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
156 /** |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
157 * Subset of the patches from the queue that were already applied to the repository |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
158 * <p>Analog of 'hg qapplied' |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
159 * |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
160 * <p>Clients shall call {@link #refresh()} prior to first use |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
161 * @return collection of records in no particular order, may be empty if none applied |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
162 */ |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
163 public List<PatchRecord> getAppliedPatches() { |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
164 return Collections.unmodifiableList(applied); |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
165 } |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
166 |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
167 /** |
465
2078692eeb58
MqManager: read status/series of the active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
464
diff
changeset
|
168 * All of the patches in the active queue that MQ knows about for this repository |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
169 * |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
170 * <p>Clients shall call {@link #refresh()} prior to first use |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
171 * @return collection of records in no particular order, may be empty if there are no patches in the queue |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
172 */ |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
173 public List<PatchRecord> getAllKnownPatches() { |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
174 return Collections.unmodifiableList(allKnown); |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
175 } |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
176 |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
177 /** |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
178 * Name of the patch queue <code>hg qqueue --active</code> which is active now. |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
179 * @return patch queue name |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
180 */ |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
181 public String getActiveQueueName() { |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
182 return activeQueue; |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
183 } |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
184 |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
185 /** |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
186 * Patch queues known in the repository, <code>hg qqueue -l</code> analog. |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
187 * There's at least one patch queue (default one names 'patches'). Only one patch queue at a time is active. |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
188 * |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
189 * @return names of patch queues |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
190 */ |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
191 public List<String> getQueueNames() { |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
192 return Collections.unmodifiableList(queueNames); |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
193 } |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
194 |
475
0e34b8f3946a
Tests for MqManager
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
195 public final class PatchRecord { |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
196 private final Nodeid nodeid; |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
197 private final String name; |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
198 private final Path location; |
464
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
199 |
1a3c18d57a8e
MqManager evolution: same PatchRecord instances, list patch queues, detect active queue
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
463
diff
changeset
|
200 // hashCode/equals might be useful if cons becomes public |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
201 |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
202 PatchRecord(Nodeid revision, String name, Path diffLocation) { |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
203 nodeid = revision; |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
204 this.name = name; |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
205 this.location = diffLocation; |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
206 } |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
207 |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
208 /** |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
209 * Identifies changeset of the patch that has been applied to the repository |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
210 * |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
211 * @return changeset revision or <code>null</code> if this patch is not yet applied |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
212 */ |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
213 public Nodeid getRevision() { |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
214 return nodeid; |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
215 } |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
216 |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
217 /** |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
218 * Identifies patch, either based on a user-supplied name (<code>hg qnew <i>patch-name</i></code>) or |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
219 * an automatically generated name (like <code><i>revisionIndex</i>.diff</code> for imported changesets). |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
220 * Clients shall not rely on this naming scheme, though. |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
221 * |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
222 * @return never <code>null</code> |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
223 */ |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
224 public String getName() { |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
225 return name; |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
226 } |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
227 |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
228 /** |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
229 * Location of diff file with the patch, relative to repository root |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
230 * @return path to the patch, never <code>null</code> |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
231 */ |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
232 public Path getPatchLocation() { |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
233 return location; |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
234 } |
475
0e34b8f3946a
Tests for MqManager
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
235 |
0e34b8f3946a
Tests for MqManager
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
236 @Override |
0e34b8f3946a
Tests for MqManager
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
237 public String toString() { |
0e34b8f3946a
Tests for MqManager
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
238 String fmt = "mq.PatchRecord[name:%s; %spath:%s]"; |
0e34b8f3946a
Tests for MqManager
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
239 String ni = nodeid != null ? String.format("applied as: %s; ", nodeid.shortNotation()) : ""; |
0e34b8f3946a
Tests for MqManager
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
240 return String.format(fmt, name, ni, location); |
0e34b8f3946a
Tests for MqManager
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
241 } |
463
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
242 } |
a0507a9f3da0
Initial support for MqExtension
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
243 } |