##// END OF EJS Templates
rebase: extract dryrun as a function...
Sushil khanchi -
r38515:c92fdc27 default
parent child Browse files
Show More
@@ -818,22 +818,7 b' def rebase(ui, repo, **opts):'
818 818 opts[r'dest'] = '_destautoorphanrebase(SRC)'
819 819
820 820 if dryrun:
821 rbsrt = rebaseruntime(repo, ui, inmemory=True,
822 opts=pycompat.byteskwargs(opts))
823 with repo.wlock(), repo.lock():
824 try:
825 overrides = {('rebase', 'singletransaction'): True}
826 with ui.configoverride(overrides, 'rebase'):
827 _origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
828 leaveunfinished=True, **opts)
829 except error.InMemoryMergeConflictsError:
830 ui.status(_('hit a merge conflict\n'))
831 return 1
832 else:
833 ui.status(_('there will be no conflict, you can rebase\n'))
834 return 0
835 finally:
836 rbsrt._prepareabortorcontinue(isabort=True)
821 return _dryrunrebase(ui, repo, **opts)
837 822 elif inmemory:
838 823 try:
839 824 # in-memory merge doesn't support conflicts, so if we hit any, abort
@@ -849,6 +834,24 b' def rebase(ui, repo, **opts):'
849 834 else:
850 835 return _origrebase(ui, repo, **opts)
851 836
837 def _dryrunrebase(ui, repo, **opts):
838 rbsrt = rebaseruntime(repo, ui, inmemory=True,
839 opts=pycompat.byteskwargs(opts))
840 with repo.wlock(), repo.lock():
841 try:
842 overrides = {('rebase', 'singletransaction'): True}
843 with ui.configoverride(overrides, 'rebase'):
844 _origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
845 leaveunfinished=True, **opts)
846 except error.InMemoryMergeConflictsError:
847 ui.status(_('hit a merge conflict\n'))
848 return 1
849 else:
850 ui.status(_('there will be no conflict, you can rebase\n'))
851 return 0
852 finally:
853 rbsrt._prepareabortorcontinue(isabort=True)
854
852 855 def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, rbsrt=None,
853 856 **opts):
854 857 opts = pycompat.byteskwargs(opts)
General Comments 0
You need to be logged in to leave comments. Login now