update hook: how to obtain files

Matt Mackall mpm at selenic.com
Mon Oct 3 14:22:06 CDT 2011

On Mon, 2011-10-03 at 21:15 +0200, Johan Samyn wrote:
> Hi,
> I have a repo with the pbranch extension enabled, where I'm doing kind
> of task based development. For the project we are working on,
> intermediate compiled code is stored in the sourcetree, with the
> sources. That intermediate code is not automatically recompiled when
> executed,  the runtime simply uses the intermediate compiled version
> when it finds one. So when I change branches, I have intermediate code
> that is not in sync with the sources. This is all on Windows, btw.
> That's why I would like to obtain the list of all the files that are in
> the update, from an (post-)update hook. So I can delete the wrong
> intermediate code files (they will be recompiled automatically the first
> time a source is saved by the used ide, or when it is first executed). I
> tried Google first, but didn't find what I was looking for (or my search
> patterns were just wrong :-( ). So can anyone please give me any hints
> on how I can do that ?

Unfortunately, the update hook doesn't tell you what changeset you're
coming -from-, so it's hard to calculate the difference. If you knew
both the starting and ending changeset, then you could do:

 hg status --rev start:end

to find the changes. If you add a pre-update hook, you can record the
current cset for this purpose.

Mathematics is the supreme nostalgia of our time.

More information about the Mercurial-devel mailing list