# HG changeset patch # User Pulkit Goyal # Date 2019-04-16 16:44:12 # Node ID 2003f0bffcb197699b6665939e21a681f9c73570 # Parent 8a37c9b6cf0a29869a1f8b659add1a65bd1c7135 narrow: drop unrequired if conditionals Differential Revision: https://phab.mercurial-scm.org/D6241 diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -149,10 +149,8 @@ def _handlechangespec_2(op, inpart): # bundle2 parameters instead. if data: inc, exc = data.split('\0') - if inc: - includepats |= set(inc.splitlines()) - if exc: - excludepats |= set(exc.splitlines()) + includepats |= set(inc.splitlines()) + excludepats |= set(exc.splitlines()) narrowspec.validatepatterns(includepats) narrowspec.validatepatterns(excludepats) diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -2214,14 +2214,8 @@ def _getbundlechangegrouppart(bundler, r if (kwargs.get(r'narrow', False) and kwargs.get(r'narrow_acl', False) and (include or exclude)): narrowspecpart = bundler.newpart('narrow:spec') - data = '' - if include: - data += '\n'.join(include) - data += '\0' - if exclude: - data += '\n'.join(exclude) - - narrowspecpart.data = data + narrowspecpart.data = '%s\0%s' % ('\n'.join(include), + '\n'.join(exclude)) @getbundle2partsgenerator('bookmarks') def _getbundlebookmarkpart(bundler, repo, source, bundlecaps=None,