Mercurial Log by file extension - mercurial

I'm trying to find a way to generate a HG log file with history for just certain file types (like *.java). I need the diffs with the log...but again only the .java files.
Thanks

It sounds like you want something like this:
hg log --patch --rev "modifies('**.java')"
See hg help revsets and hg help filesets for information on how to target Mercurial command using specific rules.

Related

Mercurial, how to remove file from repository?

I push in our repository more big video files, my fault, I did not notice them and forgot to add the folder with the video to ignore file. Now my friends can not upgrade because a shortage of memory (abort: out of memory). How do I remove a video from the master repository? I tried to just delete the folder with the video in /home/hg/project/.hg/ But then do not start updating with an error. Help me pliz and sorry for my english/
See the Mercurial FAQ:
4.14. I committed a change containing nuclear launch codes, how do I delete it permanently?
4.15. I committed a large binary file/files, how do I delete them permanently?
There are some options described on the Editing History page as well.
You:
$ hg rm video.ogv
$ hg ci -m "removed video.ogv"
Other:
$ hg pull your-repository
$ hg update
The HG FAQ merely gives a few vague pointers. Here's how to do it:
Add to your .hgrc:
[extensions]
hgext.convert=
[convert]
hg.saverev=false
Create a filemap of what files you want to remove (myfilemap)
exclude "relative/path/to/file.mp4"
Use hg convert to make a new repo
hg convert --filemap myfilemap myrepo myrepo.new
Now you have the new repo without the excluded files.

Mercurial reporting - Revision and file change report available?

I'm looking for a way to view all of a repository's branches and each file that has changed in that branch. I'm not interested in the file level changes as this report is for simple auditing.
Can this be done?
hg log -b <branchname> --template "{files} "
Plus some post-processing, because output will be like this
lang/UTF-8/serendipity_lang_ru.inc.php lang/UTF-8/serendipity_lang_ru.inc.php lang/UTF-8/serendipity_lang_ru.inc.php lang/UTF-8/serendipity_lang_ru.inc.php plugins/serendipity_event_assigncategories/UTF-8/lang_ru.inc.php plugins/serendipity_event_entryproperties/UTF-8/lang_ru.inc.php plugins/serendipity_event_freetag/UTF-8/lang_ru.inc.php plugins/serendipity_event_gravatar/UTF-8/lang_ru.inc.php plugins/serendipity_event_relatedlinks/UTF-8/lang_ru.inc.php plugins/serendipity_event_nl2br/UTF-8/lang_ru.inc.php plugins/serendipity_event_freetag/UTF-8/lang_ru.inc.php
Use hg status to get information about files that have changed between revisions. See the revset language for how to select the revisions.
If you want to see file changes between the first and last changesets on branch B:
$ hg status --rev "min(branch(B)):max(branch(B))"
You can even make an alias for this:
[alias]
audit = status --rev "min(branch($1)):max(branch($1))"
and then use hg audit B to get the same result.

How do I merge local changes if any (other changes otherwise) in Mercurial?

There are two heads on my repository. I have five files that I've edited locally. The Bitbucket repo has 15 changed files that I haven't edited, but it also contains changed versions of the same 5 files.
I'd like to do the following:
1) If I've edited a file and the Bitbucket repo contains the same edited file, I'd like my changes to take preference.
2) If I haven't edited a file, I'd like to update to the latest version.
What sequence of commands in Mercurial will let me do this? Do I have to use an external program?
WITH LOCAL COMMITS
hg pull
hg update --rev ${my version}
hg merge --rev ${their version} --tool internal:local
See also hg help merge-tools
WITHOUT LOCAL COMMITS
hg status -qn gives you a list of files you have changed. Since it's only five files, I'd copy them away manually, then revert, pull, update and copy them back into place. On unix you could write a throw-away shell script, something that goes kinda' like this:
ls -l *.mine # check to see that there are none
for file in `hg status -qn`; do cp ${file} ${file}.mine; done
hg revert --all; hg pull; hg update
for file in *.mine; do cp ${file} ${file%.mine}; done
This is untested code. Run it at your own risk. Eat muffins and be happy.
just do
hg pull
hg merge
This will pull the latest changes from bitbucket and allow you to merge your local changes the way you want.
This is really a basic functionality, you should read some documentation about mercurial, for example HG Init like said in the comments.

Mercurial: make `hg log` not show files?

I'm (ab)using Mercurial to manage thousands of files that change often, but I'd like to be able to view the log (hg log) without having my term filled with all of the filenames that changed on each commit. hg log -q is a little too quiet, since I need to see the descriptions. Is there a flag I'm missing for hg log?
It sounds as if you might have the verbose flag turned on. You can check by running hg showconfig and looking for a line like ui.verbose=true.
There are a few ways you can fix it:
remove that line from the offending configuration file (Mercurial can use several, and they vary by OS: use hg help config to list the possibilities).
override the flag in your repository's .hg\hgrc or your private Mercurial configuration (Mercurial.ini or ~/.hgrc): add the following lines to it:
[ui]
verbose=false
clear the verbose flag on the commandline: hg log --config ui.verbose=false.

Mercurial: Obtain the current changeset of a particular file

What is the easiest way of obtaining the changeset version of a particular file in Mercurial? A similar thing that we did for svn was to run "svn --info" in the command line and then obtain the Revision number. Is there any similar approach for Mercurial?
The concept you're missing is that all files are all the same changeset. Unlike SVN you update your entire working dir, not just folders and files. So you want:
hg id
to get just the rev number and hash, or
hg parents
to get info about the comment your current working dir is at, or
hg summary
for detailed info about what checkout you're at.
Simplest is hg log -l1 path/to/file.