From 1b37ff416a866e26e1976ce25d256350742f2854 Mon Sep 17 00:00:00 2001 From: Ville Rantanen Date: Fri, 24 Jul 2015 10:29:46 +0300 Subject: [PATCH] hgmenu installs its requirements --- bin/hgmenu | 57 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/bin/hgmenu b/bin/hgmenu index 5cd9d29..7e20199 100755 --- a/bin/hgmenu +++ b/bin/hgmenu @@ -25,34 +25,43 @@ do case "$opt" in done echo 'Mercurial: -a: Add files* -c: Commit -d: Diff -l: Log -m: merge -p: Pull -P: Push -r: Remove files* -u: Update -s: Status -t: Start thg -v: View +a: Add files to track* +c: Commit changes to local repository +d: Difference of current and previous versions +l: Log +m: Merge conflicting change sets +p: Pull changes from remote repository +P: Push changes to remote repository +r: Remove files* +u: Update from local repository +s: Status +t: Start thg, graphical repository viewer +v: View, internal graphical viewer + +X: Add the required extensions to your ~/.hgrc q: Quit * Requires arguments ' echo Current arguments: "$@" -read -p "Command: " -s -N 1 CMD +read -p "Command: " -N 1 CMD echo "" LESS="less -R -S" case "$CMD" in a) [[ -z "$@" ]] && argsreq + find "$@" \( -type d -name .hg -prune \) -o -type f -print + read -p "Add all these files? y/n" foo + [[ $foo = "n" ]] && exit hg add "$@" ;; c) + [[ -z "$@" ]] || { + echo Commiting files: + find "$@" \( -type d -name .hg -prune \) -o -type f -print + } read -p "Commit message: " MSG hg commit -m "$MSG" "$@" ;; @@ -73,6 +82,9 @@ case "$CMD" in ;; r) [[ -z "$@" ]] && argsreq + find "$@" \( -type d -name .hg -prune \) -o -type f -print + read -p "Remove all these files? y/n" foo + [[ $foo = "n" ]] && exit hg remove "$@" ;; u) @@ -90,6 +102,25 @@ case "$CMD" in q) exit ;; + X) + grep -q "color\s*=" ~/.hgrc || { + grep -q "^[extensions]" ~/.hgrc && { + sed '0,/^\[extensions\]/s//[extensions]\ncolor=/' ~/.hgrc + } || { + echo -e "[extensions]\ncolor=" + } + } + grep -q "hgk\s*=" ~/.hgrc || { + grep -q "^[extensions]" ~/.hgrc && { + sed '0,/^\[extensions\]/s//[extensions]\nhgk=/' ~/.hgrc + } || { + echo -e "[extensions]\nhgk=" + } + } + ;; + *) + echo Command $CMD not recognized + ;; esac