Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/destutil.py Tue Apr 12 14:43:36 2016 +0000 +++ b/mercurial/destutil.py Fri Apr 15 20:37:11 2016 +0900 @@ -101,6 +101,10 @@ node = repo.revs('max(.::(%ln))', heads).first() if bookmarks.isactivewdirparent(repo): movemark = repo['.'].node() + elif currentbranch == 'default' and not wc.p1(): + # "null" parent belongs to "default" branch, but it doesn't exist, so + # update to the tipmost non-closed branch head + node = repo.revs('max(head() and not closed())').first() else: node = repo['.'].node() return node, movemark, None