diff --git a/hosts/common/programs/default.nix b/hosts/common/programs/default.nix index c87784203..b5ffc334a 100644 --- a/hosts/common/programs/default.nix +++ b/hosts/common/programs/default.nix @@ -125,7 +125,7 @@ ./megapixels.nix ./megapixels-next.nix ./mepo.nix - ./mercurial.nix + ./mercurial ./mimeo ./mimetype.nix ./mmcli.nix diff --git a/hosts/common/programs/mercurial.nix b/hosts/common/programs/mercurial.nix deleted file mode 100644 index 3ac82ab9b..000000000 --- a/hosts/common/programs/mercurial.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ pkgs, ... }: -{ - sane.programs.mercurial = { - packageUnwrapped = pkgs.mercurialFull; - sandbox.wrapperType = "inplace"; # etc/mercurial/hgrc refers to hg python-path (to define an extension) - suggestedPrograms = [ - "less" #< TODO: this might be a missing dependency on the nix side of things? - ]; - sandbox.net = "clearnet"; - sandbox.whitelistPwd = true; - sandbox.whitelistSsh = true; - sandbox.extraHomePaths = [ - # even with `whitelistPwd`, hg has to crawl *up* the path -- which isn't necessarily in the sandbox -- to locate the repo root. - "dev" - "ref" - ]; - fs.".config/hg/hgrc".symlink.text = '' - # `hg config` => to show the finalized config - - [extensions] - # Mercurial Queues (MQ) extension adds patch-stack support to mercurial. - # MQ is shipped in mercurial, but not enabled by default. - # it's a port of some git extension, idk which. - mq = - - [diff] - # showfunc = True - # `diff.git = True`: render diffs with `diff --git` instead of `diff -r` - git = True - # `diff.unified = N`: show N lines of context (else, use default as per `diff`) - # unified = 10 - - [alias] - q = qseries -s -v - # - # `hg qdup NEW_QUEUE_NAME`: copy all patches in the current queue into a new queue - # current queue must not be named "patches" - qdup = !$HG qq --active > /tmp/hg.active ; $HG qpop -a ; cp -R .hg/patches-$(cat /tmp/hg.active) .hg/patches-$1 ; echo $1 >> .hg/patches.queues ; $HG qq $1 - qstat = qdiff --stat - sblame = blame -undq - # - # these aliases are BROKEN: - # `hg qmigrate OTHER_QUEUE_NAME`: copy currently-applied patches onto another queue - # qmigrate = !$HG export -o '/tmp/qmigrate-$1' ; $HG qpop -a ; $HG qqueue $1 ; $HG import '/tmp/qmigrate-$1' - # `hg qcref`: like `git add -p`; select which changes should be in this patch, interactively - # qcref = !$HG qrefresh --exclude . && $HG qrefresh --config ui.interface.chunkselector=curses --interactive - ''; - }; -} diff --git a/hosts/common/programs/mercurial/default.nix b/hosts/common/programs/mercurial/default.nix new file mode 100644 index 000000000..b2f386ad0 --- /dev/null +++ b/hosts/common/programs/mercurial/default.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: +{ + sane.programs.mercurial = { + packageUnwrapped = pkgs.mercurialFull; + sandbox.wrapperType = "inplace"; # etc/mercurial/hgrc refers to hg python-path (to define an extension) + suggestedPrograms = [ + "less" #< TODO: this might be a missing dependency on the nix side of things? + ]; + sandbox.net = "clearnet"; + sandbox.whitelistPwd = true; + sandbox.whitelistSsh = true; + sandbox.extraHomePaths = [ + # even with `whitelistPwd`, hg has to crawl *up* the path -- which isn't necessarily in the sandbox -- to locate the repo root. + "dev" + "ref" + ]; + fs.".config/hg/hgrc".symlink.target = ./hgrc; + }; +} diff --git a/hosts/common/programs/mercurial/hgrc b/hosts/common/programs/mercurial/hgrc new file mode 100644 index 000000000..4c6a64de9 --- /dev/null +++ b/hosts/common/programs/mercurial/hgrc @@ -0,0 +1,29 @@ +# `hg config` => to show the finalized config + +[extensions] +# Mercurial Queues (MQ) extension adds patch-stack support to mercurial. +# MQ is shipped in mercurial, but not enabled by default. +# it's a port of some git extension, idk which. +mq = + +[diff] +# showfunc = True +# `diff.git = True`: render diffs with `diff --git` instead of `diff -r` +git = True +# `diff.unified = N`: show N lines of context (else, use default as per `diff`) +# unified = 10 + +[alias] +q = qseries -s -v +# +# `hg qdup NEW_QUEUE_NAME`: copy all patches in the current queue into a new queue +# current queue must not be named "patches" +qdup = !$HG qq --active > /tmp/hg.active ; $HG qpop -a ; cp -R .hg/patches-$(cat /tmp/hg.active) .hg/patches-$1 ; echo $1 >> .hg/patches.queues ; $HG qq $1 +qstat = qdiff --stat +sblame = blame -undq +# +# these aliases are BROKEN: +# `hg qmigrate OTHER_QUEUE_NAME`: copy currently-applied patches onto another queue +# qmigrate = !$HG export -o '/tmp/qmigrate-$1' ; $HG qpop -a ; $HG qqueue $1 ; $HG import '/tmp/qmigrate-$1' +# `hg qcref`: like `git add -p`; select which changes should be in this patch, interactively +# qcref = !$HG qrefresh --exclude . && $HG qrefresh --config ui.interface.chunkselector=curses --interactive