--- a/mercurial/destutil.py Wed Feb 24 23:00:33 2016 +0900
+++ b/mercurial/destutil.py Wed Feb 24 23:00:33 2016 +0900
@@ -92,12 +92,13 @@
wc = repo[None]
movemark = node = None
currentbranch = wc.branch()
- try:
- node = repo.revs('max(.::(head() and branch(%s)))'
- , currentbranch).first()
+ if currentbranch in repo.branchmap():
+ heads = repo.branchheads(currentbranch, closed=True)
+ if heads:
+ node = repo.revs('max(.::(%ln))', heads).first()
if bookmarks.isactivewdirparent(repo):
movemark = repo['.'].node()
- except error.RepoLookupError:
+ else:
if currentbranch == 'default': # no default branch!
node = repo.lookup('tip') # update to tip
else: