defernia.world.repo — Revision control of world

Under the hood, Repository uses Mercurial as backend to manage revisions. That is, it depends on local filesystem.

class defernia.world.repo.Repository(path=None)

World repository.

Parameters:path (basestring) – a repository path. it could be None to avoid repository initialization
facts = None

(set) The set of attached Fact objects.

path

(basestring) The path of the repository. Could be None when the repository is not initialized yet.

In order to initialize the repository, set path property.

working

(WorkingContext) The working context of the repository.

add(fact)

Adds an transient fact object into the repository. The added fact object will start to be tracked by the version control system.

Parameters:fact (Fact) – an transient fact object to add

Note

Actually, it’s an alias of WorkingContext.add() method.

commit(message, user)

Commits pending changes.

Parameters:
  • message (basestring) – a commit message
  • user – an user string like 'Hong Minhee <minhee@dahlia.kr>' or an object that implements __email__() method
class defernia.world.repo.BaseChangeContext(repository, changectx)

The abstract base class of ChangeContext and WorkingContext.

Additionally it implements collections.Mapping interface also. Fact objects can be gotten by an index operator.

Parameters:
  • repository (Repository) – the repository
  • changectx (mercurial.context.changectx) – the Mercurial internal change context object

Note

Its constructor is internal-use only. Do not instantiate this type directly. Use an index operator of Repository objects instead:

repository[rev]
repository = None

(Repository) The repository of the change context.

changectx = None

(mercurial.context.changectx) The Mercurial internal change context object.

facts = None

(dict) The dictionary of loaded fact objects. Keys are __fact_id__ strings and values are Fact objects.

parents

(collections.Sequence) The list of parent nodes.

datetime

(datetime.datetime) The time of the changeset. It is a timezone-aware datetime.datetime value.

class defernia.world.repo.ChangeContext(repository, changectx)

The change context of the revision.

revision

(basestring) The hexadecimal revision.

message

(basestring) Commit message.

class defernia.world.repo.WorkingContext(repository, changectx)

Currently working change context.

ignored_file_globs

(collections.MutableSet) The set of ignored file globs. If you add an additional new glob pattern into the set, it will be added into .hgignore file internally.

add(fact)

Adds an transient fact object into the repository. The added fact object will start to be tracked by the version control system.

Parameters:fact (Fact) – an transient fact object to add
class defernia.world.repo.FixedOffsetTimezone(offset=None)

The simple datetime.tzinfo implementation that stores just its offset.

Parameters:offset (datetime.timedelta) – an offset from UTC. UTC by default
class defernia.world.repo.IgnoredFileGlobSet(context)

The set abstracts .hgignore list. It is a subtype of collections.MutableSet.

Parameters:context (WorkingContext) – a working context

Note

This object is returned by WorkingContext.ignored_file_globs property. Use the property instead of direct creation of this object.

path

(basestring) The absolute path of .hgignore file.

exception defernia.world.repo.RepositoryError(*args, **kw)

An abstract base class of Repository-related errors. It is a subtype of mercurial.error.RepoError.

exception defernia.world.repo.FactRepositoryError(fact, repository, message=None)

The exception which rise when the repository of fact has any problem. It is a subtype of ValueError.

Parameters:
  • fact (Fact) – a fact object related to the error
  • repository (Repository) – a repository related to ther error
  • message (basestring) – an optional error message
fact = None

(Fact) The fact object related to the error.

repository = None

(Repository) The repository related to the error.

exception defernia.world.repo.RepositoryLookupError(repository, revision, message=None)

The exception which rise when the requested revision cannot be found. It is a subtype of mercurial.error.RepoLookupError and LookupError.

Parameters:
  • repository (Repository) – a repository related to ther error
  • revision – a requested revision
  • message (basestring) – an optional error message
repository = None

(Repository) The repository related to the error.

revision = None

The requested revision

Project Versions

Previous topic

defernia.world.serializer — Fact serializer

Next topic

defernia.world.repodir — Repositories directory

This Page