Mercurial > hg4j
annotate src/com/tmate/hgkit/ll/Changeset.java @ 46:4022c34a4804
Better hashCode impl
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 14 Jan 2011 04:56:53 +0100 |
parents | 21e26da142fa |
children | b01500fe2604 |
rev | line source |
---|---|
38
50dfc69c108e
Nodeid is confusing, denote it's reference to manifest
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
1 /* |
50dfc69c108e
Nodeid is confusing, denote it's reference to manifest
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
2 * Copyright (c) 2010, 2011 Artem Tikhomirov |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
3 */ |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
4 package com.tmate.hgkit.ll; |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
5 |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
6 import java.io.UnsupportedEncodingException; |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
7 import java.util.ArrayList; |
40
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
8 import java.util.Date; |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
9 import java.util.Locale; |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
10 |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
11 /** |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
12 * @see mercurial/changelog.py:read() |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
13 * <pre> |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
14 format used: |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
15 nodeid\n : manifest node in ascii |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 user\n : user, no \n or \r allowed |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
17 time tz extra\n : date (time is int or float, timezone is int) |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
18 : extra is metadatas, encoded and separated by '\0' |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
19 : older versions ignore it |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
20 files\n\n : files modified by the cset, no \n or \r allowed |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
21 (.*) : comment (free text, ideally utf-8) |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
22 |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
23 changelog v0 doesn't use extra |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
24 * </pre> |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
25 * @author artem |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
26 */ |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
27 public class Changeset { |
3
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
28 // TODO immutable |
38
50dfc69c108e
Nodeid is confusing, denote it's reference to manifest
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
29 private /*final*/ Nodeid manifest; |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
30 private String user; |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
31 private String comment; |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
32 private ArrayList<String> files; |
40
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
33 private Date time; |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
34 private String extras; // TODO branch, etc. |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
35 |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
36 public void dump() { |
40
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
37 System.out.println("User: " + user); |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
38 System.out.println("Comment: " + comment); |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
39 System.out.println("Manifest: " + manifest); |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
40 System.out.printf(Locale.US, "Date: %ta %<tb %<td %<tH:%<tM:%<tS %<tY %<tz\n", time); |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
41 System.out.println("Files: " + files.size()); |
40
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
42 if (extras != null) { |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
43 System.out.println("Extra: " + extras); |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
44 } |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
45 for (String s : files) { |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
46 System.out.print('\t'); |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
47 System.out.println(s); |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
48 } |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
49 } |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
50 |
3
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
51 public static Changeset parse(byte[] data, int offset, int length) { |
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
52 Changeset rv = new Changeset(); |
5
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
53 rv.init(data, offset, length); |
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
54 return rv; |
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
55 } |
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
56 |
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
57 /*package-local*/ void init(byte[] data, int offset, int length) { |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
58 final int bufferEndIndex = offset + length; |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
59 final byte lineBreak = (byte) '\n'; |
3
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
60 int breakIndex1 = indexOf(data, lineBreak, offset, bufferEndIndex); |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
61 if (breakIndex1 == -1) { |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
62 throw new IllegalArgumentException("Bad Changeset data"); |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
63 } |
5
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
64 Nodeid _nodeid = Nodeid.fromAscii(data, 0, breakIndex1); |
3
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
65 int breakIndex2 = indexOf(data, lineBreak, breakIndex1+1, bufferEndIndex); |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
66 if (breakIndex2 == -1) { |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
67 throw new IllegalArgumentException("Bad Changeset data"); |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
68 } |
5
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
69 String _user = new String(data, breakIndex1+1, breakIndex2 - breakIndex1 - 1); |
3
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
70 int breakIndex3 = indexOf(data, lineBreak, breakIndex2+1, bufferEndIndex); |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
71 if (breakIndex3 == -1) { |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
72 throw new IllegalArgumentException("Bad Changeset data"); |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
73 } |
40
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
74 String _timeString = new String(data, breakIndex2+1, breakIndex3 - breakIndex2 - 1); |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
75 int space1 = _timeString.indexOf(' '); |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
76 if (space1 == -1) { |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
77 throw new IllegalArgumentException("Bad Changeset data"); |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
78 } |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
79 int space2 = _timeString.indexOf(' ', space1+1); |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
80 if (space2 == -1) { |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
81 space2 = _timeString.length(); |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
82 } |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
83 long unixTime = Long.parseLong(_timeString.substring(0, space1)); // XXX Float, perhaps |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
84 int timezone = Integer.parseInt(_timeString.substring(space1+1, space2)); |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
85 // XXX not sure need to add timezone here - I can't figure out whether Hg keeps GMT time, and records timezone just for info, or unixTime is taken local |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
86 // on commit and timezone is recorded to adjust it to UTC. |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
87 Date _time = new Date((unixTime + timezone) * 1000); |
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
88 String _extras = space2 < _timeString.length() ? _timeString.substring(space2+1) : null; |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
89 |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
90 // |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
91 int lastStart = breakIndex3 + 1; |
3
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
92 int breakIndex4 = indexOf(data, lineBreak, lastStart, bufferEndIndex); |
5
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
93 ArrayList<String> _files = new ArrayList<String>(5); |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
94 while (breakIndex4 != -1 && breakIndex4 + 1 < bufferEndIndex) { |
5
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
95 _files.add(new String(data, lastStart, breakIndex4 - lastStart)); |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
96 lastStart = breakIndex4 + 1; |
3
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
97 if (data[breakIndex4 + 1] == lineBreak) { |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
98 // found \n\n |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
99 break; |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
100 } else { |
3
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
101 breakIndex4 = indexOf(data, lineBreak, lastStart, bufferEndIndex); |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
102 } |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
103 } |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
104 if (breakIndex4 == -1 || breakIndex4 >= bufferEndIndex) { |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
105 throw new IllegalArgumentException("Bad Changeset data"); |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
106 } |
5
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
107 String _comment; |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
108 try { |
5
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
109 _comment = new String(data, breakIndex4+2, bufferEndIndex - breakIndex4 - 2, "UTF-8"); |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
110 } catch (UnsupportedEncodingException ex) { |
5
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
111 _comment = ""; |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
112 throw new IllegalStateException("Could hardly happen"); |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
113 } |
5
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
114 // change this instance at once, don't leave it partially changes in case of error |
38
50dfc69c108e
Nodeid is confusing, denote it's reference to manifest
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
5
diff
changeset
|
115 this.manifest = _nodeid; |
5
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
116 this.user = _user; |
40
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
117 this.time = _time; |
5
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
118 this.files = _files; |
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
119 this.comment = _comment; |
40
21e26da142fa
Time parsing in Changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
38
diff
changeset
|
120 this.extras = _extras; |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
121 } |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
122 |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
123 private static int indexOf(byte[] src, byte what, int startOffset, int endIndex) { |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
124 for (int i = startOffset; i < endIndex; i++) { |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
125 if (src[i] == what) { |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
126 return i; |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
127 } |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
128 } |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
129 return -1; |
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
130 } |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
0
diff
changeset
|
131 |
3
24bb4f365164
Rudimentary log functionality with basic infrastructure is in place
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
2
diff
changeset
|
132 public interface Inspector { |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
0
diff
changeset
|
133 // first(), last(), single(). |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
0
diff
changeset
|
134 // <T> |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
0
diff
changeset
|
135 void next(Changeset cset); |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
0
diff
changeset
|
136 } |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
137 } |