[PATCH hglib] client: update method parses only the line with known format

Alexander Plavin me at aplavin.ru
Tue Apr 23 12:20:36 CDT 2013


# HG changeset patch
# User Alexander Plavin <me at aplavin.ru>
# Date 1366737561 -14400
# Node ID e10a24363cdaef6a6cc937d9f388d02d273416b8
# Parent  181d1a4115cf7f9ab23f4db2647d3974803aa6db
client: update method parses only the line with known format

Before this there was incorrect behaviour of update when output of 'hg update'
had multiple lines, e.g. with largefiles enabled

diff -r 181d1a4115cf -r e10a24363cda hglib/client.py
--- a/hglib/client.py	Tue Apr 02 01:11:47 2013 -0500
+++ b/hglib/client.py	Tue Apr 23 21:19:21 2013 +0400
@@ -1508,6 +1508,12 @@
         # filter out 'merging ...' lines
         out = util.skiplines(out, 'merging ')
 
+        for line in out.split('\n'):
+            # get only the line with known format, which contains 4 counters
+            if re.match('^\d+ [\w ]+(, \d+ [\w ]+){3}$', line):
+                out = line
+                break
+
         counters = out.rstrip().split(', ')
         return tuple(int(s.split(' ', 1)[0]) for s in counters)
 


More information about the Mercurial-devel mailing list