##// END OF EJS Templates
localrepo: execute appropriate actions for dirstate at releasing transaction...
FUJIWARA Katsunori -
r26577:8f2ff40f default
parent child Browse files
Show More
@@ -209,9 +209,6 b' def _aborttransaction(repo):'
209 tr = repo.currenttransaction()
209 tr = repo.currenttransaction()
210 tr.abort()
210 tr.abort()
211
211
212 # TODO: this should be done via transaction.abort()
213 repo.dirstate.invalidate() # prevent wlock from writing changes out
214
215 # restore to backuped dirstate
212 # restore to backuped dirstate
216 repo.vfs.rename(dirstatebackup, 'dirstate')
213 repo.vfs.rename(dirstatebackup, 'dirstate')
217 dirstatebackup = None
214 dirstatebackup = None
@@ -997,13 +997,26 b' class localrepository(object):'
997 pending = lambda: tr.writepending() and self.root or ""
997 pending = lambda: tr.writepending() and self.root or ""
998 reporef().hook('pretxnclose', throw=True, pending=pending,
998 reporef().hook('pretxnclose', throw=True, pending=pending,
999 txnname=desc, **tr.hookargs)
999 txnname=desc, **tr.hookargs)
1000 def releasefn(tr, success):
1001 repo = reporef()
1002 if success:
1003 repo.dirstate.write()
1004 else:
1005 # prevent in-memory changes from being written out at
1006 # the end of outer wlock scope or so
1007 repo.dirstate.invalidate()
1008
1009 # discard all changes (including ones already written
1010 # out) in this transaction
1011 repo.vfs.rename('journal.dirstate', 'dirstate')
1000
1012
1001 tr = transaction.transaction(rp, self.svfs, vfsmap,
1013 tr = transaction.transaction(rp, self.svfs, vfsmap,
1002 "journal",
1014 "journal",
1003 "undo",
1015 "undo",
1004 aftertrans(renames),
1016 aftertrans(renames),
1005 self.store.createmode,
1017 self.store.createmode,
1006 validator=validate)
1018 validator=validate,
1019 releasefn=releasefn)
1007
1020
1008 tr.hookargs['txnid'] = txnid
1021 tr.hookargs['txnid'] = txnid
1009 # note: writing the fncache only during finalize mean that the file is
1022 # note: writing the fncache only during finalize mean that the file is
General Comments 0
You need to be logged in to leave comments. Login now