# HG changeset patch # User Idan Kamara # Date 1312929498 -10800 # Node ID 3ac38d500d682d845d0fb5fedde61517f41edaa2 # Parent eac8be119d81281225b95c857363f0356835ce0d move hgclient._eatlines to util diff -r eac8be119d81 -r 3ac38d500d68 hglib/client.py --- a/hglib/client.py Sat Jul 23 22:55:39 2011 +0300 +++ b/hglib/client.py Wed Aug 10 01:38:18 2011 +0300 @@ -65,13 +65,6 @@ fields compose one revision. ''' return [self.revision._make(rev) for rev in util.grouper(6, splitted)] - def _eatlines(self, s, n): - idx = 0 - for i in xrange(n): - idx = s.find('\n', idx) + 1 - - return s[idx:] - def runcommand(self, args, inchannels, outchannels): def writeblock(data): self.server.stdin.write(struct.pack(self.inputfmt, len(data))) @@ -206,7 +199,7 @@ if not out: return [] - out = self._eatlines(out, 2).split('\0')[:-1] + out = util.eatlines(out, 2).split('\0')[:-1] return self._parserevs(out) def outgoing(self, revrange=None, path=None): @@ -221,7 +214,7 @@ if not out: return [] - out = self._eatlines(out, 2).split('\0')[:-1] + out = util.eatlines(out, 2).split('\0')[:-1] return self._parserevs(out) def commit(self, message, addremove=False): diff -r eac8be119d81 -r 3ac38d500d68 hglib/util.py --- a/hglib/util.py Sat Jul 23 22:55:39 2011 +0300 +++ b/hglib/util.py Wed Aug 10 01:38:18 2011 +0300 @@ -5,6 +5,13 @@ args = [iter(iterable)] * n return itertools.izip(*args) +def eatlines(s, n): + idx = 0 + for i in xrange(n): + idx = s.find('\n', idx) + 1 + + return s[idx:] + def cmdbuilder(name, *args, **kwargs): """ A helper for building the command arguments