From afcb1683faace885e780d536e50eab1733e0a6e1 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 2 Jun 2016 11:03:59 -0400 Subject: [PATCH] vcs-url: handle more repos --- .bin/vcs-url | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.bin/vcs-url b/.bin/vcs-url index bab6e78..655717d 100755 --- a/.bin/vcs-url +++ b/.bin/vcs-url @@ -88,8 +88,8 @@ git_url() { repo=$(echo "${remote}" | sed -e 's,^git@github.com[:/],,' -e 's,^https://github.com/,,' -e 's,^git://github.com/,,' -e 's:[.]git$::') url="https://github.com/${repo}/commit/" ;; - git://git.sv.gnu.org/*) - repo=$(echo "${remote}" | sed -e 's,^git://git.sv.gnu.org/,,' -e 's:[.]git$::') + git://git.sv.gnu.org/*|git://git.savannah.gnu.org/*) + repo=$(echo "${remote}" | sed -r -e 's,^git://git.(sv|savannah).gnu.org/,,' -e 's:[.]git$::') url="http://git.savannah.gnu.org/cgit/${repo}.git/commit/?h=" ;; git://git.code.sf.net/p/*) @@ -107,6 +107,10 @@ git_url() { repo=$(echo "${remote}" | sed -e 's,^[^/]*//[^/]*/,,' -e 's,[.]git$,,') url="https://git.enlightenment.org/${repo}.git/commit/?id=" ;; + *://git.qemu.org/*) + repo=$(echo "${remote}" | sed -e 's,^[^/]*//[^/]*/,,' -e 's,[.]git$,,') + url="http://git.qemu.org/?p=${repo}.git;a=commit;h=" + ;; *) echo "Unknown remote: ${remote}" exit 1 @@ -161,7 +165,7 @@ usage() { } main() { - local vcs="git" + local vcs="auto" while [[ $# -gt 0 ]] ; do case $1 in -c) vcs="cvs";; @@ -176,6 +180,16 @@ main() { shift done + if [[ ${vcs} == "auto" ]] ; then + if [[ -d CVS ]] ; then + vcs="cvs" + elif svn info >&/dev/null ; then + vcs="svn" + else + vcs="git" + fi + fi + case ${vcs} in cvs) cvs_url "$@";; git) git_url "$@";; -- 2.39.5