Mercurial > hg-stable
annotate tests/test-blackbox.t @ 18674:c61b49d059eb
blackbox: tests for the blackbox extension
A few tests to cover the blackbox extension. Covers commands, hooks, and
incoming changes.
author | Durham Goode <durham@fb.com> |
---|---|
date | Sat, 09 Feb 2013 13:35:30 -0800 |
parents | |
children | 539210ed2069 |
rev | line source |
---|---|
18674
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
1 setup |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
2 $ cat > mock.py <<EOF |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
3 > from mercurial import util |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
4 > import getpass |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
5 > |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
6 > def makedate(): |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
7 > return 0, 0 |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
8 > def getuser(): |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
9 > return 'bob' |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
10 > # mock the date and user apis so the output is always the same |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
11 > def uisetup(ui): |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
12 > util.makedate = makedate |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
13 > getpass.getuser = getuser |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
14 > EOF |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
15 $ cat >> $HGRCPATH <<EOF |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
16 > [extensions] |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
17 > blackbox= |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
18 > mock=`pwd`/mock.py |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
19 > EOF |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
20 $ hg init blackboxtest |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
21 $ cd blackboxtest |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
22 |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
23 command, exit codes, and duration |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
24 |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
25 $ echo a > a |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
26 $ hg add a |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
27 $ hg blackbox |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
28 1970/01/01 00:00:00 bob> add a |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
29 1970/01/01 00:00:00 bob> add exited 0 after * seconds (glob) |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
30 |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
31 extension and python hooks - use the eol extension for a pythonhook |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
32 |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
33 $ echo '[extensions]' >> .hg/hgrc |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
34 $ echo 'eol=' >> .hg/hgrc |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
35 $ echo '[hooks]' >> .hg/hgrc |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
36 $ echo 'update = echo hooked' >> .hg/hgrc |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
37 $ hg update |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
38 hooked |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
39 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
40 $ hg blackbox -l 4 |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
41 1970/01/01 00:00:00 bob> update |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
42 1970/01/01 00:00:00 bob> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob) |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
43 1970/01/01 00:00:00 bob> exthook-update: echo hooked finished in * seconds (glob) |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
44 1970/01/01 00:00:00 bob> update exited False after * seconds (glob) |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
45 |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
46 incoming change tracking |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
47 |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
48 $ hg clone . ../blackboxtest2 |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
49 updating to branch default |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
50 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
51 $ hg commit -ma |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
52 $ cd ../blackboxtest2 |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
53 $ hg pull |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
54 pulling from $TESTTMP/blackboxtest |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
55 requesting all changes |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
56 adding changesets |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
57 adding manifests |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
58 adding file changes |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
59 added 1 changesets with 1 changes to 1 files |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
60 (run 'hg update' to get a working copy) |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
61 $ hg blackbox -l 3 |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
62 1970/01/01 00:00:00 bob> pull |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
63 1970/01/01 00:00:00 bob> 1 incoming changes - new heads: cb9a9f314b8b (glob) |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
64 1970/01/01 00:00:00 bob> pull exited None after * seconds (glob) |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
65 |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
66 cleanup |
c61b49d059eb
blackbox: tests for the blackbox extension
Durham Goode <durham@fb.com>
parents:
diff
changeset
|
67 $ cd .. |