Mercurial > hg
changeset 49728:5177be2b4387
path: pass `path` to `peer` in `hg debugbackupbundle`
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:29:11 +0100 |
parents | aae6b10d93f2 |
children | acf4be97033b |
files | mercurial/debugcommands.py |
diffstat | 1 files changed, 10 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/debugcommands.py Fri Dec 02 06:24:52 2022 +0100 +++ b/mercurial/debugcommands.py Fri Dec 02 06:29:11 2022 +0100 @@ -3707,20 +3707,19 @@ for backup in backups: # Much of this is copied from the hg incoming logic source = os.path.relpath(backup, encoding.getcwd()) - source, branches = urlutil.get_unique_pull_path( + path = urlutil.get_unique_pull_path_obj( b'debugbackupbundle', - repo, ui, source, - default_branches=opts.get(b'branch'), ) try: - other = hg.peer(repo, opts, source) + other = hg.peer(repo, opts, path) except error.LookupError as ex: - msg = _(b"\nwarning: unable to open bundle %s") % source + msg = _(b"\nwarning: unable to open bundle %s") % path.loc hint = _(b"\n(missing parent rev %s)\n") % short(ex.name) ui.warn(msg, hint=hint) continue + branches = (path.branch, opts.get(b'branch', [])) revs, checkout = hg.addbranchrevs( repo, other, branches, opts.get(b"rev") ) @@ -3743,29 +3742,29 @@ with repo.lock(), repo.transaction(b"unbundle") as tr: if scmutil.isrevsymbol(other, recovernode): ui.status(_(b"Unbundling %s\n") % (recovernode)) - f = hg.openpath(ui, source) - gen = exchange.readbundle(ui, f, source) + f = hg.openpath(ui, path.loc) + gen = exchange.readbundle(ui, f, path.loc) if isinstance(gen, bundle2.unbundle20): bundle2.applybundle( repo, gen, tr, source=b"unbundle", - url=b"bundle:" + source, + url=b"bundle:" + path.loc, ) else: - gen.apply(repo, b"unbundle", b"bundle:" + source) + gen.apply(repo, b"unbundle", b"bundle:" + path.loc) break else: backupdate = encoding.strtolocal( time.strftime( "%a %H:%M, %Y-%m-%d", - time.localtime(os.path.getmtime(source)), + time.localtime(os.path.getmtime(path.loc)), ) ) ui.status(b"\n%s\n" % (backupdate.ljust(50))) if ui.verbose: - ui.status(b"%s%s\n" % (b"bundle:".ljust(13), source)) + ui.status(b"%s%s\n" % (b"bundle:".ljust(13), path.loc)) else: opts[ b"template"