##// 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 opts[r'dest'] = '_destautoorphanrebase(SRC)'
818 opts[r'dest'] = '_destautoorphanrebase(SRC)'
819
819
820 if dryrun:
820 if dryrun:
821 rbsrt = rebaseruntime(repo, ui, inmemory=True,
821 return _dryrunrebase(ui, repo, **opts)
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)
837 elif inmemory:
822 elif inmemory:
838 try:
823 try:
839 # in-memory merge doesn't support conflicts, so if we hit any, abort
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 else:
834 else:
850 return _origrebase(ui, repo, **opts)
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 def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, rbsrt=None,
855 def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, rbsrt=None,
853 **opts):
856 **opts):
854 opts = pycompat.byteskwargs(opts)
857 opts = pycompat.byteskwargs(opts)
General Comments 0
You need to be logged in to leave comments. Login now