[Request] [+- ] D10886: narrowbundle: use new context manager for silencing the ui

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Jun 18 23:58:39 UTC 2021


martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Same reasoning as the previous change. This affects a few tests
  because of the hack from d7304434390f <https://phab.mercurial-scm.org/rHGd7304434390f5efca405744fa12a6585edae3d83> (changegroup: move message about
  added changes to transaction summary, 2019-09-08).

REPOSITORY
  rHG Mercurial

BRANCH
  default

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
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210618/3cb006d7/attachment.html>


More information about the Mercurial-patches mailing list