monotone-commits-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-commits-diffs] net.venge.monotone.contrib.usher: 798075fe057a


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone.contrib.usher: 798075fe057afbf49dc0f25e19bb7315a680f357
Date: Wed, 19 Jan 2011 16:20:47 GMT

revision:            798075fe057afbf49dc0f25e19bb7315a680f357
date:                2011-01-19T16:20:23
author:              Richard Levitte <address@hidden>
branch:              net.venge.monotone.contrib.usher
changelog:
Add a usherctl command to get information about a project

manifest:
format_version "1"

new_manifest [f62294822997bc82f09fd76af9354b42829a0b10]

old_revision [81275b80b30cea1d2818d4f26fd8ced7ed6cb55a]

patch "doc/usherctl.1"
 from [393f7651b857ae243a7507442f7f587146b73809]
   to [c9cb2faaeb84800ec08d33ff6b909d6d7e292c98]

patch "utils/usherctl"
 from [b29d51898d66a04f4808afa79dcac9ea24fc0279]
   to [9e14ac83eddd623bcf86c9c2afe76c4213b3d7af]
============================================================
--- utils/usherctl	b29d51898d66a04f4808afa79dcac9ea24fc0279
+++ utils/usherctl	9e14ac83eddd623bcf86c9c2afe76c4213b3d7af
@@ -630,6 +630,41 @@ addprojectpattern () {
     echo >&2 "pattern '$pattern' added to project '$name'."
 }
 
+projectinfo () {
+    name="$1"; shift
+
+    if [ ! -d "$USHER_PROJECTDIR/$name" ]; then
+	echo >&2 "usherctl doesn't manage the project $name"
+	return 1
+    fi
+
+    while [ $# -gt 0 ]; do
+	case "$1" in
+	    configdir )
+		echo "configdir: $USHER_PROJECTDIR/$name"
+		;;
+	    database )
+		echo "database: $USHER_PROJECTDIR/$name/database.mtn"
+		;;
+	    patterns )
+		if [ -f "$USHER_PROJECTDIR/$name/admin/patterns" ]; then
+		    patterns="`cat "$USHER_PROJECTDIR/$name/admin/patterns" | sed -e '/^ *$/d'`"
+		    if [ -z "$patterns" ]; then patterns="*"; fi
+		    echo "$patterns" | sed -e 's|^|pattern: |'
+		fi
+		;;
+	    type )
+		if [ -f "$USHER_PROJECTDIR/$name/admin/type.private" ]; then
+		    echo "type: private"
+		elif [ -f "$USHER_PROJECTDIR/$name/admin/type.public" ]; then
+		    echo "type: public"
+		fi
+		;;
+	esac
+	shift
+    done
+}
+
 list () {
     grep '^ *server  *"' "$USHER_CONF" | cut -f2 -d'"' | while read name; do
 	text="$name"
@@ -776,6 +811,55 @@ case $1 in
 	rmproject "$1"
 	;;
 
+    info )
+	shift
+	name="$1"
+	shift
+
+	c=
+	d=
+	p=
+	t=
+	TEMP=`POSIXLY_CORRECT=yes getopt -o cdpt -n "usherctl info" -- "$@"`
+	eval set -- "$TEMP"
+	while true; do
+	    case "$1" in
+		-c ) # config/project directory
+		    c=configdir
+		    shift
+		    ;;
+		-d ) # project database
+		    d=database
+		    shift
+		    ;;
+		-p ) # project patterns
+		    p=patterns
+		    shift
+		    ;;
+		-t ) # project type
+		    t=type
+		    shift
+		    ;;
+		--)
+		    shift
+		    break
+		    ;;
+	    esac
+	done
+	infos=`echo $c $d $p $t`
+
+	if [ -z "$name" ]; then
+	    echo >&2 "You have to give your project a name."
+	    exit 1
+	fi
+	
+	if [ -z "$infos" ]; then
+	    projectinfo "$name" configdir database patterns type
+	else
+	    projectinfo "$name" $infos
+	fi
+	;;
+
     addkey )
 	shift
 	name="$1"
============================================================
--- doc/usherctl.1	393f7651b857ae243a7507442f7f587146b73809
+++ doc/usherctl.1	c9cb2faaeb84800ec08d33ff6b909d6d7e292c98
@@ -152,6 +152,22 @@ no pattern has been defined yet, the def
 no pattern has been defined yet, the default pattern is
 .BR * .
 .TP
+\fBinfo\fP \fIname\fP [ \fB-cdpt\fP ]
+Prints information about a project.  If no options are given, all
+information will be printed, as if all options had been given.
+.RS
+.PP
+Available options:
+.IP \fB-c\fP
+Print the config (project) directory.
+.IP \fB-d\fP
+Print the project's database.
+.IP \fB-p\fP
+Print the project's branch patterns.
+.IP \fB-t\fP
+Print the project's type (\fCpublic\fP or \fCprivate\fP).
+.RE
+.TP
 \fBstart\fP
 Starts the
 .B usher

reply via email to

[Prev in Thread] Current Thread [Next in Thread]