##// END OF EJS Templates
push: gather all bookmark decisions together...
Pierre-Yves David -
r22651:b901645a default
parent child Browse files
Show More
@@ -226,10 +226,6 b' def push(repo, remote, force=False, revs'
226 226 if locallock is not None:
227 227 locallock.release()
228 228
229 if pushop.bookmarks:
230 pushop.bkresult = bookmod.pushtoremote(repo.ui, repo, remote,
231 pushop.bookmarks)
232
233 229 return pushop
234 230
235 231 # list of steps to perform discovery before push
@@ -334,11 +330,40 b' def _pushdiscoverybookmarks(pushop):'
334 330 ancestors = repo.changelog.ancestors(revnums, inclusive=True)
335 331 remotebookmark = remote.listkeys('bookmarks')
336 332
333 explicit = set(pushop.bookmarks)
334
337 335 comp = bookmod.compare(repo, repo._bookmarks, remotebookmark, srchex=hex)
338 336 addsrc, adddst, advsrc, advdst, diverge, differ, invalid = comp
339 337 for b, scid, dcid in advsrc:
338 if b in explicit:
339 explicit.remove(b)
340 340 if not ancestors or repo[scid].rev() in ancestors:
341 341 pushop.outbookmarks.append((b, dcid, scid))
342 # search added bookmark
343 for b, scid, dcid in addsrc:
344 if b in explicit:
345 explicit.remove(b)
346 pushop.outbookmarks.append((b, '', scid))
347 # search for overwritten bookmark
348 for b, scid, dcid in advdst + diverge + differ:
349 if b in explicit:
350 explicit.remove(b)
351 pushop.outbookmarks.append((b, dcid, scid))
352 # search for bookmark to delete
353 for b, scid, dcid in adddst:
354 if b in explicit:
355 explicit.remove(b)
356 # treat as "deleted locally"
357 pushop.outbookmarks.append((b, dcid, ''))
358
359 if explicit:
360 explicit = sorted(explicit)
361 # we should probably list all of them
362 ui.warn(_('bookmark %s does not exist on the local '
363 'or remote repository!\n') % explicit[0])
364 pushop.bkresult = 2
365
366 pushop.outbookmarks.sort()
342 367
343 368 def _pushcheckoutgoing(pushop):
344 369 outgoing = pushop.outgoing
@@ -99,8 +99,8 b" push/pull name that doesn't exist"
99 99 $ hg push -B badname ../a
100 100 pushing to ../a
101 101 searching for changes
102 bookmark badname does not exist on the local or remote repository!
102 103 no changes found
103 bookmark badname does not exist on the local or remote repository!
104 104 [2]
105 105 $ hg pull -B anotherbadname ../a
106 106 pulling from ../a
@@ -356,7 +356,7 b' hgweb'
356 356 pushing to http://localhost:$HGPORT/
357 357 searching for changes
358 358 no changes found
359 exporting bookmark Z
359 updating bookmark Z
360 360 [1]
361 361 $ hg book -d Z
362 362 $ hg in -B http://localhost:$HGPORT/
@@ -881,7 +881,6 b' push'
881 881 remote: added 1 changesets with 0 changes to 0 files (-1 heads)
882 882 remote: 1 new obsolescence markers
883 883 updating bookmark book_eea1
884 exporting bookmark book_eea1
885 884 $ hg -R other log -G
886 885 o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G
887 886 |\
@@ -950,7 +949,6 b' push over ssh'
950 949 remote: added 1 changesets with 1 changes to 1 files
951 950 remote: 1 new obsolescence markers
952 951 updating bookmark book_5fdd
953 exporting bookmark book_5fdd
954 952 $ hg -R other log -G
955 953 o 6:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_5fdd C
956 954 |
@@ -989,7 +987,6 b' push over http'
989 987 remote: added 1 changesets with 1 changes to 1 files
990 988 remote: 1 new obsolescence markers
991 989 updating bookmark book_32af
992 exporting bookmark book_32af
993 990 $ cat other-error.log
994 991
995 992 Check final content.
@@ -183,8 +183,8 b' pushkey hook'
183 183 pushing to ../a
184 184 searching for changes
185 185 no changes found
186 pushkey hook: HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1
186 187 exporting bookmark foo
187 pushkey hook: HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1
188 188 [1]
189 189 $ cd ../a
190 190
@@ -215,8 +215,6 b' test that prepushkey can prevent incomin'
215 215 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
216 216 no changes found
217 217 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
218 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
219 exporting bookmark baz
220 218 prepushkey.forbid hook: HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000
221 219 abort: prepushkey hook exited with status 1
222 220 [255]
General Comments 0
You need to be logged in to leave comments. Login now