| 1 |
#testcases flat tree |
| 2 |
$ . "$TESTDIR/narrow-library.sh" |
| 3 |
|
| 4 |
#if tree |
| 5 |
$ cat << EOF >> $HGRCPATH |
| 6 |
> [experimental] |
| 7 |
> treemanifest = 1 |
| 8 |
> EOF |
| 9 |
#endif |
| 10 |
|
| 11 |
$ hg init master |
| 12 |
$ cd master |
| 13 |
$ cat >> .hg/hgrc <<EOF |
| 14 |
> [narrow] |
| 15 |
> serveellipses=True |
| 16 |
> EOF |
| 17 |
|
| 18 |
$ mkdir inside |
| 19 |
$ echo 'inside' > inside/f |
| 20 |
$ hg add inside/f |
| 21 |
$ hg commit -m 'add inside' |
| 22 |
|
| 23 |
$ mkdir widest |
| 24 |
$ echo 'widest' > widest/f |
| 25 |
$ hg add widest/f |
| 26 |
$ hg commit -m 'add widest' |
| 27 |
|
| 28 |
$ mkdir outside |
| 29 |
$ echo 'outside' > outside/f |
| 30 |
$ hg add outside/f |
| 31 |
$ hg commit -m 'add outside' |
| 32 |
|
| 33 |
$ cd .. |
| 34 |
|
| 35 |
narrow clone the inside file |
| 36 |
|
| 37 |
$ hg clone --narrow ssh://user@dummy/master narrow --include inside |
| 38 |
requesting all changes |
| 39 |
adding changesets |
| 40 |
adding manifests |
| 41 |
adding file changes |
| 42 |
added 2 changesets with 1 changes to 1 files |
| 43 |
new changesets *:* (glob) |
| 44 |
updating to branch default |
| 45 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 46 |
$ cd narrow |
| 47 |
$ hg tracked |
| 48 |
I path:inside |
| 49 |
$ ls -A |
| 50 |
.hg |
| 51 |
inside |
| 52 |
$ cat inside/f |
| 53 |
inside |
| 54 |
$ cd .. |
| 55 |
|
| 56 |
add more upstream files which we will include in a wider narrow spec |
| 57 |
|
| 58 |
$ cd master |
| 59 |
|
| 60 |
$ mkdir wider |
| 61 |
$ echo 'wider' > wider/f |
| 62 |
$ hg add wider/f |
| 63 |
$ echo 'widest v2' > widest/f |
| 64 |
$ hg commit -m 'add wider, update widest' |
| 65 |
|
| 66 |
$ echo 'widest v3' > widest/f |
| 67 |
$ hg commit -m 'update widest v3' |
| 68 |
|
| 69 |
$ echo 'inside v2' > inside/f |
| 70 |
$ hg commit -m 'update inside' |
| 71 |
|
| 72 |
$ mkdir outside2 |
| 73 |
$ echo 'outside2' > outside2/f |
| 74 |
$ hg add outside2/f |
| 75 |
$ hg commit -m 'add outside2' |
| 76 |
|
| 77 |
$ echo 'widest v4' > widest/f |
| 78 |
$ hg commit -m 'update widest v4' |
| 79 |
|
| 80 |
$ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n" |
| 81 |
7: update widest v4 |
| 82 |
6: add outside2 |
| 83 |
5: update inside |
| 84 |
4: update widest v3 |
| 85 |
3: add wider, update widest |
| 86 |
2: add outside |
| 87 |
1: add widest |
| 88 |
0: add inside |
| 89 |
|
| 90 |
$ cd .. |
| 91 |
|
| 92 |
Testing the --import-rules flag of `hg tracked` command |
| 93 |
|
| 94 |
$ cd narrow |
| 95 |
$ hg tracked --import-rules |
| 96 |
hg tracked: option --import-rules requires argument |
| 97 |
hg tracked [OPTIONS]... [REMOTE] |
| 98 |
|
| 99 |
show or change the current narrowspec |
| 100 |
|
| 101 |
options ([+] can be repeated): |
| 102 |
|
| 103 |
--addinclude VALUE [+] new paths to include |
| 104 |
--removeinclude VALUE [+] old paths to no longer include |
| 105 |
--auto-remove-includes automatically choose unused includes to |
| 106 |
remove |
| 107 |
--addexclude VALUE [+] new paths to exclude |
| 108 |
--import-rules VALUE import narrowspecs from a file |
| 109 |
--removeexclude VALUE [+] old paths to no longer exclude |
| 110 |
--clear whether to replace the existing narrowspec |
| 111 |
--force-delete-local-changes forces deletion of local changes when |
| 112 |
narrowing |
| 113 |
--[no-]backup back up local changes when narrowing |
| 114 |
(default: on) |
| 115 |
--update-working-copy update working copy when the store has |
| 116 |
changed |
| 117 |
-e --ssh CMD specify ssh command to use |
| 118 |
--remotecmd CMD specify hg command to run on the remote side |
| 119 |
--insecure do not verify server certificate (ignoring |
| 120 |
web.cacerts config) |
| 121 |
|
| 122 |
(use 'hg tracked -h' to show more help) |
| 123 |
[10] |
| 124 |
$ hg tracked --import-rules doesnotexist |
| 125 |
abort: cannot read narrowspecs from '$TESTTMP/narrow/doesnotexist': $ENOENT$ |
| 126 |
[50] |
| 127 |
|
| 128 |
$ cat > specs <<EOF |
| 129 |
> %include foo |
| 130 |
> [include] |
| 131 |
> path:widest/ |
| 132 |
> [exclude] |
| 133 |
> path:inside/ |
| 134 |
> EOF |
| 135 |
|
| 136 |
$ hg tracked --import-rules specs |
| 137 |
abort: including other spec files using '%include' is not supported in narrowspec |
| 138 |
[10] |
| 139 |
|
| 140 |
$ cat > specs <<EOF |
| 141 |
> [include] |
| 142 |
> outisde |
| 143 |
> [exclude] |
| 144 |
> inside |
| 145 |
> EOF |
| 146 |
|
| 147 |
$ hg tracked --import-rules specs |
| 148 |
comparing with ssh://user@dummy/master |
| 149 |
searching for changes |
| 150 |
looking for local changes to affected paths |
| 151 |
deleting data/inside/f.i |
| 152 |
deleting meta/inside/00manifest.i (tree !) |
| 153 |
deleting unwanted files from working copy |
| 154 |
saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) |
| 155 |
adding changesets |
| 156 |
adding manifests |
| 157 |
adding file changes |
| 158 |
added 2 changesets with 0 changes to 0 files |
| 159 |
$ hg tracked |
| 160 |
I path:outisde |
| 161 |
X path:inside |
| 162 |
|
| 163 |
Testing the --import-rules flag with --addinclude and --addexclude |
| 164 |
|
| 165 |
$ cat > specs <<EOF |
| 166 |
> [include] |
| 167 |
> widest |
| 168 |
> EOF |
| 169 |
|
| 170 |
$ hg tracked --import-rules specs --addinclude 'wider/' |
| 171 |
comparing with ssh://user@dummy/master |
| 172 |
searching for changes |
| 173 |
saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) |
| 174 |
adding changesets |
| 175 |
adding manifests |
| 176 |
adding file changes |
| 177 |
added 3 changesets with 1 changes to 1 files |
| 178 |
$ hg tracked |
| 179 |
I path:outisde |
| 180 |
I path:wider |
| 181 |
I path:widest |
| 182 |
X path:inside |
| 183 |
|
| 184 |
$ cat > specs <<EOF |
| 185 |
> [exclude] |
| 186 |
> outside2 |
| 187 |
> EOF |
| 188 |
|
| 189 |
$ hg tracked --import-rules specs --addexclude 'widest' |
| 190 |
comparing with ssh://user@dummy/master |
| 191 |
searching for changes |
| 192 |
looking for local changes to affected paths |
| 193 |
deleting data/widest/f.i |
| 194 |
deleting meta/widest/00manifest.i (tree !) |
| 195 |
deleting unwanted files from working copy |
| 196 |
$ hg tracked |
| 197 |
I path:outisde |
| 198 |
I path:wider |
| 199 |
X path:inside |
| 200 |
X path:outside2 |
| 201 |
X path:widest |
| 202 |
|
| 203 |
$ hg tracked --import-rules specs --clear |
| 204 |
abort: the --clear option is not yet supported |
| 205 |
[10] |
| 206 |
|
| 207 |
Testing with passing a out of wdir file |
| 208 |
|
| 209 |
$ cat > ../nspecs <<EOF |
| 210 |
> [include] |
| 211 |
> widest |
| 212 |
> EOF |
| 213 |
|
| 214 |
$ hg tracked --import-rules ../nspecs |
| 215 |
comparing with ssh://user@dummy/master |
| 216 |
searching for changes |
| 217 |
saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) |
| 218 |
adding changesets |
| 219 |
adding manifests |
| 220 |
adding file changes |
| 221 |
added 3 changesets with 0 changes to 0 files |
| 222 |
|
| 223 |
$ cd .. |
| 224 |
|
| 225 |
Testing tracked command on a non-narrow repo |
| 226 |
|
| 227 |
$ hg init non-narrow |
| 228 |
$ cd non-narrow |
| 229 |
$ hg tracked --addinclude foobar |
| 230 |
abort: the tracked command is only supported on repositories cloned with --narrow |
| 231 |
[10] |