338 else: |
338 else: |
339 headssum = _oldheadssummary(repo, remoteheads, outgoing, inc) |
339 headssum = _oldheadssummary(repo, remoteheads, outgoing, inc) |
340 pushop.pushbranchmap = headssum |
340 pushop.pushbranchmap = headssum |
341 newbranches = [branch for branch, heads in headssum.iteritems() |
341 newbranches = [branch for branch, heads in headssum.iteritems() |
342 if heads[0] is None] |
342 if heads[0] is None] |
343 # Makes a set of closed branches |
|
344 closedbranches = set() |
|
345 for tag, heads, tip, isclosed in repo.branchmap().iterbranches(): |
|
346 if isclosed: |
|
347 closedbranches.add(tag) |
|
348 closedbranches = (closedbranches & set(newbranches)) |
|
349 # 1. Check for new branches on the remote. |
343 # 1. Check for new branches on the remote. |
350 if newbranches and not newbranch: # new branch requires --new-branch |
344 if newbranches and not newbranch: # new branch requires --new-branch |
351 branchnames = ', '.join(sorted(newbranches)) |
345 branchnames = ', '.join(sorted(newbranches)) |
|
346 # Calculate how many of the new branches are closed branches |
|
347 closedbranches = set() |
|
348 for tag, heads, tip, isclosed in repo.branchmap().iterbranches(): |
|
349 if isclosed: |
|
350 closedbranches.add(tag) |
|
351 closedbranches = (closedbranches & set(newbranches)) |
352 if closedbranches: |
352 if closedbranches: |
353 errmsg = (_("push creates new remote branches: %s (%d closed)!") |
353 errmsg = (_("push creates new remote branches: %s (%d closed)!") |
354 % (branchnames, len(closedbranches))) |
354 % (branchnames, len(closedbranches))) |
355 else: |
355 else: |
356 errmsg = (_("push creates new remote branches: %s!")% branchnames) |
356 errmsg = (_("push creates new remote branches: %s!")% branchnames) |