Mercurial > jhg
diff src/org/tmatesoft/hg/internal/COWTransaction.java @ 665:dde18bc7053b v1.2m1
Test Copy-on-Write transactions
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 10 Jul 2013 20:16:37 +0200 |
parents | 12a4f60ea972 |
children |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/COWTransaction.java Wed Jul 10 19:33:51 2013 +0200 +++ b/src/org/tmatesoft/hg/internal/COWTransaction.java Wed Jul 10 20:16:37 2013 +0200 @@ -24,6 +24,7 @@ import org.tmatesoft.hg.core.HgIOException; import org.tmatesoft.hg.core.SessionContext; +import org.tmatesoft.hg.repo.HgInvalidStateException; /** * This transaction strategy makes a copy of original file and breaks origin hard links, if any. @@ -103,7 +104,9 @@ public void commit() throws HgIOException { for (Iterator<RollbackEntry> it = entries.iterator(); it.hasNext();) { RollbackEntry e = it.next(); - assert e.success; + if (!e.success) { + throw new HgInvalidStateException(String.format("Attempt to commit transaction without successful clearance of file %s", e.origin)); + } if (e.failure != null) { throw new HgIOException("Can't close transaction with a failure.", e.failure, e.origin); }