[PATCH 3 of 4] bundle2: move the 'close' method off the unpackermixin
Ryan McElroy
rm at fb.com
Mon Apr 10 05:17:21 EDT 2017
On 4/9/17 6:41 PM, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
> # Date 1491757704 -7200
> # Sun Apr 09 19:08:24 2017 +0200
> # Node ID 9df8644ff8483025564479285c0e652677bae0a0
> # Parent 0ae7bb16d6ceb88bbb76859dbdf30c9f92490369
> # EXP-Topic bundle2.doc
> bundle2: move the 'close' method off the unpackermixin
>
> That method is unrelated to unpacking and only used by the unbundle20 class.
s/That/This
> We move it there for clarity.
>
> diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
> --- a/mercurial/bundle2.py
> +++ b/mercurial/bundle2.py
> @@ -653,12 +653,6 @@ class unpackermixin(object):
> else:
> raise
> return None
> -
> - def close(self):
> - """close underlying file"""
> - if util.safehasattr(self._fp, 'close'):
> - return self._fp.close()
> -
> def getunbundler(ui, fp, magicstring=None):
> """return a valid unbundler object for a given magicstring"""
> if magicstring is None:
> @@ -811,6 +805,11 @@ class unbundle20(unpackermixin):
> self.params # load params
> return self._compressed
>
> + def close(self):
> + """close underlying file"""
> + if util.safehasattr(self._fp, 'close'):
> + return self._fp.close()
> +
> formatmap = {'20': unbundle20}
>
> b2streamparamsmap = {}
>
More information about the Mercurial-devel
mailing list