Patchwork [1,of,3,hglib] client: do not append an option to a list of arguments

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 11, 2017, 11:41 a.m.
Message ID <519dfa937de37d1441e2.1510400490@mimosa>
Download mbox | patch
Permalink /patch/25476/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 11, 2017, 11:41 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1510399286 -32400
#      Sat Nov 11 20:21:26 2017 +0900
# Node ID 519dfa937de37d1441e2a39da76d700c7099b0c7
# Parent  5f3e6f1a7e68298e21f893683c5b5d3f634c2c30
client: do not append an option to a list of arguments

It wouldn't work if args are terminated with "--".

Patch

diff --git a/hglib/client.py b/hglib/client.py
--- a/hglib/client.py
+++ b/hglib/client.py
@@ -845,9 +845,8 @@  class hgclient(object):
 
         args = cmdbuilder(b('grep'), all=all, a=text, f=follow, i=ignorecase,
                           l=fileswithmatches, n=line, u=user, d=date,
-                          I=include, X=exclude, hidden=self.hidden,
+                          I=include, X=exclude, hidden=self.hidden, print0=True,
                           *[pattern] + files)
-        args.append(b('-0'))
 
         def eh(ret, out, err):
             if ret != 1:
@@ -1129,13 +1128,14 @@  class hgclient(object):
 
         """
         # we can't really use --preview since merge doesn't support --template
-        args = cmdbuilder(b('merge'), r=rev, f=force, t=tool)
+        args = cmdbuilder(b('merge'), r=rev, f=force, t=tool,
+                          y=(cb is merge.handlers.noninteractive))
 
         prompt = None
         if cb is merge.handlers.abort:
             prompt = cb
         elif cb is merge.handlers.noninteractive:
-            args.append(b('-y'))
+            pass
         else:
             prompt = lambda size, output: cb(output) + b('\n')
 
@@ -1466,9 +1466,7 @@  class hgclient(object):
         args = cmdbuilder(b('status'), rev=rev, change=change, A=all,
                           m=modified, a=added, r=removed, d=deleted, c=clean,
                           u=unknown, i=ignored, C=copies, S=subrepos, I=include,
-                          X=exclude, hidden=self.hidden)
-
-        args.append(b('-0'))
+                          X=exclude, hidden=self.hidden, print0=True)
 
         out = self.rawcommand(args)
         l = []