From patchwork Tue Apr 23 17:20:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [hglib] client: update method parses only the line with known format From: Alexander Plavin X-Patchwork-Id: 1473 Message-Id: To: mercurial-devel@selenic.com Date: Tue, 23 Apr 2013 21:20:36 +0400 # HG changeset patch # User Alexander Plavin # 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)