[PATCH RFC aiaiai 05/11] email: add canonical_url variable for list_projects

Jacob Keller jacob.e.keller at intel.com
Thu Mar 27 11:40:03 PDT 2014

If supplied, this url can be used to add a [git clone -b <branch> <url>]
section to the list_projects output, which indicates to the user how to
clone the specified project. This can be useful to enable users to more
easily see how to start working on a project.

The canonical url is not used by aiaiai as an access point. It mainly is
useful if the local clones that aiaiai uses are setup as --mirror

Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
 doc/email/configuration.txt      |  4 ++++
 doc/email/example-aiaiai.cfg     |  5 +++++
 email/aiaiai-email-sh-functions  |  3 ++-
 email/aiaiai-email-test-patchset | 12 ++++++++++--
 4 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/doc/email/configuration.txt b/doc/email/configuration.txt
index 70a307f15797..9056e0c0fb74 100644
--- a/doc/email/configuration.txt
+++ b/doc/email/configuration.txt
@@ -155,6 +155,10 @@ specified for each project.
     branch ie: origin/master, but can actually be any refspec. Note that the
     defconfigs specified in the config option must actually be available from
     the refspec.
+* canonical_url
+    The url to use when displaying a url for user consumption. Intended to be a
+    patch-submitter visible mirror of the local path used internally. If not
+    supplied, aiaiai will display the path instead.
 2.4 Aiaiai Hooks
diff --git a/doc/email/example-aiaiai.cfg b/doc/email/example-aiaiai.cfg
index 73014d8520f4..f9c7e0fbdc67 100644
--- a/doc/email/example-aiaiai.cfg
+++ b/doc/email/example-aiaiai.cfg
@@ -152,6 +152,11 @@
 	# server. No default value.
 	path = /home/aiaiai/work/git/android-x86
+	# Remote url used for display only. Aiaiai does not directly use this,
+	# and does not attempt to keep the path up to date itself. This is used
+	# only for display to the user.
+	canonical_url = git://aiaiai/git/android-x86
 	# Git refspec to validate the patches against. Usually this a the
 	# remote branch name. But may actually be any refspec.
diff --git a/email/aiaiai-email-sh-functions b/email/aiaiai-email-sh-functions
index b80892151514..20e482603d73 100644
--- a/email/aiaiai-email-sh-functions
+++ b/email/aiaiai-email-sh-functions
@@ -213,7 +213,7 @@ __parse_default_config()
 # Similar to "parse_config", but parses a project configuration section. If the
 # project is found, the following variables are defined:
-# pcfg_name, pcfg_description, pcfg_path and pcfg_branch.
+# pcfg_name, pcfg_description, pcfg_path, pcfg_branch and pcfg_canonical_url.
 # The following variables are defined, but receive default values from the
 # [defaults] section, if they are not specified in the project section:
@@ -241,6 +241,7 @@ parse_prj_config()
 	ini_config_get_or_die pcfg_description   "$cfgfile" "prj_$prj" "description"
 	ini_config_get_or_die pcfg_path          "$cfgfile" "prj_$prj" "path"
 	ini_config_get_or_die pcfg_branch        "$cfgfile" "prj_$prj" "branch"
+	pcfg_canonical_url="$(ini_config_get "$cfgfile" "prj_$prj" "canonical_url")"
 	# The following options all take default value from the "defaults"
 	# section, and hence "override" those settings. First we need to populate those.
diff --git a/email/aiaiai-email-test-patchset b/email/aiaiai-email-test-patchset
index c02b331387d0..c5b5a3d78b59 100755
--- a/email/aiaiai-email-test-patchset
+++ b/email/aiaiai-email-test-patchset
@@ -73,9 +73,17 @@ list_projects()
 		# Get project description
 		local descr
 		ini_config_get_or_die descr "$cfgfile" "prj_$prj" "description"
 		local email="$cfg_ownmail_local+$prj@$cfg_ownmail_domain"
-		printf "* %s\n" "$prj ($email): $descr"
+		# If given a url, display a sample clone line in the project
+		url="$(ini_config_get "$cfgfile" "prj_$prj" "canonical_url")"
+		branch="$(ini_config_get "$cfgfile" "prj_$prj" "branch")"
+		if [ -n "$url" ]; then
+			printf "* %s\n" "$prj ($email) [git clone -b $branch $url]: $descr"
+		else
+			printf "* %s\n" "$prj ($email): $descr"
+		fi

More information about the aiaiai mailing list