comparison hglib/client.py @ 213:388820908580 2.6.2

hglib: update grep to cope with behavior change in hg 5.2. Since version 5.2, revision filed not printed without all argument. Fixed inaccurate pasring result with lastest hg and changed test case.
author Daehyeok Mun <daehyeok@gmail.com>
date Sat, 21 Mar 2020 19:59:50 -0700
parents 67398bbf788d
children 68588c652ac6
comparison
equal deleted inserted replaced
212:868a903689fd 213:388820908580
879 def eh(ret, out, err): 879 def eh(ret, out, err):
880 if ret != 1: 880 if ret != 1:
881 raise error.CommandError(args, ret, out, err) 881 raise error.CommandError(args, ret, out, err)
882 return b('') 882 return b('')
883 883
884 out = self.rawcommand(args, eh=eh).split(b('\0')) 884 out = self.rawcommand(args, eh=eh).split(b('\0'))[:-1]
885 885
886 fieldcount = 3 886 fieldcount = 1
887 if all or self.version < (5, 2):
888 fieldcount += 1
887 if user: 889 if user:
888 fieldcount += 1 890 fieldcount += 1
889 if date: 891 if date:
890 fieldcount += 1 892 fieldcount += 1
891 if line: 893 if line:
892 fieldcount += 1 894 fieldcount += 1
893 if all: 895 if all:
894 fieldcount += 1 896 fieldcount += 1
895 if fileswithmatches: 897 if not fileswithmatches:
896 fieldcount -= 1 898 fieldcount += 1
897 899
898 return util.grouper(fieldcount, out) 900 return util.grouper(fieldcount, out)
899 901
900 def heads(self, rev=[], startrev=[], topological=False, closed=False): 902 def heads(self, rev=[], startrev=[], topological=False, closed=False):
901 """Return a list of current repository heads or branch heads. 903 """Return a list of current repository heads or branch heads.