676 ### Various trouble warning ### |
676 ### Various trouble warning ### |
677 ##################################################################### |
677 ##################################################################### |
678 |
678 |
679 # This section take care of issue warning to the user when troubles appear |
679 # This section take care of issue warning to the user when troubles appear |
680 |
680 |
|
681 |
|
682 def _warnobsoletewc(ui, repo): |
|
683 if repo['.'].obsolete(): |
|
684 ui.warn(_('working directory parent is obsolete!\n')) |
|
685 if (not ui.quiet) and obsolete.isenabled(repo, commandopt): |
|
686 ui.warn(_('(use "hg evolve" to update to its successor)\n')) |
|
687 |
681 @eh.wrapcommand("update") |
688 @eh.wrapcommand("update") |
682 @eh.wrapcommand("parents") |
|
683 @eh.wrapcommand("pull") |
689 @eh.wrapcommand("pull") |
684 def wrapmayobsoletewc(origfn, ui, repo, *args, **opts): |
690 def wrapmayobsoletewc(origfn, ui, repo, *args, **opts): |
685 """Warn that the working directory parent is an obsolete changeset""" |
691 """Warn that the working directory parent is an obsolete changeset""" |
686 def warnobsolete(): |
692 def warnobsolete(): |
687 if repo['.'].obsolete(): |
693 _warnobsoletewc(ui, repo) |
688 ui.warn(_('working directory parent is obsolete!\n')) |
|
689 if (not ui.quiet) and obsolete.isenabled(repo, commandopt): |
|
690 ui.warn(_('(use "hg evolve" to update to its successor)\n')) |
|
691 wlock = None |
694 wlock = None |
692 try: |
695 try: |
693 wlock = repo.wlock() |
696 wlock = repo.wlock() |
694 repo._afterlock(warnobsolete) |
697 repo._afterlock(warnobsolete) |
695 res = origfn(ui, repo, *args, **opts) |
698 res = origfn(ui, repo, *args, **opts) |
696 finally: |
699 finally: |
697 lockmod.release(wlock) |
700 lockmod.release(wlock) |
|
701 return res |
|
702 |
|
703 @eh.wrapcommand("parents") |
|
704 def wrapparents(origfn, ui, repo, *args, **opts): |
|
705 res = origfn(ui, repo, *args, **opts) |
|
706 _warnobsoletewc(ui, repo) |
698 return res |
707 return res |
699 |
708 |
700 # XXX this could wrap transaction code |
709 # XXX this could wrap transaction code |
701 # XXX (but this is a bit a layer violation) |
710 # XXX (but this is a bit a layer violation) |
702 @eh.wrapcommand("commit") |
711 @eh.wrapcommand("commit") |