comparison hglib/client.py @ 192:7a84a8656679

client: do not append an option to a list of arguments It wouldn't work if args are terminated with "--".
author Yuya Nishihara <yuya@tcha.org>
date Sat, 11 Nov 2017 20:21:26 +0900
parents 6987d6cd420c
children 22767a1e61ac
comparison
equal deleted inserted replaced
191:6987d6cd420c 192:7a84a8656679
850 if not isinstance(files, list): 850 if not isinstance(files, list):
851 files = [files] 851 files = [files]
852 852
853 args = cmdbuilder(b('grep'), all=all, a=text, f=follow, i=ignorecase, 853 args = cmdbuilder(b('grep'), all=all, a=text, f=follow, i=ignorecase,
854 l=fileswithmatches, n=line, u=user, d=date, 854 l=fileswithmatches, n=line, u=user, d=date,
855 I=include, X=exclude, hidden=self.hidden, 855 I=include, X=exclude, hidden=self.hidden, print0=True,
856 *[pattern] + files) 856 *[pattern] + files)
857 args.append(b('-0'))
858 857
859 def eh(ret, out, err): 858 def eh(ret, out, err):
860 if ret != 1: 859 if ret != 1:
861 raise error.CommandError(args, ret, out, err) 860 raise error.CommandError(args, ret, out, err)
862 return b('') 861 return b('')
1134 which are the contents of stdout. It should return one of the 1133 which are the contents of stdout. It should return one of the
1135 expected choices (a single character). 1134 expected choices (a single character).
1136 1135
1137 """ 1136 """
1138 # we can't really use --preview since merge doesn't support --template 1137 # we can't really use --preview since merge doesn't support --template
1139 args = cmdbuilder(b('merge'), r=rev, f=force, t=tool) 1138 args = cmdbuilder(b('merge'), r=rev, f=force, t=tool,
1139 y=(cb is merge.handlers.noninteractive))
1140 1140
1141 prompt = None 1141 prompt = None
1142 if cb is merge.handlers.abort: 1142 if cb is merge.handlers.abort:
1143 prompt = cb 1143 prompt = cb
1144 elif cb is merge.handlers.noninteractive: 1144 elif cb is merge.handlers.noninteractive:
1145 args.append(b('-y')) 1145 pass
1146 else: 1146 else:
1147 prompt = lambda size, output: cb(output) + b('\n') 1147 prompt = lambda size, output: cb(output) + b('\n')
1148 1148
1149 self.rawcommand(args, prompt=prompt) 1149 self.rawcommand(args, prompt=prompt)
1150 1150
1471 raise ValueError('cannot specify both rev and change') 1471 raise ValueError('cannot specify both rev and change')
1472 1472
1473 args = cmdbuilder(b('status'), rev=rev, change=change, A=all, 1473 args = cmdbuilder(b('status'), rev=rev, change=change, A=all,
1474 m=modified, a=added, r=removed, d=deleted, c=clean, 1474 m=modified, a=added, r=removed, d=deleted, c=clean,
1475 u=unknown, i=ignored, C=copies, S=subrepos, I=include, 1475 u=unknown, i=ignored, C=copies, S=subrepos, I=include,
1476 X=exclude, hidden=self.hidden) 1476 X=exclude, hidden=self.hidden, print0=True)
1477
1478 args.append(b('-0'))
1479 1477
1480 out = self.rawcommand(args) 1478 out = self.rawcommand(args)
1481 l = [] 1479 l = []
1482 1480
1483 for entry in out.split(b('\0')): 1481 for entry in out.split(b('\0')):