selective file commit in the checkin message

David Champion dgc at uchicago.edu
Tue Jun 11 15:28:52 CDT 2013


* On 11 Jun 2013, riz.plate wrote: 
> I remember that way back I think I could remove the files in the checkin
> message and the cvs would not check those in.
> 
> Do you think it is a good idea for a new feature? i.e. if the files are
> removed from checkin message/template , those files are removed from the
> checkin.

I think that sounds pretty easy to implement in a shell script, if it's
something you need very often.

[alias]
ci = ! hg-selective-commit

-- 
       David Champion • dgc at uchicago.edu • University of Chicago
Enrico Fermi Institute • Computation Institute • USATLAS Midwest Tier 2
-------------- next part --------------
#!/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


More information about the Mercurial-devel mailing list