Show More
@@ -1632,21 +1632,60 b' class localrepository(repo.repository):' | |||||
1632 | # XXX If push failed we should use strict common and not |
|
1632 | # XXX If push failed we should use strict common and not | |
1633 | # future to avoir pushing phase data on unknown changeset. |
|
1633 | # future to avoir pushing phase data on unknown changeset. | |
1634 | # This is to done later. |
|
1634 | # This is to done later. | |
1635 | futctx = [self[n] for n in fut if n != nullid] |
|
1635 | ||
1636 | for phase in phases.trackedphases[::-1]: |
|
1636 | # element we want to push | |
1637 |
|
|
1637 | topush = [] | |
1638 | # get all candidate for head in previous phase |
|
1638 | ||
1639 | inprev = [ctx for ctx in futctx |
|
1639 | # store details of known remote phase of several revision | |
1640 | if ctx.phase() == prevphase] |
|
1640 | # /!\ set of index I holds rev where: I <= rev.phase() | |
1641 | for newremotehead in self.set('heads(%ld & (%ln::))', |
|
1641 | # /!\ public phase (index 0) is ignored | |
1642 | inprev, rroots[phase]): |
|
1642 | remdetails = [set() for i in xrange(len(phases.allphases))] | |
1643 | r = remote.pushkey('phases', |
|
1643 | _revs = set() | |
1644 | newremotehead.hex(), |
|
1644 | for relremphase in phases.trackedphases[::-1]: | |
1645 | str(phase), str(prevphase)) |
|
1645 | # we iterate backward because the list alway grows | |
1646 |
|
|
1646 | # when filled in this direction. | |
1647 | self.ui.warn(_('updating phase of %s' |
|
1647 | _revs.update(self.revs('%ln::%ln', | |
1648 |
|
|
1648 | rroots[relremphase], fut)) | |
1649 | % (newremotehead, prevphase)) |
|
1649 | remdetails[relremphase].update(_revs) | |
|
1650 | ||||
|
1651 | for phase in phases.allphases[:-1]: | |||
|
1652 | # We don't need the last phase as we will never want to | |||
|
1653 | # move anything to it while moving phase backward. | |||
|
1654 | ||||
|
1655 | # Get the list of all revs on remote which are in a | |||
|
1656 | # phase higher than currently processed phase. | |||
|
1657 | relremrev = remdetails[phase + 1] | |||
|
1658 | ||||
|
1659 | if not relremrev: | |||
|
1660 | # no candidate to remote push anymore | |||
|
1661 | # break before any expensive revset | |||
|
1662 | break | |||
|
1663 | ||||
|
1664 | #dynamical inject appropriate phase symbol | |||
|
1665 | phasename = phases.phasenames[phase] | |||
|
1666 | odrevset = 'heads(%%ld and %s())' % phasename | |||
|
1667 | outdated = self.set(odrevset, relremrev) | |||
|
1668 | for od in outdated: | |||
|
1669 | candstart = len(remdetails) - 1 | |||
|
1670 | candstop = phase + 1 | |||
|
1671 | candidateold = xrange(candstart, candstop, -1) | |||
|
1672 | for oldphase in candidateold: | |||
|
1673 | if od.rev() in remdetails[oldphase]: | |||
|
1674 | break | |||
|
1675 | else: # last one: no need to search | |||
|
1676 | oldphase = phase + 1 | |||
|
1677 | topush.append((oldphase, phase, od)) | |||
|
1678 | ||||
|
1679 | # push every needed data | |||
|
1680 | for oldphase, newphase, newremotehead in topush: | |||
|
1681 | r = remote.pushkey('phases', | |||
|
1682 | newremotehead.hex(), | |||
|
1683 | str(oldphase), str(newphase)) | |||
|
1684 | if not r: | |||
|
1685 | self.ui.warn(_('updating phase of %s ' | |||
|
1686 | 'to %s from %s failed!\n') | |||
|
1687 | % (newremotehead, newphase, | |||
|
1688 | oldphase)) | |||
1650 | finally: |
|
1689 | finally: | |
1651 | locallock.release() |
|
1690 | locallock.release() | |
1652 | finally: |
|
1691 | finally: |
@@ -91,6 +91,10 b' Even on merge' | |||||
91 | Test secret changeset are not pushed |
|
91 | Test secret changeset are not pushed | |
92 |
|
92 | |||
93 | $ hg init ../push-dest |
|
93 | $ hg init ../push-dest | |
|
94 | $ cat > ../push-dest/.hg/hgrc << EOF | |||
|
95 | > [phases] | |||
|
96 | > publish=False | |||
|
97 | > EOF | |||
94 | $ hg push ../push-dest -f # force because we push multiple heads |
|
98 | $ hg push ../push-dest -f # force because we push multiple heads | |
95 | pushing to ../push-dest |
|
99 | pushing to ../push-dest | |
96 | searching for changes |
|
100 | searching for changes | |
@@ -100,18 +104,18 b' Test secret changeset are not pushed' | |||||
100 | added 5 changesets with 5 changes to 5 files (+1 heads) |
|
104 | added 5 changesets with 5 changes to 5 files (+1 heads) | |
101 | $ hglog |
|
105 | $ hglog | |
102 | 7 2 merge B' and E |
|
106 | 7 2 merge B' and E | |
103 |
6 |
|
107 | 6 1 B' | |
104 | 5 2 H |
|
108 | 5 2 H | |
105 | 4 2 E |
|
109 | 4 2 E | |
106 |
3 |
|
110 | 3 1 D | |
107 |
2 |
|
111 | 2 1 C | |
108 | 1 0 B |
|
112 | 1 0 B | |
109 | 0 0 A |
|
113 | 0 0 A | |
110 | $ cd ../push-dest |
|
114 | $ cd ../push-dest | |
111 | $ hglog |
|
115 | $ hglog | |
112 |
4 |
|
116 | 4 1 B' | |
113 |
3 |
|
117 | 3 1 D | |
114 |
2 |
|
118 | 2 1 C | |
115 | 1 0 B |
|
119 | 1 0 B | |
116 | 0 0 A |
|
120 | 0 0 A | |
117 | $ cd .. |
|
121 | $ cd .. | |
@@ -142,10 +146,10 b' Test revset' | |||||
142 | $ hglog -r 'public()' |
|
146 | $ hglog -r 'public()' | |
143 | 0 0 A |
|
147 | 0 0 A | |
144 | 1 0 B |
|
148 | 1 0 B | |
145 | 2 0 C |
|
|||
146 | 3 0 D |
|
|||
147 | 6 0 B' |
|
|||
148 | $ hglog -r 'draft()' |
|
149 | $ hglog -r 'draft()' | |
|
150 | 2 1 C | |||
|
151 | 3 1 D | |||
|
152 | 6 1 B' | |||
149 | $ hglog -r 'secret()' |
|
153 | $ hglog -r 'secret()' | |
150 | 4 2 E |
|
154 | 4 2 E | |
151 | 5 2 H |
|
155 | 5 2 H |
@@ -29,7 +29,7 b' expect ssl error' | |||||
29 | searching for changes |
|
29 | searching for changes | |
30 | remote: ssl required |
|
30 | remote: ssl required | |
31 | remote: ssl required |
|
31 | remote: ssl required | |
32 | updating phase of ba677d0156c1to 0 failed! |
|
32 | updating phase of ba677d0156c1 to 0 from 1 failed! | |
33 | % serve errors |
|
33 | % serve errors | |
34 |
|
34 | |||
35 | expect authorization error |
|
35 | expect authorization error |
General Comments 0
You need to be logged in to leave comments.
Login now