Patchwork [1,of,4,V2] bundle2: add documention to 'part.addparams'

login
register
mail settings
Submitter Pierre-Yves David
Date April 10, 2017, 3:33 p.m.
Message ID <75799788617866ec7898.1491838385@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/20069/
State Accepted
Headers show

Comments

Pierre-Yves David - April 10, 2017, 3:33 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1491754569 -7200
#      Sun Apr 09 18:16:09 2017 +0200
# Node ID 75799788617866ec78984b08225e025eeca73790
# Parent  e0dc40530c5aa514feb6a09cf79ab6a3aa2ec331
# EXP-Topic bundle2.doc
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 757997886178
bundle2: add documention to 'part.addparams'

There are some non-obvious limitations on the parameters of this method.
Add some documentation where people will likely look to understand how
to use this API.
Pierre-Yves David - April 10, 2017, 3:57 p.m.
I wanted to CC you this V2, but I failed to do so.

On 04/10/2017 05:33 PM, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1491754569 -7200
> #      Sun Apr 09 18:16:09 2017 +0200
> # Node ID 75799788617866ec78984b08225e025eeca73790
> # Parent  e0dc40530c5aa514feb6a09cf79ab6a3aa2ec331
> # EXP-Topic bundle2.doc
> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
> #              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 757997886178
> bundle2: add documention to 'part.addparams'
>
> There are some non-obvious limitations on the parameters of this method.
> Add some documentation where people will likely look to understand how
> to use this API.
>
> diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
> --- a/mercurial/bundle2.py
> +++ b/mercurial/bundle2.py
> @@ -900,6 +900,13 @@ class bundlepart(object):
>          return tuple(self._advisoryparams)
>
>      def addparam(self, name, value='', mandatory=True):
> +        """add a parameter to the part
> +
> +        If 'mandatory' is set to True, the remote handler must claim support
> +        for this parameter or the unbundling will be aborted.
> +
> +        The 'name' and 'value' cannot exceed 255 bytes each.
> +        """
>          if self._generated is not None:
>              raise error.ReadOnlyPartError('part is being generated')
>          if name in self._seenparams:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -900,6 +900,13 @@  class bundlepart(object):
         return tuple(self._advisoryparams)
 
     def addparam(self, name, value='', mandatory=True):
+        """add a parameter to the part
+
+        If 'mandatory' is set to True, the remote handler must claim support
+        for this parameter or the unbundling will be aborted.
+
+        The 'name' and 'value' cannot exceed 255 bytes each.
+        """
         if self._generated is not None:
             raise error.ReadOnlyPartError('part is being generated')
         if name in self._seenparams: