hgext/obsolete.py
changeset 320 63f267bd2176
parent 311 5eecfda0a5c7
child 321 41ba89f0caa5
equal deleted inserted replaced
319:e7431cf7fca9 320:63f267bd2176
   620 
   620 
   621 def noextinctsvisibleheads(orig, repo):
   621 def noextinctsvisibleheads(orig, repo):
   622     repo._turn_extinct_secret()
   622     repo._turn_extinct_secret()
   623     return orig(repo)
   623     return orig(repo)
   624 
   624 
       
   625 def wrapcmdutilamend(orig, ui, repo, commitfunc, old, *args, **kwargs):
       
   626     oldnode = old.node()
       
   627     new = orig(ui, repo, commitfunc, old, *args, **kwargs)
       
   628     if new != oldnode:
       
   629         lock = repo.lock()
       
   630         try:
       
   631             newmarker = {
       
   632                 'subjects':  [new],
       
   633                 'object': oldnode,
       
   634                 'date':  util.makedate(),
       
   635                 'user': ui.username(),
       
   636                 'reason': 'commit --amend',
       
   637                 }
       
   638             repo.obsoletestore.new(newmarker)
       
   639             repo._clearobsoletecache()
       
   640             repo._turn_extinct_secret()
       
   641         finally:
       
   642             lock.release()
       
   643     return new
       
   644 
   625 def uisetup(ui):
   645 def uisetup(ui):
   626     extensions.wrapcommand(commands.table, "update", wrapmayobsoletewc)
   646     extensions.wrapcommand(commands.table, "update", wrapmayobsoletewc)
   627     extensions.wrapcommand(commands.table, "pull", wrapmayobsoletewc)
   647     extensions.wrapcommand(commands.table, "pull", wrapmayobsoletewc)
       
   648     if util.safehasattr(cmdutil, 'amend'):
       
   649         extensions.wrapfunction(cmdutil, 'amend', wrapcmdutilamend)
   628     extensions.wrapfunction(discovery, 'findcommonoutgoing', wrapfindcommonoutgoing)
   650     extensions.wrapfunction(discovery, 'findcommonoutgoing', wrapfindcommonoutgoing)
   629     extensions.wrapfunction(discovery, 'checkheads', wrapcheckheads)
   651     extensions.wrapfunction(discovery, 'checkheads', wrapcheckheads)
   630     extensions.wrapfunction(phases, 'visibleheads', noextinctsvisibleheads)
   652     extensions.wrapfunction(phases, 'visibleheads', noextinctsvisibleheads)
   631     extensions.wrapfunction(phases, 'advanceboundary', wrapclearcache)
   653     extensions.wrapfunction(phases, 'advanceboundary', wrapclearcache)
   632     if util.safehasattr(phases, 'visiblebranchmap'):
   654     if util.safehasattr(phases, 'visiblebranchmap'):