Mercurial > public > mercurial-scm > python-hglib
annotate tests/test-status.py @ 213:388820908580 2.6.2
hglib: update grep to cope with behavior change in hg 5.2.
Since version 5.2, revision filed not printed without all argument.
Fixed inaccurate pasring result with lastest hg and changed test case.
author | Daehyeok Mun <daehyeok@gmail.com> |
---|---|
date | Sat, 21 Mar 2020 19:59:50 -0700 |
parents | c1b966866ed7 |
children |
rev | line source |
---|---|
148
c1b966866ed7
hglib: make all imports absolute (issue4520)
Brett Cannon <brett@python.org>
parents:
143
diff
changeset
|
1 import os |
c1b966866ed7
hglib: make all imports absolute (issue4520)
Brett Cannon <brett@python.org>
parents:
143
diff
changeset
|
2 from tests import common |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
35
diff
changeset
|
3 from hglib.util import b |
33
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
4 |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
5 class test_status(common.basetest): |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
6 def test_empty(self): |
34
f6e1d9a6e0cd
client: change return value of status() to a list of (code, file path)
Idan Kamara <idankk86@gmail.com>
parents:
33
diff
changeset
|
7 self.assertEquals(self.client.status(), []) |
33
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
8 |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
9 def test_one_of_each(self): |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
10 self.append('.hgignore', 'ignored') |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
11 self.append('ignored', 'a') |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
12 self.append('clean', 'a') |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
13 self.append('modified', 'a') |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
14 self.append('removed', 'a') |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
15 self.append('missing', 'a') |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
35
diff
changeset
|
16 self.client.commit(b('first'), addremove=True) |
33
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
17 self.append('modified', 'a') |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
18 self.append('added', 'a') |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
35
diff
changeset
|
19 self.client.add([b('added')]) |
33
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
20 os.remove('missing') |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
35
diff
changeset
|
21 self.client.remove([b('removed')]) |
33
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
22 self.append('untracked') |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
23 |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
35
diff
changeset
|
24 l = [(b('M'), b('modified')), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
35
diff
changeset
|
25 (b('A'), b('added')), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
35
diff
changeset
|
26 (b('R'), b('removed')), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
35
diff
changeset
|
27 (b('C'), b('.hgignore')), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
35
diff
changeset
|
28 (b('C'), b('clean')), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
35
diff
changeset
|
29 (b('!'), b('missing')), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
35
diff
changeset
|
30 (b('?'), b('untracked')), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
35
diff
changeset
|
31 (b('I'), b('ignored'))] |
33
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
32 |
34
f6e1d9a6e0cd
client: change return value of status() to a list of (code, file path)
Idan Kamara <idankk86@gmail.com>
parents:
33
diff
changeset
|
33 st = self.client.status(all=True) |
f6e1d9a6e0cd
client: change return value of status() to a list of (code, file path)
Idan Kamara <idankk86@gmail.com>
parents:
33
diff
changeset
|
34 |
f6e1d9a6e0cd
client: change return value of status() to a list of (code, file path)
Idan Kamara <idankk86@gmail.com>
parents:
33
diff
changeset
|
35 for i in l: |
f6e1d9a6e0cd
client: change return value of status() to a list of (code, file path)
Idan Kamara <idankk86@gmail.com>
parents:
33
diff
changeset
|
36 self.assertTrue(i in st) |
f6e1d9a6e0cd
client: change return value of status() to a list of (code, file path)
Idan Kamara <idankk86@gmail.com>
parents:
33
diff
changeset
|
37 |
f6e1d9a6e0cd
client: change return value of status() to a list of (code, file path)
Idan Kamara <idankk86@gmail.com>
parents:
33
diff
changeset
|
38 def test_copy(self): |
f6e1d9a6e0cd
client: change return value of status() to a list of (code, file path)
Idan Kamara <idankk86@gmail.com>
parents:
33
diff
changeset
|
39 self.append('source', 'a') |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
35
diff
changeset
|
40 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:
35
diff
changeset
|
41 self.client.copy(b('source'), b('dest')) |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
35
diff
changeset
|
42 l = [(b('A'), b('dest')), (b(' '), b('source'))] |
34
f6e1d9a6e0cd
client: change return value of status() to a list of (code, file path)
Idan Kamara <idankk86@gmail.com>
parents:
33
diff
changeset
|
43 self.assertEquals(self.client.status(copies=True), l) |
35
1e33bbea23e5
client: handle spaces correctly in status()
Idan Kamara <idankk86@gmail.com>
parents:
34
diff
changeset
|
44 |
1e33bbea23e5
client: handle spaces correctly in status()
Idan Kamara <idankk86@gmail.com>
parents:
34
diff
changeset
|
45 def test_copy_origin_space(self): |
1e33bbea23e5
client: handle spaces correctly in status()
Idan Kamara <idankk86@gmail.com>
parents:
34
diff
changeset
|
46 self.append('s ource', 'a') |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
35
diff
changeset
|
47 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:
35
diff
changeset
|
48 self.client.copy(b('s ource'), b('dest')) |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
35
diff
changeset
|
49 l = [(b('A'), b('dest')), (b(' '), b('s ource'))] |
35
1e33bbea23e5
client: handle spaces correctly in status()
Idan Kamara <idankk86@gmail.com>
parents:
34
diff
changeset
|
50 self.assertEquals(self.client.status(copies=True), l) |