Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In mercurial how can I find changesets that contain a string?

Let's say I have the following revisions:

rev 1:
+ Dim Foo as integer

rev 2:
+ I like big butts, I cannot lie

rev 3
- Dim Foo as integer

Foo is in rev 1 & 2, and removed from three. What command can I issue that will return all changesets that Foo was added or deleted?

Ideally I'd like to be able to do this from toroisehg as well

like image 774
WhiskerBiscuit Avatar asked Mar 15 '12 18:03

WhiskerBiscuit


People also ask

What is Mercurial changeset?

A changeset (sometimes abbreviated "cset") is an atomic collection of changes to files in a repository. It contains all recorded local modification that lead to a new revision of the repository. A changeset is identified uniquely by a changeset ID. In a single repository, you can identify it using a revision number.

How do I change commit message in Mercurial?

Since version 2.2, the commit command has a --amend option that will fold any changes into your working directory into the latest commit, and allow you to edit the commit message. hg commit --amend can in fact be used on any changeset that is a (topological) branch head, that is, one that has no child changesets.

What is hg command?

Description. The hg command provides a command line interface to the Mercurial system.

What is hg command in ubuntu?

DESCRIPTION. The hg command provides a command line interface to the Mercurial system.


1 Answers

You can use the grep command :

hg grep --all Foo

To address Lazy Badger concerns in comments.

$ hg init
$ echo "Dim Foo as integer" > test 
$ hg commit -m "1"
$ echo "I like big butts, I cannot lie" > test 
$ hg commit -m "2"
$ echo "Dim Foo as integer" > test 
$ hg commit -m "3"
$ hg grep --all Foo

The output of the grep command is :

test:2:+:Dim Foo as integer
test:1:-:Dim Foo as integer
test:0:+:Dim Foo as integer

Which means, Foo was first seen in the file test on revision 0 (the + sign tells us that), then it dissapeared on revision 1 (the - signs), and reappear again on revision 2.

I don't know if it is what you want, but it clearly indicates revision on which the searched word was added or deleted.

like image 64
krtek Avatar answered Oct 07 '22 16:10

krtek