Show More
@@ -664,11 +664,39 b' def newheads(repo, heads, roots):' | |||||
664 |
|
664 | |||
665 | * `heads`: define the first subset |
|
665 | * `heads`: define the first subset | |
666 | * `roots`: define the second we subtract from the first""" |
|
666 | * `roots`: define the second we subtract from the first""" | |
|
667 | # prevent an import cycle | |||
|
668 | # phases > dagop > patch > copies > scmutil > obsolete > obsutil > phases | |||
|
669 | from . import dagop | |||
|
670 | ||||
|
671 | repo = repo.unfiltered() | |||
|
672 | cl = repo.changelog | |||
|
673 | rev = cl.nodemap.get | |||
|
674 | if not roots: | |||
|
675 | return heads | |||
|
676 | if not heads or heads == [nullrev]: | |||
|
677 | return [] | |||
|
678 | # The logic operated on revisions, convert arguments early for convenience | |||
|
679 | new_heads = set(rev(n) for n in heads if n != nullid) | |||
|
680 | roots = [rev(n) for n in roots] | |||
667 | if not heads or not roots: |
|
681 | if not heads or not roots: | |
668 | return heads |
|
682 | return heads | |
669 | repo = repo.unfiltered() |
|
683 | # compute the area we need to remove | |
670 | revs = repo.revs('heads(::%ln - (%ln::%ln))', heads, roots, heads) |
|
684 | affected_zone = repo.revs("(%ld::%ld)", roots, new_heads) | |
671 | return pycompat.maplist(repo.changelog.node, revs) |
|
685 | # heads in the area are no longer heads | |
|
686 | new_heads.difference_update(affected_zone) | |||
|
687 | # revisions in the area have children outside of it, | |||
|
688 | # They might be new heads | |||
|
689 | candidates = repo.revs("parents(%ld + (%ld and merge())) and not null", | |||
|
690 | roots, affected_zone) | |||
|
691 | candidates -= affected_zone | |||
|
692 | if new_heads or candidates: | |||
|
693 | # remove candidate that are ancestors of other heads | |||
|
694 | new_heads.update(candidates) | |||
|
695 | prunestart = repo.revs("parents(%ld) and not null", new_heads) | |||
|
696 | pruned = dagop.reachableroots(repo, candidates, prunestart) | |||
|
697 | new_heads.difference_update(pruned) | |||
|
698 | ||||
|
699 | return pycompat.maplist(cl.node, sorted(new_heads)) | |||
672 |
|
700 | |||
673 | def newcommitphase(ui): |
|
701 | def newcommitphase(ui): | |
674 | """helper to get the target phase of new commit |
|
702 | """helper to get the target phase of new commit |
@@ -141,10 +141,10 b' delete a remote bookmark' | |||||
141 | bundle2-output: payload chunk size: 23 |
|
141 | bundle2-output: payload chunk size: 23 | |
142 | bundle2-output: closing payload chunk |
|
142 | bundle2-output: closing payload chunk | |
143 | bundle2-output: bundle part: "check:phases" |
|
143 | bundle2-output: bundle part: "check:phases" | |
144 |
bundle2-output-part: "check:phases" 4 |
|
144 | bundle2-output-part: "check:phases" 24 bytes payload | |
145 | bundle2-output: part 2: "CHECK:PHASES" |
|
145 | bundle2-output: part 2: "CHECK:PHASES" | |
146 | bundle2-output: header chunk size: 19 |
|
146 | bundle2-output: header chunk size: 19 | |
147 |
bundle2-output: payload chunk size: 4 |
|
147 | bundle2-output: payload chunk size: 24 | |
148 | bundle2-output: closing payload chunk |
|
148 | bundle2-output: closing payload chunk | |
149 | bundle2-output: bundle part: "pushkey" |
|
149 | bundle2-output: bundle part: "pushkey" | |
150 | bundle2-output-part: "pushkey" (params: 4 mandatory) empty payload |
|
150 | bundle2-output-part: "pushkey" (params: 4 mandatory) empty payload | |
@@ -180,9 +180,9 b' delete a remote bookmark' | |||||
180 | bundle2-input: part parameters: 0 |
|
180 | bundle2-input: part parameters: 0 | |
181 | bundle2-input: found a handler for part check:phases |
|
181 | bundle2-input: found a handler for part check:phases | |
182 | bundle2-input-part: "check:phases" supported |
|
182 | bundle2-input-part: "check:phases" supported | |
183 |
bundle2-input: payload chunk size: 4 |
|
183 | bundle2-input: payload chunk size: 24 | |
184 | bundle2-input: payload chunk size: 0 |
|
184 | bundle2-input: payload chunk size: 0 | |
185 |
bundle2-input-part: total payload size 4 |
|
185 | bundle2-input-part: total payload size 24 | |
186 | bundle2-input: part header size: 90 |
|
186 | bundle2-input: part header size: 90 | |
187 | bundle2-input: part type: "PUSHKEY" |
|
187 | bundle2-input: part type: "PUSHKEY" | |
188 | bundle2-input: part id: "3" |
|
188 | bundle2-input: part id: "3" | |
@@ -253,10 +253,10 b' delete a remote bookmark' | |||||
253 | bundle2-output: payload chunk size: 23 |
|
253 | bundle2-output: payload chunk size: 23 | |
254 | bundle2-output: closing payload chunk |
|
254 | bundle2-output: closing payload chunk | |
255 | bundle2-output: bundle part: "check:phases" |
|
255 | bundle2-output: bundle part: "check:phases" | |
256 |
bundle2-output-part: "check:phases" 4 |
|
256 | bundle2-output-part: "check:phases" 24 bytes payload | |
257 | bundle2-output: part 2: "CHECK:PHASES" |
|
257 | bundle2-output: part 2: "CHECK:PHASES" | |
258 | bundle2-output: header chunk size: 19 |
|
258 | bundle2-output: header chunk size: 19 | |
259 |
bundle2-output: payload chunk size: 4 |
|
259 | bundle2-output: payload chunk size: 24 | |
260 | bundle2-output: closing payload chunk |
|
260 | bundle2-output: closing payload chunk | |
261 | bundle2-output: bundle part: "bookmarks" |
|
261 | bundle2-output: bundle part: "bookmarks" | |
262 | bundle2-output-part: "bookmarks" 23 bytes payload |
|
262 | bundle2-output-part: "bookmarks" 23 bytes payload | |
@@ -293,9 +293,9 b' delete a remote bookmark' | |||||
293 | bundle2-input: part parameters: 0 |
|
293 | bundle2-input: part parameters: 0 | |
294 | bundle2-input: found a handler for part check:phases |
|
294 | bundle2-input: found a handler for part check:phases | |
295 | bundle2-input-part: "check:phases" supported |
|
295 | bundle2-input-part: "check:phases" supported | |
296 |
bundle2-input: payload chunk size: 4 |
|
296 | bundle2-input: payload chunk size: 24 | |
297 | bundle2-input: payload chunk size: 0 |
|
297 | bundle2-input: payload chunk size: 0 | |
298 |
bundle2-input-part: total payload size 4 |
|
298 | bundle2-input-part: total payload size 24 | |
299 | bundle2-input: part header size: 16 |
|
299 | bundle2-input: part header size: 16 | |
300 | bundle2-input: part type: "BOOKMARKS" |
|
300 | bundle2-input: part type: "BOOKMARKS" | |
301 | bundle2-input: part id: "3" |
|
301 | bundle2-input: part id: "3" |
General Comments 0
You need to be logged in to leave comments.
Login now