--- 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