37
|
1 import common
|
|
2
|
|
3 class test_diff(common.basetest):
|
|
4 def test_basic(self):
|
|
5 self.append('a', 'a\n')
|
|
6 self.client.add('a')
|
|
7 diff1 = """diff -r 000000000000 a
|
|
8 --- /dev/null
|
|
9 +++ b/a
|
|
10 @@ -0,0 +1,1 @@
|
|
11 +a
|
|
12 """
|
|
13 self.assertEquals(diff1, self.client.diff(nodates=True))
|
|
14 self.assertEquals(diff1, self.client.diff(['a'], nodates=True))
|
|
15 rev0, node0 = self.client.commit('first')
|
|
16 diff2 = """diff -r 000000000000 -r %s a
|
|
17 --- /dev/null
|
|
18 +++ b/a
|
|
19 @@ -0,0 +1,1 @@
|
|
20 +a
|
|
21 """ % node0[:12]
|
|
22 self.assertEquals(diff2, self.client.diff(change=rev0, nodates=True))
|
|
23 self.append('a', 'a\n')
|
|
24 rev1, node1 = self.client.commit('second')
|
|
25 diff3 = """diff -r %s a
|
|
26 --- a/a
|
|
27 +++ b/a
|
|
28 @@ -1,1 +1,2 @@
|
|
29 a
|
|
30 +a
|
|
31 """ % node0[:12]
|
|
32 self.assertEquals(diff3, self.client.diff(revs=[rev0], nodates=True))
|
|
33 diff4 = """diff -r %s -r %s a
|
|
34 --- a/a
|
|
35 +++ b/a
|
|
36 @@ -1,1 +1,2 @@
|
|
37 a
|
|
38 +a
|
|
39 """ % (node0[:12], node1[:12])
|
|
40 self.assertEquals(diff4, self.client.diff(revs=[rev0, rev1], nodates=True))
|