127 if currentbranch in repo.branchmap(): |
127 if currentbranch in repo.branchmap(): |
128 # here, all descendant branch heads are closed |
128 # here, all descendant branch heads are closed |
129 heads = repo.branchheads(currentbranch, closed=True) |
129 heads = repo.branchheads(currentbranch, closed=True) |
130 assert heads, b"any branch has at least one head" |
130 assert heads, b"any branch has at least one head" |
131 node = repo.revs(b'max(.::(%ln))', heads).first() |
131 node = repo.revs(b'max(.::(%ln))', heads).first() |
132 assert node is not None, ( |
132 assert ( |
133 b"any revision has at least " b"one descendant branch head" |
133 node is not None |
134 ) |
134 ), b"any revision has at least one descendant branch head" |
135 if bookmarks.isactivewdirparent(repo): |
135 if bookmarks.isactivewdirparent(repo): |
136 movemark = repo[b'.'].node() |
136 movemark = repo[b'.'].node() |
137 else: |
137 else: |
138 # here, no "default" branch, and all branches are closed |
138 # here, no "default" branch, and all branches are closed |
139 node = repo.lookup(b'tip') |
139 node = repo.lookup(b'tip') |