[PATCH 1 of 4 V2] localrepo: make report level in repo.transaction configurable

David Soria Parra dsp at experimentalworks.net
Tue Oct 1 05:29:21 CDT 2013


# HG changeset patch
# User David Soria Parra <dsp at experimentalworks.net>
# Date 1380622829 -7200
#      Tue Oct 01 12:20:29 2013 +0200
# Node ID a13c59f8506b0096508e4c8cbcc27612eabd5272
# Parent  63b15faf952df7d79912028e43888a72bd892822
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.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -812,7 +812,7 @@
     def wwritedata(self, filename, data):
         return self._filter(self._decodefilterpats, filename, data)
 
-    def transaction(self, desc):
+    def transaction(self, desc, report=None):
         tr = self._transref and self._transref() or None
         if tr and tr.running():
             return tr.nest()
@@ -824,8 +824,8 @@
 
         self._writejournal(desc)
         renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]
-
-        tr = transaction.transaction(self.ui.warn, self.sopener,
+        rp = report and report or self.ui.warn
+        tr = transaction.transaction(rp, self.sopener,
                                      self.sjoin("journal"),
                                      aftertrans(renames),
                                      self.store.createmode)


More information about the Mercurial-devel mailing list