public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ulrich Mueller (ulm)" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] eselect r685 - in trunk: . modules
Date: Thu, 08 Oct 2009 07:51:55 +0000	[thread overview]
Message-ID: <E1Mvnn1-0003gP-2z@stork.gentoo.org> (raw)

Author: ulm
Date: 2009-10-08 07:51:54 +0000 (Thu, 08 Oct 2009)
New Revision: 685

Modified:
   trunk/ChangeLog
   trunk/modules/news.eselect
Log:
Improve handling of removed news items.

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-10-08 07:33:57 UTC (rev 684)
+++ trunk/ChangeLog	2009-10-08 07:51:54 UTC (rev 685)
@@ -1,3 +1,12 @@
+2009-10-08  Ulrich Mueller  <ulm@gentoo.org>
+
+	* modules/news.eselect (do_read): Improve handling of removed news
+	items: Display only a warning message instead of an error if an
+	item's file doesn't exist.
+	(do_list): Take default date from item name. Assume that the item
+	has been removed if we cannot read its header.
+	(mail_header): Really remove leading zeros in numeric month.
+
 2009-10-05  Ulrich Mueller  <ulm@gentoo.org>
 
 	* libs/path-manipulation.bash.in (relative_name): New function.

Modified: trunk/modules/news.eselect
===================================================================
--- trunk/modules/news.eselect	2009-10-08 07:33:57 UTC (rev 684)
+++ trunk/modules/news.eselect	2009-10-08 07:51:54 UTC (rev 685)
@@ -176,10 +176,12 @@
 		stat=${item%%/*}; item=${item#*/}
 		repo=${item%%/*}; item=${item#*/}
 		find_repo_dir "${repo}"
-		header=$(read_item "${dir}" "${item}" header)
+		title="(${item} - no title)"
+		posted=${item:0:10}
+		[[ ${posted} == +([0-9])-+([0-9])-+([0-9]) ]] || posted="(no date) "
+		header=$(read_item "${dir}" "${item}" header) \
+			|| title="(${item} - removed?)"
 		IFS=$'\n'
-		title="(${item} - no title)"
-		posted="(no date) "
 		for line in ${header}; do
 			case "${line%%:*}" in
 				Title) title=${line##*([^:]):*([[:space:]])} ;;
@@ -270,31 +272,31 @@
 		repo=${item%%/*}; item=${item#*/}
 		find_repo_dir "${repo}"
 		case ${format} in
-			raw)
-				read_item "${dir}" "${item}"
-				;;
-			cooked)
-				write_list_start "${item}"
-				header=$(read_item "${dir}" "${item}" header)
-				IFS=$'\n'
-				for line in ${header}; do
-					case "${line%%:*}" in
-						Title)
-							write_kv_list_entry "${line%%:*}" \
-								"$(highlight "${line##*([^:]):*([[:space:]])}")"
-							;;
-						Author|Translator|Posted|Revision)
-							write_kv_list_entry "${line%%:*}" \
-								"${line##*([^:]):*([[:space:]])}"
-							;;
-					esac
-				done
-				IFS=${ifs_save}
-				echo
-				read_item "${dir}" "${item}" body
-				;;
-			mbox)
-				header=$(read_item "${dir}" "${item}" header)
+		raw)
+			read_item "${dir}" "${item}"
+			;;
+		cooked)
+			write_list_start "${item}"
+			header=$(read_item "${dir}" "${item}" header)
+			IFS=$'\n'
+			for line in ${header}; do
+				case "${line%%:*}" in
+					Title)
+						write_kv_list_entry "${line%%:*}" \
+							"$(highlight "${line##*([^:]):*([[:space:]])}")"
+						;;
+					Author|Translator|Posted|Revision)
+						write_kv_list_entry "${line%%:*}" \
+							"${line##*([^:]):*([[:space:]])}"
+						;;
+				esac
+			done
+			IFS=${ifs_save}
+			echo
+			read_item "${dir}" "${item}" body
+			;;
+		mbox)
+			if header=$(read_item "${dir}" "${item}" header); then
 				author=""; title=""; posted=""
 				IFS=$'\n'
 				for line in ${header}; do
@@ -315,9 +317,13 @@
 				IFS=${ifs_save}
 				echo
 				read_item "${dir}" "${item}" body | sed 's/^>*From />&/;$q'
-				;;
+			else
+				false
+			fi
+			;;
 		esac
-		[[ $? -ne 0 ]] && write_error_msg "Error reading item \"${item}\""
+		[[ $? -ne 0 ]] \
+			&& write_warning_msg "News item \"${item}\" no longer exists"
 		echo
 
 		[[ ${stat} = unread ]] || continue




                 reply	other threads:[~2009-10-08  7:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1Mvnn1-0003gP-2z@stork.gentoo.org \
    --to=ulm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox