I'm writing my blog system(django), and my blog files are VCSed by mercurial,
I want get files create/update time, how could I do this by using commandline or python?
edit: this is a example:
$ SOME_COMMAND
xxx.txt 2010-12-13-04:12:12 2010-12-14:04:12:12
xyx.txt 2010-12-13-04:12:12 2010-12-14:04:12:12
xxy.txt 2010-12-13-04:12:12 2010-12-14:04:12:12
yxx.txt 2010-12-13-04:12:12 2010-12-14:04:12:12
yyx.txt 2010-12-13-04:12:12 2010-12-14:04:12:12
Use the command hg update to switch to an existing branch. Use hg commit --close-branch to mark this branch head as closed. When all heads of a branch are closed, the branch will be considered closed. Returns 0 on success.
A quick overview of the basic commands: hg init: create a new repository. hg commit: save your changes in the current repository.
A simple way to 'uncommit' your last commit is to use hg strip -r -1 -k. In case the link breaks, the documentation mentioned by @phb states: hg rollback Roll back the last transaction (DANGEROUS) (DEPRECATED) Please use 'hg commit --amend' instead of rollback to correct mistakes in the last commit.
To get the most recent modification time of a file:
hg log --template '{date}' -l 1 path/to/file
and to get the creation time:
hg log --template '{date}' -r 0:tip -l 1 README
Example output:
$ hg log --template '{date}' -r 0:tip -l 1 README
1115154970.028800
$ hg log --template '{date}' -l 1 README
1255462070.025200
Those date values are unix epoc seconds followed by a dot and a timezone offset. You can pretty format them using various filters described in hg help templates
like this:
$ hg log --template '{date|rfc822date}' -l 1 README
Tue, 13 Oct 2009 12:27:50 -0700
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With