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

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

[Gnu-arch-users] Re: cached rev support in pyarch


From: David Allouche
Subject: [Gnu-arch-users] Re: cached rev support in pyarch
Date: Fri, 11 Jun 2004 10:53:58 +0200
User-agent: Mutt/1.5.5.1+cvs20040105i

This is an answer to a private mail, since I think it is of general
interest, I post it publicly.

On Thu, Jun 10, 2004 at 08:07:19PM +1000, Robert Collins wrote:
> do you have something to interrogate revisions about cached status & set
> / reset the cached status therein?

Nothing yet.

The interface should look like:

arch.Revision.cache(self, root=None)

  Cache a full source tree for this revision in the archive.

  DirName root: cache root for trees with pristines
    (NOTE: not sure how that should be used...)

  raise:

    * arch.errors.ArchiveError
      archive is not registered

    * arch.errors.RevisionError
      revision does not exists in the archive

    * arch.errors.CachedrevError
      cachedrev already exists

    * OSError (with appropriate value)
      given root directory does not exist
      created with OSError(2, "No such file or directory", '/foo')
      or something similar

    * arch.util.ExecProblem
      something else went wrong

arch.Revision.uncache(self):

  Remove the cached form of this revision from its archive.

  NOTE: in accordance with the behaviour of tla, this command succeeds
  (assuming the revision is valid) even if the revision has no cachedrev
  or does not exist

  raise:

    * arch.errors.ArchiveError:
      archive is not registered

    * arch.util.ExecProblem
      something else went wrong

arch.Version.iter_cachedrevs(self):

   Iterate over the cached revisions in this version

   Return type: iterator of Revision

   raise:

     * arch.errors.ArchiveError
       archive is not registered

     * arch.errors.VersionError
       this version does not exist in the archive

     * util.ExecProblem
       something else went wrong
     

The exception stuff is probably imperfect and still being thought out.
But the recent patches from abentley suggest there is a need for better
exception reporting. Comments welcome.

I considered a arch.Revision.is_cached(self) method, but since it is not
currently possible to implement it efficiently (it has to do a, very
slow, iter_cachedrevs), that is postponed.

I also considered a arch.Revision.cached property, but since cacherev is
not idempotent (second run causes an error) and arch.Revision.is_cached
is not possible to implement efficiently, it is posponed.

PS: in a future version, I am considering dropping the iter prefix from
most (or all) commands which create iterators, not sure whether that
would be a good idea or not. What is your opinion?

-- 
                                                            -- ddaa




reply via email to

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