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

login
register
mail settings
Submitter David Soria Parra
Date Oct. 1, 2013, 10:29 a.m.
Message ID <a13c59f8506b0096508e.1380623361@achird.localdomain>
Download mbox | patch
Permalink /patch/2683/
State Accepted
Commit eddc2a2d57e6395eca2d6564192c45a863f03cab
Headers show

Comments

David Soria Parra - Oct. 1, 2013, 10:29 a.m.
# HG changeset patch
# User David Soria Parra <dsp@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.

Patch

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)