Mercurial > utils
view dvcs/myhg-nearest-tag @ 663:136298c89fdd default tip
Enabling of "Developer mode" to allow symlinks without elevation.
author | Oleksandr Gavenko <gavenkoa@gmail.com> |
---|---|
date | Sun, 15 Nov 2020 15:24:16 +0200 |
parents | 33b86caf4b1a |
children |
line wrap: on
line source
#!/bin/sh nearest_tag_by_date() { hg log -r 'tag()' --template '{node} {tags}\n' | while read r t; do \ hg log -r "ancestor($r,$1)" --template "{date|isodate} $t\n"; \ done | sort } nearest_tag_by_rev() { hg log -r 'tag()' --template '{node} {tags}\n' | while read r t; do n=`hg log -r "ancestor($r,$1)::$1" --template "X\n" | wc -l`; echo $n $t; done | sort -n -r | while read n t; do printf "%8s %s\n" $n "$t"; done } usage() { cat <<EOF myhg-nearest-tag [--by-date | --by-rev] [REV] --by-date sort by dates to marge base --by-date sort by rev counts to marge base REV from which revision (default is ".") EOF } distance=nearest_tag_by_date case "$1" in --by-date) shift distance=nearest_tag_by_date ;; --by-rev) shift distance=nearest_tag_by_rev ;; --help) usage exit 0 ;; esac if [ -z "$1" ]; then set . fi echo $distance $1 $distance $1