/
.hgrc
139 lines (123 loc) · 6.49 KB
/
.hgrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
[ui]
username = wren romano <wrengr@google.com>
color = auto
mergemarkers = detailed
# TODO: add a [color] section, namely to change things from google's
# version of "bright" system colors, to the colors we actually want.
# Not sure if the [color256] section is purely google-only (they mention
# the 'terminal256colors' google_hgext subextension), or if it's
# something more public.
[extensions]
# Note: evolve updates the meaning of 'commit --amend' (but not 'commit'
# itself) and also adds the commands: 'uncommit', 'prune', 'touch', 'fold',
# 'split', 'next', 'prev'. For more guidance, see:
# <https://www.mercurial-scm.org/wiki/EvolveExtension>
# <https://www.mercurial-scm.org/doc/evolution/user-guide.html>
# <https://www.mercurial-scm.org/doc/evolution/evolve-faq.html>
evolve =
[commands]
# Make `hg resolve -m` abort if there are conflict markers in the file
resolve.mark-check = abort
# Require destination for `hg update` and `hg rebase`
update.requiredest = true
rebase.requiredest = true
# N.B., Mercurial essentially requires the -FRX flags (afaict, the -X is
# mainly just because of the -F; though there may be something else
# going on that I'm missing). It would use them by default if both
# $PAGER and $LESS are unset, but since we set $PAGER we need to
# explicitly override/extend it here.
[pager]
pager = less -isqFRX
[alias]
rollback = !echo 'ERROR: `rollback` is deprecated. You prolly meant to use `backout` instead'
# This is the most common meaning for which I use the `git oo` alias.
# (N.B., mercurial does have `co` as an alias for update; and `oo`
# originated as a simplification of typing `co` anyways.)
oo = update
# Override the usual `st` abbreviation to ignore untracked (:= unknown |
# ignored) files.
st = status -q
# Diff HEAD against a given change, considering only those files in that change
# FIXME: How to get these to default to '.' when no argument is provided?
rediff = !$HG diff -r $1 -- $($HG status --no-status --change $1)
# Note: there's also (apparently) an alias 'record'='commit --interactive'
# BUG: hg normally has `ci` mean the equivalent of `git commit -a`;
# not sure if this alias will override that or no.
ci = commit --interactive
ca = commit
# N.B., The 'evolve' plugin adds its own 'amend' command/alias which
# modifies the behavior of the standard 'commit --amend', so we want to
# be sure to use that here.
# Note: there's also (apparently) an alias 'camend'='amend --interactive'
ai = amend --interactive
aa = amend
ra = rebase --abort
rc = !$HG resolve --mark && $HG rebase --continue
# TODO: would we ever want a short name for `hg rebase --stop`?
ea = evolve --abort
ec = !$HG resolve --mark && $HG evolve --continue
ma = merge --abort
mc = !$HG resolve --mark && $HG merge --continue
# This gets the short hash of the current revision (for scripting
# purposes). There are various methods for getting the long hash,
# but all of them come with their own problems; cf.,
# <https://stackoverflow.com/q/2485651>
shorthash = id -i
# Note: this is quite different from `hg summary`, but you may be
# interested in that command too.
# Warning: for some reason this seems to take a long time to finish
# after it's printed that one commit.
top = log --stat --limit 1 --rev .
# Like `git show {commit}`, instead of autocompleting to `hg showconfig`.
# (Technically, when the commit is `.` then this is closer to
# `git diff --cached HEAD^` than to `git show`.)
# Note: when the commit is `tip` specifically, there's also the alternative
# command: `hg tip -p`, which runs a bit faster and doesn't use $PAGER.
# TODO: For more on this topic, see: <https://stackoverflow.com/a/3547662>
# and <https://stackoverflow.com/a/39867096> plus others on the same page.
# We use the Bash wrappering in order to provide a default argument `.`
# when the commit is not provided (to better mimic `git show`).
# FIXME: Make this less fragile against things like `hg show -- FILE`
# BUG: the `${:-}` doesn't seem to be working as intended! That is, when we provide an actual argument it's still being overwritten with the period! How come using `$1` works for the 'rediff' alias but not here? Aha, that's because the hg-alias stuff has its own version of `$1` separate from the things interpolated by bash, and those are expanded before running the bash code; cf., <https://www.selenic.com/mercurial/hgrc.5.html#alias>
show = !$HG diff -c ${1:-'.'}
# TODO: an alias for `hg log -pr {commit} -- {file}` which is the
# equivalent of `git show {commit} -- {file}`. Though the big question
# is how to spell the alias so that we can provide both the commit and the
# file(s) separately (e.g., to default the {commit} to `.` if not provided).
# I suppose we could just use `show = log -pr`, assuming that has the
# same force as the alias above when no files are specified.
# TODO: how does the builtin `hg blame` compare to `hg annotate --user
# --number`? Also, what's a good alias for `blame -u -c -l`?
# N.B., there's also an 'uncommit' extension that adds both `uncommit`
# and `unamend`; overriding the commands from the 'evolve' extension.
unmerge = update -C -r.
# TODO: We may want an alias for the following command (or we may just
# want to leave this here as a note-to-self):
## backport the result of a merge as a single commit:
# `hg graft -r 123 --base 123^`
# N.B., we may prefer to use `pstatus` in lieu of `status` (or have
# separate aliases for each).
# TODO: Need to update this to automatically select the correct BASE ref.
#whatsout = status --no-status --rev BASE
# Copypasta from <google-aliases.rc>
## A command to rewrite the message of a changeset without modifying
## any of the files in the changeset.
#reword = commit --amend 're:^$'
#reword:help = [-m MSG]
#reword:doc = edit commit message without changing its contents
#reword:category = management
## shows the modified files in the current revision (parent of the working
## directory) relative to the cwd. Does NOT include any uncommitted changes.
#revstatus = status --change .
#revstatus:doc = show changed files in the current revision
#revstatus:category = wdir
# {end copypasta}
# This points to our local copy of fig_status.py. We do not directly
# use the version in Piper because that would entail performance loss
# by making a roundtrip to the server on every access/invocation of
# hg (as well as constantly giving us a warning message explaining
# that fact). Alas, that means we need to manually keep it in sync
# with the original.
[extensions]
# Yes, ~/.hgrc does understand tilde expansion
figstatus = ~/local/lib/prompts/fig_status/fig_status.py