1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377
|
#testcases secret draft
Load commonly used test logic
$ . "$TESTDIR/testutil"
$ cat >> $HGRCPATH <<EOF
> [templates]
> shorttags = '{rev}:{node|short} {phase} {tags}{if(obsolete, " X")}\n'
> EOF
#if secret
The phases setting should not affect hg-git
$ cat >> $HGRCPATH <<EOF
> [phases]
> new-commit = secret
> EOF
#endif
Create a bare upstream repository
$ git init --bare repo.git
Initialized empty Git repository in $TESTTMP/repo.git/
Create a couple of commits from Git
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m 'add alpha'
$ echo beta > beta
$ git add beta
$ fn_git_commit -m 'add beta'
$ fn_git_tag -a -m 'added tag beta' beta
$ git remote add origin $TESTTMP/repo.git
$ git push --quiet --tags --set-upstream origin master
Branch 'master' set up to track remote branch 'master' from 'origin'. (?)
$ cd ..
Clone it:
$ hg clone repo.git hgrepo
importing 2 git commits
new changesets ff7a2f2d8d70:7fe02317c63d (2 drafts)
updating to bookmark master
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd hgrepo
Verify that annotated tags are unaffected by reexports:
$ GIT_DIR=.hg/git git tag -ln
beta added tag beta
$ hg gexport
$ GIT_DIR=.hg/git git tag -ln
beta added tag beta
Error checking on tag creation
$ hg tag --git beta --remove
abort: cannot remove git tags
(the git documentation heavily discourages editing tags)
[255]
$ hg tag --git beta -r null
abort: cannot remove git tags
(the git documentation heavily discourages editing tags)
[255]
$ hg tag --git beta --remove -r 0
abort: cannot specify both --rev and --remove
[10]
$ hg tag --git alpha
abort: git tags require an explicit revision
(please specify -r/--rev)
[255]
$ hg tag --git alpha alpha -r 0
abort: tag names must be unique
[255]
$ hg tag --git alpha -r 0 -e
abort: cannot specify both --git and --edit
[10]
$ hg tag --git alpha -r 0 -m 42
abort: cannot specify both --git and --message
[10]
$ hg tag --git alpha -r 0 -d 42
abort: cannot specify both --git and --date
[10]
$ hg tag --git alpha -r 0 -u user@example.com
abort: cannot specify both --git and --user
[10]
$ hg tag --git 'with space' -r 0
abort: the name 'with space' is not a valid git tag
[255]
$ hg tag --git ' beta' -r 0
abort: the name 'beta' already exists
[255]
$ hg tag --git master -r 0
abort: the name 'master' already exists
[255]
$ hg tag --git tip -r 0
abort: the name 'tip' is reserved
[10]
Create a git tag from hg
$ hg tag --git alpha --debug -r 0
finding unexported changesets
saving git map to $TESTTMP/hgrepo/.hg/git-mapfile
adding git tag alpha
$ hg log --graph
@ changeset: 1:7fe02317c63d
| bookmark: master
| tag: beta
| tag: default/master
| tag: tip
| user: test <test@example.org>
| date: Mon Jan 01 00:00:11 2007 +0000
| summary: add beta
|
o changeset: 0:ff7a2f2d8d70
tag: alpha
user: test <test@example.org>
date: Mon Jan 01 00:00:10 2007 +0000
summary: add alpha
$ echo beta-fix >> beta
$ fn_hg_commit -m 'fix for beta'
#if secret
$ hg phase -d
#endif
$ hg push
pushing to $TESTTMP/repo.git
searching for changes
adding objects
remote: found 0 deltas to reuse
added 1 commits with 1 trees and 1 blobs
updating reference refs/heads/master
adding reference refs/tags/alpha
Verify that amending commits known to remotes doesn't break anything
$ cat >> $HGRCPATH << EOF
> [experimental]
> evolution = createmarkers
> evolution.createmarkers = yes
> EOF
$ hg tags
tip 2:61175962e488
default/master 2:61175962e488
beta 1:7fe02317c63d
alpha 0:ff7a2f2d8d70
$ echo beta-fix-again >> beta
$ fn_hg_commit --amend
$ hg log -T shorttags
3:3094b9e8da41 draft tip
2:61175962e488 draft default/master X
1:7fe02317c63d draft beta
0:ff7a2f2d8d70 draft alpha
$ hg tags
tip 3:3094b9e8da41
default/master 2:61175962e488
beta 1:7fe02317c63d
alpha 0:ff7a2f2d8d70
$ hg push
pushing to $TESTTMP/repo.git
searching for changes
abort: pushing refs/heads/master overwrites 3094b9e8da41
[255]
$ hg push -f
pushing to $TESTTMP/repo.git
searching for changes
adding objects
remote: found 0 deltas to reuse
added 1 commits with 1 trees and 1 blobs
updating reference refs/heads/master
Now create a tag for the old, obsolete master
$ cd ../repo.git
$ git tag detached $(hg log -R ../hgrepo --hidden -r 2 -T '{gitnode}\n')
$ git tag
alpha
beta
detached
$ cd ../hgrepo
$ hg pull
pulling from $TESTTMP/repo.git
no changes found
$ hg log -T shorttags
3:3094b9e8da41 draft default/master tip
2:61175962e488 draft detached X
1:7fe02317c63d draft beta
0:ff7a2f2d8d70 draft alpha
$ hg tags
tip 3:3094b9e8da41
default/master 3:3094b9e8da41
detached 2:61175962e488
beta 1:7fe02317c63d
alpha 0:ff7a2f2d8d70
$ hg push
pushing to $TESTTMP/repo.git
searching for changes
no changes found
[1]
$ cd ..
Verify that revsets can point out git tags; for that we need an
untagged commit.
$ cd hgrepo
$ touch gamma
$ fn_hg_commit -A -m 'add gamma'
#if secret
$ hg phase -d
#endif
$ hg log -T shorttags -r 'gittag()'
0:ff7a2f2d8d70 draft alpha
1:7fe02317c63d draft beta
2:61175962e488 draft detached X
$ hg log -T shorttags -r 'gittag(detached)'
2:61175962e488 draft detached X
$ hg log -T shorttags -r 'gittag("re:a$")'
0:ff7a2f2d8d70 draft alpha
1:7fe02317c63d draft beta
Create a git tag from hg, but pointing to a new commit:
$ hg tag --git gamma --debug -r tip
invalid branch cache (visible): tip differs (?)
finding unexported changesets
exporting 1 changesets
converting revision 0eb1ab0073a885a498d4ae3dc5cf0c26e750fa3d
packing 3 loose objects...
packed 3 loose objects!
saving git map to $TESTTMP/hgrepo/.hg/git-mapfile
adding git tag gamma
$ hg push
pushing to $TESTTMP/repo.git
searching for changes
adding objects
remote: found 0 deltas to reuse
added 1 commits with 1 trees and 1 blobs
updating reference refs/heads/master
adding reference refs/tags/gamma
$ cd ../gitrepo
$ git fetch --quiet --tags
$ git tag
alpha
beta
detached
gamma
$ cd ..
Try to overwrite an annotated tag:
$ cd hgrepo
$ hg tags -v
tip 4:0eb1ab0073a8
gamma 4:0eb1ab0073a8 git
default/master 4:0eb1ab0073a8 git-remote
detached 2:61175962e488 git
beta 1:7fe02317c63d git
alpha 0:ff7a2f2d8d70 git
$ hg book not-master
$ hg tag beta
abort: tag 'beta' already exists (use -f to force)
[10]
$ hg tag -f beta
#if secret
$ hg phase -d
#endif
$ hg push
pushing to $TESTTMP/repo.git
warning: not overwriting annotated tag 'beta'
searching for changes
adding objects
remote: found 0 deltas to reuse
added 1 commits with 1 trees and 1 blobs
adding reference refs/heads/not-master
$ hg tags
tip 5:c49682c7cba4
default/not-master 5:c49682c7cba4
gamma 4:0eb1ab0073a8
default/master 4:0eb1ab0073a8
beta 4:0eb1ab0073a8
detached 2:61175962e488
alpha 0:ff7a2f2d8d70
$ cd ..
Check whether `gimport` handles tags
$ cd hgrepo
$ rm .hg/git-tags .hg/git-mapfile
$ hg gimport
importing 6 git commits
$ hg tags -q
tip
default/not-master
gamma
default/master
beta
detached
alpha
$ cd ..
Test how pulling an explicit branch with an annotated tag:
$ hg clone -r master repo.git hgrepo-2
importing 4 git commits
new changesets ff7a2f2d8d70:0eb1ab0073a8 (4 drafts)
updating to branch default
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg log -r 'ancestors(master) and tagged()' -T shorttags -R hgrepo-2
0:ff7a2f2d8d70 draft alpha
1:7fe02317c63d draft beta
3:0eb1ab0073a8 draft default/master gamma tip
$ hg tags -v -R hgrepo-2
tip 3:0eb1ab0073a8
gamma 3:0eb1ab0073a8 git
default/master 3:0eb1ab0073a8 git-remote
beta 1:7fe02317c63d git
alpha 0:ff7a2f2d8d70 git
$ GIT_DIR=hgrepo-2/.hg/git git fetch --quiet repo.git
$ rm -rf hgrepo-2
$ hg clone -r master repo.git hgrepo-2
importing 4 git commits
new changesets ff7a2f2d8d70:0eb1ab0073a8 (4 drafts)
updating to branch default
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg log -r 'tagged()' -T shorttags -R hgrepo-2
0:ff7a2f2d8d70 draft alpha
1:7fe02317c63d draft beta
3:0eb1ab0073a8 draft default/master gamma tip
This used to die:
$ hg -R hgrepo-2 gexport
This used to fail, since we didn't actually pull the annotated tag:
$ hg -R hgrepo-2 push
pushing to $TESTTMP/repo.git
searching for changes
no changes found
[1]
$ rm -rf hgrepo-2
Check that pulling will update phases only:
$ cd hgrepo
$ hg phase -fs gamma detached
$ hg pull
pulling from $TESTTMP/repo.git
no changes found
$ hg log -T shorttags -r gamma -r detached
4:0eb1ab0073a8 draft beta default/master gamma
2:61175962e488 draft detached X
$ cd ..
Check that we pull new tags to existing commits:
$ cd gitrepo
$ git tag
alpha
beta
detached
gamma
$ fn_git_tag extra-simple-tag
$ fn_git_tag -m annotated extra-annotated-tag
$ git push --tags
To $TESTTMP/repo.git
* [new tag] extra-annotated-tag -> extra-annotated-tag
* [new tag] extra-simple-tag -> extra-simple-tag
$ cd ../hgrepo
$ hg pull -r master
pulling from $TESTTMP/repo.git
no changes found
$ hg tags -v | grep extra
extra-simple-tag 1:7fe02317c63d git
extra-annotated-tag 1:7fe02317c63d git
|