Get pull and update dates in Mercurial

Can I find out when a particular commit was checked out from a remote repository and files updated by Mercurial?

More precisely, I did a hg pull -u few days ago, and now I would like to know if this application downloaded only the last commit or if there were any commits that have not yet been extracted, which makes my last pull them as well.

hg log seems to date commit dates, but nothing about updates. Is this information anywhere?

+6
source share
2 answers

This information is not recorded by Mercurial. The Mercurial repository is just a container for changesets, and Mercurial does not store how (or when) changes were made to the repository.

You can configure hooks for this, although you will have to create 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 will record the current date, the current repository, and the current tip in ~/.pull-log just before each hg pull . After drawing out a new tip is recorded. You could create scripts that parse the log file to retrieve information about what each click did.

hg log seems to date commit dates, but nothing about updates

Yes, hg log refers only to the saved history (change sets), and copy operations such as updating are not part of the recorded history.

Finally, let me mention that this is the first time I have seen someone ask for a β€œpull magazine”. However, it is quite common: there are scripts to support the "push log" on the server to find out who was pushing what and when. This is done by Mozilla and others. See this README for some getting started instructions.

+8
source

If you want to register when and with what version of the hg update was used to update the code, use the following buttons:

 [hooks] pre-update = (echo "---------------------------------"; date --rfc-3339=s; hg root; echo "pre-update:"; hg identify --id --branch) >> .hgupdates post-update = (echo "post-update:"; hg identify --id --branch) >> .hgupdates 

the hooks above create a log entry, as it happens every time the hg update starts:

 2015-12-23 00:44:31+02:00 /var/www/my/project pre-update: 802120d1d3a0 somebranch post-update: 302720d1d3d2 otherbranch 

This also works when the hg update is done without a specific check flag (-r) set

+1
source

Source: https://habr.com/ru/post/913418/


All Articles