gnu-arch-users
[Top][All Lists]
Advanced

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

Re: [Gnu-arch-users] furth/arch for dummies


From: Tom Lord
Subject: Re: [Gnu-arch-users] furth/arch for dummies
Date: Wed, 7 Jul 2004 16:06:07 -0700 (PDT)

    > From: "Robert Anderson" <address@hidden>

    > Maybe I could develop an appreciation for this furth/arch stuff
    > if I was shown what a new command definition for tla would look
    > like using furth.  

Yeah.  I don't want to go off half-cocked, though, so be patient.


    > So, instead of what I have now, which is an
    > undocumented, ad-hoc, assumption filled script for finding
    > missing patches which touch file X:

    > #!/bin/sh

    > version="$1"
    > file="$2"

    > patches=`tla missing $version`

    > for patch in $patches; do
    >   if [ ! -e ,,$patch ]; then
    >     tla get-changeset $version--$patch ,,$patch
    >   fi
    > done

    > for cs in ,,patch-*; do
    >   tla show-changeset $cs | grep $file > ,out
    >   if [ -s ,out ]; then
    >     echo $cs
    >   fi
    > done

    > rm ,out

    > If furth came to fruition, I would do what instead?  Or isn't
    > this at all what furth is for?  (I'm thinking emacs:elisp as
    > tla:furth.  Maybe that's wrong.)

No, that analogy's ok.  My answer will probably be frustratingly
abstract, though:

I'd expect the mgt. of your ",,$patch" tmp directories to be buried
deep in a library that manages a general purpose cache.  So, your
first for loop would just disappear.

Similarly, I'd expect that changeset parsing would be buried in a
library so that you wouldn't call "show-changeset" but would instead,
call something closer to the (internal to tla) function
arch_changeset_report (the essense of what show-changeset does).

Finally, your second surviving for loop would probably be replaced by
a higher order function.   In pseudo-lisp syntax (not necessarily what
will be used) you might reduce all of your code to something 
that is little more than:


   (display-list-lines
     (all (lambda (rev) (member file (touched-files (changeset-of rev))))
          (missing version)))


In other words, pick all ("all") revisions from the list of missing
revisions ("(missing version)") with the property that the changeset
for that revision touches the interesting file ("(lambda ...)") and
print the resulting list of revisions as unquoted strings, one per
line ("display-list-lines").

Even better, you'd put this part:

     (all (lambda (rev) (member file (touched-files (changeset-of rev))))
          (missing version))

in a library of your own (or find it in a standard one) and then 
reduce your program to something like:

     (display-list-lines (missing-that-touch-file file version))


-t





reply via email to

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