Patchwork [stable] convert: add docstring on convert.subversion.geturl()

login
register
mail settings
Submitter Manuel Jacob
Date June 30, 2020, 2:40 p.m.
Message ID <6e8eb725639ad010e446.1593528022@tmp>
Download mbox | patch
Permalink /patch/46600/
State Accepted
Headers show

Comments

Manuel Jacob - June 30, 2020, 2:40 p.m.
# HG changeset patch
# User Manuel Jacob <me@manueljacob.de>
# Date 1593527985 -7200
#      Tue Jun 30 16:39:45 2020 +0200
# Branch stable
# Node ID 6e8eb725639ad010e44626ce3635637ba33b0015
# Parent  6597e2a73a2870328fa41e46db7ab1271077a7f5
# EXP-Topic svn_encoding
convert: add docstring on convert.subversion.geturl()

The function is unusual for a bytes-handling function in Mercurial because it
can’t handle arbitrary bytes. Therefore we should document this fact.

Pointed out by Yuya Nishihara while reviewing e3b19004087a.
Yuya Nishihara - July 1, 2020, 12:25 p.m.
On Tue, 30 Jun 2020 16:40:22 +0200, Manuel Jacob wrote:
> # HG changeset patch
> # User Manuel Jacob <me@manueljacob.de>
> # Date 1593527985 -7200
> #      Tue Jun 30 16:39:45 2020 +0200
> # Branch stable
> # Node ID 6e8eb725639ad010e44626ce3635637ba33b0015
> # Parent  6597e2a73a2870328fa41e46db7ab1271077a7f5
> # EXP-Topic svn_encoding
> convert: add docstring on convert.subversion.geturl()

Queued, thanks.

Patch

diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -140,6 +140,11 @@ 
 
 
 def geturl(path):
+    """Convert path or URL to a SVN URL, encoded in UTF-8.
+
+    This can raise UnicodeDecodeError if the path or URL can't be converted to
+    unicode using `fsencoding`.
+    """
     try:
         return svn.client.url_from_path(
             svn.core.svn_path_canonicalize(fs2svn(path))