简体   繁体   中英

How do you find the changesets between two tags in mercurial?

If I have two tags named 2.0 and 2.1, how do I find the changeset messages between the two? I'm trying to find to a way to use HG make release notes and list the different messages associated with the commits.

Example Changeset:

changeset: 263:5a4b3c2d1e user: User Name <user.name@gmail.com> date: Tue Nov 27 14:22:54 2018 -0500 summary: Added tag 2.0.1 for changeset 9876fghij

Desired Output:

Added tag 2.1 for changeset 67890pqrst Change Info... Added tag 2.0.1 for changeset 9876fghij Change Info... Added tag 2.0 for changeset klmno12345

Preface

"Any challenge has a simple, easy-to-understand wrong decision". And Boris's answer is a nicest illustration for this rule: "::" topo-range will produce good results only in case of pure single-branch development (which is, in common, The Bad Idea (tm) anyway)

Face

Good solution must correctly handle complex DAGs and answer on question "New changesets included in NEW, missing in OLD (regardless of the nature of occurrence)"

For me it's "only()" functions in revsets with both parameters

"only(set, [set])"

Changesets that are ancestors of the first set that are not ancestors of any other head in the repo. If a second set is specified, the result is ancestors of the first set that are not ancestors of the second set (ie ::set1 - ::set2).

hg log -r "only(2.1,2.0)"

maybe for better presentation powered by predefined style "changelog"

hg log -r "only(2.1,2.0)" -s changelog

or custom style|template

You'll want to use a revset to select all changesets between two tags, for example: 2.0::2.1 will likely do the trick. You can validate the selected changesets by running: hg log -G -r '2.0::2.1' . (See hg help revset for more information about revsets).

Once you have the right selected changesets, you can now apply a template to retrieve only the needed information. For example if you only want the first line of changeset description, you can do hg log -r '2.0::2.1' -T '{desc}\\n' for the whole description or hg log -r '2.0::2.1' -T '{desc|firstline}\\n' only for the first line of each changeset description.

If you want to add even more information, hg help template is your friend.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM