| 1 |
$ . "$TESTDIR/narrow-library.sh" |
| 2 |
|
| 3 |
$ hg init master |
| 4 |
$ cd master |
| 5 |
$ cat >> .hg/hgrc <<EOF |
| 6 |
> [narrow] |
| 7 |
> serveellipses=True |
| 8 |
> EOF |
| 9 |
$ mkdir dir |
| 10 |
$ mkdir dir/src |
| 11 |
$ cd dir/src |
| 12 |
$ for x in `$TESTDIR/seq.py 20`; do echo $x > "f$x"; hg add "f$x"; hg commit -m "Commit src $x"; done |
| 13 |
$ cd .. |
| 14 |
$ mkdir tests |
| 15 |
$ cd tests |
| 16 |
$ for x in `$TESTDIR/seq.py 20`; do echo $x > "t$x"; hg add "t$x"; hg commit -m "Commit test $x"; done |
| 17 |
$ cd ../../.. |
| 18 |
|
| 19 |
Only path: and rootfilesin: pattern prefixes are allowed |
| 20 |
|
| 21 |
$ hg clone --narrow ssh://user@dummy/master badnarrow --noupdate --include 'glob:**' |
| 22 |
abort: invalid prefix on narrow pattern: glob:** |
| 23 |
(narrow patterns must begin with one of the following: path:, rootfilesin:) |
| 24 |
[255] |
| 25 |
|
| 26 |
$ hg clone --narrow ssh://user@dummy/master badnarrow --noupdate --exclude 'set:ignored' |
| 27 |
abort: invalid prefix on narrow pattern: set:ignored |
| 28 |
(narrow patterns must begin with one of the following: path:, rootfilesin:) |
| 29 |
[255] |
| 30 |
|
| 31 |
rootfilesin: patterns work |
| 32 |
|
| 33 |
$ hg clone --narrow ssh://user@dummy/master rootfilesin --noupdate --include 'rootfilesin:dir' |
| 34 |
requesting all changes |
| 35 |
adding changesets |
| 36 |
adding manifests |
| 37 |
adding file changes |
| 38 |
added 1 changesets with 0 changes to 0 files |
| 39 |
new changesets 26ce255d5b5d |
| 40 |
$ hg tracked -R rootfilesin |
| 41 |
I rootfilesin:dir |
| 42 |
|
| 43 |
narrow clone a file, f10 |
| 44 |
|
| 45 |
$ hg clone --narrow ssh://user@dummy/master narrow --noupdate --include "dir/src/f10" |
| 46 |
requesting all changes |
| 47 |
adding changesets |
| 48 |
adding manifests |
| 49 |
adding file changes |
| 50 |
added 3 changesets with 1 changes to 1 files |
| 51 |
new changesets *:* (glob) |
| 52 |
$ cd narrow |
| 53 |
$ hg debugrequires | grep -v generaldelta |
| 54 |
dotencode |
| 55 |
dirstate-v2 (dirstate-v2 !) |
| 56 |
fncache |
| 57 |
narrowhg-experimental |
| 58 |
persistent-nodemap (rust !) |
| 59 |
revlog-compression-zstd (zstd !) |
| 60 |
revlogv1 |
| 61 |
share-safe |
| 62 |
sparserevlog |
| 63 |
store |
| 64 |
|
| 65 |
$ hg tracked |
| 66 |
I path:dir/src/f10 |
| 67 |
$ hg tracked |
| 68 |
I path:dir/src/f10 |
| 69 |
$ hg update |
| 70 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 71 |
$ find * | sort |
| 72 |
dir |
| 73 |
dir/src |
| 74 |
dir/src/f10 |
| 75 |
$ cat dir/src/f10 |
| 76 |
10 |
| 77 |
|
| 78 |
$ cd .. |
| 79 |
|
| 80 |
local-to-local narrow clones work |
| 81 |
|
| 82 |
$ hg clone --narrow master narrow-via-localpeer --noupdate --include "dir/src/f10" |
| 83 |
requesting all changes |
| 84 |
adding changesets |
| 85 |
adding manifests |
| 86 |
adding file changes |
| 87 |
added 3 changesets with 1 changes to 1 files |
| 88 |
new changesets 5d21aaea77f8:26ce255d5b5d |
| 89 |
$ hg tracked -R narrow-via-localpeer |
| 90 |
I path:dir/src/f10 |
| 91 |
$ rm -Rf narrow-via-localpeer |
| 92 |
|
| 93 |
narrow clone with a newline should fail |
| 94 |
|
| 95 |
$ hg clone --narrow ssh://user@dummy/master narrow_fail --noupdate --include 'dir/src/f10 |
| 96 |
> ' |
| 97 |
abort: newlines are not allowed in narrowspec paths |
| 98 |
[255] |
| 99 |
|
| 100 |
narrow clone a directory, tests/, except tests/t19 |
| 101 |
|
| 102 |
$ hg clone --narrow ssh://user@dummy/master narrowdir --noupdate --include "dir/tests/" --exclude "dir/tests/t19" |
| 103 |
requesting all changes |
| 104 |
adding changesets |
| 105 |
adding manifests |
| 106 |
adding file changes |
| 107 |
added 21 changesets with 19 changes to 19 files |
| 108 |
new changesets *:* (glob) |
| 109 |
$ cd narrowdir |
| 110 |
$ hg tracked |
| 111 |
I path:dir/tests |
| 112 |
X path:dir/tests/t19 |
| 113 |
$ hg tracked |
| 114 |
I path:dir/tests |
| 115 |
X path:dir/tests/t19 |
| 116 |
$ hg update |
| 117 |
19 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 118 |
$ find * | sort |
| 119 |
dir |
| 120 |
dir/tests |
| 121 |
dir/tests/t1 |
| 122 |
dir/tests/t10 |
| 123 |
dir/tests/t11 |
| 124 |
dir/tests/t12 |
| 125 |
dir/tests/t13 |
| 126 |
dir/tests/t14 |
| 127 |
dir/tests/t15 |
| 128 |
dir/tests/t16 |
| 129 |
dir/tests/t17 |
| 130 |
dir/tests/t18 |
| 131 |
dir/tests/t2 |
| 132 |
dir/tests/t20 |
| 133 |
dir/tests/t3 |
| 134 |
dir/tests/t4 |
| 135 |
dir/tests/t5 |
| 136 |
dir/tests/t6 |
| 137 |
dir/tests/t7 |
| 138 |
dir/tests/t8 |
| 139 |
dir/tests/t9 |
| 140 |
|
| 141 |
$ cd .. |
| 142 |
|
| 143 |
narrow clone everything but a directory (tests/) |
| 144 |
|
| 145 |
$ hg clone --narrow ssh://user@dummy/master narrowroot --noupdate --exclude "dir/tests" |
| 146 |
requesting all changes |
| 147 |
adding changesets |
| 148 |
adding manifests |
| 149 |
adding file changes |
| 150 |
added 21 changesets with 20 changes to 20 files |
| 151 |
new changesets *:* (glob) |
| 152 |
$ cd narrowroot |
| 153 |
$ hg tracked |
| 154 |
I path:. |
| 155 |
X path:dir/tests |
| 156 |
$ hg tracked |
| 157 |
I path:. |
| 158 |
X path:dir/tests |
| 159 |
$ hg update |
| 160 |
20 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 161 |
$ find * | sort |
| 162 |
dir |
| 163 |
dir/src |
| 164 |
dir/src/f1 |
| 165 |
dir/src/f10 |
| 166 |
dir/src/f11 |
| 167 |
dir/src/f12 |
| 168 |
dir/src/f13 |
| 169 |
dir/src/f14 |
| 170 |
dir/src/f15 |
| 171 |
dir/src/f16 |
| 172 |
dir/src/f17 |
| 173 |
dir/src/f18 |
| 174 |
dir/src/f19 |
| 175 |
dir/src/f2 |
| 176 |
dir/src/f20 |
| 177 |
dir/src/f3 |
| 178 |
dir/src/f4 |
| 179 |
dir/src/f5 |
| 180 |
dir/src/f6 |
| 181 |
dir/src/f7 |
| 182 |
dir/src/f8 |
| 183 |
dir/src/f9 |
| 184 |
|
| 185 |
$ cd .. |
| 186 |
|
| 187 |
narrow clone no paths at all |
| 188 |
|
| 189 |
$ hg clone --narrow ssh://user@dummy/master narrowempty --noupdate |
| 190 |
requesting all changes |
| 191 |
adding changesets |
| 192 |
adding manifests |
| 193 |
adding file changes |
| 194 |
added 1 changesets with 0 changes to 0 files |
| 195 |
new changesets * (glob) |
| 196 |
$ cd narrowempty |
| 197 |
$ hg tracked |
| 198 |
$ hg update |
| 199 |
0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 200 |
$ ls -A |
| 201 |
.hg |
| 202 |
|
| 203 |
$ cd .. |
| 204 |
|
| 205 |
simple clone |
| 206 |
$ hg clone ssh://user@dummy/master simpleclone |
| 207 |
requesting all changes |
| 208 |
adding changesets |
| 209 |
adding manifests |
| 210 |
adding file changes |
| 211 |
added 40 changesets with 40 changes to 40 files |
| 212 |
new changesets * (glob) |
| 213 |
updating to branch default |
| 214 |
40 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 215 |
$ cd simpleclone |
| 216 |
$ find * | sort |
| 217 |
dir |
| 218 |
dir/src |
| 219 |
dir/src/f1 |
| 220 |
dir/src/f10 |
| 221 |
dir/src/f11 |
| 222 |
dir/src/f12 |
| 223 |
dir/src/f13 |
| 224 |
dir/src/f14 |
| 225 |
dir/src/f15 |
| 226 |
dir/src/f16 |
| 227 |
dir/src/f17 |
| 228 |
dir/src/f18 |
| 229 |
dir/src/f19 |
| 230 |
dir/src/f2 |
| 231 |
dir/src/f20 |
| 232 |
dir/src/f3 |
| 233 |
dir/src/f4 |
| 234 |
dir/src/f5 |
| 235 |
dir/src/f6 |
| 236 |
dir/src/f7 |
| 237 |
dir/src/f8 |
| 238 |
dir/src/f9 |
| 239 |
dir/tests |
| 240 |
dir/tests/t1 |
| 241 |
dir/tests/t10 |
| 242 |
dir/tests/t11 |
| 243 |
dir/tests/t12 |
| 244 |
dir/tests/t13 |
| 245 |
dir/tests/t14 |
| 246 |
dir/tests/t15 |
| 247 |
dir/tests/t16 |
| 248 |
dir/tests/t17 |
| 249 |
dir/tests/t18 |
| 250 |
dir/tests/t19 |
| 251 |
dir/tests/t2 |
| 252 |
dir/tests/t20 |
| 253 |
dir/tests/t3 |
| 254 |
dir/tests/t4 |
| 255 |
dir/tests/t5 |
| 256 |
dir/tests/t6 |
| 257 |
dir/tests/t7 |
| 258 |
dir/tests/t8 |
| 259 |
dir/tests/t9 |
| 260 |
|
| 261 |
$ cd .. |
| 262 |
|
| 263 |
Testing the --narrowspec flag to clone |
| 264 |
|
| 265 |
$ cat >> narrowspecs <<EOF |
| 266 |
> %include foo |
| 267 |
> [include] |
| 268 |
> path:dir/tests/ |
| 269 |
> path:dir/src/f12 |
| 270 |
> EOF |
| 271 |
|
| 272 |
$ hg clone ssh://user@dummy/master specfile --narrowspec narrowspecs |
| 273 |
reading narrowspec from '$TESTTMP/narrowspecs' |
| 274 |
config error: cannot specify other files using '%include' in narrowspec |
| 275 |
[30] |
| 276 |
|
| 277 |
$ cat > narrowspecs <<EOF |
| 278 |
> [include] |
| 279 |
> path:dir/tests/ |
| 280 |
> path:dir/src/f12 |
| 281 |
> EOF |
| 282 |
|
| 283 |
$ hg clone ssh://user@dummy/master specfile --narrowspec narrowspecs |
| 284 |
reading narrowspec from '$TESTTMP/narrowspecs' |
| 285 |
requesting all changes |
| 286 |
adding changesets |
| 287 |
adding manifests |
| 288 |
adding file changes |
| 289 |
added 23 changesets with 21 changes to 21 files |
| 290 |
new changesets c13e3773edb4:26ce255d5b5d |
| 291 |
updating to branch default |
| 292 |
21 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 293 |
$ cd specfile |
| 294 |
$ hg tracked |
| 295 |
I path:dir/src/f12 |
| 296 |
I path:dir/tests |
| 297 |
$ cd .. |
| 298 |
|
| 299 |
Narrow spec with invalid patterns is rejected |
| 300 |
|
| 301 |
$ cat > narrowspecs <<EOF |
| 302 |
> [include] |
| 303 |
> glob:** |
| 304 |
> EOF |
| 305 |
|
| 306 |
$ hg clone ssh://user@dummy/master badspecfile --narrowspec narrowspecs |
| 307 |
reading narrowspec from '$TESTTMP/narrowspecs' |
| 308 |
abort: invalid prefix on narrow pattern: glob:** |
| 309 |
(narrow patterns must begin with one of the following: path:, rootfilesin:) |
| 310 |
[255] |