diff -r bb14a81ce647 -r 6f92d6bd2972 hgext/rebase.py --- a/hgext/rebase.py Wed Feb 03 09:06:52 2016 -0800 +++ b/hgext/rebase.py Wed Feb 03 09:23:52 2016 -0800 @@ -397,13 +397,14 @@ if dest.closesbranch() and not keepbranchesf: ui.status(_('reopening closed branch head %s\n') % dest) - if keepbranchesf and collapsef: - branches = set() - for rev in state: - branches.add(repo[rev].branch()) - if len(branches) > 1: - raise error.Abort(_('cannot collapse multiple named ' - 'branches')) + if keepbranchesf: + if collapsef: + branches = set() + for rev in state: + branches.add(repo[rev].branch()) + if len(branches) > 1: + raise error.Abort(_('cannot collapse multiple named ' + 'branches')) # Rebase if not targetancestors: