diff 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
line wrap: on
line diff
--- a/hglib/client.py	Wed Dec 11 10:25:17 2019 -0500
+++ b/hglib/client.py	Sat Mar 21 19:59:50 2020 -0700
@@ -881,9 +881,11 @@
                 raise error.CommandError(args, ret, out, err)
             return b('')
 
-        out = self.rawcommand(args, eh=eh).split(b('\0'))
+        out = self.rawcommand(args, eh=eh).split(b('\0'))[:-1]
 
-        fieldcount = 3
+        fieldcount = 1
+        if all or self.version < (5, 2):
+            fieldcount += 1
         if user:
             fieldcount += 1
         if date:
@@ -892,8 +894,8 @@
             fieldcount += 1
         if all:
             fieldcount += 1
-        if fileswithmatches:
-            fieldcount -= 1
+        if not fileswithmatches:
+            fieldcount += 1
 
         return util.grouper(fieldcount, out)