|
1 ============================================ |
|
2 Tests for the admin::chainsaw-update command |
|
3 ============================================ |
|
4 |
|
5 setup |
|
6 ===== |
|
7 |
|
8 $ cat >> $HGRCPATH << EOF |
|
9 > [extensions] |
|
10 > chainsaw= |
|
11 > EOF |
|
12 |
|
13 $ hg init src |
|
14 $ cd src |
|
15 $ echo 1 > foo |
|
16 $ hg ci -Am1 |
|
17 adding foo |
|
18 $ cd .. |
|
19 |
|
20 Actual tests |
|
21 ============ |
|
22 |
|
23 Simple invocation |
|
24 ----------------- |
|
25 |
|
26 $ hg init repo |
|
27 $ cd repo |
|
28 $ hg admin::chainsaw-update --rev default --source ../src |
|
29 breaking locks, if any |
|
30 recovering after interrupted transaction, if any |
|
31 no interrupted transaction available |
|
32 pulling from ../src |
|
33 updating to revision 'default' |
|
34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
35 chainsaw-update to revision 'default' for repository at '$TESTTMP/repo' done |
|
36 |
|
37 $ cat foo |
|
38 1 |
|
39 |
|
40 Test lock breacking capabilities |
|
41 -------------------------------- |
|
42 |
|
43 Demonstrate lock-breaking capabilities with locks that regular Mercurial |
|
44 operation would not break, because the hostnames registered in locks differ |
|
45 from the current hostname (happens a lot with succesive containers): |
|
46 |
|
47 $ ln -s invalid.host.test/effffffc:171814 .hg/store/lock |
|
48 $ ln -s invalid.host.test/effffffc:171814 .hg/wlock |
|
49 $ hg debuglock |
|
50 lock: (.*?), process 171814, host invalid.host.test/effffffc \((\d+)s\) (re) |
|
51 wlock: (.*?), process 171814, host invalid.host.test/effffffc \((\d+)s\) (re) |
|
52 [2] |
|
53 |
|
54 $ hg admin::chainsaw-update --no-purge-ignored --rev default --source ../src -q |
|
55 no interrupted transaction available |
|
56 |
|
57 Test file purging capabilities |
|
58 ------------------------------ |
|
59 |
|
60 Let's also add local modifications (tracked and untracked) to demonstrate the |
|
61 purging. |
|
62 |
|
63 $ echo untracked > bar |
|
64 $ echo modified > foo |
|
65 $ hg status -A |
|
66 M foo |
|
67 ? bar |
|
68 |
|
69 $ echo 2 > ../src/foo |
|
70 $ hg -R ../src commit -m2 |
|
71 $ hg admin::chainsaw-update --rev default --source ../src -q |
|
72 no interrupted transaction available |
|
73 $ hg status -A |
|
74 C foo |
|
75 $ cat foo |
|
76 2 |
|
77 |
|
78 Now behaviour with respect to ignored files: they are not purged if |
|
79 the --no-purge-ignored flag is passed, but they are purged by default |
|
80 |
|
81 $ echo bar > .hgignore |
|
82 $ hg ci -Aqm hgignore |
|
83 $ echo ignored > bar |
|
84 $ hg status --all |
|
85 I bar |
|
86 C .hgignore |
|
87 C foo |
|
88 |
|
89 $ hg admin::chainsaw-update --no-purge-ignored --rev default --source ../src -q |
|
90 no interrupted transaction available |
|
91 $ hg status --all |
|
92 I bar |
|
93 C .hgignore |
|
94 C foo |
|
95 $ cat bar |
|
96 ignored |
|
97 |
|
98 $ hg admin::chainsaw-update --rev default --source ../src -q |
|
99 no interrupted transaction available |
|
100 $ hg status --all |
|
101 C .hgignore |
|
102 C foo |
|
103 $ test -f bar |
|
104 [1] |
|
105 |