Received: from spf3.us4.outblaze.com (spf3.us4.outblaze.com [205.158.62.25]) by sdf.lonestar.org (8.12.10/8.12.10) with ESMTP id j0EGAQuf004702 for ; Fri, 14 Jan 2005 16:10:27 GMT Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by spf3.us4.outblaze.com (Postfix) with ESMTP id 5EA1A539A6 for ; Fri, 14 Jan 2005 16:10:46 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CpUDq-00052F-MB for migo@homemail.com; Fri, 14 Jan 2005 11:22:50 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CpUCu-0004rV-CE for gnu-arch-users@gnu.org; Fri, 14 Jan 2005 11:21:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CpUCr-0004qK-TW for gnu-arch-users@gnu.org; Fri, 14 Jan 2005 11:21:51 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CpUCq-0004p4-QU for gnu-arch-users@gnu.org; Fri, 14 Jan 2005 11:21:49 -0500 Received: from [194.158.229.26] (helo=mail-ps.sunrise.ch) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CpTzt-0003ZY-Ne for gnu-arch-users@gnu.org; Fri, 14 Jan 2005 11:08:26 -0500 Received: from acn.212.98.42.40.adslpremium.ch (212.98.42.40) by mail-ps.sunrise.ch (7.0.036) id 41E38E940009EB50 for gnu-arch-users@gnu.org; Fri, 14 Jan 2005 17:08:18 +0100 Received: from halftrack.hq.acn-group.ch ([172.16.145.83]) by van.hq.acn-group.ch with esmtp (Exim 3.36 #1 (Debian)) id 1CpTzl-00049E-00 for ; Fri, 14 Jan 2005 17:08:17 +0100 Received: from localhost ([127.0.0.1]) by halftrack.hq.acn-group.ch with esmtp (Exim 3.36 #1 (Debian)) id 1CpTzl-0001Yq-00 for ; Fri, 14 Jan 2005 17:08:17 +0100 From: Robin Farine To: gnu-arch-users@gnu.org Subject: Re: [Gnu-arch-users] rapid repair of corrupted revision library? Date: Fri, 14 Jan 2005 17:08:16 +0100 User-Agent: KMail/1.7.1 References: In-Reply-To: MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_w5+5BJt8TwG1wjY" Message-Id: <200501141708.16711.robin.farine@terminus.org> X-BeenThere: gnu-arch-users@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: a discussion list for all things arch-ish List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: gnu-arch-users-bounces+migo=homemail.com@gnu.org Errors-To: gnu-arch-users-bounces+migo=homemail.com@gnu.org Status: RO Content-Length: 5861 Lines: 278 --Boundary-00=_w5+5BJt8TwG1wjY Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Friday 14 January 2005 15.51, Andrew Wilcox wrote: > Does anyone have a tool to selectively remove all corrupted > revisions from a library? The 'fixrevlib' command of the attached wrapper script does approximately that. Note that this script is quite old so some of the commands might not work anymore due to changes in tla CLI. But at least 'fixrevlib' worked with tla 1.2. --Boundary-00=_w5+5BJt8TwG1wjY Content-Type: application/x-shellscript; name="tlaw" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="tlaw" #! /bin/bash set -f pid=$$ progname="$0" topdir=`pwd` files_to_clean="" usage() { { echo "Usage: $progname [options]" echo " changes" echo " list sub-trees with local changes" echo " commit -l|--log [commit opts]" echo " commit while preserving the log file" echo " fixrevlib " echo " rebuild corrupt revision libraries" echo " gencfg" echo " generates an Arch configuration that reflects the current" echo " directory's nested projects." echo " import -l|--log [import opts]" echo " import while preserving the log file" echo " lintcfg [tree-lint opts]" echo " run tree-lint on the whole project tree" echo " lsvers [-A ] [ ...]" echo " list all or a subset of the cat--bra--ver in an archive" echo " newbranch [source-revision] tag-version" echo " Create a new tag from to ." echo " If the caller doesn't specify a , try to" echo " obtain one from the current directory." echo " Create the necessary category, branch and version for" echo " if they don't already exist." } >&2 exit 64 } cleanup () { cd $topdir if test -n "$files_to_clean"; then rm -f $files_to_clean fi } trap "cleanup" 0 1 2 3 15 error() { echo "Error: $2" exit $1 } do_commit_or_import() { cmd="$1" argc=0 argv=() log_file="" tmplog="/tmp/arch-log.$$" files_to_clean="$files_to_clean $tmplog" shift while test $# -ne 0; do argv[argc]="$1" argc=$(($argc+1)) case $1 in -l|--log) shift if test $# -eq 0; then usage fi log_file="$1" argv[argc]="$tmplog" argc=$(($argc+1)) ;; *) ;; esac shift done if test -n "$log_file"; then cp $log_file $tmplog fi tla $cmd "${argv[@]}" } cmd_changes() { for tree in . `tla srcfind --nested -t`; do tla changes -q -d "$tree" || echo "$tree" done } cmd_commit() { do_commit_or_import commit "$@" } cmd_fixrevlib() { test -n "$1" || usage revision="$1" tmpout="/tmp/tlaw$$.out" ret=0 while true; do tla library-add "$revision" 2> "$tmpout" && break rev=$(awk \ 'BEGIN { archive="FOO"; revision="BAR" } $1 == "archive:" { archive=$2 } $1 == "revision:" { revision=$2 } END { print archive"/"revision }' "$tmpout") case "$rev" in FOO/*|*/BAR) echo "*** failed to parse revision ($rev)" cat "$tmpout" ret=2 break ;; *) ;; esac tla library-remove $rev || break done rm -f "$tmpout" return $ret } cmd_gencfg() { for tree in `tla srcfind --nested -t`; do printf "%-24s %s\n" "${tree}" "`tla tree-version $tree`"; done } cmd_import() { do_commit_or_import import "$@" } cmd_list_versions() { archive_opt="" categories="" while test $# -gt 0; do case "$1" in -A) if test $# -lt 2; then usage fi shift archive_opt="-A $1" ;; -*) usage ;; *) categories="${categories} $1" ;; esac shift done if test -z "$categories"; then categories=`tla categories ${archive_opt}` fi for cat in ${categories}; do branches=`tla branches ${archive_opt} ${cat}` for bra in ${branches}; do tla versions ${archive_opt} ${bra} done done } # # Usage: cmd_new_branch [source-revision] tag-version # # Create a new tag from to . # If the caller doesn't specify a , try to # obtain one from the current directory. Create the necessary # category, branch and version for if they don't # already exist. # cmd_new_branch () { source="" if test $# -eq 2; then source="$1" shift else { ver=`tla tree-version`; } || exit $? { rev=`tla logs | tail -1`; } || exit $? if test -z "$rev"; then source="${ver}" else source="${ver}--${rev}" fi fi tag="$1" if ! tla revisions $tag >/dev/null 2>&1; then tla archive-setup $tag || exit $? fi tla tag $source $tag } cmd_tree_lint() { for tree in . `tla srcfind --nested -t`; do tla tree-lint "$@" "$tree" | awk -v root="{${tree}}/" \ '{ sub(/^\.\//, root); print }' done } if test $# -ge 1; then cmd="$1" shift case "$cmd" in changes) cmd_changes ;; commit) cmd_commit "$@" ;; fixrevlib) cmd_fixrevlib "$@" ;; gencfg) cmd_gencfg ;; import) cmd_import "$@" ;; lintcfg) cmd_tree_lint "$@" ;; lsvers) cmd_list_versions "$@" ;; newbranch) cmd_new_branch "$@" ;; *) usage ;; esac exit $? fi usage --Boundary-00=_w5+5BJt8TwG1wjY Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Gnu-arch-users mailing list Gnu-arch-users@gnu.org http://lists.gnu.org/mailman/listinfo/gnu-arch-users GNU arch home page: http://savannah.gnu.org/projects/gnu-arch/ --Boundary-00=_w5+5BJt8TwG1wjY--