annotate tests/test-diff.py @ 120:5d3783aebe5f 1.2

log: fix 'hidden' option We were passing -h, which is 'help', not 'hidden'.
author Julien Cristau <julien.cristau@logilab.fr>
date Mon, 27 Jan 2014 09:29:55 +0100
parents 86ff8611a8fa
children 1b47146a4a2c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
37
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
1 import common
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
2
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
3 class test_diff(common.basetest):
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
4 def test_basic(self):
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
5 self.append('a', 'a\n')
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
6 self.client.add('a')
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
7 diff1 = """diff -r 000000000000 a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
8 --- /dev/null
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
9 +++ b/a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
10 @@ -0,0 +1,1 @@
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
11 +a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
12 """
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
13 self.assertEquals(diff1, self.client.diff(nodates=True))
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
14 self.assertEquals(diff1, self.client.diff(['a'], nodates=True))
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
15 rev0, node0 = self.client.commit('first')
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
16 diff2 = """diff -r 000000000000 -r %s a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
17 --- /dev/null
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
18 +++ b/a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
19 @@ -0,0 +1,1 @@
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
20 +a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
21 """ % node0[:12]
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
22 self.assertEquals(diff2, self.client.diff(change=rev0, nodates=True))
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
23 self.append('a', 'a\n')
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
24 rev1, node1 = self.client.commit('second')
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
25 diff3 = """diff -r %s a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
26 --- a/a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
27 +++ b/a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
28 @@ -1,1 +1,2 @@
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
29 a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
30 +a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
31 """ % node0[:12]
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
32 self.assertEquals(diff3, self.client.diff(revs=[rev0], nodates=True))
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
33 diff4 = """diff -r %s -r %s a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
34 --- a/a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
35 +++ b/a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
36 @@ -1,1 +1,2 @@
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
37 a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
38 +a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
39 """ % (node0[:12], node1[:12])
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
40 self.assertEquals(diff4, self.client.diff(revs=[rev0, rev1], nodates=True))
105
86ff8611a8fa client: always set HGPLAIN=1 (issue3502)
Siddharth Agarwal <sid0@fb.com>
parents: 37
diff changeset
41
86ff8611a8fa client: always set HGPLAIN=1 (issue3502)
Siddharth Agarwal <sid0@fb.com>
parents: 37
diff changeset
42 def test_basic_plain(self):
86ff8611a8fa client: always set HGPLAIN=1 (issue3502)
Siddharth Agarwal <sid0@fb.com>
parents: 37
diff changeset
43 open('.hg/hgrc', 'a').write('[defaults]\ndiff=--git\n')
86ff8611a8fa client: always set HGPLAIN=1 (issue3502)
Siddharth Agarwal <sid0@fb.com>
parents: 37
diff changeset
44 self.test_basic()