614 @eh.wrapcommand("update") |
614 @eh.wrapcommand("update") |
615 @eh.wrapcommand("parents") |
615 @eh.wrapcommand("parents") |
616 @eh.wrapcommand("pull") |
616 @eh.wrapcommand("pull") |
617 def wrapmayobsoletewc(origfn, ui, repo, *args, **opts): |
617 def wrapmayobsoletewc(origfn, ui, repo, *args, **opts): |
618 """Warn that the working directory parent is an obsolete changeset""" |
618 """Warn that the working directory parent is an obsolete changeset""" |
619 res = origfn(ui, repo, *args, **opts) |
619 def warnobsolete(): |
620 if repo['.'].obsolete(): |
620 if repo['.'].obsolete(): |
621 ui.warn(_('working directory parent is obsolete!\n')) |
621 ui.warn(_('working directory parent is obsolete!\n')) |
|
622 wlock = None |
|
623 try: |
|
624 wlock = repo.wlock() |
|
625 repo._afterlock(warnobsolete) |
|
626 res = origfn(ui, repo, *args, **opts) |
|
627 finally: |
|
628 lockmod.release(wlock) |
622 return res |
629 return res |
623 |
630 |
624 # XXX this could wrap transaction code |
631 # XXX this could wrap transaction code |
625 # XXX (but this is a bit a layer violation) |
632 # XXX (but this is a bit a layer violation) |
626 @eh.wrapcommand("commit") |
633 @eh.wrapcommand("commit") |