| 1 |
test sparse |
| 2 |
|
| 3 |
$ hg init myrepo |
| 4 |
$ cd myrepo |
| 5 |
$ cat > .hg/hgrc <<EOF |
| 6 |
> [extensions] |
| 7 |
> sparse= |
| 8 |
> purge= |
| 9 |
> strip= |
| 10 |
> rebase= |
| 11 |
> EOF |
| 12 |
|
| 13 |
Config file without [section] is rejected |
| 14 |
|
| 15 |
$ cat > bad.sparse <<EOF |
| 16 |
> *.html |
| 17 |
> EOF |
| 18 |
|
| 19 |
$ hg debugsparse --import-rules bad.sparse |
| 20 |
abort: sparse config entry outside of section: *.html |
| 21 |
(add an [include] or [exclude] line to declare the entry type) |
| 22 |
[255] |
| 23 |
$ rm bad.sparse |
| 24 |
|
| 25 |
$ echo a > index.html |
| 26 |
$ echo x > data.py |
| 27 |
$ echo z > readme.txt |
| 28 |
$ cat > webpage.sparse <<EOF |
| 29 |
> # frontend sparse profile |
| 30 |
> [include] |
| 31 |
> *.html |
| 32 |
> EOF |
| 33 |
$ cat > backend.sparse <<EOF |
| 34 |
> # backend sparse profile |
| 35 |
> [include] |
| 36 |
> *.py |
| 37 |
> EOF |
| 38 |
$ hg ci -Aqm 'initial' |
| 39 |
|
| 40 |
$ hg debugsparse --include '*.sparse' |
| 41 |
|
| 42 |
Verify enabling a single profile works |
| 43 |
|
| 44 |
$ hg debugsparse --enable-profile webpage.sparse |
| 45 |
$ ls -A |
| 46 |
.hg |
| 47 |
backend.sparse |
| 48 |
index.html |
| 49 |
webpage.sparse |
| 50 |
|
| 51 |
Verify enabling two profiles works |
| 52 |
|
| 53 |
$ hg debugsparse --enable-profile backend.sparse |
| 54 |
$ ls -A |
| 55 |
.hg |
| 56 |
backend.sparse |
| 57 |
data.py |
| 58 |
index.html |
| 59 |
webpage.sparse |
| 60 |
|
| 61 |
Verify disabling a profile works |
| 62 |
|
| 63 |
$ hg debugsparse --disable-profile webpage.sparse |
| 64 |
$ ls -A |
| 65 |
.hg |
| 66 |
backend.sparse |
| 67 |
data.py |
| 68 |
webpage.sparse |
| 69 |
|
| 70 |
Verify that a profile is updated across multiple commits |
| 71 |
|
| 72 |
$ cat > webpage.sparse <<EOF |
| 73 |
> # frontend sparse profile |
| 74 |
> [include] |
| 75 |
> *.html |
| 76 |
> EOF |
| 77 |
$ cat > backend.sparse <<EOF |
| 78 |
> # backend sparse profile |
| 79 |
> [include] |
| 80 |
> *.py |
| 81 |
> *.txt |
| 82 |
> EOF |
| 83 |
|
| 84 |
$ echo foo >> data.py |
| 85 |
|
| 86 |
$ hg ci -m 'edit profile' |
| 87 |
$ ls -A |
| 88 |
.hg |
| 89 |
backend.sparse |
| 90 |
data.py |
| 91 |
readme.txt |
| 92 |
webpage.sparse |
| 93 |
|
| 94 |
$ hg up -q 0 |
| 95 |
$ ls -A |
| 96 |
.hg |
| 97 |
backend.sparse |
| 98 |
data.py |
| 99 |
webpage.sparse |
| 100 |
|
| 101 |
$ hg up -q 1 |
| 102 |
$ ls -A |
| 103 |
.hg |
| 104 |
backend.sparse |
| 105 |
data.py |
| 106 |
readme.txt |
| 107 |
webpage.sparse |
| 108 |
|
| 109 |
Introduce a conflicting .hgsparse change |
| 110 |
|
| 111 |
$ hg up -q 0 |
| 112 |
$ cat > backend.sparse <<EOF |
| 113 |
> # Different backend sparse profile |
| 114 |
> [include] |
| 115 |
> *.html |
| 116 |
> EOF |
| 117 |
$ echo bar >> data.py |
| 118 |
|
| 119 |
$ hg ci -qAm "edit profile other" |
| 120 |
$ ls -A |
| 121 |
.hg |
| 122 |
backend.sparse |
| 123 |
index.html |
| 124 |
webpage.sparse |
| 125 |
|
| 126 |
Verify conflicting merge pulls in the conflicting changes |
| 127 |
|
| 128 |
$ hg merge 1 |
| 129 |
temporarily included 2 file(s) in the sparse checkout for merging |
| 130 |
merging backend.sparse |
| 131 |
warning: conflicts while merging backend.sparse! (edit, then use 'hg resolve --mark') |
| 132 |
merging data.py |
| 133 |
warning: conflicts while merging data.py! (edit, then use 'hg resolve --mark') |
| 134 |
0 files updated, 0 files merged, 0 files removed, 2 files unresolved |
| 135 |
use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
| 136 |
[1] |
| 137 |
|
| 138 |
$ rm *.orig |
| 139 |
$ ls -A |
| 140 |
.hg |
| 141 |
backend.sparse |
| 142 |
data.py |
| 143 |
index.html |
| 144 |
webpage.sparse |
| 145 |
|
| 146 |
Verify resolving the merge removes the temporarily unioned files |
| 147 |
|
| 148 |
$ cat > backend.sparse <<EOF |
| 149 |
> # backend sparse profile |
| 150 |
> [include] |
| 151 |
> *.html |
| 152 |
> *.txt |
| 153 |
> EOF |
| 154 |
$ hg resolve -m backend.sparse |
| 155 |
|
| 156 |
$ cat > data.py <<EOF |
| 157 |
> x |
| 158 |
> foo |
| 159 |
> bar |
| 160 |
> EOF |
| 161 |
$ hg resolve -m data.py |
| 162 |
(no more unresolved files) |
| 163 |
|
| 164 |
$ hg ci -qAm "merge profiles" |
| 165 |
$ ls -A |
| 166 |
.hg |
| 167 |
backend.sparse |
| 168 |
index.html |
| 169 |
readme.txt |
| 170 |
webpage.sparse |
| 171 |
|
| 172 |
$ hg cat -r . data.py |
| 173 |
x |
| 174 |
foo |
| 175 |
bar |
| 176 |
|
| 177 |
Verify stripping refreshes dirstate |
| 178 |
|
| 179 |
$ hg strip -q -r . |
| 180 |
$ ls -A |
| 181 |
.hg |
| 182 |
backend.sparse |
| 183 |
index.html |
| 184 |
webpage.sparse |
| 185 |
|
| 186 |
Verify rebase conflicts pulls in the conflicting changes |
| 187 |
|
| 188 |
$ hg up -q 1 |
| 189 |
$ ls -A |
| 190 |
.hg |
| 191 |
backend.sparse |
| 192 |
data.py |
| 193 |
readme.txt |
| 194 |
webpage.sparse |
| 195 |
|
| 196 |
$ hg rebase -d 2 |
| 197 |
rebasing 1:a2b1de640a62 "edit profile" |
| 198 |
temporarily included 2 file(s) in the sparse checkout for merging |
| 199 |
merging backend.sparse |
| 200 |
warning: conflicts while merging backend.sparse! (edit, then use 'hg resolve --mark') |
| 201 |
merging data.py |
| 202 |
warning: conflicts while merging data.py! (edit, then use 'hg resolve --mark') |
| 203 |
unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') |
| 204 |
[240] |
| 205 |
$ rm *.orig |
| 206 |
$ ls -A |
| 207 |
.hg |
| 208 |
backend.sparse |
| 209 |
data.py |
| 210 |
index.html |
| 211 |
webpage.sparse |
| 212 |
|
| 213 |
Verify resolving conflict removes the temporary files |
| 214 |
|
| 215 |
$ cat > backend.sparse <<EOF |
| 216 |
> [include] |
| 217 |
> *.html |
| 218 |
> *.txt |
| 219 |
> EOF |
| 220 |
$ hg resolve -m backend.sparse |
| 221 |
|
| 222 |
$ cat > data.py <<EOF |
| 223 |
> x |
| 224 |
> foo |
| 225 |
> bar |
| 226 |
> EOF |
| 227 |
$ hg resolve -m data.py |
| 228 |
(no more unresolved files) |
| 229 |
continue: hg rebase --continue |
| 230 |
|
| 231 |
$ hg rebase -q --continue |
| 232 |
$ ls -A |
| 233 |
.hg |
| 234 |
backend.sparse |
| 235 |
index.html |
| 236 |
readme.txt |
| 237 |
webpage.sparse |
| 238 |
|
| 239 |
$ hg cat -r . data.py |
| 240 |
x |
| 241 |
foo |
| 242 |
bar |
| 243 |
|
| 244 |
Test checking out a commit that does not contain the sparse profile. The |
| 245 |
warning message can be suppressed by setting missingwarning = false in |
| 246 |
[sparse] section of your config: |
| 247 |
|
| 248 |
$ hg debugsparse --reset |
| 249 |
$ hg rm *.sparse |
| 250 |
$ hg commit -m "delete profiles" |
| 251 |
$ hg up -q ".^" |
| 252 |
$ hg debugsparse --enable-profile backend.sparse |
| 253 |
$ ls -A |
| 254 |
.hg |
| 255 |
index.html |
| 256 |
readme.txt |
| 257 |
$ hg up tip | grep warning |
| 258 |
warning: sparse profile 'backend.sparse' not found in rev bfcb76de99cc - ignoring it |
| 259 |
[1] |
| 260 |
$ ls -A |
| 261 |
.hg |
| 262 |
data.py |
| 263 |
index.html |
| 264 |
readme.txt |
| 265 |
$ hg debugsparse --disable-profile backend.sparse | grep warning |
| 266 |
warning: sparse profile 'backend.sparse' not found in rev bfcb76de99cc - ignoring it |
| 267 |
[1] |
| 268 |
$ cat >> .hg/hgrc <<EOF |
| 269 |
> [sparse] |
| 270 |
> missingwarning = false |
| 271 |
> EOF |
| 272 |
$ hg debugsparse --enable-profile backend.sparse |
| 273 |
|
| 274 |
$ cd .. |
| 275 |
|
| 276 |
#if unix-permissions |
| 277 |
|
| 278 |
Test file permissions changing across a sparse profile change |
| 279 |
$ hg init sparseperm |
| 280 |
$ cd sparseperm |
| 281 |
$ cat > .hg/hgrc <<EOF |
| 282 |
> [extensions] |
| 283 |
> sparse= |
| 284 |
> EOF |
| 285 |
$ touch a b |
| 286 |
$ cat > .hgsparse <<EOF |
| 287 |
> [include] |
| 288 |
> a |
| 289 |
> EOF |
| 290 |
$ hg commit -Aqm 'initial' |
| 291 |
$ chmod a+x b |
| 292 |
$ hg commit -qm 'make executable' |
| 293 |
$ cat >> .hgsparse <<EOF |
| 294 |
> b |
| 295 |
> EOF |
| 296 |
$ hg commit -qm 'update profile' |
| 297 |
$ hg up -q 0 |
| 298 |
$ hg debugsparse --enable-profile .hgsparse |
| 299 |
$ hg up -q 2 |
| 300 |
$ ls -l b |
| 301 |
-rwxr-xr-x* b (glob) |
| 302 |
|
| 303 |
#endif |