Mercurial > hg4j
annotate src/com/tmate/hgkit/ll/HgDataFile.java @ 17:571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 27 Dec 2010 01:43:08 +0100 |
parents | fc265ddeab26 |
children | e929cecae4e1 |
rev | line source |
---|---|
17
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
1 /* |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2010 Artem Tikhomirov |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
3 */ |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
4 package com.tmate.hgkit.ll; |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
5 |
5
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
6 import static com.tmate.hgkit.ll.HgRepository.TIP; |
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
7 |
17
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
8 import java.util.Arrays; |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
9 |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
10 /** |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
11 * Extends Revlog/uses RevlogStream? |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
12 * ? name:HgFileNode? |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
13 * @author artem |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
14 */ |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
15 public class HgDataFile extends Revlog { |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 |
3
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
17 private final RevlogStream content; // XXX move up to Revlog? |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
18 |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
19 // absolute from repo root? |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
20 // slashes, unix-style? |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
21 // repo location agnostic, just to give info to user, not to access real storage |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
22 private final String path; |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
23 |
3
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
24 /*package-local*/HgDataFile(HgRepository hgRepo, String path, RevlogStream content) { |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
25 super(hgRepo); |
3
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
26 this.path = path; |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
27 this.content = content; |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
28 } |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
29 |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
30 public boolean exists() { |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
31 return content != null; // XXX need better impl |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
32 } |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
33 |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
34 public String getPath() { |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
35 return path; // hgRepo.backresolve(this) -> name? |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
36 } |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
37 |
5
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
38 public int getRevisionCount() { |
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
39 return content.revisionCount(); |
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
40 } |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
41 |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
42 public byte[] content() { |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
43 return content(TIP); |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
44 } |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
45 |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
46 public byte[] content(int revision) { |
5
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
47 final byte[][] dataPtr = new byte[1][]; |
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
48 Revlog.Inspector insp = new Revlog.Inspector() { |
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
49 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { |
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
50 dataPtr[0] = data; |
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
51 } |
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
52 }; |
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
53 content.iterate(revision, revision, true, insp); |
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
54 return dataPtr[0]; |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
55 } |
3
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
56 |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
57 public void history(Changeset.Inspector inspector) { |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
58 if (!exists()) { |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
59 throw new IllegalStateException("Can't get history of invalid repository file node"); |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
60 } |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
61 final int[] commitRevisions = new int[content.revisionCount()]; |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
62 Revlog.Inspector insp = new Revlog.Inspector() { |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
63 int count = 0; |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
64 |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
65 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
66 commitRevisions[count++] = linkRevision; |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
67 } |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
68 }; |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
69 content.iterate(0, -1, false, insp); |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
70 getRepo().getChangelog().range(inspector, commitRevisions); |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
71 } |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
72 |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
73 public void history(int start, int end, Changeset.Inspector i) { |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
74 throw HgRepository.notImplemented(); |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
75 } |
17
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
76 |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
77 /** |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
78 * XXX perhaps, return value Nodeid[2] and boolean needNodeids is better (and higher level) API for this query? |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
79 * |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
80 * @param revision - revision to query parents, or {@link HgRepository#TIP} |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
81 * @param parentRevisions - int[2] to get local revision numbers of parents (e.g. {6, -1}) |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
82 * @param parent1 - byte[20] or null, if parent's nodeid is not needed |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
83 * @param parent2 - byte[20] or null, if second parent's nodeid is not needed |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
84 * @return |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
85 */ |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
86 public void parents(int revision, int[] parentRevisions, byte[] parent1, byte[] parent2) { |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
87 if (revision != TIP && !(revision >= 0 && revision < content.revisionCount())) { |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
88 throw new IllegalArgumentException(String.valueOf(revision)); |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
89 } |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
90 if (parentRevisions == null || parentRevisions.length < 2) { |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
91 throw new IllegalArgumentException(String.valueOf(parentRevisions)); |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
92 } |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
93 if (parent1 != null && parent1.length < 20) { |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
94 throw new IllegalArgumentException(parent1.toString()); |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
95 } |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
96 if (parent2 != null && parent2.length < 20) { |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
97 throw new IllegalArgumentException(parent2.toString()); |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
98 } |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
99 class ParentCollector implements Revlog.Inspector { |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
100 public int p1 = -1; |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
101 public int p2 = -1; |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
102 public byte[] nodeid; |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
103 |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
104 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
105 p1 = parent1Revision; |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
106 p2 = parent2Revision; |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
107 this.nodeid = new byte[20]; |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
108 // nodeid arg now comes in 32 byte from (as in file format description), however upper 12 bytes are zeros. |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
109 System.arraycopy(nodeid, nodeid.length > 20 ? nodeid.length - 20 : 0, this.nodeid, 0, 20); |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
110 } |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
111 }; |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
112 ParentCollector pc = new ParentCollector(); |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
113 content.iterate(revision, revision, false, pc); |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
114 parentRevisions[0] = pc.p1; |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
115 parentRevisions[1] = pc.p2; |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
116 if (parent1 != null) { |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
117 if (parentRevisions[0] == -1) { |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
118 Arrays.fill(parent1, 0, 20, (byte) 0); |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
119 } else { |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
120 content.iterate(parentRevisions[0], parentRevisions[0], false, pc); |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
121 System.arraycopy(pc.nodeid, 0, parent1, 0, 20); |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
122 } |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
123 } |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
124 if (parent2 != null) { |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
125 if (parentRevisions[1] == -1) { |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
126 Arrays.fill(parent2, 0, 20, (byte) 0); |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
127 } else { |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
128 content.iterate(parentRevisions[1], parentRevisions[1], false, pc); |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
129 System.arraycopy(pc.nodeid, 0, parent2, 0, 20); |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
130 } |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
131 } |
571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
132 } |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
133 } |