annotate tests/test-commit.py @ 186:d06b48001662

package: update package url Replace the package url which was pointing to the repository to the wiki page instead. This way pypi users will directly see the basic usage and can easily find the repository url on the wiki page.
author Boris Feld <boris.feld@octobus.net>
date Wed, 19 Jul 2017 14:48:40 +0200
parents c1b966866ed7
children 67398bbf788d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
148
c1b966866ed7 hglib: make all imports absolute (issue4520)
Brett Cannon <brett@python.org>
parents: 144
diff changeset
1 from tests import common
c1b966866ed7 hglib: make all imports absolute (issue4520)
Brett Cannon <brett@python.org>
parents: 144
diff changeset
2 import hglib, datetime
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 136
diff changeset
3 from hglib.util import b
16
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
4
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
5 class test_commit(common.basetest):
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
6 def test_user(self):
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
7 self.append('a', 'a')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 136
diff changeset
8 rev, node = self.client.commit(b('first'), addremove=True,
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 136
diff changeset
9 user=b('foo'))
16
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
10 rev = self.client.log(node)[0]
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 136
diff changeset
11 self.assertEquals(rev.author, b('foo'))
16
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
12
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
13 def test_no_user(self):
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
14 self.append('a', 'a')
134
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 99
diff changeset
15 self.assertRaises(hglib.error.CommandError,
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 136
diff changeset
16 self.client.commit, b('first'), user=b(''))
16
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
17
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
18 def test_close_branch(self):
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
19 self.append('a', 'a')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 136
diff changeset
20 rev0, node0 = self.client.commit(b('first'), addremove=True)
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 136
diff changeset
21 self.client.branch(b('foo'))
16
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
22 self.append('a', 'a')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 136
diff changeset
23 rev1, node1 = self.client.commit(b('second'))
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 136
diff changeset
24 revclose = self.client.commit(b('closing foo'), closebranch=True)
16
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
25 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
26
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
27 self.assertEquals(self.client.branches(),
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 self.assertEquals(self.client.branches(closed=True),
134
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 99
diff changeset
31 [(revclose.branch, int(revclose.rev),
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 99
diff changeset
32 revclose.node[:12]),
16
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
33 (rev0.branch, int(rev0.rev), rev0.node[:12])])
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
34
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
35 def test_message_logfile(self):
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 136
diff changeset
36 self.assertRaises(ValueError, self.client.commit, b('foo'),
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 136
diff changeset
37 logfile=b('bar'))
16
943aff89b068 client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
38 self.assertRaises(ValueError, self.client.commit)
99
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 def test_date(self):
2b36619ec0a0 client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents: 16
diff changeset
41 self.append('a', 'a')
2b36619ec0a0 client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents: 16
diff changeset
42 now = datetime.datetime.now().replace(microsecond=0)
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 136
diff changeset
43 rev0, node0 = self.client.commit(
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 136
diff changeset
44 b('first'), addremove=True,
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 136
diff changeset
45 date=now.isoformat(' ').encode('latin-1'))
99
2b36619ec0a0 client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents: 16
diff changeset
46
2b36619ec0a0 client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents: 16
diff changeset
47 self.assertEquals(now, self.client.tip().date)
136
dc63978871ed client: add support for 'hg commit --amend'
David Douard <david.douard@logilab.fr>
parents: 134
diff changeset
48
dc63978871ed client: add support for 'hg commit --amend'
David Douard <david.douard@logilab.fr>
parents: 134
diff changeset
49 def test_amend(self):
dc63978871ed client: add support for 'hg commit --amend'
David Douard <david.douard@logilab.fr>
parents: 134
diff changeset
50 self.append('a', 'a')
dc63978871ed client: add support for 'hg commit --amend'
David Douard <david.douard@logilab.fr>
parents: 134
diff changeset
51 now = datetime.datetime.now().replace(microsecond=0)
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 136
diff changeset
52 rev0, node0 = self.client.commit(
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 136
diff changeset
53 b('first'), addremove=True,
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 136
diff changeset
54 date=now.isoformat(' ').encode('latin-1'))
136
dc63978871ed client: add support for 'hg commit --amend'
David Douard <david.douard@logilab.fr>
parents: 134
diff changeset
55
dc63978871ed client: add support for 'hg commit --amend'
David Douard <david.douard@logilab.fr>
parents: 134
diff changeset
56 self.assertEquals(now, self.client.tip().date)
dc63978871ed client: add support for 'hg commit --amend'
David Douard <david.douard@logilab.fr>
parents: 134
diff changeset
57
dc63978871ed client: add support for 'hg commit --amend'
David Douard <david.douard@logilab.fr>
parents: 134
diff changeset
58 self.append('a', 'a')
dc63978871ed client: add support for 'hg commit --amend'
David Douard <david.douard@logilab.fr>
parents: 134
diff changeset
59 rev1, node1 = self.client.commit(amend=True)
dc63978871ed client: add support for 'hg commit --amend'
David Douard <david.douard@logilab.fr>
parents: 134
diff changeset
60 self.assertEquals(now, self.client.tip().date)
dc63978871ed client: add support for 'hg commit --amend'
David Douard <david.douard@logilab.fr>
parents: 134
diff changeset
61 self.assertNotEquals(node0, node1)
dc63978871ed client: add support for 'hg commit --amend'
David Douard <david.douard@logilab.fr>
parents: 134
diff changeset
62 self.assertEqual(1, len(self.client.log()))