680 @eh.wrapcommand("update") |
680 @eh.wrapcommand("update") |
681 @eh.wrapcommand("parents") |
681 @eh.wrapcommand("parents") |
682 @eh.wrapcommand("pull") |
682 @eh.wrapcommand("pull") |
683 def wrapmayobsoletewc(origfn, ui, repo, *args, **opts): |
683 def wrapmayobsoletewc(origfn, ui, repo, *args, **opts): |
684 """Warn that the working directory parent is an obsolete changeset""" |
684 """Warn that the working directory parent is an obsolete changeset""" |
685 def warnobsolete(): |
685 |
686 if repo['.'].obsolete(): |
686 prior = (repo['.'].obsolete(), repo['.'].rev) |
|
687 try: |
|
688 res = origfn(ui, repo, *args, **opts) |
|
689 finally: |
|
690 after = (repo['.'].obsolete(), repo['.'].rev) |
|
691 if prior != after and after[0]: |
687 ui.warn(_('working directory parent is obsolete!\n')) |
692 ui.warn(_('working directory parent is obsolete!\n')) |
688 if (not ui.quiet) and obsolete.isenabled(repo, commandopt): |
693 if (not ui.quiet) and obsolete.isenabled(repo, commandopt): |
689 ui.warn(_('(use "hg evolve" to update to its successor)\n')) |
694 ui.warn(_('(use "hg evolve" to update to its successor)\n')) |
690 wlock = None |
|
691 try: |
|
692 wlock = repo.wlock() |
|
693 repo._afterlock(warnobsolete) |
|
694 res = origfn(ui, repo, *args, **opts) |
|
695 finally: |
|
696 lockmod.release(wlock) |
|
697 return res |
695 return res |
698 |
696 |
699 # XXX this could wrap transaction code |
697 # XXX this could wrap transaction code |
700 # XXX (but this is a bit a layer violation) |
698 # XXX (but this is a bit a layer violation) |
701 @eh.wrapcommand("commit") |
699 @eh.wrapcommand("commit") |