Show More
@@ -806,7 +806,6 b' def rebase(ui, repo, **opts):' | |||||
806 | inmemory = ui.configbool('rebase', 'experimental.inmemory') |
|
806 | inmemory = ui.configbool('rebase', 'experimental.inmemory') | |
807 | dryrun = opts.get('dry_run') |
|
807 | dryrun = opts.get('dry_run') | |
808 | confirm = opts.get('confirm') |
|
808 | confirm = opts.get('confirm') | |
809 | stop = opts.get('stop') |
|
|||
810 | selactions = [k for k in ['abort', 'stop', 'continue'] if opts.get(k)] |
|
809 | selactions = [k for k in ['abort', 'stop', 'continue'] if opts.get(k)] | |
811 | if len(selactions) > 1: |
|
810 | if len(selactions) > 1: | |
812 | raise error.Abort(_('cannot use --%s with --%s') |
|
811 | raise error.Abort(_('cannot use --%s with --%s') | |
@@ -819,8 +818,7 b' def rebase(ui, repo, **opts):' | |||||
819 | if dryrun and confirm: |
|
818 | if dryrun and confirm: | |
820 | raise error.Abort(_('cannot specify both --confirm and --dry-run')) |
|
819 | raise error.Abort(_('cannot specify both --confirm and --dry-run')) | |
821 |
|
820 | |||
822 | if (opts.get('continue') or opts.get('abort') or |
|
821 | if action in {'abort', 'continue'} or repo.currenttransaction() is not None: | |
823 | repo.currenttransaction() is not None): |
|
|||
824 | # in-memory rebase is not compatible with resuming rebases. |
|
822 | # in-memory rebase is not compatible with resuming rebases. | |
825 | # (Or if it is run within a transaction, since the restart logic can |
|
823 | # (Or if it is run within a transaction, since the restart logic can | |
826 | # fail the entire transaction.) |
|
824 | # fail the entire transaction.) | |
@@ -836,8 +834,8 b' def rebase(ui, repo, **opts):' | |||||
836 | opts['dest'] = '_destautoorphanrebase(SRC)' |
|
834 | opts['dest'] = '_destautoorphanrebase(SRC)' | |
837 |
|
835 | |||
838 | if dryrun or confirm: |
|
836 | if dryrun or confirm: | |
839 | return _dryrunrebase(ui, repo, opts) |
|
837 | return _dryrunrebase(ui, repo, action, opts) | |
840 | elif stop: |
|
838 | elif action == 'stop': | |
841 | rbsrt = rebaseruntime(repo, ui) |
|
839 | rbsrt = rebaseruntime(repo, ui) | |
842 | rbsrt.restorestatus() |
|
840 | rbsrt.restorestatus() | |
843 |
|
841 | |||
@@ -863,16 +861,16 b' def rebase(ui, repo, **opts):' | |||||
863 | # and re-run as an on-disk merge. |
|
861 | # and re-run as an on-disk merge. | |
864 | overrides = {('rebase', 'singletransaction'): True} |
|
862 | overrides = {('rebase', 'singletransaction'): True} | |
865 | with ui.configoverride(overrides, 'rebase'): |
|
863 | with ui.configoverride(overrides, 'rebase'): | |
866 | return _dorebase(ui, repo, opts, inmemory=inmemory) |
|
864 | return _dorebase(ui, repo, action, opts, inmemory=inmemory) | |
867 | except error.InMemoryMergeConflictsError: |
|
865 | except error.InMemoryMergeConflictsError: | |
868 | ui.warn(_('hit merge conflicts; re-running rebase without in-memory' |
|
866 | ui.warn(_('hit merge conflicts; re-running rebase without in-memory' | |
869 | ' merge\n')) |
|
867 | ' merge\n')) | |
870 |
_dorebase(ui, repo, |
|
868 | _dorebase(ui, repo, action='abort') | |
871 | return _dorebase(ui, repo, opts, inmemory=False) |
|
869 | return _dorebase(ui, repo, action, opts, inmemory=False) | |
872 | else: |
|
870 | else: | |
873 | return _dorebase(ui, repo, opts) |
|
871 | return _dorebase(ui, repo, action, opts) | |
874 |
|
872 | |||
875 | def _dryrunrebase(ui, repo, opts): |
|
873 | def _dryrunrebase(ui, repo, action, opts): | |
876 | rbsrt = rebaseruntime(repo, ui, inmemory=True, opts=opts) |
|
874 | rbsrt = rebaseruntime(repo, ui, inmemory=True, opts=opts) | |
877 | confirm = opts.get('confirm') |
|
875 | confirm = opts.get('confirm') | |
878 | if confirm: |
|
876 | if confirm: | |
@@ -885,7 +883,7 b' def _dryrunrebase(ui, repo, opts):' | |||||
885 | try: |
|
883 | try: | |
886 | overrides = {('rebase', 'singletransaction'): True} |
|
884 | overrides = {('rebase', 'singletransaction'): True} | |
887 | with ui.configoverride(overrides, 'rebase'): |
|
885 | with ui.configoverride(overrides, 'rebase'): | |
888 | _origrebase(ui, repo, opts, rbsrt, inmemory=True, |
|
886 | _origrebase(ui, repo, action, opts, rbsrt, inmemory=True, | |
889 | leaveunfinished=True) |
|
887 | leaveunfinished=True) | |
890 | except error.InMemoryMergeConflictsError: |
|
888 | except error.InMemoryMergeConflictsError: | |
891 | ui.status(_('hit a merge conflict\n')) |
|
889 | ui.status(_('hit a merge conflict\n')) | |
@@ -911,11 +909,13 b' def _dryrunrebase(ui, repo, opts):' | |||||
911 | rbsrt._prepareabortorcontinue(isabort=True, backup=False, |
|
909 | rbsrt._prepareabortorcontinue(isabort=True, backup=False, | |
912 | suppwarns=True) |
|
910 | suppwarns=True) | |
913 |
|
911 | |||
914 | def _dorebase(ui, repo, opts, inmemory=False): |
|
912 | def _dorebase(ui, repo, action, opts, inmemory=False): | |
915 | rbsrt = rebaseruntime(repo, ui, inmemory, opts) |
|
913 | rbsrt = rebaseruntime(repo, ui, inmemory, opts) | |
916 | return _origrebase(ui, repo, opts, rbsrt, inmemory=inmemory) |
|
914 | return _origrebase(ui, repo, action, opts, rbsrt, inmemory=inmemory) | |
917 |
|
915 | |||
918 |
def _origrebase(ui, repo, opts, rbsrt, inmemory=False, |
|
916 | def _origrebase(ui, repo, action, opts, rbsrt, inmemory=False, | |
|
917 | leaveunfinished=False): | |||
|
918 | assert action != 'stop' | |||
919 | with repo.wlock(), repo.lock(): |
|
919 | with repo.wlock(), repo.lock(): | |
920 | # Validate input and define rebasing points |
|
920 | # Validate input and define rebasing points | |
921 | destf = opts.get('dest', None) |
|
921 | destf = opts.get('dest', None) | |
@@ -925,8 +925,6 b' def _origrebase(ui, repo, opts, rbsrt, i' | |||||
925 | # search default destination in this space |
|
925 | # search default destination in this space | |
926 | # used in the 'hg pull --rebase' case, see issue 5214. |
|
926 | # used in the 'hg pull --rebase' case, see issue 5214. | |
927 | destspace = opts.get('_destspace') |
|
927 | destspace = opts.get('_destspace') | |
928 | contf = opts.get('continue') |
|
|||
929 | abortf = opts.get('abort') |
|
|||
930 | if opts.get('interactive'): |
|
928 | if opts.get('interactive'): | |
931 | try: |
|
929 | try: | |
932 | if extensions.find('histedit'): |
|
930 | if extensions.find('histedit'): | |
@@ -942,20 +940,20 b' def _origrebase(ui, repo, opts, rbsrt, i' | |||||
942 | raise error.Abort( |
|
940 | raise error.Abort( | |
943 | _('message can only be specified with collapse')) |
|
941 | _('message can only be specified with collapse')) | |
944 |
|
942 | |||
945 |
if |
|
943 | if action: | |
946 | if rbsrt.collapsef: |
|
944 | if rbsrt.collapsef: | |
947 | raise error.Abort( |
|
945 | raise error.Abort( | |
948 | _('cannot use collapse with continue or abort')) |
|
946 | _('cannot use collapse with continue or abort')) | |
949 | if srcf or basef or destf: |
|
947 | if srcf or basef or destf: | |
950 | raise error.Abort( |
|
948 | raise error.Abort( | |
951 | _('abort and continue do not allow specifying revisions')) |
|
949 | _('abort and continue do not allow specifying revisions')) | |
952 |
if a |
|
950 | if action == 'abort' and opts.get('tool', False): | |
953 | ui.warn(_('tool option will be ignored\n')) |
|
951 | ui.warn(_('tool option will be ignored\n')) | |
954 |
if |
|
952 | if action == 'continue': | |
955 | ms = mergemod.mergestate.read(repo) |
|
953 | ms = mergemod.mergestate.read(repo) | |
956 | mergeutil.checkunresolved(ms) |
|
954 | mergeutil.checkunresolved(ms) | |
957 |
|
955 | |||
958 |
retcode = rbsrt._prepareabortorcontinue( |
|
956 | retcode = rbsrt._prepareabortorcontinue(isabort=(action == 'abort')) | |
959 | if retcode is not None: |
|
957 | if retcode is not None: | |
960 | return retcode |
|
958 | return retcode | |
961 | else: |
|
959 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now