comparison hgext/rebase.py @ 35291:aa660c1203a9

rebase: do not bail on uncomitted changes if rebasing in-memory Differential Revision: https://phab.mercurial-scm.org/D1233
author Phil Cohen <phillco@fb.com>
date Thu, 07 Dec 2017 13:20:47 -0800
parents 482614b3802a
children 306a8604741f
comparison
equal deleted inserted replaced
35290:482614b3802a 35291:aa660c1203a9
782 retcode = rbsrt._prepareabortorcontinue(abortf) 782 retcode = rbsrt._prepareabortorcontinue(abortf)
783 if retcode is not None: 783 if retcode is not None:
784 return retcode 784 return retcode
785 else: 785 else:
786 destmap = _definedestmap(ui, repo, destf, srcf, basef, revf, 786 destmap = _definedestmap(ui, repo, destf, srcf, basef, revf,
787 destspace=destspace) 787 destspace=destspace,
788 inmemory=opts['inmemory'])
788 retcode = rbsrt._preparenewrebase(destmap) 789 retcode = rbsrt._preparenewrebase(destmap)
789 if retcode is not None: 790 if retcode is not None:
790 return retcode 791 return retcode
791 792
792 tr = None 793 tr = None
802 rbsrt._performrebase(tr) 803 rbsrt._performrebase(tr)
803 804
804 rbsrt._finishrebase() 805 rbsrt._finishrebase()
805 806
806 def _definedestmap(ui, repo, destf=None, srcf=None, basef=None, revf=None, 807 def _definedestmap(ui, repo, destf=None, srcf=None, basef=None, revf=None,
807 destspace=None): 808 destspace=None, inmemory=False):
808 """use revisions argument to define destmap {srcrev: destrev}""" 809 """use revisions argument to define destmap {srcrev: destrev}"""
809 if revf is None: 810 if revf is None:
810 revf = [] 811 revf = []
811 812
812 # destspace is here to work around issues with `hg pull --rebase` see 813 # destspace is here to work around issues with `hg pull --rebase` see
816 if revf and basef: 817 if revf and basef:
817 raise error.Abort(_('cannot specify both a revision and a base')) 818 raise error.Abort(_('cannot specify both a revision and a base'))
818 if revf and srcf: 819 if revf and srcf:
819 raise error.Abort(_('cannot specify both a revision and a source')) 820 raise error.Abort(_('cannot specify both a revision and a source'))
820 821
821 cmdutil.checkunfinished(repo) 822 if not inmemory:
822 cmdutil.bailifchanged(repo) 823 cmdutil.checkunfinished(repo)
824 cmdutil.bailifchanged(repo)
823 825
824 if ui.configbool('commands', 'rebase.requiredest') and not destf: 826 if ui.configbool('commands', 'rebase.requiredest') and not destf:
825 raise error.Abort(_('you must specify a destination'), 827 raise error.Abort(_('you must specify a destination'),
826 hint=_('use: hg rebase -d REV')) 828 hint=_('use: hg rebase -d REV'))
827 829