Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 19853:eddc2a2d57e6
localrepo: make report level in repo.transaction configurable
repo.transaction always writes to stderr when a transaction aborts. In order to
be able to abort a transaction quietly (e.g shelve needs a temporary view on
the repo) we need to make the report level configurable.
author | David Soria Parra <dsp@experimentalworks.net> |
---|---|
date | Tue, 01 Oct 2013 12:20:29 +0200 |
parents | 57479e0d203d |
children | fc3fbca35085 |
comparison
equal
deleted
inserted
replaced
19852:57479e0d203d | 19853:eddc2a2d57e6 |
---|---|
811 self.wvfs.setflags(filename, False, True) | 811 self.wvfs.setflags(filename, False, True) |
812 | 812 |
813 def wwritedata(self, filename, data): | 813 def wwritedata(self, filename, data): |
814 return self._filter(self._decodefilterpats, filename, data) | 814 return self._filter(self._decodefilterpats, filename, data) |
815 | 815 |
816 def transaction(self, desc): | 816 def transaction(self, desc, report=None): |
817 tr = self._transref and self._transref() or None | 817 tr = self._transref and self._transref() or None |
818 if tr and tr.running(): | 818 if tr and tr.running(): |
819 return tr.nest() | 819 return tr.nest() |
820 | 820 |
821 # abort here if the journal already exists | 821 # abort here if the journal already exists |
823 raise error.RepoError( | 823 raise error.RepoError( |
824 _("abandoned transaction found - run hg recover")) | 824 _("abandoned transaction found - run hg recover")) |
825 | 825 |
826 self._writejournal(desc) | 826 self._writejournal(desc) |
827 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] | 827 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] |
828 | 828 rp = report and report or self.ui.warn |
829 tr = transaction.transaction(self.ui.warn, self.sopener, | 829 tr = transaction.transaction(rp, self.sopener, |
830 self.sjoin("journal"), | 830 self.sjoin("journal"), |
831 aftertrans(renames), | 831 aftertrans(renames), |
832 self.store.createmode) | 832 self.store.createmode) |
833 self._transref = weakref.ref(tr) | 833 self._transref = weakref.ref(tr) |
834 return tr | 834 return tr |