comparison hgext/evolve.py @ 1324:739208d1ee62

evolve: extract cleanup logic in the evolve function We are going to need to reuse the cleanup logic when introducing --rev, so we extract it in a method to avoid code duplication.
author Laurent Charignon <lcharignon@fb.com>
date Tue, 05 May 2015 14:25:35 -0700
parents 603104c880f7
children 1fe3da0b4601
comparison
equal deleted inserted replaced
1323:603104c880f7 1324:739208d1ee62
1213 % len(troubled)) 1213 % len(troubled))
1214 return 2 1214 return 2
1215 else: 1215 else:
1216 ui.write_err(_('no troubled changesets\n')) 1216 ui.write_err(_('no troubled changesets\n'))
1217 return 1 1217 return 1
1218
1219 def _cleanup(ui, repo, startnode, showprogress):
1220 if showprogress:
1221 ui.progress('evolve', None)
1222 if repo['.'] != startnode:
1223 ui.status(_('working directory is now at %s\n') % repo['.'])
1224
1225
1218 @command('^evolve|stabilize|solve', 1226 @command('^evolve|stabilize|solve',
1219 [('n', 'dry-run', False, 1227 [('n', 'dry-run', False,
1220 'do not perform actions, just print what would be done'), 1228 'do not perform actions, just print what would be done'),
1221 ('', 'confirm', False, 1229 ('', 'confirm', False,
1222 'ask for confirmation before performing the action'), 1230 'ask for confirmation before performing the action'),
1294 nexttrouble= _picknexttroubled(ui, repo, anyopt or allopt) 1302 nexttrouble= _picknexttroubled(ui, repo, anyopt or allopt)
1295 else: 1303 else:
1296 # Resolving a single trouble 1304 # Resolving a single trouble
1297 _solveone(ui, repo, nexttrouble, dryrunopt, confirmopt, progresscb) 1305 _solveone(ui, repo, nexttrouble, dryrunopt, confirmopt, progresscb)
1298 1306
1299 # Cleanup 1307 _cleanup(ui, repo, startnode, showprogress)
1300 if showprogress:
1301 ui.progress('evolve', None)
1302
1303 if repo['.'] != startnode:
1304 ui.status(_('working directory is now at %s\n') % repo['.'])
1305 1308
1306 1309
1307 def _evolveany(ui, repo, tro, dryrunopt, confirmopt, progresscb): 1310 def _evolveany(ui, repo, tro, dryrunopt, confirmopt, progresscb):
1308 repo = repo.unfiltered() 1311 repo = repo.unfiltered()
1309 tro = repo[tro.rev()] 1312 tro = repo[tro.rev()]