Patchwork D2465: debugcommands: allow empty argument values

login
register
mail settings
Submitter phabricator
Date Feb. 26, 2018, 9:17 p.m.
Message ID <differential-rev-PHID-DREV-65dqudz6rxi76ymh7bfp-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28432/
State Superseded
Headers show

Comments

phabricator - Feb. 26, 2018, 9:17 p.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is needed so we can use "pushkey," which relies on empty
  values being special.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -2752,7 +2752,14 @@ 
 
             args = {}
             for line in lines:
-                key, value = line.lstrip().split(' ', 1)
+                # We need to allow empty values.
+                fields = line.lstrip().split(' ', 1)
+                if len(fields) == 1:
+                    key = fields[0]
+                    value = ''
+                else:
+                    key, value = fields
+
                 args[key] = ast.literal_eval(b'b"%s"' % value)
 
             if batchedcommands is not None: