##// END OF EJS Templates
merge with stable
Sune Foldager -
r10773:bd36e5c0 merge default
parent child Browse files
Show More
@@ -2577,7 +2577,8 b' def reposetup(ui, repo):'
2577 2577 start = lrev + 1
2578 2578 if start < qbase:
2579 2579 # update the cache (excluding the patches) and save it
2580 self._updatebranchcache(partial, lrev + 1, qbase)
2580 ctxgen = (self[r] for r in xrange(lrev + 1, qbase))
2581 self._updatebranchcache(partial, ctxgen)
2581 2582 self._writebranchcache(partial, cl.node(qbase - 1), qbase - 1)
2582 2583 start = qbase
2583 2584 # if start = qbase, the cache is as updated as it should be.
@@ -2585,7 +2586,8 b' def reposetup(ui, repo):'
2585 2586 # we might as well use it, but we won't save it.
2586 2587
2587 2588 # update the cache up to the tip
2588 self._updatebranchcache(partial, start, len(cl))
2589 ctxgen = (self[r] for r in xrange(start, len(cl)))
2590 self._updatebranchcache(partial, ctxgen)
2589 2591
2590 2592 return partial
2591 2593
@@ -320,7 +320,8 b' class localrepository(repo.repository):'
320 320 # TODO: rename this function?
321 321 tiprev = len(self) - 1
322 322 if lrev != tiprev:
323 self._updatebranchcache(partial, lrev + 1, tiprev + 1)
323 ctxgen = (self[r] for r in xrange(lrev + 1, tiprev + 1))
324 self._updatebranchcache(partial, ctxgen)
324 325 self._writebranchcache(partial, self.changelog.tip(), tiprev)
325 326
326 327 return partial
@@ -398,11 +399,10 b' class localrepository(repo.repository):'
398 399 except (IOError, OSError):
399 400 pass
400 401
401 def _updatebranchcache(self, partial, start, end):
402 def _updatebranchcache(self, partial, ctxgen):
402 403 # collect new branch entries
403 404 newbranches = {}
404 for r in xrange(start, end):
405 c = self[r]
405 for c in ctxgen:
406 406 newbranches.setdefault(c.branch(), []).append(c.node())
407 407 # if older branchheads are reachable from new ones, they aren't
408 408 # really branchheads. Note checking parents is insufficient:
@@ -1503,30 +1503,22 b' class localrepository(repo.repository):'
1503 1503 update, updated_heads = self.findoutgoing(remote, common, remote_heads)
1504 1504 msng_cl, bases, heads = self.changelog.nodesbetween(update, revs)
1505 1505
1506 def checkbranch(lheads, rheads, updatelb, branchname=None):
1506 def checkbranch(lheads, rheads, branchname=None):
1507 1507 '''
1508 1508 check whether there are more local heads than remote heads on
1509 1509 a specific branch.
1510 1510
1511 1511 lheads: local branch heads
1512 1512 rheads: remote branch heads
1513 updatelb: outgoing local branch bases
1514 1513 '''
1515 1514
1516 1515 warn = 0
1517 1516
1518 if not revs and len(lheads) > len(rheads):
1517 if len(lheads) > len(rheads):
1519 1518 warn = 1
1520 1519 else:
1521 # add local heads involved in the push
1522 updatelheads = [self.changelog.heads(x, lheads)
1523 for x in updatelb]
1524 newheads = set(sum(updatelheads, [])) & set(lheads)
1525
1526 if not newheads:
1527 return True
1528
1529 1520 # add heads we don't have or that are not involved in the push
1521 newheads = set(lheads)
1530 1522 for r in rheads:
1531 1523 if r in self.changelog.nodemap:
1532 1524 desc = self.changelog.heads(r, heads)
@@ -1575,9 +1567,8 b' class localrepository(repo.repository):'
1575 1567 localbrheads = self.branchmap()
1576 1568 else:
1577 1569 localbrheads = {}
1578 for n in heads:
1579 branch = self[n].branch()
1580 localbrheads.setdefault(branch, []).append(n)
1570 ctxgen = (self[n] for n in msng_cl)
1571 self._updatebranchcache(localbrheads, ctxgen)
1581 1572
1582 1573 newbranches = list(set(localbrheads) - set(remotebrheads))
1583 1574 if newbranches: # new branch requires --force
@@ -1591,10 +1582,10 b' class localrepository(repo.repository):'
1591 1582 for branch, lheads in localbrheads.iteritems():
1592 1583 if branch in remotebrheads:
1593 1584 rheads = remotebrheads[branch]
1594 if not checkbranch(lheads, rheads, update, branch):
1585 if not checkbranch(lheads, rheads, branch):
1595 1586 return None, 0
1596 1587 else:
1597 if not checkbranch(heads, remote_heads, update):
1588 if not checkbranch(heads, remote_heads):
1598 1589 return None, 0
1599 1590
1600 1591 if inc:
@@ -166,4 +166,32 b' hg -R k ci -m merge'
166 166 hg -R k push -r a j
167 167 echo
168 168
169 echo % prepush -r should not allow you to sneak in new heads
170 hg init l
171 cd l
172 echo a >> foo
173 hg -q add foo
174 hg -q branch a
175 hg -q ci -d '0 0' -ma
176 hg -q up null
177 echo a >> foo
178 hg -q add foo
179 hg -q branch b
180 hg -q ci -d '0 0' -mb
181 cd ..
182 hg -q clone l m -u a
183 cd m
184 hg -q merge b
185 hg -q ci -d '0 0' -mmb
186 hg -q up 0
187 echo a >> foo
188 hg -q ci -ma2
189 hg -q up 2
190 echo a >> foo
191 hg -q branch -f b
192 hg -q ci -d '0 0' -mb2
193 hg -q merge 3
194 hg -q ci -d '0 0' -mma
195 hg push ../l -b b
196
169 197 exit 0
@@ -100,7 +100,7 b' abort: push creates new remote branches:'
100 100 1
101 101 pushing to ../f
102 102 searching for changes
103 abort: push creates new remote branches: d!
103 abort: push creates new remote branches: c, d!
104 104 (use 'hg push -f' to force)
105 105 1
106 106 % fail on multiple head push
@@ -167,6 +167,11 b' 1 files updated, 0 files merged, 0 files'
167 167 (branch merge, don't forget to commit)
168 168 pushing to j
169 169 searching for changes
170 abort: push creates new remote branches: b!
171 (use 'hg push -f' to force)
172
173 % prepush -r should not allow you to sneak in new heads
174 pushing to ../l
175 searching for changes
170 176 abort: push creates new remote heads on branch 'a'!
171 (you should pull and merge or use push -f to force)
172
177 (did you forget to merge? use push -f to force)
General Comments 0
You need to be logged in to leave comments. Login now