D6241: narrow: drop unrequired if conditionals
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Tue Apr 16 17:00:42 UTC 2019
pulkit created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: martinvonz.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D6241
AFFECTED FILES
hgext/narrow/narrowbundle2.py
mercurial/exchange.py
CHANGE DETAILS
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -2214,14 +2214,8 @@
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,
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 @@
# 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)
To: pulkit, durin42, martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list