##// END OF EJS Templates
rebase: add dryrun property to rebaseruntime...
Martin von Zweigbergk -
r46121:25e365d5 default
parent child Browse files
Show More
@@ -166,7 +166,7 b' def _ctxdesc(ctx):'
166 class rebaseruntime(object):
166 class rebaseruntime(object):
167 """This class is a container for rebase runtime state"""
167 """This class is a container for rebase runtime state"""
168
168
169 def __init__(self, repo, ui, inmemory=False, opts=None):
169 def __init__(self, repo, ui, inmemory=False, dryrun=False, opts=None):
170 if opts is None:
170 if opts is None:
171 opts = {}
171 opts = {}
172
172
@@ -212,6 +212,7 b' class rebaseruntime(object):'
212 self.obsoletenotrebased = {}
212 self.obsoletenotrebased = {}
213 self.obsoletewithoutsuccessorindestination = set()
213 self.obsoletewithoutsuccessorindestination = set()
214 self.inmemory = inmemory
214 self.inmemory = inmemory
215 self.dryrun = dryrun
215 self.stateobj = statemod.cmdstate(repo, b'rebasestate')
216 self.stateobj = statemod.cmdstate(repo, b'rebasestate')
216
217
217 @property
218 @property
@@ -1088,7 +1089,7 b' def rebase(ui, repo, **opts):'
1088
1089
1089
1090
1090 def _dryrunrebase(ui, repo, action, opts):
1091 def _dryrunrebase(ui, repo, action, opts):
1091 rbsrt = rebaseruntime(repo, ui, inmemory=True, opts=opts)
1092 rbsrt = rebaseruntime(repo, ui, inmemory=True, dryrun=True, opts=opts)
1092 confirm = opts.get(b'confirm')
1093 confirm = opts.get(b'confirm')
1093 if confirm:
1094 if confirm:
1094 ui.status(_(b'starting in-memory rebase\n'))
1095 ui.status(_(b'starting in-memory rebase\n'))
@@ -1102,7 +1103,7 b' def _dryrunrebase(ui, repo, action, opts'
1102 overrides = {(b'rebase', b'singletransaction'): True}
1103 overrides = {(b'rebase', b'singletransaction'): True}
1103 with ui.configoverride(overrides, b'rebase'):
1104 with ui.configoverride(overrides, b'rebase'):
1104 _origrebase(
1105 _origrebase(
1105 ui, repo, action, opts, rbsrt, leaveunfinished=True,
1106 ui, repo, action, opts, rbsrt,
1106 )
1107 )
1107 except error.InMemoryMergeConflictsError:
1108 except error.InMemoryMergeConflictsError:
1108 ui.status(_(b'hit a merge conflict\n'))
1109 ui.status(_(b'hit a merge conflict\n'))
@@ -1144,11 +1145,11 b' def _dryrunrebase(ui, repo, action, opts'
1144
1145
1145
1146
1146 def _dorebase(ui, repo, action, opts, inmemory=False):
1147 def _dorebase(ui, repo, action, opts, inmemory=False):
1147 rbsrt = rebaseruntime(repo, ui, inmemory, opts)
1148 rbsrt = rebaseruntime(repo, ui, inmemory, opts=opts)
1148 return _origrebase(ui, repo, action, opts, rbsrt)
1149 return _origrebase(ui, repo, action, opts, rbsrt)
1149
1150
1150
1151
1151 def _origrebase(ui, repo, action, opts, rbsrt, leaveunfinished=False):
1152 def _origrebase(ui, repo, action, opts, rbsrt):
1152 assert action != b'stop'
1153 assert action != b'stop'
1153 with repo.wlock(), repo.lock():
1154 with repo.wlock(), repo.lock():
1154 if opts.get(b'interactive'):
1155 if opts.get(b'interactive'):
@@ -1222,7 +1223,7 b' def _origrebase(ui, repo, action, opts, '
1222 dsguard = dirstateguard.dirstateguard(repo, b'rebase')
1223 dsguard = dirstateguard.dirstateguard(repo, b'rebase')
1223 with util.acceptintervention(dsguard):
1224 with util.acceptintervention(dsguard):
1224 rbsrt._performrebase(tr)
1225 rbsrt._performrebase(tr)
1225 if not leaveunfinished:
1226 if not rbsrt.dryrun:
1226 rbsrt._finishrebase()
1227 rbsrt._finishrebase()
1227
1228
1228
1229
General Comments 0
You need to be logged in to leave comments. Login now