Mercurial > python-hglib
annotate tests/test-commit.py @ 50:bd7dfd94b0d9
client: use util.reterrorhandler
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Thu, 18 Aug 2011 16:20:23 +0300 |
parents | 943aff89b068 |
children | 2b36619ec0a0 |
rev | line source |
---|---|
16
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1 import common, hglib |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
2 |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
3 class test_commit(common.basetest): |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
4 def test_user(self): |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
5 self.append('a', 'a') |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
6 rev, node = self.client.commit('first', addremove=True, user='foo') |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
7 rev = self.client.log(node)[0] |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
8 self.assertEquals(rev.author, 'foo') |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
9 |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
10 def test_no_user(self): |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
11 self.append('a', 'a') |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
12 self.assertRaises(hglib.error.CommandError, self.client.commit, 'first', user='') |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
13 |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
14 def test_close_branch(self): |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
15 self.append('a', 'a') |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
16 rev0, node0 = self.client.commit('first', addremove=True) |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
17 self.client.branch('foo') |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
18 self.append('a', 'a') |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
19 rev1, node1 = self.client.commit('second') |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
20 revclose = self.client.commit('closing foo', closebranch=True) |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
21 rev0, rev1, revclose = self.client.log([node0, node1, revclose[1]]) |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
22 |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
23 self.assertEquals(self.client.branches(), |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
24 [(rev0.branch, int(rev0.rev), rev0.node[:12])]) |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
25 |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
26 self.assertEquals(self.client.branches(closed=True), |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
27 [(revclose.branch, int(revclose.rev), revclose.node[:12]), |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
28 (rev0.branch, int(rev0.rev), rev0.node[:12])]) |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
29 |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
30 def test_message_logfile(self): |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
31 self.assertRaises(ValueError, self.client.commit, 'foo', logfile='bar') |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
32 self.assertRaises(ValueError, self.client.commit) |