[PATCH hglib] client: update method parses only the line with known format
Idan Kamara
idankk86 at gmail.com
Tue Apr 23 13:38:21 CDT 2013
On Tue, Apr 23, 2013 at 8:20 PM, Alexander Plavin <me at aplavin.ru> wrote:
> # 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 ')
>
^ This is no longer necessary then.
> + 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
> +
>
If we're bothering with a regex, might as well extract the counters with
groups instead of the trick below?
> counters = out.rstrip().split(', ')
> return tuple(int(s.split(' ', 1)[0]) for s in counters)
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20130423/c5ed1d51/attachment.html>
More information about the Mercurial-devel
mailing list