Mercurial > hgrepos > DevTools > mercurial-extensions
changeset 218:069be0a64afc
Further work on the update hook
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Thu, 18 Oct 2018 09:39:14 +0200 |
| parents | d5db5da1c411 |
| children | 22244ee82c55 |
| files | extensions/timestamps.py |
| diffstat | 1 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/extensions/timestamps.py Wed Oct 17 17:40:49 2018 +0200 +++ b/extensions/timestamps.py Thu Oct 18 09:39:14 2018 +0200 @@ -680,6 +680,27 @@ yield i +def update_hook(ui, repo, hooktype, **kwds): + ui.debug("UPDATE: " + repr(kwds) + '\n') + p1 = kwds.get("parent1") + p2 = kwds.get("parent2") + error = kwds.get("error") + if not repo.local(): + ui.debug("update.timestamps: repo is not local\n") + return + wctx = repo[None] + tsmatch = gen_matcher(repo, wctx) + if tsmatch is not None: + ts = Timestamps.from_ctx(wctx, ui, name=TIMESTAMPS_DATABASE) + if ts is None: + ui.warn(_("update.timestamps: timestamps database file could not be found or read\n")) + else: + # XXX TBD + pass + else: + ui.debug("update.timestamps: timestamps not activated/configured\n") + + def reposetup(ui, repo): class TimestampedRepo(repo.__class__): @@ -781,3 +802,9 @@ **kwds) repo.__class__ = TimestampedRepo + + ui.setconfig('hooks', 'update.timestamps', update_hook) + + +def uisetup(ui): + pass
