| 1 |
============================================ |
| 2 |
Tests for the admin::chainsaw-update command |
| 3 |
============================================ |
| 4 |
|
| 5 |
setup |
| 6 |
===== |
| 7 |
|
| 8 |
$ hg init src |
| 9 |
$ cd src |
| 10 |
$ echo 1 > root |
| 11 |
$ hg add root |
| 12 |
$ hg ci -Am R_0 |
| 13 |
$ hg branch A |
| 14 |
marked working directory as branch A |
| 15 |
(branches are permanent and global, did you want a bookmark?) |
| 16 |
$ echo 42 > bar |
| 17 |
$ hg add bar |
| 18 |
$ hg ci -Am A_0 |
| 19 |
$ echo 1337 > bar |
| 20 |
$ hg ci -Am A_1 |
| 21 |
$ hg update 'desc(R_0)' |
| 22 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 23 |
$ echo 1 > foo |
| 24 |
$ hg add foo |
| 25 |
$ hg ci -Am B_0 |
| 26 |
$ hg log -G |
| 27 |
@ changeset: 3:bfcb8e629987 |
| 28 |
| tag: tip |
| 29 |
| parent: 0:06f48e4098b8 |
| 30 |
| user: test |
| 31 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 32 |
| summary: B_0 |
| 33 |
| |
| 34 |
| o changeset: 2:7fd8de258aa4 |
| 35 |
| | branch: A |
| 36 |
| | user: test |
| 37 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 38 |
| | summary: A_1 |
| 39 |
| | |
| 40 |
| o changeset: 1:ae1692b8aadb |
| 41 |
|/ branch: A |
| 42 |
| user: test |
| 43 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 44 |
| summary: A_0 |
| 45 |
| |
| 46 |
o changeset: 0:06f48e4098b8 |
| 47 |
user: test |
| 48 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 49 |
summary: R_0 |
| 50 |
|
| 51 |
$ cd .. |
| 52 |
|
| 53 |
Actual tests |
| 54 |
============ |
| 55 |
|
| 56 |
Initial cloning if needed |
| 57 |
------------------------- |
| 58 |
|
| 59 |
$ hg admin::chainsaw-update --dest repo --rev default --source ./src |
| 60 |
no such directory: "repo" |
| 61 |
creating repository at "repo" |
| 62 |
recovering after interrupted transaction, if any |
| 63 |
no interrupted transaction available |
| 64 |
pulling from ./src |
| 65 |
updating to revision 'default' |
| 66 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 67 |
chainsaw-update to revision 'default' for repository at '$TESTTMP/repo' done |
| 68 |
|
| 69 |
$ cd repo |
| 70 |
$ hg log -G |
| 71 |
@ changeset: 3:bfcb8e629987 |
| 72 |
| tag: tip |
| 73 |
| parent: 0:06f48e4098b8 |
| 74 |
| user: test |
| 75 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 76 |
| summary: B_0 |
| 77 |
| |
| 78 |
| o changeset: 2:7fd8de258aa4 |
| 79 |
| | branch: A |
| 80 |
| | user: test |
| 81 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 82 |
| | summary: A_1 |
| 83 |
| | |
| 84 |
| o changeset: 1:ae1692b8aadb |
| 85 |
|/ branch: A |
| 86 |
| user: test |
| 87 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 88 |
| summary: A_0 |
| 89 |
| |
| 90 |
o changeset: 0:06f48e4098b8 |
| 91 |
user: test |
| 92 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 93 |
summary: R_0 |
| 94 |
|
| 95 |
$ hg status -A |
| 96 |
C foo |
| 97 |
C root |
| 98 |
$ cat foo |
| 99 |
1 |
| 100 |
|
| 101 |
Test lock breacking capabilities |
| 102 |
-------------------------------- |
| 103 |
|
| 104 |
Demonstrate lock-breaking capabilities with locks that regular Mercurial |
| 105 |
operation would not break, because the hostnames registered in locks differ |
| 106 |
from the current hostname (happens a lot with succesive containers): |
| 107 |
|
| 108 |
#if symlink |
| 109 |
$ ln -s invalid.host.test/effffffc:171814 .hg/store/lock |
| 110 |
$ ln -s invalid.host.test/effffffc:171814 .hg/wlock |
| 111 |
#else |
| 112 |
$ printf 'invalid.host.test/effffffc:171814' > .hg/store/lock |
| 113 |
$ printf 'invalid.host.test/effffffc:171814' > .hg/wlock |
| 114 |
#endif |
| 115 |
$ hg debuglock |
| 116 |
lock: (.*?), process 171814, host invalid.host.test/effffffc \((\d+)s\) (re) |
| 117 |
wlock: (.*?), process 171814, host invalid.host.test/effffffc \((\d+)s\) (re) |
| 118 |
[2] |
| 119 |
|
| 120 |
$ hg admin::chainsaw-update --no-purge-ignored --dest . --rev default --source ../src |
| 121 |
loaded repository at "." |
| 122 |
had to break store lock |
| 123 |
had to break working copy lock |
| 124 |
recovering after interrupted transaction, if any |
| 125 |
no interrupted transaction available |
| 126 |
pulling from ../src |
| 127 |
updating to revision 'default' |
| 128 |
0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 129 |
chainsaw-update to revision 'default' for repository at '$TESTTMP/repo' done |
| 130 |
|
| 131 |
Test file purging capabilities |
| 132 |
------------------------------ |
| 133 |
|
| 134 |
Let's also add local modifications (tracked and untracked) to demonstrate the |
| 135 |
purging. |
| 136 |
|
| 137 |
$ echo untracked > bar |
| 138 |
$ echo modified > foo |
| 139 |
$ hg status -A |
| 140 |
M foo |
| 141 |
? bar |
| 142 |
C root |
| 143 |
|
| 144 |
$ echo 2 > ../src/foo |
| 145 |
$ hg -R ../src commit -mB_1 |
| 146 |
$ hg admin::chainsaw-update --dest . --rev default --source ../src -q |
| 147 |
no interrupted transaction available |
| 148 |
$ hg log -G |
| 149 |
@ changeset: 4:973ab81c95fb |
| 150 |
| tag: tip |
| 151 |
| user: test |
| 152 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 153 |
| summary: B_1 |
| 154 |
| |
| 155 |
o changeset: 3:bfcb8e629987 |
| 156 |
| parent: 0:06f48e4098b8 |
| 157 |
| user: test |
| 158 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 159 |
| summary: B_0 |
| 160 |
| |
| 161 |
| o changeset: 2:7fd8de258aa4 |
| 162 |
| | branch: A |
| 163 |
| | user: test |
| 164 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 165 |
| | summary: A_1 |
| 166 |
| | |
| 167 |
| o changeset: 1:ae1692b8aadb |
| 168 |
|/ branch: A |
| 169 |
| user: test |
| 170 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 171 |
| summary: A_0 |
| 172 |
| |
| 173 |
o changeset: 0:06f48e4098b8 |
| 174 |
user: test |
| 175 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 176 |
summary: R_0 |
| 177 |
|
| 178 |
$ hg status -A |
| 179 |
C foo |
| 180 |
C root |
| 181 |
$ cat foo |
| 182 |
2 |
| 183 |
|
| 184 |
Now behaviour with respect to ignored files: they are not purged if |
| 185 |
the --no-purge-ignored flag is passed, but they are purged by default |
| 186 |
|
| 187 |
$ echo bar > .hgignore |
| 188 |
$ hg ci -Aqm hgignore |
| 189 |
$ echo ignored > bar |
| 190 |
$ hg status --all |
| 191 |
I bar |
| 192 |
C .hgignore |
| 193 |
C foo |
| 194 |
C root |
| 195 |
|
| 196 |
$ hg admin::chainsaw-update --no-purge-ignored --dest . --rev default --source ../src -q |
| 197 |
no interrupted transaction available |
| 198 |
$ hg status --all |
| 199 |
I bar |
| 200 |
C .hgignore |
| 201 |
C foo |
| 202 |
C root |
| 203 |
$ cat bar |
| 204 |
ignored |
| 205 |
|
| 206 |
$ hg admin::chainsaw-update --dest . --rev default --source ../src -q |
| 207 |
no interrupted transaction available |
| 208 |
$ hg status --all |
| 209 |
C .hgignore |
| 210 |
C foo |
| 211 |
C root |
| 212 |
$ test -f bar |
| 213 |
[1] |
| 214 |
|
| 215 |
test --minimal-initial-cloning variant |
| 216 |
-------------------------------------- |
| 217 |
|
| 218 |
With `--minimal-initial-cloning`, there is no "requesting all changes" |
| 219 |
message. Hence clone bundles would be bypassed (TODO test both cases |
| 220 |
# with an actual clone-bundle) |
| 221 |
|
| 222 |
$ cd .. |
| 223 |
$ hg admin::chainsaw-update --dest repo2 --rev default --source src --initial-clone-minimal |
| 224 |
no such directory: "repo2" |
| 225 |
creating repository at "repo2" |
| 226 |
recovering after interrupted transaction, if any |
| 227 |
no interrupted transaction available |
| 228 |
pulling from src |
| 229 |
updating to revision 'default' |
| 230 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 231 |
chainsaw-update to revision 'default' for repository at '$TESTTMP/repo2' done |
| 232 |
|
| 233 |
$ cd repo2 |
| 234 |
$ hg log -G |
| 235 |
@ changeset: 2:973ab81c95fb |
| 236 |
| tag: tip |
| 237 |
| user: test |
| 238 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 239 |
| summary: B_1 |
| 240 |
| |
| 241 |
o changeset: 1:bfcb8e629987 |
| 242 |
| user: test |
| 243 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 244 |
| summary: B_0 |
| 245 |
| |
| 246 |
o changeset: 0:06f48e4098b8 |
| 247 |
user: test |
| 248 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 249 |
summary: R_0 |
| 250 |
|
| 251 |
$ hg status -A |
| 252 |
C foo |
| 253 |
C root |
| 254 |
$ cat foo |
| 255 |
2 |