Mercurial > jhg
comparison src/org/tmatesoft/hg/core/Nodeid.java @ 78:c25c5c348d1b
Skip metadata in the beginning of a file content. Parse metadata, recognize copies/renames
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Tue, 25 Jan 2011 02:13:53 +0100 |
| parents | 6f1b88693d48 |
| children | a3a2e5deb320 |
comparison
equal
deleted
inserted
replaced
| 77:c677e1593919 | 78:c25c5c348d1b |
|---|---|
| 115 byte[] b = new byte[20]; // create new instance if no other reasonable guesses possible | 115 byte[] b = new byte[20]; // create new instance if no other reasonable guesses possible |
| 116 System.arraycopy(binaryRepresentation, offset, b, 0, 20); | 116 System.arraycopy(binaryRepresentation, offset, b, 0, 20); |
| 117 return new Nodeid(b, false); | 117 return new Nodeid(b, false); |
| 118 } | 118 } |
| 119 | 119 |
| 120 public static Nodeid fromAscii(String asciiRepresentation) { | |
| 121 if (asciiRepresentation.length() != 40) { | |
| 122 throw new IllegalArgumentException(); | |
| 123 } | |
| 124 // XXX is better impl for String possible? | |
| 125 return fromAscii(asciiRepresentation.getBytes(), 0, 40); | |
| 126 } | |
| 120 public static Nodeid fromAscii(byte[] asciiRepresentation, int offset, int length) { | 127 public static Nodeid fromAscii(byte[] asciiRepresentation, int offset, int length) { |
| 121 if (length != 40) { | 128 if (length != 40) { |
| 122 throw new IllegalArgumentException(); | 129 throw new IllegalArgumentException(); |
| 123 } | 130 } |
| 124 byte[] data = new byte[20]; | 131 byte[] data = new byte[20]; |
