comparison mercurial/commands.py @ 41398:2ff8994ac71d

cleanup: use repo['.'] instead of repo[None].p1() Differential Revision: https://phab.mercurial-scm.org/D5707
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 25 Jan 2019 23:43:11 -0800
parents 0bd56c291359
children 09f1c17e24dd
comparison
equal deleted inserted replaced
41397:0bd56c291359 41398:2ff8994ac71d
1100 ui.write("%s\n" % repo.dirstate.branch()) 1100 ui.write("%s\n" % repo.dirstate.branch())
1101 return 1101 return
1102 1102
1103 with repo.wlock(): 1103 with repo.wlock():
1104 if opts.get('clean'): 1104 if opts.get('clean'):
1105 label = repo[None].p1().branch() 1105 label = repo['.'].branch()
1106 repo.dirstate.setbranch(label) 1106 repo.dirstate.setbranch(label)
1107 ui.status(_('reset working directory to branch %s\n') % label) 1107 ui.status(_('reset working directory to branch %s\n') % label)
1108 elif label: 1108 elif label:
1109 1109
1110 scmutil.checknewlabel(repo, label, 'branch') 1110 scmutil.checknewlabel(repo, label, 'branch')
1670 extra['close'] = '1' 1670 extra['close'] = '1'
1671 1671
1672 if not bheads: 1672 if not bheads:
1673 raise error.Abort(_('can only close branch heads')) 1673 raise error.Abort(_('can only close branch heads'))
1674 elif opts.get('amend'): 1674 elif opts.get('amend'):
1675 if repo[None].p1().p1().branch() != branch and \ 1675 if repo['.'].p1().branch() != branch and \
1676 repo[None].p1().p2().branch() != branch: 1676 repo['.'].p2().branch() != branch:
1677 raise error.Abort(_('can only close branch heads')) 1677 raise error.Abort(_('can only close branch heads'))
1678 1678
1679 if opts.get('amend'): 1679 if opts.get('amend'):
1680 if ui.configbool('ui', 'commitsubrepos'): 1680 if ui.configbool('ui', 'commitsubrepos'):
1681 raise error.Abort(_('cannot amend with ui.commitsubrepos enabled')) 1681 raise error.Abort(_('cannot amend with ui.commitsubrepos enabled'))