]> git.wh0rd.org Git - home.git/commitdiff
vcs-url: handle more repos
authorMike Frysinger <vapier@gentoo.org>
Thu, 2 Jun 2016 15:03:59 +0000 (11:03 -0400)
committerMike Frysinger <vapier@gentoo.org>
Thu, 2 Jun 2016 15:03:59 +0000 (11:03 -0400)
.bin/vcs-url

index bab6e78c9ca5ce4b7e48c453806956f67abb70cb..655717defadef405d85f749c0b2aaed25d077204 100755 (executable)
@@ -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 "$@";;