Mercurial > public > mercurial-scm > hg
comparison mercurial/destutil.py @ 28924:d9539959167d
update: resurrect bare update from null parent to tip-most branch head
The situation is tricky if repository has no "default" branch, because "null"
revision belongs to non-existent "default" branch.
Before e1dd0de26557, bare update from null would bring us to the tip-most
non-closed branch head. e1dd0de26557 removed the special handling of missing
"default" branch since we wanted to stick to the uncommitted branch in that
case. But, if the parent is "null" revision, and if the missing branch is
"default", it shouldn't be an uncommitted branch. In this case, bare update
should bring us to the tip-most head as before.
This should fix the test breakage introduced by e1dd0de26557.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 15 Apr 2016 20:37:11 +0900 |
parents | e1dd0de26557 |
children | cf7de4aeb86b |
comparison
equal
deleted
inserted
replaced
28923:531dea16f4f7 | 28924:d9539959167d |
---|---|
99 heads = repo.branchheads(currentbranch) | 99 heads = repo.branchheads(currentbranch) |
100 if heads: | 100 if heads: |
101 node = repo.revs('max(.::(%ln))', heads).first() | 101 node = repo.revs('max(.::(%ln))', heads).first() |
102 if bookmarks.isactivewdirparent(repo): | 102 if bookmarks.isactivewdirparent(repo): |
103 movemark = repo['.'].node() | 103 movemark = repo['.'].node() |
104 elif currentbranch == 'default' and not wc.p1(): | |
105 # "null" parent belongs to "default" branch, but it doesn't exist, so | |
106 # update to the tipmost non-closed branch head | |
107 node = repo.revs('max(head() and not closed())').first() | |
104 else: | 108 else: |
105 node = repo['.'].node() | 109 node = repo['.'].node() |
106 return node, movemark, None | 110 return node, movemark, None |
107 | 111 |
108 def _destupdatebranchfallback(repo, clean, check): | 112 def _destupdatebranchfallback(repo, clean, check): |