Mercurial > python-hglib
changeset 15:f1af31960414
client: change return value of commit() to (rev, node)
this is the original output hg emits with commit --debug
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Wed, 10 Aug 2011 19:59:08 +0300 |
parents | e0d21c9db20b |
children | 943aff89b068 |
files | hglib/client.py tests/test-branch.py tests/test-branches.py tests/test-log.py tests/test-outgoing-incoming.py |
diffstat | 5 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/hglib/client.py Wed Aug 10 19:59:03 2011 +0300 +++ b/hglib/client.py Wed Aug 10 19:59:08 2011 +0300 @@ -186,7 +186,7 @@ out = self.rawcommand(args) rev, node = out.splitlines()[-1].rsplit(':') - return self.log(node)[0] + return int(rev.split()[-1]), node def config(self, refresh=False): if not self._config or refresh:
--- a/tests/test-branch.py Wed Aug 10 19:59:03 2011 +0300 +++ b/tests/test-branch.py Wed Aug 10 19:59:08 2011 +0300 @@ -8,7 +8,9 @@ def test_basic(self): self.assertEquals(self.client.branch('foo'), 'foo') self.append('a', 'a') - rev = self.client.commit('first', addremove=True) + rev, node = self.client.commit('first', addremove=True) + + rev = self.client.log(node)[0] self.assertEquals(rev.branch, 'foo') self.assertEquals(self.client.branches(),
--- a/tests/test-branches.py Wed Aug 10 19:59:03 2011 +0300 +++ b/tests/test-branches.py Wed Aug 10 19:59:08 2011 +0300 @@ -13,7 +13,8 @@ branches = self.client.branches() expected = [] - for r in (rev1, rev0): + for r, n in (rev1, rev0): + r = self.client.log(r)[0] expected.append((r.branch, int(r.rev), r.node[:12])) self.assertEquals(branches, expected)
--- a/tests/test-log.py Wed Aug 10 19:59:03 2011 +0300 +++ b/tests/test-log.py Wed Aug 10 19:59:08 2011 +0300 @@ -4,14 +4,14 @@ class test_log(common.basetest): def test_basic(self): self.append('a', 'a') - rev0 = self.client.commit('first', addremove=True) + rev0, node0 = self.client.commit('first', addremove=True) self.append('a', 'a') - rev1 = self.client.commit('second') + rev1, node1 = self.client.commit('second') revs = self.client.log() revs.reverse() self.assertTrue(len(revs) == 2) - self.assertEquals(revs[1], rev1) + self.assertEquals(revs[1].node, node1) self.assertEquals(revs[0], self.client.log('0')[0])
--- a/tests/test-outgoing-incoming.py Wed Aug 10 19:59:03 2011 +0300 +++ b/tests/test-outgoing-incoming.py Wed Aug 10 19:59:08 2011 +0300 @@ -15,10 +15,10 @@ self.assertEquals(self.client.outgoing(path='bar'), bar.incoming()) self.append('a', 'a') - rev = self.client.commit('third') + rev, node = self.client.commit('third') out = self.client.outgoing(path='bar') self.assertEquals(len(out), 1) - self.assertEquals(out[0], rev) + self.assertEquals(out[0].node, node) self.assertEquals(out, bar.incoming())