Q:

mercurial hg partial checkin

It is a very simple and stupid question,
I am working on 2 tasks and modified 2 sets of files in the code.
Now when I type 'hg ci', it checks in all the files. Can I remove certain files from the checkin i.e. do checking for only one task?
If I remove the files in the 'check in message' will they be removed from the checkin
Thanks for all the answers
This seems like a big flaw, My use case is very simple and general. Most of the time dev are working on various tasks , some are ready , some are not, bug fixes etc.
Now the only simple solution seems to be multiple local repos or clones

A:

Use hg ci <files>... to commit only certain files in your working directory.

A:

If you want to pick file by file you can use the record command.  It ships with mercurial, but you have to turn it on if you want to use it by putting: record= in the [extensions] section of your ~/.hgrc.
It goes hunk by hunk, but you can answer for a whole file:
y - record this change
n - skip this change

s - skip remaining changes to this file
f - record remaining changes to this file

d - done, skip remaining changes and files
a - record all changes to all remaining files
q - quit, recording no changes

? - display help

I'll point out that if you're committing some files but not others it's certain that you've not run your test suite on the one change without the other, but maybe that doesn't apply in your case.

A:

This isn't possible with mercurial out of the box. As have been suggested there are several ways of selecting what files you want to commit. To get this function via the commit message template, you would need an extension or a shell script wrapping the commit command.  Here's one way to do that:
[alias]
ci = ! hg-partial-commit

hg-partial-commit:
#!/bin/sh
# partial commit

edit=$(mktemp ${TMPDIR:-/tmp}/$(basename $0).XXXXXXXXXXXX)
filelist=$(mktemp ${TMPDIR:-/tmp}/$(basename $0).XXXXXXXXXXXX)
logmessage=$(mktemp ${TMPDIR:-/tmp}/$(basename $0).XXXXXXXXXXXX)
cleanup="rm -f '$edit' '$filelist' '$logmessage'"
trap "$cleanup" 0 1 2 3 15

(
    echo user: $(hg debugconfig ui.username)
    echo branch: $(hg branch)
    hg parents --template 'parent: {rev}:{node|short}  {author}  {date|isodate}\n'
    echo
    echo 'Enter commit message.  Select files to commit by deleting lines:'
    hg status 'set:not unknown()' | sed -e 's/^/@/'
) | sed -e 's/^/HG: /' >"$edit"

${VISUAL:-${EDITOR:-vi}} "$edit"
egrep -v '^HG:' "$edit" >"$logmessage"
egrep '^HG: @' "$edit" | cut -c8- >"$filelist"

hg commit -l "$logmessage" "listfile:$filelist"
$cleanup

