Mercurial > python-hglib
annotate tests/test-commit.py @ 134:1b47146a4a2c 1.4
style: fix long lines
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 30 Sep 2014 12:48:04 -0500 |
parents | 2b36619ec0a0 |
children | dc63978871ed |
rev | line source |
---|---|
99
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
16
diff
changeset
|
1 import common, hglib, datetime |
16
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') |
134 | 12 self.assertRaises(hglib.error.CommandError, |
13 self.client.commit, 'first', user='') | |
16
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
14 |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
15 def test_close_branch(self): |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
16 self.append('a', 'a') |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
17 rev0, node0 = self.client.commit('first', addremove=True) |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
18 self.client.branch('foo') |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
19 self.append('a', 'a') |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
20 rev1, node1 = self.client.commit('second') |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
21 revclose = self.client.commit('closing foo', closebranch=True) |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
22 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
|
23 |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
24 self.assertEquals(self.client.branches(), |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
25 [(rev0.branch, int(rev0.rev), rev0.node[:12])]) |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
26 |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
27 self.assertEquals(self.client.branches(closed=True), |
134 | 28 [(revclose.branch, int(revclose.rev), |
29 revclose.node[:12]), | |
16
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
30 (rev0.branch, int(rev0.rev), rev0.node[:12])]) |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
31 |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
32 def test_message_logfile(self): |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
33 self.assertRaises(ValueError, self.client.commit, 'foo', logfile='bar') |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
34 self.assertRaises(ValueError, self.client.commit) |
99
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
16
diff
changeset
|
35 |
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
16
diff
changeset
|
36 def test_date(self): |
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
16
diff
changeset
|
37 self.append('a', 'a') |
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
16
diff
changeset
|
38 now = datetime.datetime.now().replace(microsecond=0) |
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
16
diff
changeset
|
39 rev0, node0 = self.client.commit('first', addremove=True, |
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
16
diff
changeset
|
40 date=now.isoformat(' ')) |
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
16
diff
changeset
|
41 |
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
16
diff
changeset
|
42 self.assertEquals(now, self.client.tip().date) |