annotate tests/test-commit.py @ 131:a3373bf28ccb

Added tag 1.3 for changeset df808f92c0f1
author Matt Mackall <mpm@selenic.com>
date Fri, 01 Aug 2014 18:24:32 -0500
parents 2b36619ec0a0
children 1b47146a4a2c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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')
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)
99
2b36619ec0a0 client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents: 16
diff changeset
33
2b36619ec0a0 client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents: 16
diff changeset
34 def test_date(self):
2b36619ec0a0 client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents: 16
diff changeset
35 self.append('a', 'a')
2b36619ec0a0 client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents: 16
diff changeset
36 now = datetime.datetime.now().replace(microsecond=0)
2b36619ec0a0 client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents: 16
diff changeset
37 rev0, node0 = self.client.commit('first', addremove=True,
2b36619ec0a0 client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents: 16
diff changeset
38 date=now.isoformat(' '))
2b36619ec0a0 client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents: 16
diff changeset
39
2b36619ec0a0 client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents: 16
diff changeset
40 self.assertEquals(now, self.client.tip().date)