Skip to content

Instantly share code, notes, and snippets.

@yantonov
Created September 7, 2012 12:38
Show Gist options
  • Save yantonov/3665889 to your computer and use it in GitHub Desktop.
Save yantonov/3665889 to your computer and use it in GitHub Desktop.
Hg dir lister
#!/bin/bash
# Script show list of mercurial repositories with latest revision id
# first parameter - directory which contains multiple mercurial repositories
DEFAULT_MERCURIAL_REPO_DIR=`pwd`
LINE_SEPARATOR="-----"
# output line separator
function output_line_separator() {
echo "$LINE_SEPARATOR"
}
# first parameter directory with mercurial repositories
function show_hg_tip_list() {
dir=$1
output_line_separator
echo "Scanning directory with mercurial repositories :"
echo $dir
output_line_separator
find $dir -mindepth 1 -maxdepth 1 -type d | sort |
while read hg_dir; do
cd $hg_dir
echo $hg_dir
#hg tip | grep -o "^\(changeset\|summary\):.*"
hg tip | grep -o "^changeset:.*" | grep -o "[0-9].*"
echo
done
echo $hg_repo_list
}
if [ -z $1 ]; then
dir=$DEFAULT_MERCURIAL_REPO_DIR
else
dir=$1
fi
clear
show_hg_tip_list $dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment