changeset 49846:4dfcdb20ffc7

path: pass `path` to `peer` in infinitepush We directly use the `path` object to build the `peer` object.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 02 Dec 2022 06:45:46 +0100
parents 8d0a220caee5
children 8c6f783917e7
files hgext/infinitepush/__init__.py
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/infinitepush/__init__.py	Fri Dec 02 06:42:17 2022 +0100
+++ b/hgext/infinitepush/__init__.py	Fri Dec 02 06:45:46 2022 +0100
@@ -683,12 +683,10 @@
 def _pull(orig, ui, repo, source=b"default", **opts):
     opts = pycompat.byteskwargs(opts)
     # Copy paste from `pull` command
-    source, branches = urlutil.get_unique_pull_path(
+    path = urlutil.get_unique_pull_path_obj(
         b"infinite-push's pull",
-        repo,
         ui,
         source,
-        default_branches=opts.get(b'branch'),
     )
 
     scratchbookmarks = {}
@@ -709,7 +707,7 @@
                 bookmarks.append(bookmark)
 
         if scratchbookmarks:
-            other = hg.peer(repo, opts, source)
+            other = hg.peer(repo, opts, path)
             try:
                 fetchedbookmarks = other.listkeyspatterns(
                     b'bookmarks', patterns=scratchbookmarks
@@ -734,14 +732,14 @@
     try:
         # Remote scratch bookmarks will be deleted because remotenames doesn't
         # know about them. Let's save it before pull and restore after
-        remotescratchbookmarks = _readscratchremotebookmarks(ui, repo, source)
-        result = orig(ui, repo, source, **pycompat.strkwargs(opts))
+        remotescratchbookmarks = _readscratchremotebookmarks(ui, repo, path.loc)
+        result = orig(ui, repo, path.loc, **pycompat.strkwargs(opts))
         # TODO(stash): race condition is possible
         # if scratch bookmarks was updated right after orig.
         # But that's unlikely and shouldn't be harmful.
         if common.isremotebooksenabled(ui):
             remotescratchbookmarks.update(scratchbookmarks)
-            _saveremotebookmarks(repo, remotescratchbookmarks, source)
+            _saveremotebookmarks(repo, remotescratchbookmarks, path.loc)
         else:
             _savelocalbookmarks(repo, scratchbookmarks)
         return result