hgext/obsolete.py
branchstable
changeset 356 56d4c6207ef9
parent 354 bd26eb9714fb
child 359 43f79983f638
child 374 2c969d1b18e0
equal deleted inserted replaced
355:72642a6970e0 356:56d4c6207ef9
   412     revset.symbols["successors"] = revsetsuccessors
   412     revset.symbols["successors"] = revsetsuccessors
   413     revset.symbols["allsuccessors"] = revsetallsuccessors  # bad name
   413     revset.symbols["allsuccessors"] = revsetallsuccessors  # bad name
   414 
   414 
   415     templatekw.keywords['obsolete'] = obsoletekw
   415     templatekw.keywords['obsolete'] = obsoletekw
   416 
   416 
       
   417     # warning about more obsolete
       
   418     for cmd in ['commit', 'push', 'pull', 'graft', 'phase', 'unbundle']:
       
   419         entry = extensions.wrapcommand(commands.table, cmd, warnobserrors)
   417     try:
   420     try:
   418         rebase = extensions.find('rebase')
   421         rebase = extensions.find('rebase')
   419         if rebase:
   422         if rebase:
       
   423             entry = extensions.wrapcommand(rebase.cmdtable, 'rebase', warnobserrors)
   420             extensions.wrapfunction(rebase, 'buildstate', buildstate)
   424             extensions.wrapfunction(rebase, 'buildstate', buildstate)
   421             extensions.wrapfunction(rebase, 'defineparents', defineparents)
   425             extensions.wrapfunction(rebase, 'defineparents', defineparents)
   422             extensions.wrapfunction(rebase, 'concludenode', concludenode)
   426             extensions.wrapfunction(rebase, 'concludenode', concludenode)
   423             extensions.wrapcommand(rebase.cmdtable, "rebase", cmdrebase)
   427             extensions.wrapcommand(rebase.cmdtable, "rebase", cmdrebase)
   424     except KeyError:
   428     except KeyError:
   689     res = origfn(ui, repo, *args, **opts)
   693     res = origfn(ui, repo, *args, **opts)
   690     if repo['.'].obsolete():
   694     if repo['.'].obsolete():
   691         ui.warn(_('Working directory parent is obsolete\n'))
   695         ui.warn(_('Working directory parent is obsolete\n'))
   692     return res
   696     return res
   693 
   697 
       
   698 def warnobserrors(orig, ui, repo, *args, **kwargs):
       
   699     """display warning is the command resulted in more instable changeset"""
       
   700     priorunstables = len(repo.revs('unstable()'))
       
   701     priorlatecomers = len(repo.revs('latecomer()'))
       
   702     priorconflictings = len(repo.revs('conflicting()'))
       
   703     #print orig, priorunstables
       
   704     #print len(repo.revs('secret() - obsolete()'))
       
   705     try:
       
   706         return orig(ui, repo, *args, **kwargs)
       
   707     finally:
       
   708         newunstables = len(repo.revs('unstable()')) - priorunstables
       
   709         newlatecomers = len(repo.revs('latecomer()')) - priorlatecomers
       
   710         newconflictings = len(repo.revs('conflicting()')) - priorconflictings
       
   711         #print orig, newunstables
       
   712         #print len(repo.revs('secret() - obsolete()'))
       
   713         if newunstables > 0:
       
   714             ui.warn(_('%i new unstables changesets\n') % newunstables)
       
   715         if newlatecomers > 0:
       
   716             ui.warn(_('%i new latecomers changesets\n') % newlatecomers)
       
   717         if newconflictings > 0:
       
   718             ui.warn(_('%i new conflictings changesets\n') % newconflictings)
       
   719 
   694 def noextinctsvisibleheads(orig, repo):
   720 def noextinctsvisibleheads(orig, repo):
   695     repo._turn_extinct_secret()
   721     repo._turn_extinct_secret()
   696     return orig(repo)
   722     return orig(repo)
   697 
   723 
   698 def wrapcmdutilamend(orig, ui, repo, commitfunc, old, *args, **kwargs):
   724 def wrapcmdutilamend(orig, ui, repo, commitfunc, old, *args, **kwargs):