equal
deleted
inserted
replaced
59 repo._dirtyphases = True |
59 repo._dirtyphases = True |
60 |
60 |
61 def advanceboundary(repo, targetphase, nodes): |
61 def advanceboundary(repo, targetphase, nodes): |
62 """Add nodes to a phase changing other nodes phases if necessary. |
62 """Add nodes to a phase changing other nodes phases if necessary. |
63 |
63 |
|
64 This function move boundary *forward* this means that all nodes are set |
|
65 in the target phase or kept in a *lower* phase. |
|
66 |
64 Simplify boundary to contains phase roots only.""" |
67 Simplify boundary to contains phase roots only.""" |
65 |
|
66 # move roots of lower states |
|
67 for phase in xrange(targetphase + 1, len(allphases)): |
68 for phase in xrange(targetphase + 1, len(allphases)): |
68 # filter nodes that are not in a compatible phase already |
69 # filter nodes that are not in a compatible phase already |
69 # XXX rev phase cache might have been invalidated by a previous loop |
70 # XXX rev phase cache might have been invalidated by a previous loop |
70 # XXX we need to be smarter here |
71 # XXX we need to be smarter here |
71 nodes = [n for n in nodes if repo[n].phase() >= phase] |
72 nodes = [n for n in nodes if repo[n].phase() >= phase] |
79 if olds != roots: |
80 if olds != roots: |
80 # invalidate cache (we probably could be smarter here |
81 # invalidate cache (we probably could be smarter here |
81 if '_phaserev' in vars(repo): |
82 if '_phaserev' in vars(repo): |
82 del repo._phaserev |
83 del repo._phaserev |
83 repo._dirtyphases = True |
84 repo._dirtyphases = True |
|
85 |
|
86 def retractboundary(repo, targetphase, nodes): |
|
87 """Set nodes back to a phase changing other nodes phases if necessary. |
|
88 |
|
89 This function move boundary *backward* this means that all nodes are set |
|
90 in the target phase or kept in a *higher* phase. |
|
91 |
|
92 Simplify boundary to contains phase roots only.""" |
|
93 currentroots = repo._phaseroots[targetphase] |
|
94 newroots = [n for n in nodes if repo[n].phase() < targetphase] |
|
95 if newroots: |
|
96 currentroots.update(newroots) |
|
97 ctxs = repo.set('roots(%ln::)', currentroots) |
|
98 currentroots.intersection_update(ctx.node() for ctx in ctxs) |
|
99 if '_phaserev' in vars(repo): |
|
100 del repo._phaserev |
|
101 repo._dirtyphases = True |
|
102 |