This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Generating a list of which files changed between hg versions
hg diff -r 5 -r 10 will give the differences between revisions 5 and 10. But I want to see specifically just a list of files that are different - I don't want to see the full diffs. Is there a quick way to do this?
hg status can do this.
The main purpose of hg status is showing modified files in the working directory (in comparison to the last commit).
But you can use the --rev parameter to let it compare two specific revisions instead, like this:
hg status --rev 5 --rev 10
Related
This question already has answers here:
Mercurial Remove History
(2 answers)
Closed 2 years ago.
I want to ask a question about Hg.
You can see the picture that there is a branch from 196 to 199, and now I want to remove the branch in the server version and use the 195 as the newest version, could you please tell me how to do that?
Thank you so much!
If 196:199 was already pushed to remote, you can't delete this branch (check hg out or phases of these revisions)
If 196:199 are pure local, you can just simply hg strip not needed anymore anonymous branch
Anyway, you can:
Dummy merge r199 into r195 and continue work
Forget about branch, and continue your work from 195 (first push with new child-commit of 195 will require -f due to new head in branch)
This question already has an answer here:
How to push just one specific patch in Mercurial Queues?
(1 answer)
Closed 6 years ago.
I have two patches:
patch1
patch2
When I apply patch1, that is the only thing that gets applied. When I do hg qpop and then do hg qpush patch2, for some reason patch1 gets applied too. How can I make them independent from each other?
You need to use the --move option for that. For example:
hg qpush --move patch2
This will apply only patch2, but not any patches on top of it.
This question already has answers here:
How to change the default branch to push in mercurial?
(3 answers)
Closed 6 years ago.
I would like to configure Mercurial to push the commits on the current branch only, instead of all draft commits - much like Git does when the push.default is set to simple. I scanned the hgrc manual page, but couldn't locate the option which enforces this. How is it called?
Although deprecated, you can set defaults for commands in hgrc:
[defaults]
push = -r .
The recommended alternative is aliases:
[alias]
pushcurrent = push -r .
This question already has an answer here:
Are my changes gone after "hg revert"?
(1 answer)
Closed 8 years ago.
After I had accidentally added several files with
hg add
I wanted to revert that with
hg revert --all
Unfortunatelly I hadn't committed my intended changes so they were reverted as well. Can I get that content back?
You did not specify the --no-backup, so there should be backup files right next to the actual file.
Documentation to support this
Modified files are saved with a .orig suffix before reverting. To disable these backups, use --no-backup.
I'd like to search the diffs of one file (ideally a set of files) for a specified set of revisions (or all). I'm looking for a diff report that is text searchable. I've got this:
hg diff -r 0:47131 .\TheFile.cs | grep 'theSearch' -Context 50
OK, that works well enough, but deciding how much context to include is an issue as well as finding the first and last revision. I can automate this better but it seems like it'll be a bit of work.
I'm wondering if there's a tool out there that will do this better. Maybe a diff report web page for the hg server?
You can use hg grep to search the entire repo history.
For example:
hg grep --all --include .\TheFile.cs 'theSearch'
will find all instances of 'theSearch' in every revision of the repo. Without the --all flag, it stops at the first revision that includes the string.
I've a feeling that hg grep searches the contents of the entire file for every matching revision. Whereas if you want to search only the diff, try something like this:
hg log --template "{ifcontains('TODO', diff(), '{node} {desc}\n', '')}"
This will list revisions containing "TODO" in their diff. Note this will also search lines removed as well as the diff context (+/- 3 lines), so it's not perfect.
You can restrict further using args to diff() - see hg help template - and using revsets (-r ...).
This may be better than using your hg diff | grep approach because it diffs each changeset one by one rather than diffing the entire repo across two changesets, and allows you to use revsets to filter out merge revisions, for example.