[Updated] D10886: narrowbundle: use new context manager for silencing the ui

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Jun 21 12:18:54 UTC 2021


Closed by commit rHG86418ad637d1: narrowbundle: use new context manager for silencing the ui (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10886?vs=28612&id=28643

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D10886/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D10886

AFFECTED FILES
  hgext/narrow/narrowbundle2.py
  tests/test-narrow-patterns.t
  tests/test-narrow-widen.t
  tests/test-narrow.t

CHANGE DETAILS

diff --git a/tests/test-narrow.t b/tests/test-narrow.t
--- a/tests/test-narrow.t
+++ b/tests/test-narrow.t
@@ -305,7 +305,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 3 changesets with 1 changes to 1 files
+  added 4 changesets with 1 changes to 1 files (+1 heads)
   $ hg tracked
   I path:d0
   $ hg files
diff --git a/tests/test-narrow-widen.t b/tests/test-narrow-widen.t
--- a/tests/test-narrow-widen.t
+++ b/tests/test-narrow-widen.t
@@ -118,7 +118,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 3 changesets with 2 changes to 2 files
+  added 3 changesets with 2 changes to 3 files
   $ hg l
   @  ...2: add outside
   |
@@ -190,7 +190,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 8 changesets with 7 changes to 3 files
+  added 8 changesets with 7 changes to 5 files
   $ hg tracked
   I path:inside
   I path:wider
@@ -311,7 +311,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 9 changesets with 5 changes to 5 files
+  added 9 changesets with 5 changes to 9 files
   $ hg tracked
   I path:d0
   I path:d1
diff --git a/tests/test-narrow-patterns.t b/tests/test-narrow-patterns.t
--- a/tests/test-narrow-patterns.t
+++ b/tests/test-narrow-patterns.t
@@ -139,7 +139,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 9 changesets with 6 changes to 6 files
+  added 9 changesets with 6 changes to 10 files
   $ hg tracked
   I path:dir1
   I path:dir2
@@ -198,7 +198,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 11 changesets with 7 changes to 7 files
+  added 11 changesets with 7 changes to 12 files
   $ hg tracked
   I path:dir1
   I path:dir2
@@ -255,7 +255,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 13 changesets with 8 changes to 8 files
+  added 13 changesets with 8 changes to 14 files
   $ hg tracked
   I path:dir1
   I path:dir2
@@ -312,7 +312,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 13 changesets with 9 changes to 9 files
+  added 13 changesets with 9 changes to 17 files
   $ hg tracked
   I path:dir1
   I path:dir2
@@ -387,7 +387,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 10 changesets with 6 changes to 6 files
+  added 10 changesets with 6 changes to 8 files
   $ find * | sort
   dir1
   dir1/bar
diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py
--- a/hgext/narrow/narrowbundle2.py
+++ b/hgext/narrow/narrowbundle2.py
@@ -281,10 +281,10 @@
     try:
         gen = exchange.readbundle(ui, f, chgrpfile, vfs)
         # silence internal shuffling chatter
-        override = {(b'ui', b'quiet'): True}
-        if ui.verbose:
-            override = {}
-        with ui.configoverride(override):
+        maybe_silent = (
+            ui.silent() if not ui.verbose else util.nullcontextmanager()
+        )
+        with maybe_silent:
             if isinstance(gen, bundle2.unbundle20):
                 with repo.transaction(b'strip') as tr:
                     bundle2.processbundle(repo, gen, lambda: tr)



To: martinvonz, durin42, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210621/2e4d220c/attachment-0002.html>


More information about the Mercurial-patches mailing list