2782
Comment:
|
← Revision 12 as of 2019-10-31 12:34:16 ⇥
3770
Migrated to OSDN, because Bitbucket decided to eject Mercurial users
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
Line 7: | Line 6: |
Download site: [[http://bitbucket.org/face/timestamp/]] (Developed with Mercurial 1.1.2 - works with 1.2) | Repository: http://hg.osdn.net/view/mercurialextensions/timestamp (Developed with Mercurial 1.1.2 - works up to 1.3 until revision [[http://hg.osdn.net/view/mercurialextensions/timestamp/file/12e14f81d23d/timestamp.py|13:12e14f81d23d]] - works with 1.4 up to 1.5 from revision [[http://hg.osdn.net/view/mercurialextensions/timestamp/file/6ea28b25c44f/timestamp.py|16:6ea28b25c44f]]) |
Line 12: | Line 13: |
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. | |
Line 13: | Line 15: |
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 [[http://bitbucket.org/esskov/hg_timestamp_update|timestamp hook]]. (quick differences: does not use ''mtime'', but commit time; no selection of files possible) |
Line 17: | Line 19: |
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. |
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. |
Line 28: | Line 28: |
Line 35: | Line 34: |
Line 42: | Line 40: |
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 44: | Line 47: |
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. |
|
Line 45: | Line 51: |
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: | To save the current timestamps for __all__ files in the database, use the timestamp command with the save option: |
Line 50: | Line 56: |
Timestamp Extension
This extension is not distributed with Mercurial.
Author: Friedrich Kastner-Masilko
Repository: http://hg.osdn.net/view/mercurialextensions/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