Patchwork D6241: narrow: drop unrequired if conditionals

login
register
mail settings
Submitter phabricator
Date April 16, 2019, 5:13 p.m.
Message ID <af103792d46a221f36829ce77c03ac06@localhost.localdomain>
Download mbox | patch
Permalink /patch/39642/
State Not Applicable
Headers show

Comments

phabricator - April 16, 2019, 5:13 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2003f0bffcb1: narrow: drop unrequired if conditionals (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6241?vs=14768&id=14769

REVISION DETAIL
  https://phab.mercurial-scm.org/D6241

AFFECTED FILES
  hgext/narrow/narrowbundle2.py
  mercurial/exchange.py

CHANGE DETAILS




To: pulkit, durin42, martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

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)