changeset 48017:ff2304dd3ba9 stable

patchbomb: fix traceback on outgoing when not specifying revisions A user reported that `hg email -n -o` raised with the following traceback: ``` ** unknown exception encountered, please report by visiting ** https://mercurial-scm.org/wiki/BugTracker ** Python 3.8.12 (default, Sep 13 2021, 22:12:54) [GCC 7.5.0] ** Mercurial Distributed SCM (version 5.9.1) ** Extensions loaded: patchbomb Traceback (most recent call last): File "/usr/pkg/bin/hg", line 61, in <module> dispatch.run() File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 144, in run status = dispatch(req) File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 250, in dispatch status = _rundispatch(req) File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 294, in _rundispatch ret = _runcatch(req) or 0 File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 470, in _runcatch return _callcatch(ui, _runcatchfunc) File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 480, in _callcatch return scmutil.callcatch(ui, func) File "/usr/pkg/lib/python3.8/site-packages/mercurial/scmutil.py", line 153, in callcatch return func() File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 460, in _runcatchfunc return _dispatch(req) File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 1273, in _dispatch return runcommand( File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 918, in runcommand ret = _runcommand(ui, options, cmd, d) File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 1285, in _runcommand return cmdfunc() File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 1271, in <lambda> d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) File "/usr/pkg/lib/python3.8/site-packages/mercurial/util.py", line 1886, in check return func(*args, **kwargs) File "/usr/pkg/lib/python3.8/site-packages/hgext/patchbomb.py", line 817, in email revs = _getoutgoing(repo, dest, revs) File "/usr/pkg/lib/python3.8/site-packages/hgext/patchbomb.py", line 537, in _getoutgoing safe_paths = [urlutil.hidepassword(p.rawloc) for p in paths] File "/usr/pkg/lib/python3.8/site-packages/hgext/patchbomb.py", line 537, in <listcomp> safe_paths = [urlutil.hidepassword(p.rawloc) for p in paths] File "/usr/pkg/lib/python3.8/site-packages/mercurial/utils/urlutil.py", line 501, in get_push_paths msg %= dest TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'NoneType' ``` This is due to patchbomb passing `[None]` in the `dests` parameter of the multi-paths outgoing function, we fix this in this change and add a non-regression test. Differential Revision: https://phab.mercurial-scm.org/D11456
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 20 Sep 2021 15:16:10 +0200
parents 58fe6d127a01
children f82c4e8afe5c b833f8cbe199
files hgext/patchbomb.py relnotes/next tests/test-patchbomb.t
diffstat 3 files changed, 41 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/patchbomb.py	Thu Sep 09 10:42:28 2021 +0200
+++ b/hgext/patchbomb.py	Mon Sep 20 15:16:10 2021 +0200
@@ -533,7 +533,7 @@
 def _getoutgoing(repo, dest, revs):
     '''Return the revisions present locally but not in dest'''
     ui = repo.ui
-    paths = urlutil.get_push_paths(repo, ui, [dest])
+    paths = urlutil.get_push_paths(repo, ui, [dest] if dest else None)
     safe_paths = [urlutil.hidepassword(p.rawloc) for p in paths]
     ui.status(_(b'comparing with %s\n') % b','.join(safe_paths))
 
--- a/relnotes/next	Thu Sep 09 10:42:28 2021 +0200
+++ b/relnotes/next	Mon Sep 20 15:16:10 2021 +0200
@@ -18,6 +18,7 @@
  * `hg fix --working-dir` now correctly works when in an uncommitted merge state
  * `rhg` (Rust fast-path for `hg`) now supports the full config list syntax
  * `rhg` now parses some corner-cases for revsets correctly
+ * `hg email -o` now works again when not mentioning a revision
  * Lots of Windows fixes
  * Lots of miscellaneous other fixes
 
--- a/tests/test-patchbomb.t	Thu Sep 09 10:42:28 2021 +0200
+++ b/tests/test-patchbomb.t	Mon Sep 20 15:16:10 2021 +0200
@@ -2626,6 +2626,45 @@
   o  0:8580ff50825a a
   
   $ hg phase --force --secret -r 10
+
+Test without revisions specified
+  $ hg email --date '1980-1-1 0:1' -n -o -t foo
+  comparing with $TESTTMP/t
+  From [test]: test
+  this patch series consists of 1 patches.
+  
+  Cc: 
+  
+  displaying [PATCH] d ...
+  MIME-Version: 1.0
+  Content-Type: text/plain; charset="us-ascii"
+  Content-Transfer-Encoding: 7bit
+  Subject: [PATCH] d
+  X-Mercurial-Node: 2f9fa9b998c5fe3ac2bd9a2b14bfcbeecbc7c268
+  X-Mercurial-Series-Index: 1
+  X-Mercurial-Series-Total: 1
+  Message-Id: <2f9fa9b998c5fe3ac2bd.315532860@test-hostname>
+  X-Mercurial-Series-Id: <2f9fa9b998c5fe3ac2bd.315532860@test-hostname>
+  User-Agent: Mercurial-patchbomb/* (glob)
+  Date: Tue, 01 Jan 1980 00:01:00 +0000
+  From: test
+  To: foo
+  
+  # HG changeset patch
+  # User test
+  # Date 4 0
+  #      Thu Jan 01 00:00:04 1970 +0000
+  # Branch test
+  # Node ID 2f9fa9b998c5fe3ac2bd9a2b14bfcbeecbc7c268
+  # Parent  97d72e5f12c7e84f85064aa72e5a297142c36ed9
+  d
+  
+  diff -r 97d72e5f12c7 -r 2f9fa9b998c5 d
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/d	Thu Jan 01 00:00:04 1970 +0000
+  @@ -0,0 +1,1 @@
+  +d
+  
   $ hg email --date '1980-1-1 0:1' -n -t foo -s test -o ../t -r 'rev(10) or rev(6)'
   comparing with ../t
   From [test]: test