RFC: Shell Aliases and Arguments

Steve Losh steve at dumbwaiterdesign.com
Sat Aug 21 16:36:52 CDT 2010


On Aug 21, 2010, at 4:03 PM, Isaac Jurado wrote:

> Replying Steve Losh:
>> 
>> I'm looking for comments on how people think this should work (and
>> hopefully how we can implement it).  There are a few options Martin
>> and I talked about:
> 
> I've been following the previous thread related to this topic and,
> without any intention to be or seem rude, I'm unable to understand the
> need of this feature at all.
> 
> I don't know how many people are in my situation, but a better example
> than "lsroot" would be greatly appreciated.

Sure, here's a few from my current ~/.hgrc.  I'm sure I'll come up with more once over time:

    # Count the changesets in a given revset
    count = !hg log -r '\$@' --template='.' | wc -c | sed -e 's/ //g'

    # Make a new repo with some sensible defaults
    mkrepo = !$HG init $1 && cd $1 && \
              echo 'syntax: glob'  > .hgignore && \
              echo ''             >> .hgignore && \
              echo '.DS_Store'    >> .hgignore && \
              echo '*.pyc'        >> .hgignore && \
              echo '*.swp'        >> .hgignore && \
              echo '*.swo'        >> .hgignore && \
              echo '*.un~'        >> .hgignore && \
              echo "[paths]\n" >> .hg/hgrc

    # Empty out the current MQ patch
    qempty = !$HG qrefresh -X `$HG root`

    # Commit under the current MQ patch(es)
    # (will save your place in the queue and returns there once finished)
    # ciunder will open an editor for the message,
    # cmunder will take a message from the command line.
    ciunder = !HG_CUR_PATCH=`$HG qtop --color=never` && \
               $HG qnew temp-for-under && \
               $HG qpop -a && \
               $HG qpush --move temp-for-under && \
               $HG qrefresh -e && \
               $HG qfinish temp-for-under && \
               $HG qpush $HG_CUR_PATCH
    cmunder = !HG_CUR_PATCH=`$HG qtop --color=never` && \
               $HG qnew temp-for-under && \
               $HG qpop -a && \
               $HG qpush --move temp-for-under && \
               $HG qrefresh -m "$@" && \
               $HG qfinish temp-for-under && \
               $HG qpush $HG_CUR_PATCH

    # Edit this repo's hgrc file
    erc = !$EDITOR `$HG root`/.hg/hgrc

    # Simple bug/todo tracking
    # Install t first: http://bitbucket.org/sjl/t/
    bug = !~/lib/t/t.py --task-dir="`$HG root`" --list=BUGS $@
    todo = !~/lib/t/t.py --task-dir="`$HG root`" --list=TODO $@

> 
> Regards.
> 
> -- 
> Isaac Jurado
> 
> "The noblest pleasure is the joy of understanding."
>                                  Leonardo da Vinci



More information about the Mercurial-devel mailing list