##// END OF EJS Templates
exchange: abort on pushing bookmarks pointing to secret changesets (issue6159)...
Navaneeth Suresh -
r43082:3332bde5 stable
parent child Browse files
Show More
@@ -1034,6 +1034,12 b' def _bmaction(old, new):'
1034 1034 return 'delete'
1035 1035 return 'update'
1036 1036
1037 def _abortonsecretctx(pushop, node, b):
1038 """abort if a given bookmark points to a secret changeset"""
1039 if node and pushop.repo[node].phase() == phases.secret:
1040 raise error.Abort(_('cannot push bookmark %s as it points to a secret'
1041 ' changeset') % b)
1042
1037 1043 def _pushb2bookmarkspart(pushop, bundler):
1038 1044 pushop.stepsdone.add('bookmarks')
1039 1045 if not pushop.outbookmarks:
@@ -1042,6 +1048,7 b' def _pushb2bookmarkspart(pushop, bundler'
1042 1048 allactions = []
1043 1049 data = []
1044 1050 for book, old, new in pushop.outbookmarks:
1051 _abortonsecretctx(pushop, new, book)
1045 1052 new = bin(new)
1046 1053 data.append((book, new))
1047 1054 allactions.append((book, _bmaction(old, new)))
@@ -1070,6 +1077,7 b' def _pushb2bookmarkspushkey(pushop, bund'
1070 1077 assert False
1071 1078
1072 1079 for book, old, new in pushop.outbookmarks:
1080 _abortonsecretctx(pushop, new, book)
1073 1081 part = bundler.newpart('pushkey')
1074 1082 part.addparam('namespace', enc('bookmarks'))
1075 1083 part.addparam('key', enc(book))
@@ -1344,39 +1344,9 b' Move the bookmark "foo" to point at a se'
1344 1344 $ hg commit -qAm_ --config phases.new-commit=secret
1345 1345
1346 1346 Pushing the bookmark "foo" now fails as it contains a secret changeset
1347 #if b2-pushkey
1348 $ hg push -r foo
1349 pushing to $TESTTMP/issue6159remote
1350 searching for changes
1351 no changes found (ignored 1 secret changesets)
1352 abort: updating bookmark foo failed!
1353 [255]
1354 #endif
1355
1356 #if b2-binary
1357 1347 $ hg push -r foo
1358 1348 pushing to $TESTTMP/issue6159remote
1359 1349 searching for changes
1360 1350 no changes found (ignored 1 secret changesets)
1361 updating bookmark foo
1362 [1]
1363 #endif
1364
1365 Now the "remote" repo contains a bookmark pointing to a nonexistent revision
1366 $ cd ../issue6159remote
1367 #if b2-pushkey
1368 $ hg bookmark
1369 * foo 0:1599bc8b897a
1370 $ hg log -r 1599bc8b897a
1371 0:1599bc8b897a _ (no-eol)
1372 #endif
1373
1374 #if b2-binary
1375 $ hg bookmark
1376 no bookmarks set
1377 $ cat .hg/bookmarks
1378 cf489fd8a374cab73c2dc19e899bde6fe3a43f8f foo
1379 $ hg log -r cf489fd8a374
1380 abort: unknown revision 'cf489fd8a374'!
1351 abort: cannot push bookmark foo as it points to a secret changeset
1381 1352 [255]
1382 #endif
General Comments 0
You need to be logged in to leave comments. Login now