| 1 |
Preparing the subrepository 'sub' |
| 2 |
|
| 3 |
$ hg init sub |
| 4 |
$ echo sub > sub/sub |
| 5 |
$ hg add -R sub |
| 6 |
adding sub/sub |
| 7 |
$ hg commit -R sub -m "sub import" |
| 8 |
|
| 9 |
Preparing the 'main' repo which depends on the subrepo 'sub' |
| 10 |
|
| 11 |
$ hg init main |
| 12 |
$ echo main > main/main |
| 13 |
$ echo "sub = ../sub" > main/.hgsub |
| 14 |
$ hg clone sub main/sub |
| 15 |
updating to branch default |
| 16 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 17 |
$ hg add -R main |
| 18 |
adding main/.hgsub |
| 19 |
adding main/main |
| 20 |
$ hg commit -R main -m "main import" |
| 21 |
|
| 22 |
Cleaning both repositories, just as a clone -U |
| 23 |
|
| 24 |
$ hg up -C -R sub null |
| 25 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 26 |
$ hg up -C -R main null |
| 27 |
0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
| 28 |
$ rm -rf main/sub |
| 29 |
|
| 30 |
hide outer repo |
| 31 |
$ hg init |
| 32 |
|
| 33 |
Serving them both using hgweb |
| 34 |
|
| 35 |
$ printf '[paths]\n/main = main\nsub = sub\n' > webdir.conf |
| 36 |
$ hg serve --webdir-conf webdir.conf -a localhost -p $HGPORT \ |
| 37 |
> -A /dev/null -E /dev/null --pid-file hg.pid -d |
| 38 |
$ cat hg.pid >> $DAEMON_PIDS |
| 39 |
|
| 40 |
Clone main from hgweb |
| 41 |
|
| 42 |
$ hg clone "http://user:pass@localhost:$HGPORT/main" cloned |
| 43 |
requesting all changes |
| 44 |
adding changesets |
| 45 |
adding manifests |
| 46 |
adding file changes |
| 47 |
added 1 changesets with 3 changes to 3 files |
| 48 |
new changesets fdfeeb3e979e |
| 49 |
updating to branch default |
| 50 |
cloning subrepo sub from http://user@localhost:$HGPORT/sub |
| 51 |
requesting all changes |
| 52 |
adding changesets |
| 53 |
adding manifests |
| 54 |
adding file changes |
| 55 |
added 1 changesets with 1 changes to 1 files |
| 56 |
new changesets 863c1745b441 |
| 57 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 58 |
|
| 59 |
Ensure that subrepos pay attention to default:pushurl |
| 60 |
|
| 61 |
$ cat > cloned/.hg/hgrc << EOF |
| 62 |
> [paths] |
| 63 |
> default:pushurl = http://user:pass@localhost:$HGPORT/main |
| 64 |
> EOF |
| 65 |
|
| 66 |
$ hg -R cloned out -S --config paths.default=bogus://invalid |
| 67 |
comparing with http://user:***@localhost:$HGPORT/main |
| 68 |
searching for changes |
| 69 |
no changes found |
| 70 |
comparing with http://user:***@localhost:$HGPORT/sub |
| 71 |
searching for changes |
| 72 |
no changes found |
| 73 |
[1] |
| 74 |
|
| 75 |
TODO: Figure out why, if the password is left out of the default:pushurl URL, |
| 76 |
this says "no changes made to subrepo sub since last push". It looks like from |
| 77 |
the original clone command above, the password is getting stripped off, not |
| 78 |
just masked out, and that would make the hashed URL different. |
| 79 |
|
| 80 |
$ hg -R cloned push --config paths.default=bogus://invalid |
| 81 |
pushing to http://user:***@localhost:$HGPORT/main |
| 82 |
pushing subrepo sub to http://user:***@localhost:$HGPORT/sub |
| 83 |
searching for changes |
| 84 |
no changes found |
| 85 |
searching for changes |
| 86 |
no changes found |
| 87 |
abort: HTTP Error 403: ssl required |
| 88 |
[100] |
| 89 |
|
| 90 |
Checking cloned repo ids |
| 91 |
|
| 92 |
$ hg id -R cloned |
| 93 |
fdfeeb3e979e tip |
| 94 |
$ hg id -R cloned/sub |
| 95 |
863c1745b441 tip |
| 96 |
|
| 97 |
subrepo debug for 'main' clone |
| 98 |
|
| 99 |
$ hg debugsub -R cloned |
| 100 |
path sub |
| 101 |
source ../sub |
| 102 |
revision 863c1745b441bd97a8c4a096e87793073f4fb215 |
| 103 |
|
| 104 |
Test sharing with a remote URL reference |
| 105 |
|
| 106 |
$ hg init absolute_subrepo |
| 107 |
$ cd absolute_subrepo |
| 108 |
$ echo foo > foo.txt |
| 109 |
$ hg ci -Am 'initial commit' |
| 110 |
adding foo.txt |
| 111 |
$ echo "sub = http://localhost:$HGPORT/sub" > .hgsub |
| 112 |
$ hg ci -Am 'add absolute subrepo' |
| 113 |
adding .hgsub |
| 114 |
$ cd .. |
| 115 |
|
| 116 |
Clone pooling works for local clones with a remote subrepo reference. The |
| 117 |
subrepo is cloned to the pool and shared from there, so that all clones will |
| 118 |
share the same subrepo. |
| 119 |
|
| 120 |
$ hg --config extensions.share= --config share.pool=$TESTTMP/pool \ |
| 121 |
> clone absolute_subrepo cloned_from_abs |
| 122 |
(sharing from new pooled repository 8d6a2f1e993b34b6557de0042cfe825ae12a8dae) |
| 123 |
requesting all changes |
| 124 |
adding changesets |
| 125 |
adding manifests |
| 126 |
adding file changes |
| 127 |
added 2 changesets with 3 changes to 3 files |
| 128 |
new changesets 8d6a2f1e993b:* (glob) |
| 129 |
searching for changes |
| 130 |
no changes found |
| 131 |
updating working directory |
| 132 |
cloning subrepo sub from http://localhost:$HGPORT/sub |
| 133 |
(sharing from new pooled repository 863c1745b441bd97a8c4a096e87793073f4fb215) |
| 134 |
requesting all changes |
| 135 |
adding changesets |
| 136 |
adding manifests |
| 137 |
adding file changes |
| 138 |
added 1 changesets with 1 changes to 1 files |
| 139 |
new changesets 863c1745b441 |
| 140 |
searching for changes |
| 141 |
no changes found |
| 142 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 143 |
|
| 144 |
Vanilla sharing with a subrepo remote path reference will clone the subrepo. |
| 145 |
Each share of these top level repos will end up with independent subrepo copies |
| 146 |
(potentially leaving the shared parent with dangling cset references). |
| 147 |
|
| 148 |
$ hg --config extensions.share= share absolute_subrepo shared_from_abs |
| 149 |
updating working directory |
| 150 |
cloning subrepo sub from http://localhost:$HGPORT/sub |
| 151 |
requesting all changes |
| 152 |
adding changesets |
| 153 |
adding manifests |
| 154 |
adding file changes |
| 155 |
added 1 changesets with 1 changes to 1 files |
| 156 |
new changesets 863c1745b441 |
| 157 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 158 |
|
| 159 |
$ hg --config extensions.share= share -U absolute_subrepo shared_from_abs2 |
| 160 |
$ hg -R shared_from_abs2 update -r tip |
| 161 |
cloning subrepo sub from http://localhost:$HGPORT/sub |
| 162 |
requesting all changes |
| 163 |
adding changesets |
| 164 |
adding manifests |
| 165 |
adding file changes |
| 166 |
added 1 changesets with 1 changes to 1 files |
| 167 |
new changesets 863c1745b441 |
| 168 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 169 |
|
| 170 |
A parent repo without its subrepo available locally can be shared if the |
| 171 |
subrepo is referenced by absolute path. |
| 172 |
|
| 173 |
$ hg clone -U absolute_subrepo cloned_null_from_abs |
| 174 |
$ hg --config extensions.share= share cloned_null_from_abs shared_from_null_abs |
| 175 |
updating working directory |
| 176 |
cloning subrepo sub from http://localhost:$HGPORT/sub |
| 177 |
requesting all changes |
| 178 |
adding changesets |
| 179 |
adding manifests |
| 180 |
adding file changes |
| 181 |
added 1 changesets with 1 changes to 1 files |
| 182 |
new changesets 863c1745b441 |
| 183 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 184 |
|
| 185 |
$ killdaemons.py |
| 186 |
|
| 187 |
subrepo paths with ssh urls |
| 188 |
|
| 189 |
$ hg clone ssh://user@dummy/cloned sshclone |
| 190 |
requesting all changes |
| 191 |
adding changesets |
| 192 |
adding manifests |
| 193 |
adding file changes |
| 194 |
added 1 changesets with 3 changes to 3 files |
| 195 |
new changesets fdfeeb3e979e |
| 196 |
updating to branch default |
| 197 |
cloning subrepo sub from ssh://user@dummy/sub |
| 198 |
requesting all changes |
| 199 |
adding changesets |
| 200 |
adding manifests |
| 201 |
adding file changes |
| 202 |
added 1 changesets with 1 changes to 1 files |
| 203 |
new changesets 863c1745b441 |
| 204 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 205 |
|
| 206 |
$ hg -R sshclone push ssh://user@dummy/`pwd`/cloned |
| 207 |
pushing to ssh://user@dummy/$TESTTMP/cloned |
| 208 |
pushing subrepo sub to ssh://user@dummy/$TESTTMP/sub |
| 209 |
searching for changes |
| 210 |
no changes found |
| 211 |
searching for changes |
| 212 |
no changes found |
| 213 |
[1] |
| 214 |
|
| 215 |
$ cat dummylog |
| 216 |
Got arguments 1:user@dummy 2:hg -R cloned serve --stdio |
| 217 |
Got arguments 1:user@dummy 2:hg -R sub serve --stdio |
| 218 |
Got arguments 1:user@dummy 2:hg -R $TESTTMP/cloned serve --stdio |
| 219 |
Got arguments 1:user@dummy 2:hg -R $TESTTMP/sub serve --stdio |