Mercurial > python-hglib
changeset 8:3ac38d500d68
move hgclient._eatlines to util
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Wed, 10 Aug 2011 01:38:18 +0300 |
parents | eac8be119d81 |
children | 5882a698ad5c |
files | hglib/client.py hglib/util.py |
diffstat | 2 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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):
--- 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