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