2761
Comment: 1.3 notice
|
3715
hint on differences with timestamp_update
|
Deletions are marked like this. | Additions are marked like this. |
Line 6: | Line 6: |
Download site: http://bitbucket.org/face/timestamp/ (Developed with Mercurial 1.1.2 - works up to 1.3) | Download site: http://bitbucket.org/face/timestamp/ (Developed with Mercurial 1.1.2 - works up to 1.3 until revision [[http://bitbucket.org/face/timestamp/src/12e14f81d23d/timestamp.py|13:12e14f81d23d]] - works with 1.4 up to 1.5 from revision [[http://bitbucket.org/face/timestamp/src/6ea28b25c44f/timestamp.py|16:6ea28b25c44f]]) |
Line 12: | Line 12: |
For an alternative approach to the timestamping problem, please take a look at Esben Skovenborg's [[http://bitbucket.org/esskov/hg_timestamp_update|timestamp hook]]. (quick differences: does not use ''mtime'', but commit time; no selection of files possible) |
|
Line 35: | Line 38: |
Unfortunately, this hook reference will not work with TortoiseHg. You will have to either: a. insert the timestamp.py file properly into the library.zip archive or a. use the following reference instead: {{{update.timestamp = python:<DRIVELETTER>:\path\to\timestamp.py:hook}}} ^This workaround has been provided by Rob Maris.^ |
|
Line 36: | Line 45: |
The preprecommit hook only saves timestamps for modified or added files. To save the current timestamps for __all__ files in the database, use the timestamp command with the save option: | The preprecommit hook saves timestamps for files in the database that are: a. modified or added during a commit without patterns specified or a. matched by the patterns specified in a commit. To save the current timestamps for __all__ files in the database, use the timestamp command with the save option: |
Timestamp Extension
This extension is not distributed with Mercurial.
Author: Friedrich Kastner-Masilko
Download site: http://bitbucket.org/face/timestamp/ (Developed with Mercurial 1.1.2 - works up to 1.3 until revision 13:12e14f81d23d - works with 1.4 up to 1.5 from revision 16:6ea28b25c44f)
This extension is still in alpha, use it at your own risk.
Overview
This extension saves and restores timestamps for files. It does this by means of a database file .hgtimestamp, residing in the repo's root and thus being versioned. The extension forces a hook/wrapping of the commit operation, updating the timestamp database before commiting. It additionally provides a postupdate hook for restoring the timestamps on update to another changeset and a command for explicit save and restore.
For an alternative approach to the timestamping problem, please take a look at Esben Skovenborg's timestamp hook. (quick differences: does not use mtime, but commit time; no selection of files possible)
Specifying tracked files
To start tracking timestamps of files, add a .hgtimestamp text file to your repo's root. Edit the file with a text editor and add a line for each file you want to track. Simply put the file's path - as it appears in the output of Mercurial's status command - in this line.
The extension edits this database file by means of adding the timestamp as double value to each line - comma separated. Files that can't be found will be ignored.
To stop tracking a file, simply remove it's line from the file.
For an initial commit of the .hgtimestamp file you can use the "hg timestamp -s" command to timestamp all specified files.
Configuration
Configure your .hgrc to enable the extension by adding following lines:
[extensions] timestamp = path/to/timestamp.py
This will already install the preprecommit hook. To additionally enable the postupdate hook for restoring the timestamps on update to another changeset, add the following lines:
[hooks] update.timestamp = python:hgext.timestamp.hook
Unfortunately, this hook reference will not work with TortoiseHg. You will have to either:
- insert the timestamp.py file properly into the library.zip archive or
use the following reference instead: update.timestamp = python:<DRIVELETTER>:\path\to\timestamp.py:hook
This workaround has been provided by Rob Maris.
Command Usage
The preprecommit hook saves timestamps for files in the database that are:
- modified or added during a commit without patterns specified or
- matched by the patterns specified in a commit.
To save the current timestamps for all files in the database, use the timestamp command with the save option:
hg timestamp -s
The postupdate hook automatically restores timestamps, if you update to another changeset. If you want to revert individual files and restore their timestamps without updating to a complete changeset, you can use the timestamp command with the restore option:
hg revert -r <changeset> FILE hg revert -r <changeset> .hgtimestamps hg timestamp -r
Unfortunately, this will restore the timestamps of all tracked files to the reverted changeset's status. An addition to define the file to be restored is on the TODO list.
To list the timestamps stored in the repo, use the timestamp command without options:
hg timestamp