Reputation: 165
With repos laying around waiting to be checked in, people merging branches at random time, and general mayhem, I need to figure out exactly what(which changesets) was at the tip of main branch at the time of release (label/revision). And I have to do it retroactively and automatically. It seems like a basic thing that should be able to be achievable with hg log, but I can't figure out how. Please help!
With @planetmaker advice, I've tried the following, and it seems to be working!
hg log -r "branch(default) and ::HashNumber"
Upvotes: 0
Views: 32
Reputation: 6044
The answer to your problem lies in the use of revsets. Checkout hg help revset
for a complete list of what you can do with them.
If you are interested in the changeset last changeset in BRANCHNAME prior to a certain time: hg log -r"last(date(<2012-01-01)) and branch(BRANCHNAME)"
(hg help dates
for options how to define the date, including exact time).
Now, if you want to use this information in a script you do not want the full log output, but just the revision or hash itself. Use the template capability to format output. Thus amend the log call appropriately:
hg log -r"last(date(<2012-01-01)) and branch(BRANCHNAME)" --template="{node|short}\n"
in order to only get the hash. Or use {rev}
for the numerical changeset version (which is local to that very repo only, though); see hg help templates
for a full list of what you can output.
Upvotes: 1