##// END OF EJS Templates
revert: extract actual revert in its own function...
Pierre-Yves David -
r20571:d4893e64 default
parent child Browse files
Show More
@@ -2195,8 +2195,26 b' def revert(ui, repo, ctx, parents, *pats'
2195 handle(revert, False)
2195 handle(revert, False)
2196 else:
2196 else:
2197 handle(remove, False)
2197 handle(remove, False)
2198 if not opts.get('dry_run'):
2199 _performrevert(repo, parents, ctx, revert, add, remove, undelete)
2198
2200
2199 if not opts.get('dry_run'):
2201 if targetsubs:
2202 # Revert the subrepos on the revert list
2203 for sub in targetsubs:
2204 ctx.sub(sub).revert(ui, ctx.substate[sub], *pats, **opts)
2205 finally:
2206 wlock.release()
2207
2208 def _performrevert(repo, parents, ctx, revert, add, remove, undelete):
2209 """function that actually perform all the action computed for revert
2210
2211 This is an independent function to let extension to plug in and react to
2212 the imminent revert.
2213
2214 Make sure you have the working directory locked when caling this function.
2215 """
2216 parent, p2 = parents
2217 node = ctx.node()
2200 def checkout(f):
2218 def checkout(f):
2201 fc = ctx[f]
2219 fc = ctx[f]
2202 repo.wwrite(f, fc.data(), fc.flags())
2220 repo.wwrite(f, fc.data(), fc.flags())
@@ -2244,13 +2262,6 b' def revert(ui, repo, ctx, parents, *pats'
2244 if f in copied:
2262 if f in copied:
2245 repo.dirstate.copy(copied[f], f)
2263 repo.dirstate.copy(copied[f], f)
2246
2264
2247 if targetsubs:
2248 # Revert the subrepos on the revert list
2249 for sub in targetsubs:
2250 ctx.sub(sub).revert(ui, ctx.substate[sub], *pats, **opts)
2251 finally:
2252 wlock.release()
2253
2254 def command(table):
2265 def command(table):
2255 '''returns a function object bound to table which can be used as
2266 '''returns a function object bound to table which can be used as
2256 a decorator for populating table as a command table'''
2267 a decorator for populating table as a command table'''
General Comments 0
You need to be logged in to leave comments. Login now