private static File pathTxnSha1(FSFS fsfs, FSRepresentation representation, String txnId) { final String checksum = representation.getSHA1HexDigest(); final File transactionDirectory = fsfs.getTransactionDir(txnId); return SVNFileUtil.createFilePath(transactionDirectory, checksum); } }
public String getFileSHA1Checksum() throws SVNException { if (getType() != SVNNodeKind.FILE) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FILE, "Attempted to get checksum of a *non*-file node"); SVNErrorManager.error(err, SVNLogType.FSFS); } return getTextRepresentation() != null ? getTextRepresentation().getSHA1HexDigest() : ""; }
public void run() throws SVNException { final FSRepresentation oldRep = reposCacheManager.getRepresentationByHash(representation.getSHA1HexDigest()); if (oldRep != null) { oldRep.setUniquifier(representation.getUniquifier()); oldRep.setMD5HexDigest(representation.getMD5HexDigest()); // myRevNode.setTextRepresentation(oldRep); } } });
public void insert(final FSRepresentation representation, boolean rejectDup) throws SVNException { if (representation.getSHA1HexDigest() == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_CHECKSUM_KIND, "Only SHA1 checksums can be used as keys in the rep_cache table.\n"); SVNErrorManager.error(err, SVNLogType.FSFS); } FSRepresentation oldRep = getRepresentationByHash(representation.getSHA1HexDigest()); if (oldRep != null) { if (rejectDup && (oldRep.getRevision() != representation.getRevision() || oldRep.getOffset() != representation.getOffset() || oldRep.getSize() != representation.getSize() || oldRep.getExpandedSize() != representation.getExpandedSize())) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Representation key for checksum ''{0}'' exists in " + "filesystem ''{1}'' with a different value ({2},{3},{4},{5}) than what we were about to store ({6},{7},{8},{9})", new Object[] { representation.getSHA1HexDigest(), myFSFS.getRepositoryRoot(), String.valueOf(oldRep.getRevision()), String.valueOf(oldRep.getOffset()), String.valueOf(oldRep.getSize()), String.valueOf(oldRep.getExpandedSize()), String.valueOf(representation.getRevision()), String.valueOf(representation.getOffset()), String.valueOf(representation.getSize()), String.valueOf(representation.getExpandedSize()) }); SVNErrorManager.error(err, SVNLogType.FSFS); } return; } try { myTable.insert(new Object[] { representation.getSHA1HexDigest(), new Long(representation.getRevision()), new Long(representation.getOffset()), new Long(representation.getSize()), new Long(representation.getExpandedSize()) }); } catch (SqlJetException e) { SVNErrorManager.error(convertError(e), SVNLogType.FSFS); } }
public String getFileSHA1Checksum() throws SVNException { if (getType() != SVNNodeKind.FILE) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FILE, "Attempted to get checksum of a *non*-file node"); SVNErrorManager.error(err, SVNLogType.FSFS); } return getTextRepresentation() != null ? getTextRepresentation().getSHA1HexDigest() : ""; }
public String getFileSHA1Checksum() throws SVNException { if (getType() != SVNNodeKind.FILE) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FILE, "Attempted to get checksum of a *non*-file node"); SVNErrorManager.error(err, SVNLogType.FSFS); } return getTextRepresentation() != null ? getTextRepresentation().getSHA1HexDigest() : ""; }
public void insert(final FSRepresentation representation, boolean rejectDup) throws SVNException { if (representation.getSHA1HexDigest() == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_CHECKSUM_KIND, "Only SHA1 checksums can be used as keys in the rep_cache table.\n"); SVNErrorManager.error(err, SVNLogType.FSFS); } FSRepresentation oldRep = getRepresentationByHash(representation.getSHA1HexDigest()); if (oldRep != null) { if (rejectDup && (oldRep.getRevision() != representation.getRevision() || oldRep.getItemIndex() != representation.getItemIndex() || oldRep.getSize() != representation.getSize() || oldRep.getExpandedSize() != representation.getExpandedSize())) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Representation key for checksum ''{0}'' exists in " + "filesystem ''{1}'' with a different value ({2},{3},{4},{5}) than what we were about to store ({6},{7},{8},{9})", new Object[] { representation.getSHA1HexDigest(), myFSFS.getRepositoryRoot(), String.valueOf(oldRep.getRevision()), String.valueOf(oldRep.getItemIndex()), String.valueOf(oldRep.getSize()), String.valueOf(oldRep.getExpandedSize()), String.valueOf(representation.getRevision()), String.valueOf(representation.getItemIndex()), String.valueOf(representation.getSize()), String.valueOf(representation.getExpandedSize()) }); SVNErrorManager.error(err, SVNLogType.FSFS); } return; } try { myTable.insert(new Object[] { representation.getSHA1HexDigest(), new Long(representation.getRevision()), new Long(representation.getItemIndex()), new Long(representation.getSize()), new Long(representation.getExpandedSize()) }); } catch (SqlJetException e) { SVNErrorManager.error(convertError(e), SVNLogType.FSFS); } }
public void insert(final FSRepresentation representation, boolean rejectDup) throws SVNException { if (representation.getSHA1HexDigest() == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_CHECKSUM_KIND, "Only SHA1 checksums can be used as keys in the rep_cache table.\n"); SVNErrorManager.error(err, SVNLogType.FSFS); } FSRepresentation oldRep = getRepresentationByHash(representation.getSHA1HexDigest()); if (oldRep != null) { if (rejectDup && (oldRep.getRevision() != representation.getRevision() || oldRep.getOffset() != representation.getOffset() || oldRep.getSize() != representation.getSize() || oldRep.getExpandedSize() != representation.getExpandedSize())) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Representation key for checksum ''{0}'' exists in " + "filesystem ''{1}'' with a different value ({2},{3},{4},{5}) than what we were about to store ({6},{7},{8},{9})", new Object[] { representation.getSHA1HexDigest(), myFSFS.getRepositoryRoot(), String.valueOf(oldRep.getRevision()), String.valueOf(oldRep.getOffset()), String.valueOf(oldRep.getSize()), String.valueOf(oldRep.getExpandedSize()), String.valueOf(representation.getRevision()), String.valueOf(representation.getOffset()), String.valueOf(representation.getSize()), String.valueOf(representation.getExpandedSize()) }); SVNErrorManager.error(err, SVNLogType.FSFS); } return; } try { myTable.insert(new Object[] { representation.getSHA1HexDigest(), new Long(representation.getRevision()), new Long(representation.getOffset()), new Long(representation.getSize()), new Long(representation.getExpandedSize()) }); } catch (SqlJetException e) { SVNErrorManager.error(convertError(e), SVNLogType.FSFS); } }
private static void storeSha1RepMapping(FSFS fsfs, FSRepresentation representation) throws SVNException { if (fsfs.isRepSharingAllowed() && representation != null && representation.getSHA1HexDigest() != null) { final File fileName = pathTxnSha1(fsfs, representation, representation.getTxnId()); final String stringRepresentation = representation.getStringRepresentation(fsfs.getDBFormat()); SVNFileUtil.writeToFile(fileName, stringRepresentation, "UTF-8"); } }
public void run() throws SVNException { FSRepresentation oldRep = reposCacheManager.getRepresentationByHash(rep.getSHA1HexDigest()); if (oldRep != null) { oldRep.setUniquifier(rep.getUniquifier()); oldRep.setMD5HexDigest(rep.getMD5HexDigest()); truncateToSize[0] = myRepOffset; myRevNode.setTextRepresentation(oldRep); } } });
IFSRepresentationCacheManager reposCacheManager = fsfs.getRepositoryCacheManager(); if (reposCacheManager != null) { oldRepresentation = reposCacheManager.getRepresentationByHash(rep.getSHA1HexDigest());
oldRepresentation = representationsMap.get(representation.getSHA1HexDigest());