comparison mercurial/localrepo.py @ 24281:e9ede9b4c2f8

hook: have a generic hook for transaction opening We are adding generic hooking for all transactions. We do not really have any useful information to include when opening the transaction but this is a useful time to allow a hook anyway. We better let people abort transaction before they happen than after multiple seconds/minutes of processing.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 10 Dec 2014 18:19:49 -0800
parents 7977d35df13b
children db8679812f84
comparison
equal deleted inserted replaced
24280:6c55e37ba5f2 24281:e9ede9b4c2f8
907 if self.svfs.exists("journal"): 907 if self.svfs.exists("journal"):
908 raise error.RepoError( 908 raise error.RepoError(
909 _("abandoned transaction found"), 909 _("abandoned transaction found"),
910 hint=_("run 'hg recover' to clean up transaction")) 910 hint=_("run 'hg recover' to clean up transaction"))
911 911
912 self.hook('pretxnopen', throw=True, txnname=desc)
913
912 self._writejournal(desc) 914 self._writejournal(desc)
913 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] 915 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]
914 rp = report and report or self.ui.warn 916 rp = report and report or self.ui.warn
915 vfsmap = {'plain': self.vfs} # root of .hg/ 917 vfsmap = {'plain': self.vfs} # root of .hg/
916 tr = transaction.transaction(rp, self.svfs, vfsmap, 918 tr = transaction.transaction(rp, self.svfs, vfsmap,