##// END OF EJS Templates
checkheads: extract bookmark computation from the branch loop...
Pierre-Yves David -
r17212:246131d6 default
parent child Browse files
Show More
@@ -249,12 +249,22 b' def checkheads(repo, remote, outgoing, r'
249 hint=_("use 'hg push --new-branch' to create"
249 hint=_("use 'hg push --new-branch' to create"
250 " new remote branches"))
250 " new remote branches"))
251
251
252 # 2. Check for new heads.
252 # 2 compute newly pushed bookmarks. We
253 # we don't warned about bookmarked heads.
254 localbookmarks = repo._bookmarks
255 remotebookmarks = remote.listkeys('bookmarks')
256 bookmarkedheads = set()
257 for bm in localbookmarks:
258 rnode = remotebookmarks.get(bm)
259 if rnode and rnode in repo:
260 lctx, rctx = repo[bm], repo[rnode]
261 if rctx == lctx.ancestor(rctx):
262 bookmarkedheads.add(lctx.node())
263
264 # 3. Check for new heads.
253 # If there are more heads after the push than before, a suitable
265 # If there are more heads after the push than before, a suitable
254 # error message, depending on unsynced status, is displayed.
266 # error message, depending on unsynced status, is displayed.
255 error = None
267 error = None
256 localbookmarks = repo._bookmarks
257
258 unsynced = False
268 unsynced = False
259 for branch, heads in headssum.iteritems():
269 for branch, heads in headssum.iteritems():
260 if heads[0] is None:
270 if heads[0] is None:
@@ -267,14 +277,6 b' def checkheads(repo, remote, outgoing, r'
267 newhs = set(heads[1])
277 newhs = set(heads[1])
268 dhs = None
278 dhs = None
269 if len(newhs) > len(oldhs):
279 if len(newhs) > len(oldhs):
270 remotebookmarks = remote.listkeys('bookmarks')
271 bookmarkedheads = set()
272 for bm in localbookmarks:
273 rnode = remotebookmarks.get(bm)
274 if rnode and rnode in repo:
275 lctx, rctx = repo[bm], repo[rnode]
276 if rctx == lctx.ancestor(rctx):
277 bookmarkedheads.add(lctx.node())
278 # strip updates to existing remote heads from the new heads list
280 # strip updates to existing remote heads from the new heads list
279 dhs = list(newhs - bookmarkedheads - oldhs)
281 dhs = list(newhs - bookmarkedheads - oldhs)
280 if dhs:
282 if dhs:
General Comments 0
You need to be logged in to leave comments. Login now