##// END OF EJS Templates
fix calculation of new heads added during push with -r...
Benoit Boissinot -
r3923:27230c29 0.9.3 default
parent child Browse files
Show More
@@ -1392,7 +1392,7 b' class localrepository(repo.repository):'
1392 newheads = list(heads)
1392 newheads = list(heads)
1393 for r in remote_heads:
1393 for r in remote_heads:
1394 if r in self.changelog.nodemap:
1394 if r in self.changelog.nodemap:
1395 desc = self.changelog.heads(r)
1395 desc = self.changelog.heads(r, heads)
1396 l = [h for h in heads if h in desc]
1396 l = [h for h in heads if h in desc]
1397 if not l:
1397 if not l:
1398 newheads.append(r)
1398 newheads.append(r)
@@ -717,15 +717,19 b' class revlog(object):'
717 assert heads
717 assert heads
718 return (orderedout, roots, heads)
718 return (orderedout, roots, heads)
719
719
720 def heads(self, start=None):
720 def heads(self, start=None, stop=None):
721 """return the list of all nodes that have no children
721 """return the list of all nodes that have no children
722
722
723 if start is specified, only heads that are descendants of
723 if start is specified, only heads that are descendants of
724 start will be returned
724 start will be returned
725
725 if stop is specified, it will consider all the revs from stop
726 as if they had no children
726 """
727 """
727 if start is None:
728 if start is None:
728 start = nullid
729 start = nullid
730 if stop is None:
731 stop = []
732 stoprevs = dict.fromkeys([self.rev(n) for n in stop])
729 startrev = self.rev(start)
733 startrev = self.rev(start)
730 reachable = {startrev: 1}
734 reachable = {startrev: 1}
731 heads = {startrev: 1}
735 heads = {startrev: 1}
@@ -734,10 +738,12 b' class revlog(object):'
734 for r in xrange(startrev + 1, self.count()):
738 for r in xrange(startrev + 1, self.count()):
735 for p in parentrevs(r):
739 for p in parentrevs(r):
736 if p in reachable:
740 if p in reachable:
741 if r not in stoprevs:
737 reachable[r] = 1
742 reachable[r] = 1
738 heads[r] = 1
743 heads[r] = 1
739 if p in heads:
744 if p in heads and p not in stoprevs:
740 del heads[p]
745 del heads[p]
746
741 return [self.node(r) for r in heads]
747 return [self.node(r) for r in heads]
742
748
743 def children(self, node):
749 def children(self, node):
@@ -54,4 +54,9 b' hg push -r 3 -r 4 ../c; echo $?'
54 hg push -f -r 3 -r 4 ../c; echo $?
54 hg push -f -r 3 -r 4 ../c; echo $?
55 hg push -r 5 ../c; echo $?
55 hg push -r 5 ../c; echo $?
56
56
57 # issue 450
58 hg init ../e
59 hg push -r 0 ../e ; echo $?
60 hg push -r 1 ../e ; echo $?
61
57 exit 0
62 exit 0
@@ -62,3 +62,17 b' adding manifests'
62 adding file changes
62 adding file changes
63 added 1 changesets with 1 changes to 1 files (-1 heads)
63 added 1 changesets with 1 changes to 1 files (-1 heads)
64 0
64 0
65 pushing to ../e
66 searching for changes
67 adding changesets
68 adding manifests
69 adding file changes
70 added 1 changesets with 1 changes to 1 files
71 0
72 pushing to ../e
73 searching for changes
74 adding changesets
75 adding manifests
76 adding file changes
77 added 1 changesets with 1 changes to 1 files
78 0
General Comments 0
You need to be logged in to leave comments. Login now