dotfiles / hgrc

[ui]
username = Steve Losh <steve@stevelosh.com>
editor = vim
commitsubrepos = False
ignore = ~/.hgignore

[extensions]
transplant = 
graphlog =
record = 
bookmarks = 
rebase = 
purge = 
mq = 
patchbomb =
extdiff = 
color = 
parentrevspec =
schemes = 
progress =
fetch =
prompt   = ~/lib/dotfiles/mercurial/hg-prompt/prompt.py
histedit = ~/lib/dotfiles/mercurial/histedit/hg_histedit.py
hggit    = ~/.hg-git/hggit

[progress]
delay = 1.0

[web]
cacerts = /etc/hg-dummy-cert.pem

[schemes]
webf = ssh://sjl@sjl.webfactional.com/repos/
bbs = ssh://hg@bitbucket.org/
bbss = ssh://hg@bitbucket.org/sjl/
bbsd = ssh://hg@bitbucket.org/dwaiter/
gh = git://github.com/
ghs = git+ssh://git@github.com/
cb = ssh://hg@codebasehq.com/
cbdw = ssh://hg@codebasehq.com/dwaiter/
cbsl = ssh://hg@codebasehq.com/stevelosh/
dwd = ssh://hg@bitbucket.org/dwaiter/
nyh = ssh://sjl@gotham.nyhacker.org/
dl = ssh://hg@hg.dwaiter.com:38038/
mirr = ssh://hg@dwaiter.com:38038/mirror/
gc = https://code.google.com/p/

[diff]
git = True
unified = 5

[extdiff]
cmd.vd = vim
opts.vd = -c 'set lines=70' -c 'set columns=240' '+next' '+execute "DirDiff" argv(0) argv(1)'
cmd.ksdiff = /usr/local/bin/ksdiff
opts.ksdiff = --changeset --wait --filelist

[merge-tools]
splice.executable = vim
splice.args = -f $base $local $other $output -c 'SpliceInit'
splice.premerge = keep
splice.priority = 1

keepthat.executable = sh
keepthat.args = -c 'cp "$local" "$output.original" && cp "$other" "$output"'
keepthat.premerge = True

keepthis.executable = sh
keepthis.args = -c 'cp "$other" "$output.incoming" && cp "$local" "$output"'
keepthis.premerge = True

kal.executable = /usr/local/bin/ksdiff
kal.args = --merge --output $output --base $base -- $local $other

[email]
method = smtp
from = Steve Losh <steve@stevelosh.com>

[smtp]
host = smtp.gmail.com
port = 587
username = steve@stevelosh.com
tls = True

[color]
status.modified = cyan
status.added = green
status.removed = red
status.deleted = yellow bold underline
status.unknown = magenta bold underline
status.ignored = black bold
diff.diffline = none
diff.extended = cyan
diff.file_a = red
diff.file_b = green
diff.hunk = yellow bold
diff.deleted = red
diff.inserted = green
diff.changed = white
diff.trailingwhitespace = white_background

[bookmarks]
track.current = True

[defaults]
rebase = --keepbranches
addremove = --similarity 100

[alias]
# Nudge: just push the current branch.
nudge = push --branch .

# Some useful little aliases.
st = status -SC
? = summary
fdiff = diff -U 10000000000000
qfdiff = qdiff -U 10000000000000

# Push to the git mirror at the same time.
pg = !"$HG" push && "$HG" push git

# Push the qparent revision (mnemonic: q push parent).
qpp = push -r qparent

# Merge with default.
md = merge default

# Commit message shortcuts.
cm = commit -m
cus = commit -m 'Update subrepository state.'
cuf = commit -m 'Update fixtures.' -I '**fixtures**.json'
cmm = commit -m 'Merge.'
cws = commit -m 'Whitespace.'

# Merge shortcuts.
mergelocal = !$HG --config ui.merge=internal:local merge $@
mergeother = !$HG --config ui.merge=internal:other merge $@
mergefail = !$HG --config ui.merge=internal:fail merge $@

# Shortcuts to resolve merge conflicts by taking one side or the other.
takelocal = !"$HG" revert --rev 'p1()' $@ && "$HG" resolve -m $@
takeother = !"$HG" revert --rev 'p2()' $@ && "$HG" resolve -m $@

# Diff.
d = diff -p --color=auto

# Run a colored diff and pipe it to less.
dl = !"$HG" diff -p --color=always $@ | less -R

# Kaleidoscope
# Mnemonics: "kaleidoscope diff" and "kaleidoscope show"
kd = !/opt/local/bin/hg ksdiff $@
ks = !/opt/local/bin/hg ksdiff -c $@

# Log shortcuts --------------------------------------------------------------------
#
# Each of these can be used with -v to add a bit more info.

# Datelog: short, pretty hg log with dates.
dlog = log --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.dlog
_ = dlog -l15
__ = _ -l100000000
o_ = outgoing -n --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.dlog
i_ = incoming -n --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.dlog

# Shortlog: short, pretty hg log.
slog = log --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.slog
. = slog -l15
.. = . -l100000000
o. = outgoing -n --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.slog
i. = incoming -n --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.slog

# Short graphlog: short, pretty hg log with a graph.
sglog = glog --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.sglog
, = sglog -l7
,, = , -l100000000
o, = outgoing --graph --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.sglog
i, = incoming --graph --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.sglog


# hg n .     -- show a summary of rev . without diff.
# hg show .  -- show a summary of rev . with diff.
# hg sl .    -- show a summary of rev . with diff, piped to less
nlog = log --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.nlog
n = nlog -vr
show = nlog --color=always -vpr
sl = !"$HG" nlog --color=always -vpr $@ | less -R

# Simple glog command that doesn't look bad and doesn't require my CLI templates.
gl = glog -l10 --template='\033[0;33m{rev}\033[0m {desc|firstline|strip} \033[0;35m{branches}\033[0m \033[0;33m{tags}\033[0m\n\033[1;30m({date|age} by {author|person})\033[0m\n\n'

# 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 '.ropeproject' >> .hgignore && \
          echo 'tags'         >> .hgignore && \
          echo "[paths]\n" >> .hg/hgrc

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

# Commit under any applied MQ patches, and go back to where you were after doing so.
# `hg ciunder` will use `$EDITOR` to get the commit message
# `hg cmunder 'message'` takes it on 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 the current repo's hgrc file.
erc = !$EDITOR `$HG root`/.hg/hgrc

# Simple bug/todo tracking
# Idea from Justin: http://gist.github.com/464871
# 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 $@

# Easily add ignore patterns to .hgignore and commit.
ignore = ![ -n "$@" ] && echo '$@' >> `$HG root`/.hgignore && \
          $HG commit `$HG root`/.hgignore -Am 'Add "$@" to .hgignore.'

# Show in Vim
vshow = !$HG show $@ | vim -c ':AnsiEsc' -c 'setlocal buftype=nofile' -
vdiff = !$HG diff -p --color=always $@ | vim -c ':AnsiEsc' -c 'setlocal buftype=nofile' -

# Ack for non-ignored files
ack = !$HG locate "set:not ignored()" | xargs ack $@
grep-wdir = !$HG locate "set:not ignored()" | xargs grep $@

# Run hg commands on all subrepos at once.
subs  = !"$HG" debugsub | grep '^path' | cut -d' ' -f2 | xargs    -n1  -I SUB $HG -R "`$HG root`/SUB" $@
psubs = !"$HG" debugsub | grep '^path' | cut -d' ' -f2 | parallel -j10 -I SUB $HG -R "`$HG root`/SUB" $@

# Run shell commands on all subrepos at once.
subscmd  = !"$HG" debugsub | grep '^path' | cut -d' ' -f2 | xargs    -n1  -I SUB sh -c "cd `$HG root`/SUB && $@"
psubscmd = !"$HG" debugsub | grep '^path' | cut -d' ' -f2 | parallel -j10 -I SUB sh -c "cd `$HG root`/SUB && $@"

# Run a command on a subrepo:
#
#     hg sub SUBREPO_REGEX ...command and arguments...
#
# The SUBREPO_REGEX should be a regex that will let grep match one and only one of
# the subrepos in .hgsub.  For example:
#
#     $ cat .hgsub
#     bundled/foo = ...
#     bundled/bar = ...
#
#     $ hg sub fo root
#     .../bundled/foo
#     $ hg sub ar status -m
#     M lol.py
sub = !grep = "`$HG root`/.hgsub" | cut -d' ' -f1 | grep "$1" | tr -d '\n ' | xargs -0 -I SUB $HG -R SUB $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 $20

# Local settings
%include ~/.hgrc_local
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.