Mercurial > public > mercurial-scm > python-hglib
annotate tests/test-import.py @ 123:cdde1656346f
client: add 'hidden' property to show hidden changesets.
This enables interactions with the obsolete changesets in the repository:
- add the attribute in client class
- add the keyword to the relevant commands
- enable log without hidden changesets even when self.hidden is True
- add a few tests with the hidden keyword
This changeset mirrors the behavior of the mercurial global command --hidden:
an attribute is added to the client library. If set at True, adds the hidden
keyword to all command which can use it to show hidden changesets.
The alternative would be to add the keyword in rawcommand, but the hidden flag
is not relevant for commands such as add or branch.
author | Paul Tonelli <paul.tonelli@logilab.fr> |
---|---|
date | Thu, 22 May 2014 15:23:12 +0200 |
parents | e738d6fe5f3f |
children | 4359cabcb0cc |
rev | line source |
---|---|
96
9746227239e0
client: fix import --no-commit flag (issue3206)
Idan Kamara <idankk86@gmail.com>
parents:
68
diff
changeset
|
1 import common, cStringIO, os |
7
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
2 import hglib |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
3 |
13
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
4 patch = """ |
7
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
5 # HG changeset patch |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
6 # User test |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
7 # Date 0 0 |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
8 # Node ID c103a3dec114d882c98382d684d8af798d09d857 |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
9 # Parent 0000000000000000000000000000000000000000 |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
10 1 |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
11 |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
12 diff -r 000000000000 -r c103a3dec114 a |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
13 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
14 +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
15 @@ -0,0 +1,1 @@ |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
16 +1 |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
17 """ |
13
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
18 |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
19 class test_import(common.basetest): |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
20 def test_basic_cstringio(self): |
7
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
21 self.client.import_(cStringIO.StringIO(patch)) |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
22 self.assertEquals(self.client.cat(['a']), '1\n') |
13
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
23 |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
24 def test_basic_file(self): |
118
e738d6fe5f3f
tests: make the tests work under Pypy (issue3965)
Matt Mackall <mpm@selenic.com>
parents:
96
diff
changeset
|
25 f = open('patch', 'wb') |
e738d6fe5f3f
tests: make the tests work under Pypy (issue3965)
Matt Mackall <mpm@selenic.com>
parents:
96
diff
changeset
|
26 f.write(patch) |
e738d6fe5f3f
tests: make the tests work under Pypy (issue3965)
Matt Mackall <mpm@selenic.com>
parents:
96
diff
changeset
|
27 f.close() |
96
9746227239e0
client: fix import --no-commit flag (issue3206)
Idan Kamara <idankk86@gmail.com>
parents:
68
diff
changeset
|
28 |
9746227239e0
client: fix import --no-commit flag (issue3206)
Idan Kamara <idankk86@gmail.com>
parents:
68
diff
changeset
|
29 # --no-commit |
9746227239e0
client: fix import --no-commit flag (issue3206)
Idan Kamara <idankk86@gmail.com>
parents:
68
diff
changeset
|
30 self.client.import_(['patch'], nocommit=True) |
9746227239e0
client: fix import --no-commit flag (issue3206)
Idan Kamara <idankk86@gmail.com>
parents:
68
diff
changeset
|
31 self.assertEquals(open('a').read(), '1\n') |
9746227239e0
client: fix import --no-commit flag (issue3206)
Idan Kamara <idankk86@gmail.com>
parents:
68
diff
changeset
|
32 |
9746227239e0
client: fix import --no-commit flag (issue3206)
Idan Kamara <idankk86@gmail.com>
parents:
68
diff
changeset
|
33 self.client.update(clean=True) |
9746227239e0
client: fix import --no-commit flag (issue3206)
Idan Kamara <idankk86@gmail.com>
parents:
68
diff
changeset
|
34 os.remove('a') |
9746227239e0
client: fix import --no-commit flag (issue3206)
Idan Kamara <idankk86@gmail.com>
parents:
68
diff
changeset
|
35 |
13
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
36 self.client.import_(['patch']) |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
37 self.assertEquals(self.client.cat(['a']), '1\n') |