Get the dates of pull and update in Mercurial

dvcs, mercurial, pull

Solution

This information is not recorded by Mercurial. A Mercurial repository is just a container for changesets and Mercurial does not store how (or when) the changesets entered the repository.

You can setup hooks for this, though you would have to build the scripts yourself. A very rudimentary system would be

[hooks]
pre-pull = (date; hg root; hg tip) >> ~/.pull-log
post-pull = hg tip >> ~/.pull-log

This would record the current date, the current repository, and the current tip in `~/.pull-log` just before every `hg pull`. After the pull the new tip is recorded. You could build scripts that parse the log file to extract information about what each pull did.

`hg log` seems to give the dates of the commits, but nothing about the updates

Yes, `hg log` is only concerned with the stored history (changesets) and working copy operations like updating is not part of recorded history.

Finally, let me mention that this is the first time I've seen someone ask for a "pull log". However, the opposite is quite common: there are scripts for maintaining a "push log" on a server to see who pushed what and when. This is done by Mozilla among others. See this README for some starting instructions.

Problem

Is it possible to know when a certain commit was pulled from a distant repository and the files updated with Mercurial ? More precisely, I made a `hg pull -u` a few days ago, and now I'd like to know if this pull downloaded only the last commit, or if there were some commits that had not been pulled yet, making my last pull getting them as well. `hg log` seems to give the dates of the commits, but nothing about the updates. Is this information anywhere ?

Original source