Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 10912:3d7c20986027
merge with stable
author | Sune Foldager <cryo@cyanite.org> |
---|---|
date | Wed, 14 Apr 2010 19:49:06 +0200 |
parents | 4327409c1303 816bac2f9452 |
children | 39c69b5dc258 |
comparison
equal
deleted
inserted
replaced
10911:4327409c1303 | 10912:3d7c20986027 |
---|---|
1517 inc = self.findincoming(remote, common, remote_heads, force=force) | 1517 inc = self.findincoming(remote, common, remote_heads, force=force) |
1518 | 1518 |
1519 update, updated_heads = self.findoutgoing(remote, common, remote_heads) | 1519 update, updated_heads = self.findoutgoing(remote, common, remote_heads) |
1520 msng_cl, bases, heads = self.changelog.nodesbetween(update, revs) | 1520 msng_cl, bases, heads = self.changelog.nodesbetween(update, revs) |
1521 | 1521 |
1522 def checkbranch(lheads, rheads, branchname=None): | 1522 def checkbranch(lheads, rheads, lheadcnt, branchname=None): |
1523 ''' | 1523 ''' |
1524 check whether there are more local heads than remote heads on | 1524 check whether there are more local heads than remote heads on |
1525 a specific branch. | 1525 a specific branch. |
1526 | 1526 |
1527 lheads: local branch heads | 1527 lheads: local branch heads |
1528 rheads: remote branch heads | 1528 rheads: remote branch heads |
1529 lheadcnt: total number of local branch heads | |
1529 ''' | 1530 ''' |
1530 | 1531 |
1531 warn = 0 | 1532 warn = 0 |
1532 | 1533 |
1533 if len(lheads) > len(rheads): | 1534 if len(lheads) > len(rheads): |
1558 msg = _("abort: push creates new remote heads" | 1559 msg = _("abort: push creates new remote heads" |
1559 " on branch '%s'!\n") % branchname | 1560 " on branch '%s'!\n") % branchname |
1560 else: | 1561 else: |
1561 msg = _("abort: push creates new remote heads!\n") | 1562 msg = _("abort: push creates new remote heads!\n") |
1562 self.ui.warn(msg) | 1563 self.ui.warn(msg) |
1563 if len(lheads) > len(rheads): | 1564 if lheadcnt > len(rheads): |
1564 self.ui.status(_("(did you forget to merge?" | 1565 self.ui.status(_("(did you forget to merge?" |
1565 " use push -f to force)\n")) | 1566 " use push -f to force)\n")) |
1566 else: | 1567 else: |
1567 self.ui.status(_("(you should pull and merge or" | 1568 self.ui.status(_("(you should pull and merge or" |
1568 " use push -f to force)\n")) | 1569 " use push -f to force)\n")) |
1584 | 1585 |
1585 if remote_heads != [nullid]: | 1586 if remote_heads != [nullid]: |
1586 if remote.capable('branchmap'): | 1587 if remote.capable('branchmap'): |
1587 remotebrheads = remote.branchmap() | 1588 remotebrheads = remote.branchmap() |
1588 | 1589 |
1590 lbrmap = self.branchmap() | |
1591 localbrheads = {} | |
1589 if not revs: | 1592 if not revs: |
1590 localbrheads = self.branchmap() | 1593 for br, hds in lbrmap.iteritems(): |
1594 localbrheads[br] = (len(hds), hds) | |
1591 else: | 1595 else: |
1592 localbrheads = {} | |
1593 ctxgen = (self[n] for n in msng_cl) | 1596 ctxgen = (self[n] for n in msng_cl) |
1594 self._updatebranchcache(localbrheads, ctxgen) | 1597 self._updatebranchcache(localbrheads, ctxgen) |
1598 for br, hds in localbrheads.iteritems(): | |
1599 localbrheads[br] = (len(lbrmap[br]), hds) | |
1595 | 1600 |
1596 newbranches = list(set(localbrheads) - set(remotebrheads)) | 1601 newbranches = list(set(localbrheads) - set(remotebrheads)) |
1597 if newbranches: # new branch requires --force | 1602 if newbranches: # new branch requires --force |
1598 branchnames = ', '.join("%s" % b for b in newbranches) | 1603 branchnames = ', '.join("%s" % b for b in newbranches) |
1599 self.ui.warn(_("abort: push creates " | 1604 self.ui.warn(_("abort: push creates " |
1600 "new remote branches: %s!\n") | 1605 "new remote branches: %s!\n") |
1601 % branchnames) | 1606 % branchnames) |
1602 # propose 'push -b .' in the msg too? | 1607 # propose 'push -b .' in the msg too? |
1603 self.ui.status(_("(use 'hg push -f' to force)\n")) | 1608 self.ui.status(_("(use 'hg push -f' to force)\n")) |
1604 return None, 0 | 1609 return None, 0 |
1605 for branch, lheads in localbrheads.iteritems(): | 1610 for branch, x in localbrheads.iteritems(): |
1606 if branch in remotebrheads: | 1611 if branch in remotebrheads: |
1612 headcnt, lheads = x | |
1607 rheads = remotebrheads[branch] | 1613 rheads = remotebrheads[branch] |
1608 if not checkbranch(lheads, rheads, branch): | 1614 if not checkbranch(lheads, rheads, headcnt, branch): |
1609 return None, 0 | 1615 return None, 0 |
1610 else: | 1616 else: |
1611 if not checkbranch(heads, remote_heads): | 1617 if not checkbranch(heads, remote_heads, len(heads)): |
1612 return None, 0 | 1618 return None, 0 |
1613 | 1619 |
1614 if inc: | 1620 if inc: |
1615 self.ui.warn(_("note: unsynced remote changes!\n")) | 1621 self.ui.warn(_("note: unsynced remote changes!\n")) |
1616 | 1622 |