hgext/histedit.py
changeset 26584 e28102403d1b
parent 26583 49b568a4e539
child 26587 56b2bcea2529
equal deleted inserted replaced
26583:49b568a4e539 26584:e28102403d1b
   810         rules = verifyrules(rules, repo, [repo[c] for [_a, c] in state.rules])
   810         rules = verifyrules(rules, repo, [repo[c] for [_a, c] in state.rules])
   811         state.rules = rules
   811         state.rules = rules
   812         state.write()
   812         state.write()
   813         return
   813         return
   814     elif goal == 'abort':
   814     elif goal == 'abort':
   815         state.read()
   815         try:
   816         tmpnodes, leafs = newnodestoabort(state)
   816             state.read()
   817         ui.debug('restore wc to old parent %s\n' % node.short(state.topmost))
   817             tmpnodes, leafs = newnodestoabort(state)
   818 
   818             ui.debug('restore wc to old parent %s\n'
   819         # Recover our old commits if necessary
   819                     % node.short(state.topmost))
   820         if not state.topmost in repo and state.backupfile:
   820 
   821             backupfile = repo.join(state.backupfile)
   821             # Recover our old commits if necessary
   822             f = hg.openpath(ui, backupfile)
   822             if not state.topmost in repo and state.backupfile:
   823             gen = exchange.readbundle(ui, f, backupfile)
   823                 backupfile = repo.join(state.backupfile)
   824             changegroup.addchangegroup(repo, gen, 'histedit',
   824                 f = hg.openpath(ui, backupfile)
   825                                        'bundle:' + backupfile)
   825                 gen = exchange.readbundle(ui, f, backupfile)
   826             os.remove(backupfile)
   826                 changegroup.addchangegroup(repo, gen, 'histedit',
   827 
   827                                         'bundle:' + backupfile)
   828         # check whether we should update away
   828                 os.remove(backupfile)
   829         if repo.unfiltered().revs('parents() and (%n  or %ln::)',
   829 
   830                                   state.parentctxnode, leafs | tmpnodes):
   830             # check whether we should update away
   831             hg.clean(repo, state.topmost)
   831             if repo.unfiltered().revs('parents() and (%n  or %ln::)',
   832         cleanupnode(ui, repo, 'created', tmpnodes)
   832                                     state.parentctxnode, leafs | tmpnodes):
   833         cleanupnode(ui, repo, 'temp', leafs)
   833                 hg.clean(repo, state.topmost)
   834         state.clear()
   834             cleanupnode(ui, repo, 'created', tmpnodes)
       
   835             cleanupnode(ui, repo, 'temp', leafs)
       
   836         except Exception:
       
   837             if state.inprogress():
       
   838                 ui.warn(_('warning: encountered an exception during histedit '
       
   839                     '--abort; the repository may not have been completely '
       
   840                     'cleaned up\n'))
       
   841             raise
       
   842         finally:
       
   843                 state.clear()
   835         return
   844         return
   836     else:
   845     else:
   837         cmdutil.checkunfinished(repo)
   846         cmdutil.checkunfinished(repo)
   838         cmdutil.bailifchanged(repo)
   847         cmdutil.bailifchanged(repo)
   839 
   848