Mercurial > jhg
diff src/org/tmatesoft/hg/repo/HgDataFile.java @ 88:61eedab3eb3e
Status between two revisions to recognize copy/rename
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 26 Jan 2011 05:46:47 +0100 |
parents | 5f9635c01681 |
children | a3a2e5deb320 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgDataFile.java Wed Jan 26 01:07:26 2011 +0100 +++ b/src/org/tmatesoft/hg/repo/HgDataFile.java Wed Jan 26 05:46:47 2011 +0100 @@ -57,7 +57,7 @@ } public int length(Nodeid nodeid) { - return content.dataLength(getLocalRevisionNumber(nodeid)); + return content.dataLength(getLocalRevision(nodeid)); } public byte[] content() { @@ -147,6 +147,16 @@ content.iterate(start, end, false, insp); getRepo().getChangelog().range(inspector, commitRevisions); } + + // for a given local revision of the file, find out local revision in the changelog + public int getChangesetLocalRevision(int revision) { + return content.linkRevision(revision); + } + + public Nodeid getChangesetRevision(Nodeid nid) { + int changelogRevision = getChangesetLocalRevision(getLocalRevision(nid)); + return getRepo().getChangelog().getRevision(changelogRevision); + } public boolean isCopy() { if (metadata == null) { @@ -171,8 +181,17 @@ } throw new UnsupportedOperationException(); } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(getClass().getSimpleName()); + sb.append('('); + sb.append(getPath()); + sb.append(')'); + return sb.toString(); + } - public static final class MetadataEntry { + private static final class MetadataEntry { private final String entry; private final int valueStart; /*package-local*/MetadataEntry(String key, String value) {