path: pass `path` to `peer` in `hg incoming` bookmark logic
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 01 Dec 2022 17:55:17 +0100
changeset 49829 f2f4ec857f78
parent 49828 d4926e08507d
child 49830 e64b1e9f4892
path: pass `path` to `peer` in `hg incoming` bookmark logic We directly use the `path` object to build the `peer` object. Touching this code highlighted that we never honor the branches' information of when doing bookmark level incoming checks.
mercurial/commands.py
--- a/mercurial/commands.py	Thu Dec 01 16:58:22 2022 +0100
+++ b/mercurial/commands.py	Thu Dec 01 17:55:17 2022 +0100
@@ -4383,17 +4383,15 @@
     if opts.get(b'bookmarks'):
         srcs = urlutil.get_pull_paths(repo, ui, [source])
         for path in srcs:
-            source, branches = urlutil.parseurl(
-                path.rawloc, opts.get(b'branch')
-            )
-            other = hg.peer(repo, opts, source)
+            # XXX the "branches" options are not used. Should it be used?
+            other = hg.peer(repo, opts, path)
             try:
                 if b'bookmarks' not in other.listkeys(b'namespaces'):
                     ui.warn(_(b"remote doesn't support bookmarks\n"))
                     return 0
                 ui.pager(b'incoming')
                 ui.status(
-                    _(b'comparing with %s\n') % urlutil.hidepassword(source)
+                    _(b'comparing with %s\n') % urlutil.hidepassword(path.loc)
                 )
                 return bookmarks.incoming(
                     ui, repo, other, mode=path.bookmarks_mode