Mercurial > jhg
comparison src/com/tmate/hgkit/ll/HgDataFile.java @ 5:fc265ddeab26
File content and non-effective, although working, patch application
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 21 Dec 2010 05:11:06 +0100 |
parents | 24bb4f365164 |
children | 571e1b2cc3f7 |
comparison
equal
deleted
inserted
replaced
4:aa1912c70b36 | 5:fc265ddeab26 |
---|---|
1 /** | 1 /** |
2 * Copyright (c) 2010 Artem Tikhomirov | 2 * Copyright (c) 2010 Artem Tikhomirov |
3 */ | 3 */ |
4 package com.tmate.hgkit.ll; | 4 package com.tmate.hgkit.ll; |
5 | |
6 import static com.tmate.hgkit.ll.HgRepository.TIP; | |
5 | 7 |
6 /** | 8 /** |
7 * Extends Revlog/uses RevlogStream? | 9 * Extends Revlog/uses RevlogStream? |
8 * ? name:HgFileNode? | 10 * ? name:HgFileNode? |
9 * @author artem | 11 * @author artem |
29 | 31 |
30 public String getPath() { | 32 public String getPath() { |
31 return path; // hgRepo.backresolve(this) -> name? | 33 return path; // hgRepo.backresolve(this) -> name? |
32 } | 34 } |
33 | 35 |
34 private static final int TIP = -2; | 36 public int getRevisionCount() { |
37 return content.revisionCount(); | |
38 } | |
35 | 39 |
36 public byte[] content() { | 40 public byte[] content() { |
37 return content(TIP); | 41 return content(TIP); |
38 } | 42 } |
39 | 43 |
40 public byte[] content(int revision) { | 44 public byte[] content(int revision) { |
41 throw HgRepository.notImplemented(); | 45 final byte[][] dataPtr = new byte[1][]; |
46 Revlog.Inspector insp = new Revlog.Inspector() { | |
47 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, byte[] data) { | |
48 dataPtr[0] = data; | |
49 } | |
50 }; | |
51 content.iterate(revision, revision, true, insp); | |
52 return dataPtr[0]; | |
42 } | 53 } |
43 | 54 |
44 public void history(Changeset.Inspector inspector) { | 55 public void history(Changeset.Inspector inspector) { |
45 if (!exists()) { | 56 if (!exists()) { |
46 throw new IllegalStateException("Can't get history of invalid repository file node"); | 57 throw new IllegalStateException("Can't get history of invalid repository file node"); |