Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 10354:844d83da2da9
prepush: warn about every new outgoing named branch, not just the first
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sun, 07 Feb 2010 00:43:24 +0100 |
parents | 36b6b5ef7820 |
children | bc2414948012 |
comparison
equal
deleted
inserted
replaced
10353:36b6b5ef7820 | 10354:844d83da2da9 |
---|---|
1529 newheads.add(r) | 1529 newheads.add(r) |
1530 if len(newheads) > len(rheads): | 1530 if len(newheads) > len(rheads): |
1531 warn = 1 | 1531 warn = 1 |
1532 | 1532 |
1533 if warn: | 1533 if warn: |
1534 if not rheads: # new branch requires --force | 1534 self.ui.warn(_("abort: push creates new remote heads!\n")) |
1535 self.ui.warn(_("abort: push creates new" | |
1536 " remote branch '%s'!\n") % | |
1537 self[lheads[0]].branch()) | |
1538 else: | |
1539 self.ui.warn(_("abort: push creates new remote heads!\n")) | |
1540 | |
1541 self.ui.status(_("(did you forget to merge?" | 1535 self.ui.status(_("(did you forget to merge?" |
1542 " use push -f to force)\n")) | 1536 " use push -f to force)\n")) |
1543 return False | 1537 return False |
1544 return True | 1538 return True |
1545 | 1539 |
1566 localbrheads = {} | 1560 localbrheads = {} |
1567 for n in heads: | 1561 for n in heads: |
1568 branch = self[n].branch() | 1562 branch = self[n].branch() |
1569 localbrheads.setdefault(branch, []).append(n) | 1563 localbrheads.setdefault(branch, []).append(n) |
1570 | 1564 |
1565 newbranches = list(set(localbrheads) - set(remotebrheads)) | |
1566 if newbranches: # new branch requires --force | |
1567 branchnames = ', '.join("'%s'" % b for b in newbranches) | |
1568 self.ui.warn(_("abort: push creates " | |
1569 "new remote branches: %s!\n") | |
1570 % branchnames) | |
1571 # propose 'push -b .' in the msg too? | |
1572 self.ui.status(_("(use 'hg push -f' to force)\n")) | |
1573 return None, 0 | |
1571 for branch, lheads in localbrheads.iteritems(): | 1574 for branch, lheads in localbrheads.iteritems(): |
1572 rheads = remotebrheads.get(branch, []) | 1575 if branch in remotebrheads: |
1573 if not checkbranch(lheads, rheads, update): | 1576 rheads = remotebrheads[branch] |
1574 return None, 0 | 1577 if not checkbranch(lheads, rheads, update): |
1578 return None, 0 | |
1575 else: | 1579 else: |
1576 if not checkbranch(heads, remote_heads, update): | 1580 if not checkbranch(heads, remote_heads, update): |
1577 return None, 0 | 1581 return None, 0 |
1578 | 1582 |
1579 if inc: | 1583 if inc: |