Mercurial > jhg
comparison 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 |
comparison
equal
deleted
inserted
replaced
664:ae2d439fbed3 | 665:dde18bc7053b |
---|---|
22 import java.util.LinkedList; | 22 import java.util.LinkedList; |
23 import java.util.List; | 23 import java.util.List; |
24 | 24 |
25 import org.tmatesoft.hg.core.HgIOException; | 25 import org.tmatesoft.hg.core.HgIOException; |
26 import org.tmatesoft.hg.core.SessionContext; | 26 import org.tmatesoft.hg.core.SessionContext; |
27 import org.tmatesoft.hg.repo.HgInvalidStateException; | |
27 | 28 |
28 /** | 29 /** |
29 * This transaction strategy makes a copy of original file and breaks origin hard links, if any. | 30 * This transaction strategy makes a copy of original file and breaks origin hard links, if any. |
30 * Changes are directed to actual repository files. | 31 * Changes are directed to actual repository files. |
31 * | 32 * |
101 | 102 |
102 @Override | 103 @Override |
103 public void commit() throws HgIOException { | 104 public void commit() throws HgIOException { |
104 for (Iterator<RollbackEntry> it = entries.iterator(); it.hasNext();) { | 105 for (Iterator<RollbackEntry> it = entries.iterator(); it.hasNext();) { |
105 RollbackEntry e = it.next(); | 106 RollbackEntry e = it.next(); |
106 assert e.success; | 107 if (!e.success) { |
108 throw new HgInvalidStateException(String.format("Attempt to commit transaction without successful clearance of file %s", e.origin)); | |
109 } | |
107 if (e.failure != null) { | 110 if (e.failure != null) { |
108 throw new HgIOException("Can't close transaction with a failure.", e.failure, e.origin); | 111 throw new HgIOException("Can't close transaction with a failure.", e.failure, e.origin); |
109 } | 112 } |
110 if (!e.keepBackup && e.backup != null) { | 113 if (!e.keepBackup && e.backup != null) { |
111 e.backup.delete(); | 114 e.backup.delete(); |