| 1 |
Test basic functionality of url#rev syntax |
| 2 |
|
| 3 |
$ hg init repo |
| 4 |
$ cd repo |
| 5 |
$ echo a > a |
| 6 |
$ hg ci -qAm 'add a' |
| 7 |
$ hg branch foo |
| 8 |
marked working directory as branch foo |
| 9 |
(branches are permanent and global, did you want a bookmark?) |
| 10 |
$ echo >> a |
| 11 |
$ hg ci -m 'change a' |
| 12 |
$ cd .. |
| 13 |
|
| 14 |
$ hg clone 'repo#foo' clone |
| 15 |
adding changesets |
| 16 |
adding manifests |
| 17 |
adding file changes |
| 18 |
added 2 changesets with 2 changes to 1 files |
| 19 |
new changesets 1f0dee641bb7:cd2a86ecc814 |
| 20 |
updating to branch foo |
| 21 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 22 |
|
| 23 |
$ hg --cwd clone heads |
| 24 |
changeset: 1:cd2a86ecc814 |
| 25 |
branch: foo |
| 26 |
tag: tip |
| 27 |
user: test |
| 28 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 29 |
summary: change a |
| 30 |
|
| 31 |
changeset: 0:1f0dee641bb7 |
| 32 |
user: test |
| 33 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 34 |
summary: add a |
| 35 |
|
| 36 |
$ hg --cwd clone parents |
| 37 |
changeset: 1:cd2a86ecc814 |
| 38 |
branch: foo |
| 39 |
tag: tip |
| 40 |
user: test |
| 41 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 42 |
summary: change a |
| 43 |
|
| 44 |
$ cat clone/.hg/hgrc |
| 45 |
# example repository config (see 'hg help config' for more info) |
| 46 |
[paths] |
| 47 |
default = $TESTTMP/repo#foo |
| 48 |
|
| 49 |
# path aliases to other clones of this repo in URLs or filesystem paths |
| 50 |
# (see 'hg help config.paths' for more info) |
| 51 |
# |
| 52 |
# default:pushurl = ssh://[email protected]/hg/jdoes-fork |
| 53 |
# my-fork = ssh://[email protected]/hg/jdoes-fork |
| 54 |
# my-clone = /home/jdoe/jdoes-clone |
| 55 |
|
| 56 |
[ui] |
| 57 |
# name and email (local to this repository, optional), e.g. |
| 58 |
# username = Jane Doe <[email protected]> |
| 59 |
|
| 60 |
Changing original repo: |
| 61 |
|
| 62 |
$ cd repo |
| 63 |
|
| 64 |
$ echo >> a |
| 65 |
$ hg ci -m 'new head of branch foo' |
| 66 |
|
| 67 |
$ hg up -qC default |
| 68 |
$ echo bar > bar |
| 69 |
$ hg ci -qAm 'add bar' |
| 70 |
|
| 71 |
$ hg log |
| 72 |
changeset: 3:4cd725637392 |
| 73 |
tag: tip |
| 74 |
parent: 0:1f0dee641bb7 |
| 75 |
user: test |
| 76 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 77 |
summary: add bar |
| 78 |
|
| 79 |
changeset: 2:faba9097cad4 |
| 80 |
branch: foo |
| 81 |
user: test |
| 82 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 83 |
summary: new head of branch foo |
| 84 |
|
| 85 |
changeset: 1:cd2a86ecc814 |
| 86 |
branch: foo |
| 87 |
user: test |
| 88 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 89 |
summary: change a |
| 90 |
|
| 91 |
changeset: 0:1f0dee641bb7 |
| 92 |
user: test |
| 93 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 94 |
summary: add a |
| 95 |
|
| 96 |
$ hg -q outgoing '../clone' |
| 97 |
2:faba9097cad4 |
| 98 |
3:4cd725637392 |
| 99 |
$ hg summary --remote --config paths.default='../clone' |
| 100 |
parent: 3:4cd725637392 tip |
| 101 |
add bar |
| 102 |
branch: default |
| 103 |
commit: (clean) |
| 104 |
update: (current) |
| 105 |
phases: 4 draft |
| 106 |
remote: 2 outgoing |
| 107 |
$ hg -q outgoing '../clone#foo' |
| 108 |
2:faba9097cad4 |
| 109 |
$ hg summary --remote --config paths.default='../clone#foo' |
| 110 |
parent: 3:4cd725637392 tip |
| 111 |
add bar |
| 112 |
branch: default |
| 113 |
commit: (clean) |
| 114 |
update: (current) |
| 115 |
phases: 4 draft |
| 116 |
remote: 1 outgoing |
| 117 |
|
| 118 |
$ hg -q --cwd ../clone incoming '../repo#foo' |
| 119 |
2:faba9097cad4 |
| 120 |
$ hg --cwd ../clone summary --remote --config paths.default='../repo#foo' |
| 121 |
parent: 1:cd2a86ecc814 tip |
| 122 |
change a |
| 123 |
branch: foo |
| 124 |
commit: (clean) |
| 125 |
update: (current) |
| 126 |
remote: 1 or more incoming |
| 127 |
|
| 128 |
$ hg -q push '../clone#foo' |
| 129 |
|
| 130 |
$ hg --cwd ../clone heads |
| 131 |
changeset: 2:faba9097cad4 |
| 132 |
branch: foo |
| 133 |
tag: tip |
| 134 |
user: test |
| 135 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 136 |
summary: new head of branch foo |
| 137 |
|
| 138 |
changeset: 0:1f0dee641bb7 |
| 139 |
user: test |
| 140 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 141 |
summary: add a |
| 142 |
|
| 143 |
$ hg -q --cwd ../clone incoming '../repo#foo' |
| 144 |
[1] |
| 145 |
$ hg --cwd ../clone summary --remote --config paths.default='../repo#foo' |
| 146 |
parent: 1:cd2a86ecc814 |
| 147 |
change a |
| 148 |
branch: foo |
| 149 |
commit: (clean) |
| 150 |
update: 1 new changesets (update) |
| 151 |
remote: (synced) |
| 152 |
|
| 153 |
$ cd .. |
| 154 |
|
| 155 |
$ cd clone |
| 156 |
$ hg rollback |
| 157 |
repository tip rolled back to revision 1 (undo push) |
| 158 |
|
| 159 |
$ hg -q incoming |
| 160 |
2:faba9097cad4 |
| 161 |
|
| 162 |
$ hg -q pull |
| 163 |
|
| 164 |
$ hg heads |
| 165 |
changeset: 2:faba9097cad4 |
| 166 |
branch: foo |
| 167 |
tag: tip |
| 168 |
user: test |
| 169 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 170 |
summary: new head of branch foo |
| 171 |
|
| 172 |
changeset: 0:1f0dee641bb7 |
| 173 |
user: test |
| 174 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 175 |
summary: add a |
| 176 |
|
| 177 |
Pull should not have updated: |
| 178 |
|
| 179 |
$ hg parents -q |
| 180 |
1:cd2a86ecc814 |
| 181 |
|
| 182 |
Going back to the default branch: |
| 183 |
|
| 184 |
$ hg up -C 0 |
| 185 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 186 |
|
| 187 |
$ hg parents |
| 188 |
changeset: 0:1f0dee641bb7 |
| 189 |
user: test |
| 190 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 191 |
summary: add a |
| 192 |
|
| 193 |
No new revs, no update: |
| 194 |
|
| 195 |
$ hg pull -qu |
| 196 |
|
| 197 |
$ hg parents -q |
| 198 |
0:1f0dee641bb7 |
| 199 |
|
| 200 |
$ hg rollback |
| 201 |
repository tip rolled back to revision 1 (undo pull) |
| 202 |
|
| 203 |
$ hg parents -q |
| 204 |
0:1f0dee641bb7 |
| 205 |
|
| 206 |
Pull -u takes us back to branch foo: |
| 207 |
|
| 208 |
$ hg pull -qu |
| 209 |
|
| 210 |
$ hg parents |
| 211 |
changeset: 2:faba9097cad4 |
| 212 |
branch: foo |
| 213 |
tag: tip |
| 214 |
user: test |
| 215 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 216 |
summary: new head of branch foo |
| 217 |
|
| 218 |
$ hg rollback |
| 219 |
repository tip rolled back to revision 1 (undo pull) |
| 220 |
working directory now based on revision 0 |
| 221 |
|
| 222 |
$ hg up -C 0 |
| 223 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 224 |
|
| 225 |
$ hg parents -q |
| 226 |
0:1f0dee641bb7 |
| 227 |
|
| 228 |
$ hg heads -q |
| 229 |
1:cd2a86ecc814 |
| 230 |
0:1f0dee641bb7 |
| 231 |
|
| 232 |
$ hg pull -qur default default |
| 233 |
|
| 234 |
$ hg parents |
| 235 |
changeset: 3:4cd725637392 |
| 236 |
tag: tip |
| 237 |
parent: 0:1f0dee641bb7 |
| 238 |
user: test |
| 239 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 240 |
summary: add bar |
| 241 |
|
| 242 |
$ hg heads |
| 243 |
changeset: 3:4cd725637392 |
| 244 |
tag: tip |
| 245 |
parent: 0:1f0dee641bb7 |
| 246 |
user: test |
| 247 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 248 |
summary: add bar |
| 249 |
|
| 250 |
changeset: 2:faba9097cad4 |
| 251 |
branch: foo |
| 252 |
user: test |
| 253 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 254 |
summary: new head of branch foo |
| 255 |
|
| 256 |
Test handling of invalid urls |
| 257 |
|
| 258 |
$ hg id http://foo/?bar |
| 259 |
abort: unsupported URL component: "bar" |
| 260 |
[255] |
| 261 |
|
| 262 |
$ cd .. |
| 263 |
|
| 264 |
Test handling common incoming revisions between "default" and |
| 265 |
"default-push" |
| 266 |
|
| 267 |
$ hg -R clone rollback |
| 268 |
repository tip rolled back to revision 1 (undo pull) |
| 269 |
working directory now based on revision 0 |
| 270 |
|
| 271 |
$ cd repo |
| 272 |
|
| 273 |
$ hg update -q -C default |
| 274 |
$ echo modified >> bar |
| 275 |
$ hg commit -m "new head to push current default head" |
| 276 |
$ hg -q push -r ".^1" '../clone' |
| 277 |
|
| 278 |
$ hg -q outgoing '../clone' |
| 279 |
2:faba9097cad4 |
| 280 |
4:d515801a8f3d |
| 281 |
|
| 282 |
$ hg summary --remote --config paths.default='../clone#default' --config paths.default-push='../clone#foo' |
| 283 |
parent: 4:d515801a8f3d tip |
| 284 |
new head to push current default head |
| 285 |
branch: default |
| 286 |
commit: (clean) |
| 287 |
update: (current) |
| 288 |
phases: 1 draft |
| 289 |
remote: 1 outgoing |
| 290 |
|
| 291 |
$ hg summary --remote --config paths.default='../clone#foo' --config paths.default-push='../clone' |
| 292 |
parent: 4:d515801a8f3d tip |
| 293 |
new head to push current default head |
| 294 |
branch: default |
| 295 |
commit: (clean) |
| 296 |
update: (current) |
| 297 |
phases: 1 draft |
| 298 |
remote: 2 outgoing |
| 299 |
|
| 300 |
$ hg summary --remote --config paths.default='../clone' --config paths.default-push='../clone#foo' |
| 301 |
parent: 4:d515801a8f3d tip |
| 302 |
new head to push current default head |
| 303 |
branch: default |
| 304 |
commit: (clean) |
| 305 |
update: (current) |
| 306 |
phases: 1 draft |
| 307 |
remote: 1 outgoing |
| 308 |
|
| 309 |
$ hg clone -q -r 0 . ../another |
| 310 |
$ hg -q outgoing '../another#default' |
| 311 |
3:4cd725637392 |
| 312 |
4:d515801a8f3d |
| 313 |
|
| 314 |
$ hg summary --remote --config paths.default='../another#default' --config paths.default-push='../clone#default' |
| 315 |
parent: 4:d515801a8f3d tip |
| 316 |
new head to push current default head |
| 317 |
branch: default |
| 318 |
commit: (clean) |
| 319 |
update: (current) |
| 320 |
phases: 1 draft |
| 321 |
remote: 1 outgoing |
| 322 |
|
| 323 |
$ cd .. |
| 324 |
|
| 325 |
Test url#rev syntax of local destination path, which should be taken as |
| 326 |
a 'url#rev' path |
| 327 |
|
| 328 |
$ hg clone repo '#foo' |
| 329 |
updating to branch default |
| 330 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 331 |
$ hg root -R '#foo' |
| 332 |
$TESTTMP/#foo |